![]() |
NLMech
0.1.0
|
A class to enforce certain policies to reduce memory loads. More...
#include <policy.h>

Public Member Functions | |
Setter method | |
| void | addToTags (const size_t &level, const std::string &tag) |
| Adds tag to specified level tag list. More... | |
| void | removeTag (const std::string &tag) |
| Looks for tag in the level d_memControlFlag and if present removes it. More... | |
Getter method | |
| bool | populateData (const std::string &tag) |
| Returns true/false depending on whether tag is found. More... | |
| int | getMemoryControlFlag () |
| Returns memory control flag. More... | |
| bool | enablePostProcessing () |
| Returns true if post-processing computation is to be done. More... | |
Static Public Member Functions | |
| static void | destroyInstance () |
| Destroys the instance. | |
| static Policy * | getInstance (inp::PolicyDeck *deck=nullptr) |
| Returns the pointer to static class. Creates instance in its first call. More... | |
Private Member Functions | |
| void | init () |
| Initializes the data. | |
| const Policy & | operator= (const Policy &) |
| Private copy operator. More... | |
| Policy (inp::PolicyDeck *deck=nullptr) | |
| Private constructor. More... | |
| Policy (Policy const &) | |
| Private operator. | |
| ~Policy () | |
| Private destructor. | |
Private Attributes | |
| bool | d_enablePostProcessing |
| Enable post-processing calculation. More... | |
| std::vector< std::vector< std::string > > | d_lTags |
| List of variable names in different levels to help enforce the memory control. | |
| size_t | d_maxLevel |
| Specify maximum level of memory control. | |
| int | d_memControlFlag |
| Flag which indicates level of memory control to be enforced. More... | |
| std::string | d_modelTag |
| Specify model tag. | |
Static Private Attributes | |
| static Policy * | d_instance_p = nullptr |
| Static instance of Policy class. | |
A class to enforce certain policies to reduce memory loads.
We implement simple method to control population of data in simulation. Implementation can be made specific to particular model by simply assigning a tag to d_modelTag and defining a new rule for the tag in the inp::Policy::init.
For a given memory control flag i (can be 0,1,2,3), we look at the list of tags in inp::Policy::d_lTags to know whether we populate the data (given by tag, e.g. tag for data d_u in model::Model is Model_g_u) in the simulation. If it is in the list inp::Policy::d_lTags[i] then we do not populate this data in the simulation.
inp::Policy::d_lTags data is created in init() which is called when the getInstance() is invoked for the first time.
|
explicitprivate |
Private constructor.
| deck | Input deck which contains user-specified information |

| void inp::Policy::addToTags | ( | const size_t & | level, |
| const std::string & | tag | ||
| ) |
Adds tag to specified level tag list.
| level | Level of tag list |
| tag | Tag to be appended to list |
Referenced by fe::Mesh::Mesh().

| bool inp::Policy::enablePostProcessing | ( | ) |
Returns true if post-processing computation is to be done.
|
static |
Returns the pointer to static class. Creates instance in its first call.
| deck | Input deck which contains user-specified information |
Referenced by fe::Mesh::createData(), model::FDModel< T >::FDModel(), fe::MassMatrix::MassMatrix(), fe::Mesh::Mesh(), and model::Output::Output().

| int inp::Policy::getMemoryControlFlag | ( | ) |
Returns memory control flag.
Private copy operator.
| bool inp::Policy::populateData | ( | const std::string & | tag | ) |
Returns true/false depending on whether tag is found.
| tag | Tag to search for |
| void inp::Policy::removeTag | ( | const std::string & | tag | ) |
Looks for tag in the level d_memControlFlag and if present removes it.
| tag | Tag to be appended to list |
|
private |
|
private |
Flag which indicates level of memory control to be enforced.
Default is 0 which means no control. Max at present is 2 which means as much control as possible.
Referenced by Policy().