rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions
SnapshotsGenerator.Cached Class Referenceabstract

Detailed Description

Interface for the storage and generation of detailed data that can be used to build reduced basis functions.

Via the generate() method, detailed data for exactly one parameter can vector be generated and is returned. Usually, this data needs to be postprocessed afterwards. E.g. in case of reduced basis generation for evolution equations, a Cached instance could produce a detailed solution trajectory for the specified parameter and by applying a POD algorithm on this trajectory a single basis vector is extracted for basis extension.

The generate method uses caching facilities to prevent data generation twice.

Furthermore, the class provides methods to prepare and store solutions before-hand. This can be used in to compare reduced and detailed approximations for the entire training or validation set M.

Definition at line 18 of file Cached.m.

Inheritance diagram for SnapshotsGenerator.Cached:
Inheritance graph
[legend]
Collaboration diagram for SnapshotsGenerator.Cached:
Collaboration graph
[legend]

Public Member Functions

 Cached (IDetailedModel dmodel, id, force_delete, enable_caching)
 constructor for the detailed generator More...
 
function  clear_cachedirectory ()
 clears the directory containing the cached mat-files
 
function  assert_model_is_consistent (IDetailedModel dmodel, comparemodel)
 throws an inconsistency error if the the current IDetailedModel object and the one stored on the harddrive differ. More...
 
function [
detailed_sample
, tictoc
,
opt_fields ] = 
generate (IDetailedModel dmodel,IDetailedData detailed_data, fields)
 generates a detailed data sample for a specific parameter using caching facilities More...
 
function  prepare (IDetailedModel dmodel,IDetailedData detailed_data, M)
 precompute detailed data for all parameters given by M. More...
 
function IDetailedModel dmodel = get_underlying_model ()
 returns the detailed model stored on the harddrive with which the snaphshots were generated. More...
 

Public Attributes

 idname
 unique name created from the IDs as given to the constructor. More...
 
 id
 string identifier for this generator More...
 
 enable_caching = true
 boolean flag indicating whether caching is enabled. More...
 
 model_name = "default"
 name id of DetailedModel More...
 
 force_delete = true
 boolean value indicating whether the cached data shall be automatically deleted if its inconsistent with the given dmodel. More...
 
 countdown = 5
 seconds to wait before cached data is deleted automatically in case of inconsistent models. More...
 
 is_valid
 checks whether the basis generator points to a valid directory More...
 

Protected Member Functions

virtual function [
U
,
opt_fields ] = 
generate_impl (IDetailedModel dmodel,IDetailedData detailed_data, fields)
 generates a sample trajectory or detailed simulation item from which a new basis function can be generated. More...
 

Static Protected Member Functions

static function
hashcode = 
hashcode (IDetailedModel dmodel)
 this is a very simple hash code, generating an md5 hash out of the current parameter vector. More...
 

Constructor & Destructor Documentation

SnapshotsGenerator.Cached.Cached ( IDetailedModel  dmodel,
  id,
  force_delete,
  enable_caching 
)

constructor for the detailed generator

Parameters
dmodelobject specifying how the high dimensional data can be computed.
idan identifier string or a cell array of identifier strings.
force_deleteboolean value indicating whether the cached data shall be automatically deleted if its inconsistent with the given dmodel. (Default = true)
enable_cachingboolean value indicating whether the generated data shall be stored in a cache. (Default = true)
Required fields of dmodel:
  • descr.name —  descr.name
  • debug —  debug

Definition at line 214 of file Cached.m.

Here is the call graph for this function:

Member Function Documentation

function SnapshotsGenerator.Cached.assert_model_is_consistent ( IDetailedModel  dmodel,
  comparemodel 
)

throws an inconsistency error if the the current IDetailedModel object and the one stored on the harddrive differ.

Parameters
dmodelobject specifying how the high dimensional data can be computed.
comparemodelcomparemodel

Definition at line 309 of file Cached.m.

Here is the caller graph for this function:

function [ detailed_sample , tictoc , opt_fields ] = SnapshotsGenerator.Cached.generate ( IDetailedModel  dmodel,
IDetailedData  detailed_data,
  fields 
)

generates a detailed data sample for a specific parameter using caching facilities

Internally this method calls the engine method generate_impl() if the result cannot be read from the harddrive cache.

