2 % creates random Dof vectors (
for testing purposes only!)
5 % min-max vector indicating the range for the random values of the
6 % generated Dof-values.
11 function rdg = Random(dmodel,
id, ranges, force_delete, enable_caching)
12 %function rdg = Random(dmodel,
id, ranges, force_delete, enable_caching)
13 % constructor for the random detailed generator
16 %
id: an identifier
string
17 % force_delete:
boolean value indicating whether the cached data
18 % shall be automatically deleted if its inconsistent
19 % with the given 'dmodel'. (Default = 'true')
20 % enable_caching:
boolean value indicating whether the generated data
21 % shall be stored in a cache. (Default = 'true')
22 % ranges: min-max vector indicating the range for the random
23 % values of the generated Dof-values. (Default = [0 1])
24 if nargin < 2 || isempty(
id)
34 if nargin >= 3 && ~isempty(ranges)
41 methods (Access = protected)
42 function [U, opt_fields] = generate_impl(this, dmodel, detailed_data, fields)
44 model_data = detailed_data.model_data;
46 model_data = detailed_data;
48 nelems = model_data.grid.nelements;
49 hashstring = this.hashcode(dmodel);
50 hash = sscanf(hashstring(1:6), '%x');
51 rand('twister', hash);
52 if isfield(dmodel.descr, 'nt')
57 if ~isfield(dmodel.descr, 'subfields')
58 U = rand(nelems, nt+1) * (this.ranges(2)-this.ranges(1))+this.ranges(1);
60 st = dmodel.descr.subfields;
62 U.(st(i).shortname) = rand(st(i).length, nt+1) ...
63 * (st(i).ranges(2)-st(i).ranges(1)) + st(i).ranges(1);
Interface for the storage and generation of detailed data that can be used to build reduced basis fun...
Cacheable generators of detailed data snapshots.
Customizable implementation of an abstract greedy algorithm.