Nektar++
SessionReader.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File SessionReader.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description:
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIB_UTILITIES_SESSIONREADER_H
36 #define NEKTAR_LIB_UTILITIES_SESSIONREADER_H
37 
38 #include <map>
39 #include <string>
40 #include <memory>
41 
46 
47 #include <boost/algorithm/string/case_conv.hpp>
48 #include <boost/program_options/variables_map.hpp>
49 
50 class TiXmlElement;
51 class TiXmlDocument;
52 
53 namespace Nektar
54 {
55  namespace LibUtilities
56  {
57  typedef std::map<std::string, std::string> SolverInfoMap;
58  typedef std::map<std::string, NekDouble> ParameterMap;
59  typedef std::map<std::string, std::string> GeometricInfoMap;
60  typedef std::map<std::string, std::string> ExpressionMap;
61  typedef std::vector<std::string> VariableList;
62  typedef std::map<std::string, std::string> TagMap;
63  typedef std::map<std::string, std::string> FilterParams;
64  typedef std::vector<
65  std::pair<std::string, FilterParams> > FilterMap;
66 
67  struct CmdLineArg
68  {
69  std::string shortName;
70  std::string description;
71  bool isFlag;
72  };
73 
74  typedef std::map<std::string, CmdLineArg> CmdLineArgMap;
75 
76  typedef std::map<std::string, int> EnumMap;
77  typedef std::map<std::string, EnumMap> EnumMapList;
78 
79  typedef std::map<std::string, std::string> GloSysInfoMap;
80  typedef std::map<std::string, GloSysInfoMap> GloSysSolnInfoList;
81 
82  typedef std::map<std::string, std::string> GloSysInfoMap;
83  typedef std::map<std::string, GloSysInfoMap> GloSysSolnInfoList;
84 
86  {
91  };
92  const char* const FunctionTypeMap[] =
93  {
94  "No Function type",
95  "Expression",
96  "File"
97  };
98 
100  {
101  enum FunctionType m_type;
102  std::string m_filename;
104  std::string m_fileVariable;
105  };
106 
107  typedef std::map<std::pair<std::string,int>, FunctionVariableDefinition>
109  typedef std::map<std::string, FunctionVariableMap >
111 
113  typedef std::shared_ptr<SessionReader> SessionReaderSharedPtr;
114 
115  /// Reads and parses information from a Nektar++ XML session file.
117  {
118  public:
119  /// Support creation through MemoryManager.
121 
122  /**
123  * @brief Creates an instance of the SessionReader class.
124  *
125  * This function should be used by an application to instantiate the
126  * session reader. It should be called at the very beginning of the
127  * application before any other processing of command-line
128  * arguments. After instantiating the class and setting up any
129  * parallel communication, it also calls the main initialisation
130  * of the object.
131  */
132  LIB_UTILITIES_EXPORT static SessionReaderSharedPtr CreateInstance(
133  int argc, char *argv[])
134  {
135  SessionReaderSharedPtr p = MemoryManager<
136  LibUtilities::SessionReader>::AllocateSharedPtr(argc, argv);
137  return p;
138  }
139 
140  /**
141  * @brief Creates an instance of the SessionReader class initialised
142  * using a separate list of XML documents.
143  *
144  * This function should be used by an application to instantiate the
145  * session reader. It may be called after processing of command-line
146  * arguments. After instantiating the class and setting up any
147  * parallel communication, it also calls the main initialisation
148  * of the object.
149  */
150  LIB_UTILITIES_EXPORT static SessionReaderSharedPtr CreateInstance(
151  int argc,
152  char *argv[],
153  std::vector<std::string> &pFilenames,
154  const CommSharedPtr &pComm = CommSharedPtr())
155  {
156  SessionReaderSharedPtr p = MemoryManager<
158  ::AllocateSharedPtr(argc, argv, pFilenames, pComm);
159  return p;
160  }
161 
163  int argc,
164  char *argv[],
165  const std::vector<std::string> &pFilenames,
166  const CommSharedPtr &pComm);
167 
168  /// Destructor
169  LIB_UTILITIES_EXPORT ~SessionReader();
170 
171  LIB_UTILITIES_EXPORT void InitSession(
172  const std::vector<std::string> &filenames =
173  std::vector<std::string>());
174 
175  /// Provides direct access to the TiXmlDocument object.
176  LIB_UTILITIES_EXPORT TiXmlDocument &GetDocument();
177  /// Provides direct access to the TiXmlElement specified.
178  LIB_UTILITIES_EXPORT TiXmlElement *GetElement(
179  const std::string& pPath);
180  /// Tests if a specified element is defined in the XML document.
181  LIB_UTILITIES_EXPORT bool DefinesElement(
182  const std::string& pPath) const;
183  /// Returns the filename of the loaded XML document.
184  LIB_UTILITIES_EXPORT const std::vector<std::string>
185  &GetFilenames() const;
186  /// Returns the session name of the loaded XML document.
187  LIB_UTILITIES_EXPORT const std::string &GetSessionName() const;
188  /// Returns the session name with process rank
189  LIB_UTILITIES_EXPORT const std::string GetSessionNameRank() const;
190  /// Returns the communication object.
192  /// Returns if file system shared
193  LIB_UTILITIES_EXPORT bool GetSharedFilesystem();
194  /// Finalises the session.
196 
197  /* ------ PARAMETERS --------*/
198  /// Checks if a parameter is specified in the XML document.
199  LIB_UTILITIES_EXPORT bool DefinesParameter(
200  const std::string &name) const;
201  /// Returns the value of the specified parameter.
202  LIB_UTILITIES_EXPORT const NekDouble &GetParameter(
203  const std::string &pName) const;
204  /// Load an integer parameter
205  LIB_UTILITIES_EXPORT void LoadParameter(
206  const std::string &name,
207  int &var) const;
208  /// Check for and load an integer parameter.
209  LIB_UTILITIES_EXPORT void LoadParameter(
210  const std::string &name,
211  int &var,
212  const int &def) const;
213  /// Load a double precision parameter
214  LIB_UTILITIES_EXPORT void LoadParameter(
215  const std::string &name,
216  NekDouble &var) const;
217  /// Check for and load a double-precision parameter.
218  LIB_UTILITIES_EXPORT void LoadParameter(
219  const std::string &name,
220  NekDouble &var,
221  const NekDouble &def) const;
222  /// Set an integer parameter
223  LIB_UTILITIES_EXPORT void SetParameter(
224  const std::string &name,
225  int &var);
226  /// Set a double precision parameter
227  LIB_UTILITIES_EXPORT void SetParameter(
228  const std::string &name,
229  NekDouble &var);
230 
231 
232  /* ------ SOLVER INFO ------ */
233  /// Checks if a solver info property is specified.
234  LIB_UTILITIES_EXPORT bool DefinesSolverInfo(
235  const std::string &name) const;
236  /// Returns the value of the specified solver info property.
237  LIB_UTILITIES_EXPORT const std::string& GetSolverInfo(
238  const std::string &pProperty) const;
239  /// Sets the value of the specified solver info property.
240  LIB_UTILITIES_EXPORT void SetSolverInfo(
241  const std::string &pProperty, const std::string &pValue);
242  /// Returns the value of the specified solver info property as enum
243  template<typename T>
244  inline const T GetSolverInfoAsEnum(const std::string &pName) const;
245  /// Returns the value of the specified property and value as enum
246  template<typename T>
247  inline const T GetValueAsEnum(const std::string &pName,
248  const std::string &vValue) const;
249  /// Check for and load a solver info property.
250  LIB_UTILITIES_EXPORT void LoadSolverInfo(
251  const std::string &name,
252  std::string &var,
253  const std::string &def = "") const;
254  /// Check if the value of a solver info property matches.
255  LIB_UTILITIES_EXPORT void MatchSolverInfo(
256  const std::string &name,
257  const std::string &trueval,
258  bool &var,
259  const bool &def = false) const;
260  /// Check if the value of a solver info property matches.
261  LIB_UTILITIES_EXPORT bool MatchSolverInfo(
262  const std::string &name,
263  const std::string &trueval) const;
264  /// Check if the value of a solver info property matches.
265  template<typename T>
266  inline bool MatchSolverInfoAsEnum(
267  const std::string &name,
268  const T &trueval) const;
269  /// Registers an enumeration value.
270  LIB_UTILITIES_EXPORT inline static std::string RegisterEnumValue(
271  std::string pEnum,
272  std::string pString,
273  int pEnumValue);
274  /// Registers the default string value of a solver info property.
275  LIB_UTILITIES_EXPORT inline static std::string
276  RegisterDefaultSolverInfo(
277  const std::string &pName,
278  const std::string &pValue);
279 
280  /* ----GlobalSysSolnInfo ----- */
281 
282  LIB_UTILITIES_EXPORT bool DefinesGlobalSysSolnInfo(
283  const std::string &variable,
284  const std::string &property) const;
285 
286  LIB_UTILITIES_EXPORT const std::string& GetGlobalSysSolnInfo(
287  const std::string &variable,
288  const std::string &property) const;
289 
290 
291  /* ------ GEOMETRIC INFO ------ */
292  LIB_UTILITIES_EXPORT std::string GetGeometryType() const;
293  /// Checks if a geometric info property is defined.
294  LIB_UTILITIES_EXPORT bool DefinesGeometricInfo(
295  const std::string &name) const;
296  /// Checks for and load a geometric info string property.
297  LIB_UTILITIES_EXPORT void LoadGeometricInfo(
298  const std::string &name,
299  std::string &var,
300  const std::string &def = "") const;
301  /// Checks for and loads a geometric info boolean property.
302  LIB_UTILITIES_EXPORT void LoadGeometricInfo(
303  const std::string &name,
304  bool &var,
305  const bool &def = false) const;
306  /// Checks for and loads a geometric info double-precision property.
307  LIB_UTILITIES_EXPORT void LoadGeometricInfo(
308  const std::string &name,
309  NekDouble &var,
310  const NekDouble &def = 0.0) const;
311  /// Check if the value of a geometric info string property matches.
312  LIB_UTILITIES_EXPORT void MatchGeometricInfo(
313  const std::string &name,
314  const std::string &trueval,
315  bool &var,
316  const bool &def = false) const;
317 
318  /* ------ VARIABLES ------ */
319  /// Returns the name of the variable specified by the given index.
320  LIB_UTILITIES_EXPORT const std::string& GetVariable(
321  const unsigned int &idx) const;
322  LIB_UTILITIES_EXPORT void SetVariable(
323  const unsigned int &idx,
324  std::string newname);
325 
326  /// Returns the names of all variables.
327  LIB_UTILITIES_EXPORT std::vector<std::string> GetVariables() const;
328 
329  /* ------ FUNCTIONS ------*/
330  /// Checks if a specified function is defined in the XML document.
331  LIB_UTILITIES_EXPORT bool DefinesFunction(
332  const std::string &name) const;
333  /// Checks if a specified function has a given variable defined.
334  LIB_UTILITIES_EXPORT bool DefinesFunction(
335  const std::string &name,
336  const std::string &variable,
337  const int pDomain = 0) const;
338  /// Returns an EquationSharedPtr to a given function variable.
340  const std::string &name,
341  const std::string &variable,
342  const int pDomain = 0) const;
343  /// Returns an EquationSharedPtr to a given function variable index.
345  const std::string &name,
346  const unsigned int &var,
347  const int pDomain = 0) const;
348  /// Returns the type of a given function variable.
349  LIB_UTILITIES_EXPORT enum FunctionType GetFunctionType(
350  const std::string &name,
351  const std::string &variable,
352  const int pDomain = 0) const;
353  /// Returns the type of a given function variable index.
354  LIB_UTILITIES_EXPORT enum FunctionType GetFunctionType(
355  const std::string &pName,
356  const unsigned int &pVar,
357  const int pDomain = 0) const;
358  /// Returns the filename to be loaded for a given variable.
359  LIB_UTILITIES_EXPORT std::string GetFunctionFilename(
360  const std::string &name,
361  const std::string &variable,
362  const int pDomain = 0) const;
363  /// Returns the filename to be loaded for a given variable index.
364  LIB_UTILITIES_EXPORT std::string GetFunctionFilename(
365  const std::string &name,
366  const unsigned int &var,
367  const int pDomain = 0) const;
368  /// Returns the filename variable to be loaded for a given variable
369  /// index.
370  LIB_UTILITIES_EXPORT std::string GetFunctionFilenameVariable(
371  const std::string &name,
372  const std::string &variable,
373  const int pDomain = 0) const;
374 
375  /// Returns the instance of the Interpreter specific to this
376  /// session.
378 
379  /* ------ TAGS ------ */
380  /// Checks if a specified tag is defined.
381  LIB_UTILITIES_EXPORT bool DefinesTag(
382  const std::string& pName) const;
383  /// Sets a specified tag.
384  LIB_UTILITIES_EXPORT void SetTag(
385  const std::string& pName,
386  const std::string& pValue);
387  /// Returns the value of a specified tag.
388  LIB_UTILITIES_EXPORT const std::string &GetTag(
389  const std::string& pName) const;
390 
391  /* ------ FILTERS ------ */
392  LIB_UTILITIES_EXPORT const FilterMap& GetFilters() const;
393 
394  /* ------ CMDLINE ARGUMENTS ------- */
395  /// Checks if a specified cmdline argument has been given.
396  LIB_UTILITIES_EXPORT bool DefinesCmdLineArgument(
397  const std::string& pName) const;
398  /// Retrieves a command-line argument value.
399  template <typename T>
401  const std::string& pName) const
402  {
403  return m_cmdLineOptions.find(pName)->second.as<T>();
404  }
405  /// Registers a command-line argument with the session reader.
406  LIB_UTILITIES_EXPORT inline static std::string
407  RegisterCmdLineArgument(
408  const std::string &pName,
409  const std::string &pShortName,
410  const std::string &pDescription);
411  /// Registers a command-line flag with the session reader.
412  LIB_UTILITIES_EXPORT inline static std::string
413  RegisterCmdLineFlag(
414  const std::string &pName,
415  const std::string &pShortName,
416  const std::string &pDescription);
417 
418  /// Substitutes expressions defined in the XML document.
419  LIB_UTILITIES_EXPORT void SubstituteExpressions(std::string &expr);
420 
421  LIB_UTILITIES_EXPORT void SetUpXmlDoc();
422 
423  private:
424  boost::program_options::variables_map m_cmdLineOptions;
425 
426  /// Communication object.
428  /// Filenames
429  std::vector<std::string> m_filenames;
430  /// Session name of the loaded XML document (filename minus ext).
431  std::string m_sessionName;
432  /// Pointer to the loaded XML document.
433  TiXmlDocument* m_xmlDoc;
434  /// Parameters.
435  ParameterMap m_parameters;
436  /// Solver information properties.
437  SolverInfoMap m_solverInfo;
438  /// Geometric information properties.
439  GeometricInfoMap m_geometricInfo;
440  /// Expressions.
441  ExpressionMap m_expressions;
442  /// Interpreter instance.
444  /// Functions.
446  /// Variables.
447  VariableList m_variables;
448  /// Custom tags.
449  TagMap m_tags;
450  /// Filters map.
451  FilterMap m_filters;
452  /// Be verbose
453  bool m_verbose;
454  /// Running on a shared filesystem
456  /// String to enumeration map for Solver Info parameters.
457  LIB_UTILITIES_EXPORT static EnumMapList& GetSolverInfoEnums();
458  /// Default solver info options.
459  LIB_UTILITIES_EXPORT static SolverInfoMap& GetSolverInfoDefaults();
460  /// GlobalSysSoln Info map.
461  LIB_UTILITIES_EXPORT static GloSysSolnInfoList& GetGloSysSolnList();
462  /// CmdLine argument map.
463  LIB_UTILITIES_EXPORT static CmdLineArgMap& GetCmdLineArgMap();
464 
465  /// Main constructor
466  LIB_UTILITIES_EXPORT SessionReader(
467  int argc,
468  char *argv[]);
469 
470  LIB_UTILITIES_EXPORT void TestSharedFilesystem();
471 
472  /// Parse the program arguments and fill #m_cmdLineOptions
473  std::vector<std::string> ParseCommandLineArguments(
474  int argc, char *argv[]);
475 
476  /// Parse the session name.
477  std::string ParseSessionName(std::vector<std::string> &filenames);
478 
479  /// Loads an xml file into a tinyxml doc and decompresses if needed
480  LIB_UTILITIES_EXPORT void LoadDoc(
481  const std::string &pFilename,
482  TiXmlDocument* pDoc) const;
483  /// Creates an XML document from a list of input files.
484  LIB_UTILITIES_EXPORT TiXmlDocument *MergeDoc(
485  const std::vector<std::string> &pFilenames) const;
486  /// Loads and parses the specified file.
487  LIB_UTILITIES_EXPORT void ParseDocument();
488  /// Loads the given XML document and instantiates an appropriate
489  /// communication object.
490  LIB_UTILITIES_EXPORT void CreateComm(
491  int &argc,
492  char* argv[]);
493 
494  /// Partitions the comm object based on session parameters.
495  LIB_UTILITIES_EXPORT void PartitionComm();
496 
497  /// Reads the PARAMETERS section of the XML document.
498  LIB_UTILITIES_EXPORT void ReadParameters(TiXmlElement *conditions);
499  /// Reads the SOLVERINFO section of the XML document.
500  LIB_UTILITIES_EXPORT void ReadSolverInfo(TiXmlElement *conditions);
501  /// Reads the GLOBALSYSSOLNINFO section of the XML document.
502  LIB_UTILITIES_EXPORT void ReadGlobalSysSolnInfo(
503  TiXmlElement *conditions);
504  /// Reads the EXPRESSIONS section of the XML document.
505  LIB_UTILITIES_EXPORT void ReadExpressions(TiXmlElement *conditions);
506  /// Reads the VARIABLES section of the XML document.
507  LIB_UTILITIES_EXPORT void ReadVariables(TiXmlElement *conditions);
508  /// Reads the FUNCTIONS section of the XML document.
509  LIB_UTILITIES_EXPORT void ReadFunctions(TiXmlElement *conditions);
510  /// Reads the FILTERS section of the XML document.
511  LIB_UTILITIES_EXPORT void ReadFilters(TiXmlElement *filters);
512  /// Enforce parameters from command line arguments.
513  LIB_UTILITIES_EXPORT void CmdLineOverride();
514  /// Check values of solver info options are valid.
515  LIB_UTILITIES_EXPORT void VerifySolverInfo();
516 
517  /// Parse a string in the form lhs = rhs.
518  LIB_UTILITIES_EXPORT void ParseEquals(
519  const std::string &line,
520  std::string &lhs,
521  std::string &rhs);
522  };
523 
524 
525  /**
526  *
527  */
528  template<typename T>
530  const std::string &name, const T &trueval) const
531  {
532  return (GetSolverInfoAsEnum<T>(name) == trueval);
533  }
534 
535 
536  /**
537  *
538  */
539  template<typename T>
541  const std::string &pName) const
542  {
543  std::string vName = boost::to_upper_copy(pName);
544  ASSERTL0(DefinesSolverInfo(vName),
545  "Solver info '" + pName + "' not defined.");
546 
547  std::string vValue = GetSolverInfo(vName);
548  auto x = GetSolverInfoEnums().find(vName);
549  ASSERTL0(x != GetSolverInfoEnums().end(),
550  "Enum for SolverInfo property '" + pName + "' not found.");
551 
552  auto y = x->second.find(vValue);
553  ASSERTL0(y != x->second.end(),
554  "Value of SolverInfo property '" + pName +
555  "' is invalid.");
556 
557  return T(y->second);
558  }
559 
560 
561 
562  /**
563  *
564  */
565  template<typename T>
567  const std::string &pName,
568  const std::string &pValue) const
569  {
570  std::string vName = boost::to_upper_copy(pName);
571 
572  auto x = GetSolverInfoEnums().find(vName);
573  ASSERTL0(x != GetSolverInfoEnums().end(),
574  "Enum for property '" + pName + "' not found.");
575 
576  auto y = x->second.find(pValue);
577  ASSERTL0(y != x->second.end(),
578  "Value of property '" + pValue + "' is invalid.");
579  return T(y->second);
580  }
581 
582 
583 
584  /**
585  * A set of valid values for a given solver info property may be
586  * registered using this function. It must be called statically during
587  * the initialisation of a static variable. For example:
588  *
589  * @code
590  * std::string GlobalLinSys::lookupIds[2] = {
591  * LibUtilities::SessionReader::RegisterEnumValue(
592  * "GlobalSysSoln",
593  * "DirectFull",
594  * MultiRegions::eDirectFullMatrix),
595  * LibUtilities::SessionReader::RegisterEnumValue(
596  * "GlobalSysSoln",
597  * "DirectStaticCond",
598  * MultiRegions::eDirectStaticCond)
599  * }
600  * @endcode
601  *
602  * @param pEnum The name of the property.
603  * @param pString A valid value for the property.
604  * @param pEnumValue An enumeration value corresponding to this
605  * value.
606  *
607  * @return The value for the property provided by #pString.
608  */
610  std::string pEnum, std::string pString, int pEnumValue)
611  {
612  std::string vEnum = boost::to_upper_copy(pEnum);
613  auto x = GetSolverInfoEnums().find(vEnum);
614 
615  if (x == GetSolverInfoEnums().end())
616  {
617  GetSolverInfoEnums()[vEnum] = EnumMap();
618  x = GetSolverInfoEnums().find(vEnum);
619  }
620 
621  x->second[pString] = pEnumValue;
622  return pString;
623  }
624 
625 
626  /**
627  * A default value for a given solver info property may be registered
628  * using this function. The property will take this value until it is
629  * overwritten by a value specified in the XML document, or specified
630  * as a command-line argument. Usage has the form:
631  *
632  * @code
633  * std::string GlobalLinSys::def
634  * = LibUtilities::SessionReader::RegisterDefaultSolverInfo(
635  * "GlobalSysSoln","DirectMultiLevelStaticCond");
636  * @endcode
637  *
638  * @param pName The name of the property.
639  * @param pValue The default value of the property.
640  *
641  * @return The default value of the property provided by #pValue.
642  */
644  const std::string &pName,
645  const std::string &pValue)
646  {
647  std::string vName = boost::to_upper_copy(pName);
648  GetSolverInfoDefaults()[vName] = pValue;
649  return pValue;
650  }
651 
652 
653  /**
654  *
655  */
657  const std::string &pName,
658  const std::string &pShortName,
659  const std::string &pDescription)
660  {
661  ASSERTL0(!pName.empty(), "Empty name for cmdline argument.");
662  CmdLineArg x;
663  x.shortName = pShortName;
664  x.description = pDescription;
665  x.isFlag = false;
666  GetCmdLineArgMap()[pName] = x;
667  return pName;
668  }
669 
670 
671  /**
672  *
673  */
675  const std::string &pName,
676  const std::string &pShortName,
677  const std::string &pDescription)
678  {
679  ASSERTL0(!pName.empty(), "Empty name for cmdline argument.");
680  CmdLineArg x;
681  x.shortName = pShortName;
682  x.description = pDescription;
683  x.isFlag = true;
684  GetCmdLineArgMap()[pName] = x;
685  return pName;
686  }
687  }
688 }
689 
690 #endif
691 
ParameterMap m_parameters
Parameters.
std::map< std::string, std::string > SolverInfoMap
Definition: SessionReader.h:57
static std::string RegisterCmdLineFlag(const std::string &pName, const std::string &pShortName, const std::string &pDescription)
Registers a command-line flag with the session reader.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::map< std::string, int > EnumMap
Definition: SessionReader.h:76
const T GetValueAsEnum(const std::string &pName, const std::string &vValue) const
Returns the value of the specified property and value as enum.
static std::string RegisterEnumValue(std::string pEnum, std::string pString, int pEnumValue)
Registers an enumeration value.
std::map< std::string, FunctionVariableMap > FunctionMap
static void Finalise(gs_data *pGsh)
Deallocates the GSLib mapping data.
Definition: GsLib.hpp:226
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
InterpreterSharedPtr m_interpreter
Interpreter instance.
std::map< std::pair< std::string, int >, FunctionVariableDefinition > FunctionVariableMap
SolverInfoMap m_solverInfo
Solver information properties.
static std::string RegisterCmdLineArgument(const std::string &pName, const std::string &pShortName, const std::string &pDescription)
Registers a command-line argument with the session reader.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
ExpressionMap m_expressions
Expressions.
std::map< std::string, std::string > TagMap
Definition: SessionReader.h:62
std::map< std::string, std::string > GloSysInfoMap
Definition: SessionReader.h:79
CommSharedPtr m_comm
Communication object.
StandardMatrixTag & lhs
const char *const FunctionTypeMap[]
Definition: SessionReader.h:92
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
std::map< std::string, std::string > GeometricInfoMap
Definition: SessionReader.h:59
std::map< std::string, std::string > FilterParams
Definition: SessionReader.h:63
std::vector< std::string > m_filenames
Filenames.
VariableList m_variables
Variables.
bool MatchSolverInfoAsEnum(const std::string &name, const T &trueval) const
Check if the value of a solver info property matches.
const T GetSolverInfoAsEnum(const std::string &pName) const
Returns the value of the specified solver info property as enum.
std::map< std::string, GloSysInfoMap > GloSysSolnInfoList
Definition: SessionReader.h:80
std::vector< std::string > VariableList
Definition: SessionReader.h:61
#define LIB_UTILITIES_EXPORT
std::vector< std::pair< std::string, FilterParams > > FilterMap
Definition: SessionReader.h:65
std::shared_ptr< Interpreter > InterpreterSharedPtr
Definition: Interpreter.h:325
FunctionMap m_functions
Functions.
boost::program_options::variables_map m_cmdLineOptions
double NekDouble
std::map< std::string, std::string > ExpressionMap
Definition: SessionReader.h:60
FilterMap m_filters
Filters map.
std::shared_ptr< Equation > EquationSharedPtr
Definition: Equation.h:131
GeometricInfoMap m_geometricInfo
Geometric information properties.
std::map< std::string, NekDouble > ParameterMap
Definition: SessionReader.h:58
Reads and parses information from a Nektar++ XML session file.
std::map< std::string, EnumMap > EnumMapList
Definition: SessionReader.h:77
T GetCmdLineArgument(const std::string &pName) const
Retrieves a command-line argument value.
std::map< std::string, CmdLineArg > CmdLineArgMap
Definition: SessionReader.h:74
TiXmlDocument * m_xmlDoc
Pointer to the loaded XML document.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
static std::string RegisterDefaultSolverInfo(const std::string &pName, const std::string &pValue)
Registers the default string value of a solver info property.
bool m_sharedFilesystem
Running on a shared filesystem.
std::string m_sessionName
Session name of the loaded XML document (filename minus ext).
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[], std::vector< std::string > &pFilenames, const CommSharedPtr &pComm=CommSharedPtr())
Creates an instance of the SessionReader class initialised using a separate list of XML documents...
std::shared_ptr< SessionReader > SessionReaderSharedPtr