NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CacheParameters.cpp
Go to the documentation of this file.
1 
2 
3 #include <iomanip> // For std::setprecision
4 #include "../Math/RNG.hpp"
5 #include "../Param/CacheParameters.hpp"
6 
7 /*----------------------------------------*/
8 /* initializations (private) */
9 /*----------------------------------------*/
10 void NOMAD::CacheParameters::init()
11 {
12  _typeName = "Cache";
13 
14  try
15  {
16  #include "../Attribute/cacheAttributesDefinition.hpp"
17  registerAttributes( _definition );
18  }
19  catch ( NOMAD::Exception & e)
20  {
21  throw NOMAD::Exception(__FILE__,__LINE__, "Failed registering an attribute");
22  }
23 }
24 
25 /*----------------------------------------*/
26 /* check the parameters */
27 /*----------------------------------------*/
28 void NOMAD::CacheParameters::checkAndComply( std::shared_ptr<NOMAD::RunParameters> runParams )
29 {
30 
31  checkInfo();
32 
33  // VRM TODO implement the remove arguments.
34  // Should the remove be done before checking the toBeChecked flag, after it, or in
35  // a different function ?
36  if (!toBeChecked())
37  {
38  // Early out
39  return;
40  }
41 
42 
43 
44  /*----------------------------*/
45  /* Update cache file names */
46  /*----------------------------*/
47  auto problemDir = runParams->getAttributeValue<string>("PROBLEM_DIR",false);
48  std::string cacheFileName = getAttributeValueProtected<std::string>("CACHE_FILE",false);
49  if (!cacheFileName.empty())
50  {
51  NOMAD::completeFileName(cacheFileName, problemDir);
52  setAttributeValue("CACHE_FILE", cacheFileName);
53  }
54 
55  _toBeChecked = false;
56 
57 }
58 // End checkAndComply()
59 
60 
void completeFileName(std::string &filename, const std::string &problemDir, bool addSeed=false, int seed=0)
Definition: fileutils.cpp:254