Parameters
dmodelobject specifying how the high dimensional data can be computed.
detailed_dataobject defining the basis generation algorithm and storage for storing high dimensional data, i.e. dependent on dimension \(H\). This data is necessary for detailed simulations, construction of online matrices, reduced_data and reconstruction of reduced simulations.
fieldscell array of structure field names which shall also be stored in the cache in the opt_fields structure. If not given only the detailed_sample is generated.
Return values
detailed_sampleThis is usually a matrix with DOF vector columns holding the generated snapshots.
tictoctime needed to compute the snapshots.
opt_fieldsoptional fields to be cached.
Required fields of dmodel:
  • debug —  debug

Definition at line 332 of file Cached.m.

Here is the call graph for this function:

Here is the caller graph for this function:

function [ U , opt_fields ] = SnapshotsGenerator.Cached.generate_impl ( IDetailedModel  dmodel,
IDetailedData  detailed_data,
  fields 
)
protectedpure virtual

generates a sample trajectory or detailed simulation item from which a new basis function can be generated.

Parameters
fieldscell array of structure field names which shall also be stored in the cache in the opt_fields structure. If not given only the U is generated.
dmodelobject specifying how the high dimensional data can be computed.
detailed_dataobject defining the basis generation algorithm and storage for storing high dimensional data, i.e. dependent on dimension \(H\). This data is necessary for detailed simulations, construction of online matrices, reduced_data and reconstruction of reduced simulations.
Return values
Ua matrix with DOF vector columns holding the generated snapshots.
opt_fieldsoptional fields to be cached.

Implemented in SnapshotsGenerator.SpaceOpEvals, SnapshotsGenerator.Random, and SnapshotsGenerator.Trajectories.

Here is the caller graph for this function:

function IDetailedModel dmodel = SnapshotsGenerator.Cached.get_underlying_model ( )

returns the detailed model stored on the harddrive with which the snaphshots were generated.

Return values
dmodeldmodel

Definition at line 500 of file Cached.m.

Here is the caller graph for this function:

function hashcode = SnapshotsGenerator.Cached.hashcode ( IDetailedModel  dmodel)
staticprotected

this is a very simple hash code, generating an md5 hash out of the current parameter vector.

The default implementation of this function simply computes an MD5 hash out of the parameter vector;

Parameters
dmodelobject specifying how the high dimensional data can be computed.
Return values
hashcodehashcode

Definition at line 547 of file Cached.m.

Here is the caller graph for this function:

function SnapshotsGenerator.Cached.prepare ( IDetailedModel  dmodel,
IDetailedData  detailed_data,
  M 
)

precompute detailed data for all parameters given by M.

parameter
M: matrix storing the parameters for which the generation shall be prepared. The matrix size equal \(dim(\cal M) \times M_p\), where \(M_p\) denotes the number of parameter vectors. (Default = [])
Parameters
dmodelobject specifying how the high dimensional data can be computed.
detailed_dataobject defining the basis generation algorithm and storage for storing high dimensional data, i.e. dependent on dimension \(H\). This data is necessary for detailed simulations, construction of online matrices, reduced_data and reconstruction of reduced simulations.
MM
Required fields of dmodel:
  • num_cpus —  num cpus

Definition at line 431 of file Cached.m.

Here is the call graph for this function:

Member Data Documentation

SnapshotsGenerator.Cached.countdown = 5

seconds to wait before cached data is deleted automatically in case of inconsistent models.


Default: 5

Definition at line 100 of file Cached.m.

SnapshotsGenerator.Cached.enable_caching = true

boolean flag indicating whether caching is enabled.

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public
Matlab documentation of property attributes.
Default: true

Definition at line 66 of file Cached.m.

SnapshotsGenerator.Cached.force_delete = true

boolean value indicating whether the cached data shall be automatically deleted if its inconsistent with the given dmodel.


Default: true

Definition at line 90 of file Cached.m.

SnapshotsGenerator.Cached.id

string identifier for this generator

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public
Matlab documentation of property attributes.

Definition at line 56 of file Cached.m.

SnapshotsGenerator.Cached.idname

unique name created from the IDs as given to the constructor.

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 43 of file Cached.m.

SnapshotsGenerator.Cached.is_valid

checks whether the basis generator points to a valid directory

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 112 of file Cached.m.

SnapshotsGenerator.Cached.model_name = "default"

name id of DetailedModel

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public
Matlab documentation of property attributes.
Default: "default"

Definition at line 77 of file Cached.m.


The documentation for this class was generated from the following file: