13 #include <config4cpp/Configuration.h> 14 #include <boost/shared_ptr.hpp> 25 ConfigData(
const char *pPathToProgramConfigFile,
const char *pPathToCaseFolder,
const char *pScope,
bool verbose);
28 static std::shared_ptr<MF::Database::ConfigData>
New(
const char *pPathToProgramConfigFile,
const char *pPathToCaseFolder,
const char *pScope,
bool verbose) {
29 auto ConfigData_Ptr = std::make_shared<MF::Database::ConfigData>(pPathToProgramConfigFile, pPathToCaseFolder, pScope, verbose);
30 return ConfigData_Ptr;
40 inline int getCaseParamLength(
const char *parameterName) {m_pCaseParams->listLocallyScopedNames(m_pScope,
"", config4cpp::Configuration::CFG_SCOPE_AND_VARS,
false, parameterName, m_namesVec);
return m_namesVec.length(); };
41 inline float getCaseFloatParam(
const char *parameterName) {
return m_pCaseParams->lookupFloat(m_pScope, parameterName); };
42 inline int getCaseIntParam(
const char *parameterName) {
return m_pCaseParams->lookupInt(m_pScope, parameterName); };
43 inline bool getCaseBooleanParam(
const char *parameterName) {
return m_pCaseParams->lookupBoolean(m_pScope, parameterName); };
44 inline std::string
getCaseStringParam(
const char *parameterName) {
return m_pCaseParams->lookupString(m_pScope, parameterName); };
46 inline float getCaseFloatVectorParam(
const int component,
const char *parameterName) {m_pCaseParams->lookupList(m_pScope, parameterName, m_valueVector);
return m_pCaseParams->stringToFloat(m_pScope, parameterName, m_valueVector[component]);};
48 inline int getCaseIntVectorParam(
const int component,
const char *parameterName) {m_pCaseParams->lookupList(m_pScope, parameterName, m_valueVector);
return m_pCaseParams->stringToInt(m_pScope, parameterName, m_valueVector[component]);};
51 inline int getGeometryDefinition() {
return m_pCaseParams->lookupEnum(m_pScope,
"BasicParams.GeometryDefinition",
"GeometryDefinitionClass", GeometryDefinition, 1);};
52 inline int getFlowType() {
return m_pCaseParams->lookupEnum(m_pScope,
"BasicParams.FluidFlowModel_MT",
"FlowTypeClass", FlowType, 2);};
53 inline int getModelType() {
return m_pCaseParams->lookupEnum(m_pScope,
"BasicParams.CollisionModel_KT",
"ModelTypeClass", ModelType, 4);};
54 inline int getLatticeType() {
return m_pCaseParams->lookupEnum(m_pScope,
"BasicParams.LatticeType_La",
"LatticeTypeClass", LatticeType, 1);};
57 inline int getProgramParamLength(
const char *parameterName) {m_pProgramParams->listLocallyScopedNames(m_pScope,
"", config4cpp::Configuration::CFG_SCOPE_AND_VARS,
false, parameterName, m_namesVec);
return m_namesVec.length(); };
58 inline float getProgramFloatParam(
const char *parameterName) {
return m_pProgramParams->lookupFloat(m_pScope, parameterName); };
59 inline int getProgramIntParam(
const char *parameterName) {
return m_pProgramParams->lookupInt(m_pScope, parameterName); };
60 inline bool getProgramBooleanParam(
const char *parameterName) {
return m_pProgramParams->lookupBoolean(m_pScope, parameterName); };
61 inline std::string
getProgramStringParam(
const char *parameterName) {
return m_pProgramParams->lookupString(m_pScope, parameterName); };
63 inline float getProgramFloatVectorParam(
const int component,
const char *parameterName) {m_pProgramParams->lookupList(m_pScope, parameterName, m_valueVector);
return m_pProgramParams->stringToFloat(m_pScope, parameterName, m_valueVector[component]);};
65 inline int getProgramIntVectorParam(
const int component,
const char *parameterName) {m_pProgramParams->lookupList(m_pScope, parameterName, m_valueVector);
return m_pProgramParams->stringToInt(m_pScope, parameterName, m_valueVector[component]);};
68 inline int getThreadsNumber() {m_pThreadParams->listLocallyScopedNames(m_pScope,
"", config4cpp::Configuration::CFG_SCOPE,
false,
"uid-Thread", m_namesVec);
return m_namesVec.length();};
69 inline int getThreadParamLength(
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_pThreadParams->listLocallyScopedNames(m_pScope, m_namesVec[ThreadNr], config4cpp::Configuration::CFG_SCOPE_AND_VARS,
false, parameterName, m_namesVec2);
return m_namesVec2.length(); };
71 inline float getThreadFloatParam(
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]);
return m_pThreadParams->lookupFloat(m_strBuffer.c_str(), parameterName, 0); };
72 inline int getThreadIntParam(
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]);
return m_pThreadParams->lookupInt(m_strBuffer.c_str(), parameterName, 0); };
73 inline bool getThreadBooleanParam(
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]);
return m_pThreadParams->lookupBoolean(m_strBuffer.c_str(), parameterName, 0); };
74 inline std::string
getThreadStringParam(
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]);
return m_pThreadParams->lookupString(m_strBuffer.c_str(), parameterName,
""); };
77 inline float getThreadFloatVectorParam(
const int component,
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_pThreadParams->lookupList(m_strBuffer.c_str(), parameterName, m_valueVector, {});
if (m_valueVector.length() > 0)
return m_pThreadParams->stringToFloat(m_strBuffer.c_str(), parameterName, m_valueVector[component]);
return 0; };
79 inline int getThreadIntVectorParam(
const int component,
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_pThreadParams->lookupList(m_strBuffer.c_str(), parameterName, m_valueVector, {});
if (m_valueVector.length() > 0)
return m_pThreadParams->stringToInt(m_strBuffer.c_str(), parameterName, m_valueVector[component]);
return 0; };
81 inline std::string
getThreadStringVectorParam(
const int component,
const int ThreadNr,
const char *parameterName) {
getThreadsNumber(); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_pThreadParams->lookupList(m_strBuffer.c_str(), parameterName, m_valueVector, {});
if (m_valueVector.length() > 0)
return m_valueVector[component];
return ""; };
84 inline int getThreadDataVectorParamLength (
const int ThreadNr,
const int DataNr,
const char *dataName,
const char *parameterName){
getThreadParamLength(ThreadNr,dataName); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_pThreadParams->listLocallyScopedNames(m_strBuffer.c_str(), m_namesVec2[DataNr], config4cpp::Configuration::CFG_SCOPE_AND_VARS,
false, parameterName, m_namesVec3);
return m_namesVec3.length(); };
86 inline float getThreadDataFloatVectorParam(
const int component,
const int ThreadNr,
const int DataNr,
const char *dataName,
const char *parameterName) {
getThreadParamLength(ThreadNr,dataName); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec2[DataNr]); m_pThreadParams->lookupList(m_strBuffer.c_str(), parameterName, m_valueVector, {});
if (m_valueVector.length() > 0)
return m_pThreadParams->stringToFloat(m_strBuffer.c_str(), parameterName, m_valueVector[component]);
return 0; };
88 inline int getThreadDataIntVectorParam(
const int component,
const int ThreadNr,
const int DataNr,
const char *dataName,
const char *parameterName) {
getThreadParamLength(ThreadNr,dataName); m_strBuffer = m_pScope; m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec[ThreadNr]); m_strBuffer.append(
"."); m_strBuffer.append(m_namesVec2[DataNr]); m_pThreadParams->lookupList(m_strBuffer.c_str(), parameterName, m_valueVector, {});
if (m_valueVector.length() > 0)
return m_pThreadParams->stringToInt(m_strBuffer.c_str(), parameterName, m_valueVector[component]);
return 0; };
91 std::shared_ptr<MF::Parser::TextParser> m_pTextParser_Ptr;
92 config4cpp::Configuration *m_pProgramParams;
93 config4cpp::Configuration *m_pCaseParams;
94 config4cpp::Configuration *m_pThreadParams;
95 config4cpp::StringVector m_valueVector;
97 config4cpp::StringVector m_namesVec;
98 config4cpp::StringVector m_namesVec2;
99 config4cpp::StringVector m_namesVec3;
100 config4cpp::StringBuffer m_strBuffer;
102 const config4cpp::EnumNameAndValue GeometryDefinition[1] = {{
"FromSTL", 0},};
103 const config4cpp::EnumNameAndValue FlowType[2] = {{
"QuasiCompressible", 0},{
"Incompressible", 1},};
104 const config4cpp::EnumNameAndValue ModelType[4] = {{
"BGK", 0},{
"MRT", 1},{
"FBGK", 2}, {
"MRT2", 3},};
105 const config4cpp::EnumNameAndValue LatticeType[1] = {{
"D3Q19", 0},};
config4cpp::Configuration * getProgramParametres_Ptr()
Returns pointer to text parser object.
int getProgramParamLength(const char *parameterName)
Returns the LatticeType parameter of enum type: 0 - D3Q19.
std::string GeometryFile
Full path to geometry file (relative to program folder).
float getThreadFloatParam(const int ThreadNr, const char *parameterName)
Returns thread parameter number of name "parameterName" > 0 if parameter exists.
std::string getProgramStringParam(const char *parameterName)
Returns program parameter of boolean type.
bool getCaseBooleanParam(const char *parameterName)
Returns case parameter of int type.
std::string CaseFile
Full path to case config file (relative to program folder).
int getCaseIntVectorParam(const int component, const char *parameterName)
Returns case parameter of vector component of float type.
float getProgramFloatParam(const char *parameterName)
Returns number of program parameter of name "parameterName" > 0 if parameter exists.
int getThreadsNumber()
Returns program parameter of vector component of int type.
float getCaseFloatVectorParam(const int component, const char *parameterName)
Returns case parameter of string type.
The ConfigData class provides accessors for text parser objects: case parameters, program parameters ...
int getThreadIntVectorParam(const int component, const int ThreadNr, const char *parameterName)
Returns thread parameter of vector component of float type.
std::string getThreadStringParam(const int ThreadNr, const char *parameterName)
Returns thread parameter of boolean type.
std::string getThreadStringVectorParam(const int component, const int ThreadNr, const char *parameterName)
Returns thread parameter of vector component of int type.
config4cpp::Configuration * getThreadParametres_Ptr()
Returns pointer to case parameters parser object.
int getFlowType()
Returns the way of GeometryDefinition of enum type: 0 - FromSTL.
bool getThreadBooleanParam(const int ThreadNr, const char *parameterName)
Returns thread parameter of int type.
int getThreadDataIntVectorParam(const int component, const int ThreadNr, const int DataNr, const char *dataName, const char *parameterName)
Returns thread parameter of vector component of float type.
int getCaseParamLength(const char *parameterName)
bool getProgramBooleanParam(const char *parameterName)
Returns program parameter of int type.
ConfigData(const char *pPathToProgramConfigFile, const char *pPathToCaseFolder, const char *pScope, bool verbose)
int getProgramIntVectorParam(const int component, const char *parameterName)
Returns program parameter of vector component of float type.
static std::shared_ptr< MF::Database::ConfigData > New(const char *pPathToProgramConfigFile, const char *pPathToCaseFolder, const char *pScope, bool verbose)
int getThreadDataVectorParamLength(const int ThreadNr, const int DataNr, const char *dataName, const char *parameterName)
Returns thread parameter of string component of int type.
std::string ThreadFile
Full path to thread file (relative to program folder).
float getProgramFloatVectorParam(const int component, const char *parameterName)
Returns program parameter of string type.
float getCaseFloatParam(const char *parameterName)
Returns number of case parameter of name "parameterName" > 0 if parameter exists. ...
int getGeometryDefinition()
Returns case parameter of vector X component of int type.
std::string getCaseStringParam(const char *parameterName)
Returns case parameter of boolean type.
int getThreadParamLength(const int ThreadNr, const char *parameterName)
Returns number of threads.
config4cpp::Configuration * getCaseParametres_Ptr()
Returns pointer to program parameters parser object.
int getModelType()
Returns the FlowType parameter of enum type: 0 - quasi compressible, 1 - incompressible Zou et al...
int getThreadIntParam(const int ThreadNr, const char *parameterName)
Returns thread parameter of float type.
int getCaseIntParam(const char *parameterName)
Returns case parameter of float type.
float getThreadDataFloatVectorParam(const int component, const int ThreadNr, const int DataNr, const char *dataName, const char *parameterName)
Returns thread data parameter length > 0 if parameter exists.
std::shared_ptr< MF::Parser::TextParser > getTextParser_Ptr()
std::string CaseFolder
Path to case folder (relative to program folder).
std::string ProgramConfigFile
Full path to program config file (relative to program folder).
int getProgramIntParam(const char *parameterName)
Returns program parameter of float type.
float getThreadFloatVectorParam(const int component, const int ThreadNr, const char *parameterName)
Returns thread parameter of string type.
int getLatticeType()
Returns the ModelType parameter of enum type: 0 - BGK, 1 - MRT, 2 - FBGK, 3- MRT2.