46 #include <boost/iostreams/filtering_streambuf.hpp>
47 #include <boost/iostreams/copy.hpp>
48 #include <boost/iostreams/filter/gzip.hpp>
49 #include <boost/algorithm/string.hpp>
61 #include <boost/program_options.hpp>
62 #include <boost/format.hpp>
64 #ifndef NEKTAR_VERSION
65 #define NEKTAR_VERSION "Unknown"
70 namespace po = boost::program_options;
71 namespace io = boost::iostreams;
75 namespace LibUtilities
131 return solverInfoEnums;
146 return solverInfoMap;
162 return gloSysSolnInfoList;
176 return cmdLineArguments;
188 SessionReader::SessionReader(
int argc,
char *argv[])
191 m_filenames = ParseCommandLineArguments(argc, argv);
193 ASSERTL0(m_filenames.size() > 0,
"No session file(s) given.");
195 m_sessionName = ParseSessionName(m_filenames);
198 CreateComm(argc, argv);
200 TestSharedFilesystem();
204 if (m_comm->GetSize() > 1)
206 GetSolverInfoDefaults()[
"GLOBALSYSSOLN"] =
207 "IterativeStaticCond";
211 m_interpreter->SetRandomSeed((m_comm->GetRank() + 1)
212 * (
unsigned int)time(NULL));
222 SessionReader::SessionReader(
225 const std::vector<std::string> &pFilenames,
228 ASSERTL0(pFilenames.size() > 0,
"No filenames specified.");
230 ParseCommandLineArguments(argc, argv);
232 m_filenames = pFilenames;
234 m_sessionName = ParseSessionName(m_filenames);
239 CreateComm(argc, argv);
246 TestSharedFilesystem();
250 if (m_comm->GetSize() > 1)
252 GetSolverInfoDefaults()[
"GLOBALSYSSOLN"] =
253 "IterativeStaticCond";
257 m_interpreter->SetRandomSeed((m_comm->GetRank() + 1)
258 * (
unsigned int)time(NULL));
268 SessionReader::~SessionReader()
283 void SessionReader::InitSession(
284 const std::vector<std::string> &filenames)
287 if (filenames.size() > 0)
289 m_filenames = filenames;
298 m_xmlDoc = MergeDoc(m_filenames);
311 if (m_verbose && m_comm)
313 if (m_comm->TreatAsRankZero() && m_parameters.size() > 0)
315 cout <<
"Parameters:" << endl;
316 for (
auto &x : m_parameters)
318 cout <<
"\t" << x.first <<
" = " << x.second << endl;
323 if (m_comm->TreatAsRankZero() && m_solverInfo.size() > 0)
325 cout <<
"Solver Info:" << endl;
326 for (
auto &x : m_solverInfo)
328 cout <<
"\t" << x.first <<
" = " << x.second << endl;
335 void SessionReader::TestSharedFilesystem()
337 m_sharedFilesystem =
false;
339 if (m_comm->GetSize() > 1)
341 if (m_comm->GetRank() == 0)
343 std::ofstream testfile(
"shared-fs-testfile");
344 testfile <<
"" << std::endl;
345 ASSERTL1(!testfile.fail(),
"Test file creation failed");
350 int exists = (bool)boost::filesystem::exists(
"shared-fs-testfile");
353 m_sharedFilesystem = (exists == m_comm->GetSize());
355 if ((m_sharedFilesystem && m_comm->GetRank() == 0) ||
358 std::remove(
"shared-fs-testfile");
363 m_sharedFilesystem =
false;
366 if (m_verbose && m_comm->GetRank() == 0 && m_sharedFilesystem)
368 cout <<
"Shared filesystem detected" << endl;
377 std::vector<std::string> SessionReader::ParseCommandLineArguments(
378 int argc,
char *argv[])
381 po::options_description desc(
"Allowed options");
383 (
"verbose,v",
"be verbose")
384 (
"version,V",
"print version information")
385 (
"help,h",
"print this help message")
386 (
"solverinfo,I", po::value<vector<std::string> >(),
387 "override a SOLVERINFO property")
388 (
"parameter,P", po::value<vector<std::string> >(),
389 "override a parameter")
390 (
"npx", po::value<int>(),
391 "number of procs in X-dir")
392 (
"npy", po::value<int>(),
393 "number of procs in Y-dir")
394 (
"npz", po::value<int>(),
395 "number of procs in Z-dir")
396 (
"nsz", po::value<int>(),
397 "number of slices in Z-dir")
398 (
"part-only", po::value<int>(),
399 "only partition mesh into N partitions.")
400 (
"part-only-overlapping", po::value<int>(),
401 "only partition mesh into N overlapping partitions.")
402 (
"part-info",
"Output partition information")
403 #ifdef NEKTAR_USE_CWIPI
404 (
"cwipi", po::value<std::string>(),
409 for (
auto &cmdIt : GetCmdLineArgMap())
411 std::string names = cmdIt.first;
412 if (cmdIt.second.shortName !=
"")
414 names +=
"," + cmdIt.second.shortName;
416 if (cmdIt.second.isFlag)
419 (names.c_str(), cmdIt.second.description.c_str())
425 (names.c_str(), po::value<std::string>(),
426 cmdIt.second.description.c_str())
433 po::options_description hidden(
"Hidden options");
435 (
"input-file", po::value< vector<string> >(),
440 po::options_description all(
"All options");
441 all.add(desc).add(hidden);
444 po::positional_options_description
p;
445 p.add(
"input-file", -1);
448 po::parsed_options parsed = po::command_line_parser(argc, argv).
451 allow_unregistered().
455 po::store(parsed, m_cmdLineOptions);
456 po::notify(m_cmdLineOptions);
459 if (m_cmdLineOptions.count(
"help"))
466 if (m_cmdLineOptions.count(
"version"))
474 boost::replace_all(branch,
"refs/heads/",
"");
476 cout <<
" (git changeset " << sha1.substr(0, 8) <<
", ";
480 cout <<
"detached head";
484 cout <<
"head " << branch;
495 if (m_cmdLineOptions.count(
"verbose"))
505 for (
auto &x : parsed.options)
509 cout <<
"Warning: Unknown option: " << x.string_key
515 if (m_cmdLineOptions.count(
"input-file"))
517 return m_cmdLineOptions[
"input-file"].as<
518 std::vector<std::string> >();
522 return std::vector<std::string>();
530 std::string SessionReader::ParseSessionName(
531 std::vector<std::string> &filenames)
534 "At least one filename expected.");
536 std::string retval =
"";
539 std::string fname = filenames[0];
542 if (fname.size() > 4 &&
543 fname.substr(fname.size() - 4, 4) ==
"_xml")
545 retval = fname.substr(0, fname.find_last_of(
"_"));
548 else if (fname.size() > 4 &&
549 fname.substr(fname.size() - 4, 4) ==
".xml")
551 retval = fname.substr(0, fname.find_last_of(
"."));
554 else if (fname.size() > 7 &&
555 fname.substr(fname.size() - 7, 7) ==
".xml.gz")
557 retval = fname.substr(0, fname.find_last_of(
"."));
558 retval = retval.substr(0, retval.find_last_of(
"."));
568 TiXmlDocument& SessionReader::GetDocument()
570 ASSERTL1(m_xmlDoc,
"XML Document not defined.");
597 TiXmlElement* SessionReader::GetElement(
const string& pPath)
599 std::string vPath = boost::to_upper_copy(pPath);
600 std::vector<std::string> st;
601 boost::split(st, vPath, boost::is_any_of(
"\\/ "));
602 ASSERTL0(st.size() > 0,
"No path given in XML element request.");
604 TiXmlElement* vReturn = m_xmlDoc->FirstChildElement(st[0].c_str());
605 ASSERTL0(vReturn, std::string(
"Cannot find element '")
606 + st[0] + std::string(
"'."));
607 for (
int i = 1; i < st.size(); ++i)
609 vReturn = vReturn->FirstChildElement(st[i].c_str());
610 ASSERTL0(vReturn, std::string(
"Cannot find element '")
611 + st[i] + std::string(
"'."));
620 bool SessionReader::DefinesElement(
const std::string &pPath)
const
622 std::string vPath = boost::to_upper_copy(pPath);
623 std::vector<std::string> st;
624 boost::split(st, vPath, boost::is_any_of(
"\\/ "));
625 ASSERTL0(st.size() > 0,
"No path given in XML element request.");
627 TiXmlElement* vReturn = m_xmlDoc->FirstChildElement(st[0].c_str());
628 ASSERTL0(vReturn, std::string(
"Cannot find element '")
629 + st[0] + std::string(
"'."));
630 for (
int i = 1; i < st.size(); ++i)
632 vReturn = vReturn->FirstChildElement(st[i].c_str());
633 if (!vReturn)
return false;
642 const std::vector<std::string>& SessionReader::GetFilenames()
const
651 const std::string& SessionReader::GetSessionName()
const
653 return m_sessionName;
661 const std::string SessionReader::GetSessionNameRank()
const
663 std::string dirname = m_sessionName +
"_xml";
664 fs::path pdirname(dirname);
666 std::string vFilename =
"P" + boost::lexical_cast<std::string>(m_comm->GetRowComm()->GetRank());
667 fs::path pFilename(vFilename);
669 fs::path fullpath = pdirname / pFilename;
682 bool SessionReader::GetSharedFilesystem()
684 return m_sharedFilesystem;
702 bool SessionReader::DefinesParameter(
const std::string& pName)
const
704 std::string vName = boost::to_upper_copy(pName);
705 return m_parameters.find(vName) != m_parameters.end();
718 const std::string& pName)
const
720 std::string vName = boost::to_upper_copy(pName);
721 auto paramIter = m_parameters.find(vName);
723 ASSERTL0(paramIter != m_parameters.end(),
724 "Unable to find requested parameter: " + pName);
726 return paramIter->second;
733 void SessionReader::LoadParameter(
734 const std::string &pName,
int &pVar)
const
736 std::string vName = boost::to_upper_copy(pName);
737 auto paramIter = m_parameters.find(vName);
738 ASSERTL0(paramIter != m_parameters.end(),
"Required parameter '" +
739 pName +
"' not specified in session.");
740 NekDouble param = round(paramIter->second);
741 pVar = checked_cast<int>(param);
748 void SessionReader::LoadParameter(
749 const std::string &pName,
int &pVar,
const int &pDefault)
const
751 std::string vName = boost::to_upper_copy(pName);
752 auto paramIter = m_parameters.find(vName);
753 if(paramIter != m_parameters.end())
755 NekDouble param = round(paramIter->second);
756 pVar = checked_cast<int>(param);
768 void SessionReader::LoadParameter(
769 const std::string &pName,
NekDouble& pVar)
const
771 std::string vName = boost::to_upper_copy(pName);
772 auto paramIter = m_parameters.find(vName);
773 ASSERTL0(paramIter != m_parameters.end(),
"Required parameter '" +
774 pName +
"' not specified in session.");
775 pVar = paramIter->second;
782 void SessionReader::LoadParameter(
783 const std::string &pName,
787 std::string vName = boost::to_upper_copy(pName);
788 auto paramIter = m_parameters.find(vName);
789 if(paramIter != m_parameters.end())
791 pVar = paramIter->second;
804 void SessionReader::SetParameter(
const std::string &pName,
int &pVar)
806 std::string vName = boost::to_upper_copy(pName);
807 m_parameters[vName] = pVar;
814 void SessionReader::SetParameter(
815 const std::string &pName,
NekDouble& pVar)
817 std::string vName = boost::to_upper_copy(pName);
818 m_parameters[vName] = pVar;
826 bool SessionReader::DefinesSolverInfo(
const std::string &pName)
const
828 std::string vName = boost::to_upper_copy(pName);
829 auto infoIter = m_solverInfo.find(vName);
830 return (infoIter != m_solverInfo.end());
837 const std::string& SessionReader::GetSolverInfo(
838 const std::string &pProperty)
const
840 std::string vProperty = boost::to_upper_copy(pProperty);
841 auto iter = m_solverInfo.find(vProperty);
843 ASSERTL1(iter != m_solverInfo.end(),
844 "Unable to find requested property: " + pProperty);
852 void SessionReader::SetSolverInfo(
853 const std::string &pProperty,
const std::string &pValue)
855 std::string vProperty = boost::to_upper_copy(pProperty);
856 auto iter = m_solverInfo.find(vProperty);
858 ASSERTL1(iter != m_solverInfo.end(),
859 "Unable to find requested property: " + pProperty);
861 iter->second = pValue;
867 void SessionReader::LoadSolverInfo(
868 const std::string &pName,
870 const std::string &pDefault)
const
872 std::string vName = boost::to_upper_copy(pName);
873 auto infoIter = m_solverInfo.find(vName);
874 if(infoIter != m_solverInfo.end())
876 pVar = infoIter->second;
888 void SessionReader::MatchSolverInfo(
889 const std::string &pName,
890 const std::string &pTrueVal,
892 const bool &pDefault)
const
894 std::string vName = boost::to_upper_copy(pName);
895 auto infoIter = m_solverInfo.find(vName);
896 if(infoIter != m_solverInfo.end())
898 pVar = boost::iequals(infoIter->second, pTrueVal);
910 bool SessionReader::MatchSolverInfo(
911 const std::string &pName,
912 const std::string &pTrueVal)
const
914 if (DefinesSolverInfo(pName))
916 std::string vName = boost::to_upper_copy(pName);
917 auto iter = m_solverInfo.find(vName);
918 if(iter != m_solverInfo.end())
920 return boost::iequals(iter->second, pTrueVal);
930 bool SessionReader::DefinesGlobalSysSolnInfo(
const std::string &pVariable,
931 const std::string &pProperty)
const
933 auto iter = GetGloSysSolnList().find(pVariable);
934 if(iter == GetGloSysSolnList().end())
939 std::string vProperty = boost::to_upper_copy(pProperty);
941 auto iter1 = iter->second.find(vProperty);
942 if(iter1 == iter->second.end())
954 const std::string &SessionReader::GetGlobalSysSolnInfo(
const std::string &pVariable,
const std::string &pProperty)
const
956 auto iter = GetGloSysSolnList().find(pVariable);
957 ASSERTL0(iter != GetGloSysSolnList().end(),
958 "Failed to find variable in GlobalSysSolnInfoList");
960 std::string vProperty = boost::to_upper_copy(pProperty);
961 auto iter1 = iter->second.find(vProperty);
963 ASSERTL0(iter1 != iter->second.end(),
964 "Failed to find property: " + vProperty +
" in GlobalSysSolnInfoList");
966 return iter1->second;
973 bool SessionReader::DefinesTimeIntScheme()
const
975 return m_timeIntScheme.method !=
"";
984 return m_timeIntScheme;
987 std::string SessionReader::GetGeometryType()
const
989 TiXmlElement *xmlGeom = m_xmlDoc->FirstChildElement(
"NEKTAR")
990 ->FirstChildElement(
"GEOMETRY");
991 TiXmlAttribute *attr = xmlGeom->FirstAttribute();
994 std::string attrName(attr->Name());
995 if (attrName ==
"HDF5FILE")
1001 attr = attr->Next();
1006 TiXmlElement *element = xmlGeom->FirstChildElement(
"VERTEX");
1007 string IsCompressed;
1008 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
1010 if (IsCompressed.size() > 0)
1012 return "XmlCompressed";
1022 bool SessionReader::DefinesGeometricInfo(
const std::string &pName)
const
1024 std::string vName = boost::to_upper_copy(pName);
1025 return m_geometricInfo.find(vName) != m_geometricInfo.end();
1032 void SessionReader::LoadGeometricInfo(
1033 const std::string &pName,
1035 const std::string &pDefault)
const
1037 std::string vName = boost::to_upper_copy(pName);
1038 auto iter = m_geometricInfo.find(vName);
1039 if(iter != m_geometricInfo.end())
1041 pVar = iter->second;
1053 void SessionReader::LoadGeometricInfo(
1054 const std::string &pName,
1056 const bool &pDefault)
const
1058 std::string vName = boost::to_upper_copy(pName);
1059 auto iter = m_geometricInfo.find(vName);
1060 if(iter != m_geometricInfo.end())
1062 if (iter->second ==
"TRUE")
1081 void SessionReader::LoadGeometricInfo(
1082 const std::string &pName,
1086 std::string vName = boost::to_upper_copy(pName);
1087 auto iter = m_geometricInfo.find(vName);
1088 if(iter != m_geometricInfo.end())
1090 pVar = std::atoi(iter->second.c_str());
1102 void SessionReader::MatchGeometricInfo(
1103 const std::string &pName,
1104 const std::string &pTrueVal,
1106 const bool &pDefault)
const
1108 std::string vName = boost::to_upper_copy(pName);
1109 auto iter = m_geometricInfo.find(vName);
1110 if(iter != m_geometricInfo.end())
1112 pVar = boost::iequals(iter->second, pTrueVal);
1124 const std::string& SessionReader::GetVariable(
1125 const unsigned int &idx)
const
1127 ASSERTL0(idx < m_variables.size(),
"Variable index out of range.");
1128 return m_variables[idx];
1136 void SessionReader::SetVariable(
const unsigned int &idx,
1137 std::string newname)
1139 ASSERTL0(idx < m_variables.size(),
"Variable index out of range.");
1140 m_variables[idx] = newname;
1147 std::vector<std::string> SessionReader::GetVariables()
const
1156 bool SessionReader::DefinesFunction(
const std::string &pName)
const
1158 std::string vName = boost::to_upper_copy(pName);
1159 return m_functions.find(vName) != m_functions.end();
1166 bool SessionReader::DefinesFunction(
1167 const std::string &pName,
1168 const std::string &pVariable,
1169 const int pDomain)
const
1171 std::string vName = boost::to_upper_copy(pName);
1174 auto it1 = m_functions.find(vName);
1175 if (it1 != m_functions.end())
1177 pair<std::string, int> key(pVariable,pDomain);
1178 pair<std::string, int> defkey(
"*",pDomain);
1180 it1->second.find(key) != it1->second.end() ||
1181 it1->second.find(defkey) != it1->second.end();
1192 const std::string &pName,
1193 const std::string &pVariable,
1194 const int pDomain)
const
1196 std::string vName = boost::to_upper_copy(pName);
1197 auto it1 = m_functions.find(vName);
1200 std::string(
"No such function '") + pName
1201 + std::string(
"' has been defined in the session file."));
1204 pair<std::string,int> key(pVariable,pDomain);
1205 pair<std::string,int> defkey(
"*",pDomain);
1207 auto it2 = it1->second.find(key);
1208 auto it3 = it1->second.find(defkey);
1209 bool specific = it2 != it1->second.end();
1210 bool wildcard = it3 != it1->second.end();
1214 "No such variable " + pVariable
1215 +
" in domain " + boost::lexical_cast<string>(pDomain)
1216 +
" defined for function " + pName
1217 +
" in session file.");
1226 std::string(
"Function is defined by a file."));
1227 return it2->second.m_expression;
1235 const std::string &pName,
1236 const unsigned int &pVar,
1237 const int pDomain)
const
1239 ASSERTL0(pVar < m_variables.size(),
"Variable index out of range.");
1240 return GetFunction(pName, m_variables[pVar],pDomain);
1248 const std::string &pName,
1249 const std::string &pVariable,
1250 const int pDomain)
const
1252 std::string vName = boost::to_upper_copy(pName);
1253 auto it1 = m_functions.find(vName);
1255 ASSERTL0 (it1 != m_functions.end(),
1256 std::string(
"Function '") + pName
1257 + std::string(
"' not found."));
1260 pair<std::string,int> key(pVariable,pDomain);
1261 pair<std::string,int> defkey(
"*",pDomain);
1263 auto it2 = it1->second.find(key);
1264 auto it3 = it1->second.find(defkey);
1265 bool specific = it2 != it1->second.end();
1266 bool wildcard = it3 != it1->second.end();
1270 "No such variable " + pVariable
1271 +
" in domain " + boost::lexical_cast<string>(pDomain)
1272 +
" defined for function " + pName
1273 +
" in session file.");
1281 return it2->second.m_type;
1289 const std::string &pName,
1290 const unsigned int &pVar,
1291 const int pDomain)
const
1293 ASSERTL0(pVar < m_variables.size(),
"Variable index out of range.");
1294 return GetFunctionType(pName, m_variables[pVar],pDomain);
1301 std::string SessionReader::GetFunctionFilename(
1302 const std::string &pName,
1303 const std::string &pVariable,
1304 const int pDomain)
const
1306 std::string vName = boost::to_upper_copy(pName);
1307 auto it1 = m_functions.find(vName);
1309 ASSERTL0 (it1 != m_functions.end(),
1310 std::string(
"Function '") + pName
1311 + std::string(
"' not found."));
1314 pair<std::string,int> key(pVariable,pDomain);
1315 pair<std::string,int> defkey(
"*",pDomain);
1317 auto it2 = it1->second.find(key);
1318 auto it3 = it1->second.find(defkey);
1319 bool specific = it2 != it1->second.end();
1320 bool wildcard = it3 != it1->second.end();
1324 "No such variable " + pVariable
1325 +
" in domain " + boost::lexical_cast<string>(pDomain)
1326 +
" defined for function " + pName
1327 +
" in session file.");
1335 return it2->second.m_filename;
1342 std::string SessionReader::GetFunctionFilename(
1343 const std::string &pName,
1344 const unsigned int &pVar,
1345 const int pDomain)
const
1347 ASSERTL0(pVar < m_variables.size(),
"Variable index out of range.");
1348 return GetFunctionFilename(pName, m_variables[pVar],pDomain);
1355 std::string SessionReader::GetFunctionFilenameVariable(
1356 const std::string &pName,
1357 const std::string &pVariable,
1358 const int pDomain)
const
1360 std::string vName = boost::to_upper_copy(pName);
1361 auto it1 = m_functions.find(vName);
1363 ASSERTL0 (it1 != m_functions.end(),
1364 std::string(
"Function '") + pName
1365 + std::string(
"' not found."));
1368 pair<std::string,int> key(pVariable,pDomain);
1369 pair<std::string,int> defkey(
"*",pDomain);
1371 auto it2 = it1->second.find(key);
1372 auto it3 = it1->second.find(defkey);
1373 bool specific = it2 != it1->second.end();
1374 bool wildcard = it3 != it1->second.end();
1378 "No such variable " + pVariable
1379 +
" in domain " + boost::lexical_cast<string>(pDomain)
1380 +
" defined for function " + pName
1381 +
" in session file.");
1389 return it2->second.m_fileVariable;
1396 bool SessionReader::DefinesTag(
const std::string &pName)
const
1398 std::string vName = boost::to_upper_copy(pName);
1399 return m_tags.find(vName) != m_tags.end();
1406 void SessionReader::SetTag(
1407 const std::string &pName,
1408 const std::string &pValue)
1410 std::string vName = boost::to_upper_copy(pName);
1411 m_tags[vName] = pValue;
1418 const std::string &SessionReader::GetTag(
const std::string& pName)
const
1420 std::string vName = boost::to_upper_copy(pName);
1421 auto vTagIterator = m_tags.find(vName);
1422 ASSERTL0(vTagIterator != m_tags.end(),
1423 "Requested tag does not exist.");
1424 return vTagIterator->second;
1440 bool SessionReader::DefinesCmdLineArgument(
1441 const std::string& pName)
const
1443 return (m_cmdLineOptions.find(pName) != m_cmdLineOptions.end());
1450 void SessionReader::SubstituteExpressions(std::string& pExpr)
1452 for (
auto &exprIter : m_expressions)
1454 boost::replace_all(pExpr, exprIter.first, exprIter.second);
1461 void SessionReader::LoadDoc(
1462 const std::string &pFilename,
1463 TiXmlDocument* pDoc)
const
1465 if (pFilename.size() > 3 &&
1466 pFilename.substr(pFilename.size() - 3, 3) ==
".gz")
1468 ifstream file(pFilename.c_str(),
1469 ios_base::in | ios_base::binary);
1470 ASSERTL0(file.good(),
"Unable to open file: " + pFilename);
1472 io::filtering_streambuf<io::input> in;
1473 in.push(io::gzip_decompressor());
1480 catch (io::gzip_error&)
1483 "Error: File '" + pFilename +
"' is corrupt.");
1486 else if (pFilename.size() > 4 &&
1487 pFilename.substr(pFilename.size() - 4, 4) ==
"_xml")
1489 fs::path pdirname(pFilename);
1491 pad % m_comm->GetRank();
1492 fs::path pRankFilename(pad.str());
1493 fs::path fullpath = pdirname / pRankFilename;
1496 ASSERTL0(file.good(),
"Unable to open file: " + fullpath.string());
1501 ifstream file(pFilename.c_str());
1502 ASSERTL0(file.good(),
"Unable to open file: " + pFilename);
1510 TiXmlDocument *SessionReader::MergeDoc(
1511 const std::vector<std::string> &pFilenames)
const
1513 ASSERTL0(pFilenames.size() > 0,
"No filenames for merging.");
1516 TiXmlDocument *vMainDoc =
new TiXmlDocument;
1517 LoadDoc(pFilenames[0], vMainDoc);
1519 TiXmlHandle vMainHandle(vMainDoc);
1520 TiXmlElement* vMainNektar =
1521 vMainHandle.FirstChildElement(
"NEKTAR").Element();
1526 for (
int i = 1; i < pFilenames.size(); ++i)
1528 if((pFilenames[i].compare(pFilenames[i].size()-3,3,
"xml") == 0)
1529 ||(pFilenames[i].compare(pFilenames[i].size()-6,6,
"xml.gz") == 0))
1531 TiXmlDocument* vTempDoc =
new TiXmlDocument;
1532 LoadDoc(pFilenames[i], vTempDoc);
1534 TiXmlHandle docHandle(vTempDoc);
1535 TiXmlElement* vTempNektar;
1536 vTempNektar = docHandle.FirstChildElement(
"NEKTAR").Element();
1537 ASSERTL0(vTempNektar,
"Unable to find NEKTAR tag in file.");
1538 TiXmlElement*
p = vTempNektar->FirstChildElement();
1542 TiXmlElement *vMainEntry =
1543 vMainNektar->FirstChildElement(
p->Value());
1546 if (!
p->FirstChild() && vMainEntry)
1548 std::string warningmsg =
1549 "File " + pFilenames[i] +
" contains " +
1550 "an empty XML element " +
1551 std::string(
p->Value()) +
1552 " which will be ignored.";
1553 NEKERROR(ErrorUtil::ewarning, warningmsg.c_str());
1559 vMainNektar->RemoveChild(vMainEntry);
1561 TiXmlElement *q =
new TiXmlElement(*
p);
1562 vMainNektar->LinkEndChild(q);
1564 p =
p->NextSiblingElement();
1577 void SessionReader::ParseDocument()
1580 ASSERTL0(m_xmlDoc,
"No XML document loaded.");
1583 TiXmlHandle docHandle(m_xmlDoc);
1585 e = docHandle.FirstChildElement(
"NEKTAR").
1586 FirstChildElement(
"CONDITIONS").Element();
1591 ReadGlobalSysSolnInfo (e);
1592 ReadTimeIntScheme (e);
1593 ReadExpressions (e);
1597 e = docHandle.FirstChildElement(
"NEKTAR").
1598 FirstChildElement(
"FILTERS").Element();
1607 void SessionReader::CreateComm(
1617 string vCommModule(
"Serial");
1620 vCommModule =
"ParallelMPI";
1622 if (m_cmdLineOptions.count(
"cwipi") &&
GetCommFactory().ModuleExists(
"CWIPI"))
1624 vCommModule =
"CWIPI";
1638 void SessionReader::PartitionComm()
1640 if (m_comm->GetSize() > 1)
1646 if (DefinesCmdLineArgument(
"npx")) {
1647 nProcX = GetCmdLineArgument<int>(
"npx");
1649 if (DefinesCmdLineArgument(
"npy")) {
1650 nProcY = GetCmdLineArgument<int>(
"npy");
1652 if (DefinesCmdLineArgument(
"npz")) {
1653 nProcZ = GetCmdLineArgument<int>(
"npz");
1655 if (DefinesCmdLineArgument(
"nsz")) {
1656 nStripZ = GetCmdLineArgument<int>(
"nsz");
1658 ASSERTL0(m_comm->GetSize() % (nProcZ*nProcY*nProcX) == 0,
1659 "Cannot exactly partition using PROC_Z value.");
1661 "Cannot exactly partition using PROC_Y value.");
1663 "Cannot exactly partition using PROC_X value.");
1666 int nProcSm = nProcZ * nProcY * nProcX;
1670 int nProcSem = m_comm->GetSize() / nProcSm;
1672 m_comm->SplitComm(nProcSm,nProcSem);
1673 m_comm->GetColumnComm()->SplitComm(nProcZ/nStripZ,nStripZ);
1674 m_comm->GetColumnComm()->GetColumnComm()->SplitComm(
1675 (nProcY*nProcX),nProcZ/nStripZ);
1676 m_comm->GetColumnComm()->GetColumnComm()->GetColumnComm()
1677 ->SplitComm(nProcX,nProcY);
1685 void SessionReader::ReadParameters(TiXmlElement *conditions)
1687 m_parameters.clear();
1694 TiXmlElement *parametersElement = conditions->FirstChildElement(
1699 if (parametersElement)
1701 TiXmlElement *parameter =
1702 parametersElement->FirstChildElement(
"P");
1710 stringstream tagcontent;
1711 tagcontent << *parameter;
1712 TiXmlNode *node = parameter->FirstChild();
1714 while (node && node->Type() != TiXmlNode::TINYXML_TEXT)
1716 node = node->NextSibling();
1722 std::string line = node->ToText()->Value(), lhs, rhs;
1725 ParseEquals(line, lhs, rhs);
1730 "Syntax error in parameter expression '"
1731 + line +
"' in XML element: \n\t'"
1732 + tagcontent.str() +
"'");
1738 if (!lhs.empty() && !rhs.empty())
1744 m_interpreter, rhs);
1747 catch (
const std::runtime_error &)
1750 "Error evaluating parameter expression"
1751 " '" + rhs +
"' in XML element: \n\t'"
1752 + tagcontent.str() +
"'");
1754 m_interpreter->SetParameter(lhs, value);
1755 caseSensitiveParameters[lhs] = value;
1756 boost::to_upper(lhs);
1757 m_parameters[lhs] = value;
1761 parameter = parameter->NextSiblingElement();
1770 void SessionReader::ReadSolverInfo(TiXmlElement *conditions)
1772 m_solverInfo.clear();
1773 m_solverInfo = GetSolverInfoDefaults();
1780 TiXmlElement *solverInfoElement =
1781 conditions->FirstChildElement(
"SOLVERINFO");
1783 if (solverInfoElement)
1785 TiXmlElement *solverInfo =
1786 solverInfoElement->FirstChildElement(
"I");
1790 std::stringstream tagcontent;
1791 tagcontent << *solverInfo;
1793 ASSERTL0(solverInfo->Attribute(
"PROPERTY"),
1794 "Missing PROPERTY attribute in solver info "
1795 "XML element: \n\t'" + tagcontent.str() +
"'");
1796 std::string solverProperty =
1797 solverInfo->Attribute(
"PROPERTY");
1799 "PROPERTY attribute must be non-empty in XML "
1800 "element: \n\t'" + tagcontent.str() +
"'");
1803 std::string solverPropertyUpper =
1804 boost::to_upper_copy(solverProperty);
1807 ASSERTL0(solverInfo->Attribute(
"VALUE"),
1808 "Missing VALUE attribute in solver info "
1809 "XML element: \n\t'" + tagcontent.str() +
"'");
1810 std::string solverValue = solverInfo->Attribute(
"VALUE");
1812 "VALUE attribute must be non-empty in XML "
1813 "element: \n\t'" + tagcontent.str() +
"'");
1816 m_solverInfo[solverPropertyUpper] = solverValue;
1817 solverInfo = solverInfo->NextSiblingElement(
"I");
1821 if (m_comm && m_comm->GetRowComm()->GetSize() > 1)
1824 m_solverInfo[
"GLOBALSYSSOLN"] ==
"IterativeFull" ||
1825 m_solverInfo[
"GLOBALSYSSOLN"] ==
"IterativeStaticCond" ||
1826 m_solverInfo[
"GLOBALSYSSOLN"] ==
1827 "IterativeMultiLevelStaticCond" ||
1828 m_solverInfo[
"GLOBALSYSSOLN"] ==
"XxtFull" ||
1829 m_solverInfo[
"GLOBALSYSSOLN"] ==
"XxtStaticCond" ||
1830 m_solverInfo[
"GLOBALSYSSOLN"] ==
1831 "XxtMultiLevelStaticCond" ||
1832 m_solverInfo[
"GLOBALSYSSOLN"] ==
"PETScFull" ||
1833 m_solverInfo[
"GLOBALSYSSOLN"] ==
"PETScStaticCond" ||
1834 m_solverInfo[
"GLOBALSYSSOLN"] ==
1835 "PETScMultiLevelStaticCond",
1836 "A parallel solver must be used when run in parallel.");
1845 void SessionReader::ReadGlobalSysSolnInfo(TiXmlElement *conditions)
1847 GetGloSysSolnList().clear();
1854 TiXmlElement *GlobalSys =
1855 conditions->FirstChildElement(
"GLOBALSYSSOLNINFO");
1862 TiXmlElement *VarInfo = GlobalSys->FirstChildElement(
"V");
1866 std::stringstream tagcontent;
1867 tagcontent << *VarInfo;
1868 ASSERTL0(VarInfo->Attribute(
"VAR"),
1869 "Missing VAR attribute in GobalSysSolnInfo XML "
1870 "element: \n\t'" + tagcontent.str() +
"'");
1872 std::string VarList = VarInfo->Attribute(
"VAR");
1874 "VAR attribute must be non-empty in XML element:\n\t'"
1875 + tagcontent.str() +
"'");
1878 std::vector<std::string> varStrings;
1879 bool valid = ParseUtils::GenerateVector(VarList, varStrings);
1881 ASSERTL0(valid,
"Unable to process list of variable in XML "
1882 "element \n\t'" + tagcontent.str() +
"'");
1884 if(varStrings.size())
1886 TiXmlElement *SysSolnInfo = VarInfo->FirstChildElement(
"I");
1891 tagcontent << *SysSolnInfo;
1893 ASSERTL0(SysSolnInfo->Attribute(
"PROPERTY"),
1894 "Missing PROPERTY attribute in "
1895 "GlobalSysSolnInfo for variable(s) '"
1896 + VarList +
"' in XML element: \n\t'"
1897 + tagcontent.str() +
"'");
1899 std::string SysSolnProperty =
1900 SysSolnInfo->Attribute(
"PROPERTY");
1903 "GlobalSysSolnIno properties must have a "
1904 "non-empty name for variable(s) : '"
1905 + VarList +
"' in XML element: \n\t'"
1906 + tagcontent.str() +
"'");
1909 std::string SysSolnPropertyUpper =
1910 boost::to_upper_copy(SysSolnProperty);
1913 ASSERTL0(SysSolnInfo->Attribute(
"VALUE"),
1914 "Missing VALUE attribute in GlobalSysSolnInfo "
1915 "for variable(s) '" + VarList
1916 +
"' in XML element: \n\t"
1917 + tagcontent.str() +
"'");
1919 std::string SysSolnValue =
1920 SysSolnInfo->Attribute(
"VALUE");
1922 "GlobalSysSolnInfo properties must have a "
1923 "non-empty value for variable(s) '"
1924 + VarList +
"' in XML element: \n\t'"
1925 + tagcontent.str() +
"'");
1928 for(
int i = 0; i < varStrings.size(); ++i)
1930 auto x = GetGloSysSolnList().find(varStrings[i]);
1931 if (x == GetGloSysSolnList().end())
1933 (GetGloSysSolnList()[varStrings[i]])[
1934 SysSolnPropertyUpper] = SysSolnValue;
1938 x->second[SysSolnPropertyUpper] = SysSolnValue;
1942 SysSolnInfo = SysSolnInfo->NextSiblingElement(
"I");
1944 VarInfo = VarInfo->NextSiblingElement(
"V");
1948 if (m_verbose && GetGloSysSolnList().size() > 0 && m_comm)
1950 if(m_comm->GetRank() == 0)
1952 cout <<
"GlobalSysSoln Info:" << endl;
1954 for (
auto &x : GetGloSysSolnList())
1956 cout <<
"\t Variable: " << x.first << endl;
1958 for (
auto &y : x.second)
1960 cout <<
"\t\t " << y.first <<
" = " << y.second
1972 void SessionReader::ReadTimeIntScheme(TiXmlElement *conditions)
1979 TiXmlElement *timeInt = conditions->FirstChildElement(
1980 "TIMEINTEGRATIONSCHEME");
1987 TiXmlElement *method = timeInt->FirstChildElement(
"METHOD");
1988 TiXmlElement *variant = timeInt->FirstChildElement(
"VARIANT");
1989 TiXmlElement *order = timeInt->FirstChildElement(
"ORDER");
1990 TiXmlElement *params = timeInt->FirstChildElement(
"FREEPARAMETERS");
1993 ASSERTL0(method,
"Missing METHOD tag inside "
1994 "TIMEINTEGRATIONSCHEME.");
1995 ASSERTL0(order,
"Missing ORDER tag inside "
1996 "TIMEINTEGRATIONSCHEME.");
1998 m_timeIntScheme.method = method->GetText();
2000 std::string orderStr = order->GetText();
2003 ASSERTL0(m_timeIntScheme.method.size() > 0,
2004 "Empty text inside METHOD tag in TIMEINTEGRATIONSCHEME.");
2006 "Empty text inside ORDER tag in TIMEINTEGRATIONSCHEME.");
2009 m_timeIntScheme.order = boost::lexical_cast<unsigned int>(
2014 NEKERROR(ErrorUtil::efatal,
"In ORDER tag, unable to convert "
2015 "string '" + orderStr +
"' to an unsigned integer.");
2020 m_timeIntScheme.variant = variant->GetText();
2025 std::string paramsStr = params->GetText();
2027 "Empty text inside FREEPARAMETERS tag in "
2028 "TIMEINTEGRATIONSCHEME.");
2030 std::vector<std::string> pSplit;
2031 boost::split(pSplit, paramsStr, boost::is_any_of(
" "));
2033 m_timeIntScheme.freeParams.resize(pSplit.size());
2034 for (
size_t i = 0; i < pSplit.size(); ++i)
2038 m_timeIntScheme.freeParams[i] = boost::lexical_cast<
2043 NEKERROR(ErrorUtil::efatal,
"In FREEPARAMETERS tag, "
2044 "unable to convert string '" + pSplit[i] +
"' "
2045 "to a floating-point value.");
2050 if (m_verbose && m_comm)
2052 if (m_comm->GetRank() == 0)
2054 cout <<
"Trying to use time integration scheme:" << endl;
2055 cout <<
"\t Method : " << m_timeIntScheme.method << endl;
2056 cout <<
"\t Variant: " << m_timeIntScheme.variant << endl;
2057 cout <<
"\t Order : " << m_timeIntScheme.order << endl;
2059 if (m_timeIntScheme.freeParams.size() > 0)
2061 cout <<
"\t Params :";
2062 for (
auto &x : m_timeIntScheme.freeParams)
2075 void SessionReader::ReadExpressions(TiXmlElement *conditions)
2077 m_expressions.clear();
2084 TiXmlElement *expressionsElement =
2085 conditions->FirstChildElement(
"EXPRESSIONS");
2087 if (expressionsElement)
2089 TiXmlElement *expr = expressionsElement->FirstChildElement(
"E");
2093 stringstream tagcontent;
2094 tagcontent << *expr;
2096 "Missing NAME attribute in expression "
2097 "definition: \n\t'" + tagcontent.str() +
"'");
2098 std::string nameString = expr->Attribute(
"NAME");
2100 "Expressions must have a non-empty name: \n\t'"
2101 + tagcontent.str() +
"'");
2104 "Missing VALUE attribute in expression "
2105 "definition: \n\t'" + tagcontent.str() +
"'");
2106 std::string valString = expr->Attribute(
"VALUE");
2108 "Expressions must have a non-empty value: \n\t'"
2109 + tagcontent.str() +
"'");
2111 auto exprIter = m_expressions.find(nameString);
2112 ASSERTL0(exprIter == m_expressions.end(),
2113 std::string(
"Expression '") + nameString
2114 + std::string(
"' already specified."));
2116 m_expressions[nameString] = valString;
2117 expr = expr->NextSiblingElement(
"E");
2126 void SessionReader::ReadVariables(TiXmlElement *conditions)
2128 m_variables.clear();
2135 TiXmlElement *variablesElement =
2136 conditions->FirstChildElement(
"VARIABLES");
2140 if (variablesElement)
2142 TiXmlElement *varElement =
2143 variablesElement->FirstChildElement(
"V");
2146 int nextVariableNumber = -1;
2150 stringstream tagcontent;
2151 tagcontent << *varElement;
2155 nextVariableNumber++;
2158 int err = varElement->QueryIntAttribute(
"ID", &i);
2160 "Variables must have a unique ID number attribute "
2161 "in XML element: \n\t'" + tagcontent.str() +
"'");
2163 "ID numbers for variables must begin with zero and"
2164 " be sequential in XML element: \n\t'"
2165 + tagcontent.str() +
"'");
2167 TiXmlNode* varChild = varElement->FirstChild();
2172 while(varChild && varChild->Type() != TiXmlNode::TINYXML_TEXT)
2174 varChild = varChild->NextSibling();
2178 "Unable to read variable definition body for "
2180 + boost::lexical_cast<string>(i)
2181 +
" in XML element: \n\t'"
2182 + tagcontent.str() +
"'");
2183 std::string variableName = varChild->ToText()->ValueStr();
2185 std::istringstream variableStrm(variableName);
2186 variableStrm >> variableName;
2189 variableName) == m_variables.end(),
2191 + boost::lexical_cast<string>(i)
2192 +
" in XML element \n\t'" + tagcontent.str()
2193 +
"'\nhas already been defined.");
2195 m_variables.push_back(variableName);
2197 varElement = varElement->NextSiblingElement(
"V");
2201 "Number of variables must be greater than zero.");
2209 void SessionReader::ReadFunctions(TiXmlElement *conditions)
2211 m_functions.clear();
2219 TiXmlElement *
function = conditions->FirstChildElement(
"FUNCTION");
2222 stringstream tagcontent;
2223 tagcontent << *
function;
2226 ASSERTL0(function->Attribute(
"NAME"),
2227 "Functions must have a NAME attribute defined in XML "
2228 "element: \n\t'" + tagcontent.str() +
"'");
2229 std::string functionStr =
function->Attribute(
"NAME");
2231 "Functions must have a non-empty name in XML "
2232 "element: \n\t'" + tagcontent.str() +
"'");
2235 boost::to_upper(functionStr);
2238 TiXmlElement *variable =
function->FirstChildElement();
2247 std::string conditionType = variable->Value();
2250 std::string variableStr;
2251 if (!variable->Attribute(
"VAR"))
2257 variableStr = variable->Attribute(
"VAR");
2261 std::vector<std::string> variableList;
2262 ParseUtils::GenerateVector(variableStr, variableList);
2265 std::string domainStr;
2266 if (!variable->Attribute(
"DOMAIN"))
2272 domainStr = variable->Attribute(
"DOMAIN");
2276 std::string evarsStr =
"x y z t";
2277 if (variable->Attribute(
"EVARS"))
2279 evarsStr = evarsStr + std::string(
" ") + variable->Attribute(
"EVARS");
2283 std::vector<std::string> varSplit;
2284 std::vector<unsigned int> domainList;
2285 ParseUtils::GenerateSeqVector(domainStr, domainList);
2288 if (conditionType ==
"E")
2293 ASSERTL0(variable->Attribute(
"VALUE"),
2294 "Attribute VALUE expected for function '"
2295 + functionStr +
"'.");
2296 std::string fcnStr = variable->Attribute(
"VALUE");
2299 (std::string(
"Expression for var: ")
2301 + std::string(
" must be specified.")).c_str());
2303 SubstituteExpressions(fcnStr);
2311 else if (conditionType ==
"F")
2313 if (variable->Attribute(
"TIMEDEPENDENT") &&
2314 boost::lexical_cast<bool>(variable->Attribute(
"TIMEDEPENDENT")))
2324 ASSERTL0(variable->Attribute(
"FILE"),
2325 "Attribute FILE expected for function '"
2326 + functionStr +
"'.");
2327 std::string filenameStr = variable->Attribute(
"FILE");
2330 "A filename must be specified for the FILE "
2331 "attribute of function '" + functionStr
2334 std::vector<std::string> fSplit;
2335 boost::split(fSplit, filenameStr, boost::is_any_of(
":"));
2337 ASSERTL0(fSplit.size() == 1 || fSplit.size() == 2,
2338 "Incorrect filename specification in function "
2339 + functionStr +
"'. "
2340 "Specify variables inside file as: "
2341 "filename:var1,var2");
2346 if (fSplit.size() == 2)
2349 "Filename variable mapping not valid "
2350 "when using * as a variable inside "
2351 "function '" + functionStr +
"'.");
2354 varSplit, fSplit[1], boost::is_any_of(
","));
2355 ASSERTL0(varSplit.size() == variableList.size(),
2356 "Filename variables should contain the "
2357 "same number of variables defined in "
2358 "VAR in function " + functionStr +
"'.");
2365 stringstream tagcontent;
2366 tagcontent << *variable;
2369 "Identifier " + conditionType +
" in function "
2370 + std::string(function->Attribute(
"NAME"))
2371 +
" is not recognised in XML element: \n\t'"
2372 + tagcontent.str() +
"'");
2378 for (
unsigned int i = 0; i < variableList.size(); ++i)
2380 for(
unsigned int j = 0; j < domainList.size(); ++j)
2383 pair<std::string,int> key(variableList[i],domainList[j]);
2384 auto fcnsIter = functionVarMap.find(key);
2385 ASSERTL0(fcnsIter == functionVarMap.end(),
2386 "Error setting expression '" + variableList[i]
2388 + boost::lexical_cast<std::string>(domainList[j])
2389 +
"' in function '" + functionStr +
"'. "
2390 "Expression has already been defined.");
2392 if (varSplit.size() > 0)
2396 functionVarMap[key] = funcDef2;
2400 functionVarMap[key] = funcDef;
2405 variable = variable->NextSiblingElement();
2408 m_functions[functionStr] = functionVarMap;
2409 function =
function->NextSiblingElement(
"FUNCTION");
2417 void SessionReader::ReadFilters(TiXmlElement *filters)
2426 TiXmlElement *filter = filters->FirstChildElement(
"FILTER");
2429 ASSERTL0(filter->Attribute(
"TYPE"),
2430 "Missing attribute 'TYPE' for filter.");
2431 std::string typeStr = filter->Attribute(
"TYPE");
2433 std::map<std::string, std::string> vParams;
2435 TiXmlElement *param = filter->FirstChildElement(
"PARAM");
2439 "Missing attribute 'NAME' for parameter in filter "
2441 std::string nameStr = param->Attribute(
"NAME");
2443 ASSERTL0(param->GetText(),
"Empty value string for param.");
2444 std::string valueStr = param->GetText();
2446 vParams[nameStr] = valueStr;
2448 param = param->NextSiblingElement(
"PARAM");
2451 m_filters.push_back(
2452 std::pair<std::string, FilterParams>(typeStr, vParams));
2454 filter = filter->NextSiblingElement(
"FILTER");
2458 void SessionReader::ParseEquals(
2459 const std::string &line,
2464 size_t beg = line.find_first_not_of(
" ");
2465 size_t end = line.find_first_of(
"=");
2467 if (beg == end)
throw 1;
2469 if (end != line.find_last_of(
"="))
throw 1;
2471 if (end == std::string::npos)
throw 1;
2473 lhs = line.substr(line.find_first_not_of(
" "),
2475 lhs = lhs .substr(0, lhs.find_last_not_of(
" ")+1);
2476 rhs = line.substr(line.find_last_of(
"=")+1);
2477 rhs = rhs .substr(rhs.find_first_not_of(
" "));
2478 rhs = rhs .substr(0, rhs.find_last_not_of(
" ")+1);
2484 void SessionReader::CmdLineOverride()
2487 if (m_cmdLineOptions.count(
"solverinfo"))
2489 std::vector<std::string> solverInfoList =
2490 m_cmdLineOptions[
"solverinfo"].as<
2491 std::vector<std::string> >();
2493 for (
size_t i = 0; i < solverInfoList.size(); ++i)
2495 std::string lhs, rhs;
2499 ParseEquals(solverInfoList[i], lhs, rhs);
2504 "Parse error with command line "
2505 "option: "+solverInfoList[i]);
2508 std::string lhsUpper = boost::to_upper_copy(lhs);
2509 m_solverInfo[lhsUpper] = rhs;
2513 if (m_cmdLineOptions.count(
"parameter"))
2515 std::vector<std::string> parametersList =
2516 m_cmdLineOptions[
"parameter"].as<
2517 std::vector<std::string> >();
2519 for (
size_t i = 0; i < parametersList.size(); ++i)
2521 std::string lhs, rhs;
2525 ParseEquals(parametersList[i], lhs, rhs);
2530 "Parse error with command line "
2531 "option: "+parametersList[i]);
2534 std::string lhsUpper = boost::to_upper_copy(lhs);
2538 m_parameters[lhsUpper] =
2539 boost::lexical_cast<NekDouble>(rhs);
2544 "Unable to convert string: "+rhs+
2545 "to double value.");
2551 void SessionReader::VerifySolverInfo()
2553 for (
auto &x : m_solverInfo)
2555 std::string solverProperty = x.first;
2556 std::string solverValue = x.second;
2558 auto propIt = GetSolverInfoEnums().find(solverProperty);
2559 if (propIt != GetSolverInfoEnums().end())
2561 auto valIt = propIt->second.find(solverValue);
2562 ASSERTL0(valIt != propIt->second.end(),
2563 "Value '" + solverValue +
"' is not valid for "
2564 "property '" + solverProperty +
"'");
2570 void SessionReader::SetUpXmlDoc(
void)
2572 m_xmlDoc = MergeDoc(m_filenames);
2577 return m_interpreter;
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
NekDouble Evaluate() const
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static void Finalise(gs_data *pGsh)
Deallocates the GSLib mapping data.
std::shared_ptr< Interpreter > InterpreterSharedPtr
std::map< std::string, std::string > SolverInfoMap
std::map< std::string, GloSysInfoMap > GloSysSolnInfoList
std::string PortablePath(const boost::filesystem::path &path)
create portable path on different platforms for boost::filesystem path
std::map< std::string, NekDouble > ParameterMap
std::shared_ptr< Equation > EquationSharedPtr
std::vector< std::pair< std::string, FilterParams > > FilterMap
std::map< std::string, EnumMap > EnumMapList
CommFactory & GetCommFactory()
std::map< std::string, CmdLineArg > CmdLineArgMap
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
@ eFunctionTypeExpression
@ eFunctionTypeTransientFile
std::map< std::pair< std::string, int >, FunctionVariableDefinition > FunctionVariableMap
const std::string kGitBranch
const std::string kGitSha1
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
The above copyright notice and this permission notice shall be included.
EquationSharedPtr m_expression
std::string m_fileVariable