Rheolef
7.2
an efficient C++ finite element environment
|
Here is a convenient way to implement a persistent data base of big object that are long to initialize and then used only in a read-only mode, via accessors, no modifiers. Examples of such objects in scientific computing are are finite element meshes (see geo
), that are long to load from file and requires large memory, or high-order polynomial basis (see basis
), that are long to initialize (e.g. Vandermonde matrix inversion). When such objects are created independently in different parts of a code, both memory size and computation time could be save by reusing them when these objects was already created.
The aim of the persistent_table class is to automate the implementation of a persistent data base for a generic object, that could be e.g. a finite element mesh or a polynomial basis. It requires very few modification of a pre-existing object. The implementation of the persistent_table class bases on those of smart_pointer
class for handling reference counting. When shared object in the data base are not modifiable, the idea is to use the smart_pointer_nocopy
class. Otherwise, when the object has to be modified, the name of the object, that is used as a key in an hashtable, should also be modified, in order to address the new modified object. Here is a small minimalist example of the class.
This documentation has been generated from file util/lib/persistent_table.h