Nektar++
|
Reads and parses information from a Nektar++ XML session file. More...
#include <SessionReader.h>
Public Member Functions | |
SessionReader (int argc, char *argv[], const std::vector< std::string > &pFilenames, const CommSharedPtr &pComm) | |
~SessionReader () | |
Destructor. More... | |
void | InitSession (const std::vector< std::string > &filenames=std::vector< std::string >()) |
TiXmlDocument & | GetDocument () |
Provides direct access to the TiXmlDocument object. More... | |
TiXmlElement * | GetElement (const std::string &pPath) |
Provides direct access to the TiXmlElement specified. More... | |
bool | DefinesElement (const std::string &pPath) const |
Tests if a specified element is defined in the XML document. More... | |
const std::vector< std::string > & | GetFilenames () const |
Returns the filename of the loaded XML document. More... | |
const std::string & | GetSessionName () const |
Returns the session name of the loaded XML document. More... | |
const std::string | GetSessionNameRank () const |
Returns the session name with process rank. More... | |
CommSharedPtr | GetComm () |
Returns the communication object. More... | |
bool | GetSharedFilesystem () |
Returns if file system shared. More... | |
void | Finalise () |
Finalises the session. More... | |
bool | DefinesParameter (const std::string &name) const |
Checks if a parameter is specified in the XML document. More... | |
const NekDouble & | GetParameter (const std::string &pName) const |
Returns the value of the specified parameter. More... | |
void | LoadParameter (const std::string &name, int &var) const |
Load an integer parameter. More... | |
void | LoadParameter (const std::string &name, int &var, const int &def) const |
Check for and load an integer parameter. More... | |
void | LoadParameter (const std::string &name, NekDouble &var) const |
Load a double precision parameter. More... | |
void | LoadParameter (const std::string &name, NekDouble &var, const NekDouble &def) const |
Check for and load a double-precision parameter. More... | |
void | SetParameter (const std::string &name, int &var) |
Set an integer parameter. More... | |
void | SetParameter (const std::string &name, NekDouble &var) |
Set a double precision parameter. More... | |
bool | DefinesSolverInfo (const std::string &name) const |
Checks if a solver info property is specified. More... | |
const std::string & | GetSolverInfo (const std::string &pProperty) const |
Returns the value of the specified solver info property. More... | |
void | SetSolverInfo (const std::string &pProperty, const std::string &pValue) |
Sets the value of the specified solver info property. More... | |
template<typename T > | |
const T | GetSolverInfoAsEnum (const std::string &pName) const |
Returns the value of the specified solver info property as enum. More... | |
template<typename T > | |
const T | GetValueAsEnum (const std::string &pName, const std::string &vValue) const |
Returns the value of the specified property and value as enum. More... | |
void | LoadSolverInfo (const std::string &name, std::string &var, const std::string &def="") const |
Check for and load a solver info property. More... | |
void | MatchSolverInfo (const std::string &name, const std::string &trueval, bool &var, const bool &def=false) const |
Check if the value of a solver info property matches. More... | |
bool | MatchSolverInfo (const std::string &name, const std::string &trueval) const |
Check if the value of a solver info property matches. More... | |
template<typename T > | |
bool | MatchSolverInfoAsEnum (const std::string &name, const T &trueval) const |
Check if the value of a solver info property matches. More... | |
bool | DefinesGlobalSysSolnInfo (const std::string &variable, const std::string &property) const |
const std::string & | GetGlobalSysSolnInfo (const std::string &variable, const std::string &property) const |
bool | DefinesTimeIntScheme () const |
Returns true if the TIMEINTEGRATIONSCHEME section is defined in the session file. More... | |
const TimeIntScheme & | GetTimeIntScheme () const |
Returns the time integration scheme structure m_timeIntScheme from the session file. More... | |
std::string | GetGeometryType () const |
bool | DefinesGeometricInfo (const std::string &name) const |
Checks if a geometric info property is defined. More... | |
void | LoadGeometricInfo (const std::string &name, std::string &var, const std::string &def="") const |
Checks for and load a geometric info string property. More... | |
void | LoadGeometricInfo (const std::string &name, bool &var, const bool &def=false) const |
Checks for and loads a geometric info boolean property. More... | |
void | LoadGeometricInfo (const std::string &name, NekDouble &var, const NekDouble &def=0.0) const |
Checks for and loads a geometric info double-precision property. More... | |
void | MatchGeometricInfo (const std::string &name, const std::string &trueval, bool &var, const bool &def=false) const |
Check if the value of a geometric info string property matches. More... | |
const std::string & | GetVariable (const unsigned int &idx) const |
Returns the name of the variable specified by the given index. More... | |
void | SetVariable (const unsigned int &idx, std::string newname) |
std::vector< std::string > | GetVariables () const |
Returns the names of all variables. More... | |
bool | DefinesFunction (const std::string &name) const |
Checks if a specified function is defined in the XML document. More... | |
bool | DefinesFunction (const std::string &name, const std::string &variable, const int pDomain=0) const |
Checks if a specified function has a given variable defined. More... | |
EquationSharedPtr | GetFunction (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns an EquationSharedPtr to a given function variable. More... | |
EquationSharedPtr | GetFunction (const std::string &name, const unsigned int &var, const int pDomain=0) const |
Returns an EquationSharedPtr to a given function variable index. More... | |
enum FunctionType | GetFunctionType (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns the type of a given function variable. More... | |
enum FunctionType | GetFunctionType (const std::string &pName, const unsigned int &pVar, const int pDomain=0) const |
Returns the type of a given function variable index. More... | |
std::string | GetFunctionFilename (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns the filename to be loaded for a given variable. More... | |
std::string | GetFunctionFilename (const std::string &name, const unsigned int &var, const int pDomain=0) const |
Returns the filename to be loaded for a given variable index. More... | |
std::string | GetFunctionFilenameVariable (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns the filename variable to be loaded for a given variable index. More... | |
InterpreterSharedPtr | GetInterpreter () |
Returns the instance of the Interpreter specific to this session. More... | |
bool | DefinesTag (const std::string &pName) const |
Checks if a specified tag is defined. More... | |
void | SetTag (const std::string &pName, const std::string &pValue) |
Sets a specified tag. More... | |
const std::string & | GetTag (const std::string &pName) const |
Returns the value of a specified tag. More... | |
const FilterMap & | GetFilters () const |
bool | DefinesCmdLineArgument (const std::string &pName) const |
Checks if a specified cmdline argument has been given. More... | |
template<typename T > | |
T | GetCmdLineArgument (const std::string &pName) const |
Retrieves a command-line argument value. More... | |
void | SubstituteExpressions (std::string &expr) |
Substitutes expressions defined in the XML document. More... | |
void | SetUpXmlDoc () |
Static Public Member Functions | |
static SessionReaderSharedPtr | CreateInstance (int argc, char *argv[]) |
Creates an instance of the SessionReader class. More... | |
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. More... | |
static std::string | RegisterEnumValue (std::string pEnum, std::string pString, int pEnumValue) |
Registers an enumeration value. More... | |
static std::string | RegisterDefaultSolverInfo (const std::string &pName, const std::string &pValue) |
Registers the default string value of a solver info property. More... | |
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. More... | |
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. More... | |
Private Member Functions | |
SessionReader (int argc, char *argv[]) | |
Main constructor. More... | |
void | TestSharedFilesystem () |
std::vector< std::string > | ParseCommandLineArguments (int argc, char *argv[]) |
Parse the program arguments and fill m_cmdLineOptions. More... | |
std::string | ParseSessionName (std::vector< std::string > &filenames) |
Parse the session name. More... | |
void | LoadDoc (const std::string &pFilename, TiXmlDocument *pDoc) const |
Loads an xml file into a tinyxml doc and decompresses if needed. More... | |
TiXmlDocument * | MergeDoc (const std::vector< std::string > &pFilenames) const |
Creates an XML document from a list of input files. More... | |
void | ParseDocument () |
Loads and parses the specified file. More... | |
void | CreateComm (int &argc, char *argv[]) |
Loads the given XML document and instantiates an appropriate communication object. More... | |
void | PartitionComm () |
Partitions the comm object based on session parameters. More... | |
void | ReadParameters (TiXmlElement *conditions) |
Reads the PARAMETERS section of the XML document. More... | |
void | ReadSolverInfo (TiXmlElement *conditions) |
Reads the SOLVERINFO section of the XML document. More... | |
void | ReadGlobalSysSolnInfo (TiXmlElement *conditions) |
Reads the GLOBALSYSSOLNINFO section of the XML document. More... | |
void | ReadTimeIntScheme (TiXmlElement *conditions) |
Reads the TIMEINTEGRATIONSCHEME section of the XML document. More... | |
void | ReadExpressions (TiXmlElement *conditions) |
Reads the EXPRESSIONS section of the XML document. More... | |
void | ReadVariables (TiXmlElement *conditions) |
Reads the VARIABLES section of the XML document. More... | |
void | ReadFunctions (TiXmlElement *conditions) |
Reads the FUNCTIONS section of the XML document. More... | |
void | ReadFilters (TiXmlElement *filters) |
Reads the FILTERS section of the XML document. More... | |
void | CmdLineOverride () |
Enforce parameters from command line arguments. More... | |
void | VerifySolverInfo () |
Check values of solver info options are valid. More... | |
void | ParseEquals (const std::string &line, std::string &lhs, std::string &rhs) |
Parse a string in the form lhs = rhs. More... | |
Static Private Member Functions | |
static EnumMapList & | GetSolverInfoEnums () |
String to enumeration map for Solver Info parameters. More... | |
static SolverInfoMap & | GetSolverInfoDefaults () |
Default solver info options. More... | |
static GloSysSolnInfoList & | GetGloSysSolnList () |
GlobalSysSoln Info map. More... | |
static CmdLineArgMap & | GetCmdLineArgMap () |
CmdLine argument map. More... | |
Private Attributes | |
boost::program_options::variables_map | m_cmdLineOptions |
CommSharedPtr | m_comm |
Communication object. More... | |
std::vector< std::string > | m_filenames |
Filenames. More... | |
std::string | m_sessionName |
Session name of the loaded XML document (filename minus ext). More... | |
TiXmlDocument * | m_xmlDoc |
Pointer to the loaded XML document. More... | |
ParameterMap | m_parameters |
Parameters. More... | |
SolverInfoMap | m_solverInfo |
Solver information properties. More... | |
GeometricInfoMap | m_geometricInfo |
Geometric information properties. More... | |
ExpressionMap | m_expressions |
Expressions. More... | |
InterpreterSharedPtr | m_interpreter |
Interpreter instance. More... | |
FunctionMap | m_functions |
Functions. More... | |
VariableList | m_variables |
Variables. More... | |
TagMap | m_tags |
Custom tags. More... | |
FilterMap | m_filters |
Filters map. More... | |
TimeIntScheme | m_timeIntScheme |
Time integration scheme information. More... | |
bool | m_verbose |
Be verbose. More... | |
bool | m_sharedFilesystem |
Running on a shared filesystem. More... | |
Friends | |
class | MemoryManager< SessionReader > |
Support creation through MemoryManager. More... | |
Reads and parses information from a Nektar++ XML session file.
This class provides an interface to Nektar++-specific content in a supplied XML document. It also initialises a Nektar++ session including setting up communication for parallel execution and where necessary partitioning the supplied mesh for running across multiple processes.
A session should be initialised at the beginning of a user's application by passing the command-line arguments. This not only allows the SessionReader to extract the name of the XML document to load containing Nektar++ session information, but also supplies the MPI arguments necessary for setting up parallel communication. The SessionReader should be initialised using the CreateInstance function:
The instance vSession
can now be passed to other key Nektar++ components during their construction.
The SessionReader class provides streamlined, validated access to session parameters, solver information and functions defined within a Nektar++ XML document. The available routines and their usage is documented below.
In the case of solver information properties, the classes to which these parameters are pertinent may register with the SessionReader class the set of valid values for a given property. Such values may also be associated with an enumeration value for more transparent use of the property values in code.
Definition at line 124 of file SessionReader.h.
Nektar::LibUtilities::SessionReader::SessionReader | ( | int | argc, |
char * | argv[], | ||
const std::vector< std::string > & | pFilenames, | ||
const CommSharedPtr & | pComm | ||
) |
Definition at line 222 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
Nektar::LibUtilities::SessionReader::~SessionReader | ( | ) |
Destructor.
Definition at line 268 of file BasicUtils/SessionReader.cpp.
|
private |
Main constructor.
This constructor parses the command-line arguments given to the user application to set up any MPI communication, read supplied XML session files, and partition meshes where necessary.
argc | Number of command-line arguments |
argv | Array of command-line arguments |
Definition at line 188 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Enforce parameters from command line arguments.
Definition at line 2484 of file BasicUtils/SessionReader.cpp.
References NEKERROR.
|
private |
Loads the given XML document and instantiates an appropriate communication object.
Definition at line 1607 of file BasicUtils/SessionReader.cpp.
References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), and Nektar::LibUtilities::GetCommFactory().
|
inlinestatic |
Creates an instance of the SessionReader class.
This function should be used by an application to instantiate the session reader. It should be called at the very beginning of the application before any other processing of command-line arguments. After instantiating the class and setting up any parallel communication, it also calls the main initialisation of the object.
Definition at line 140 of file SessionReader.h.
References CellMLToNektar.cellml_metadata::p.
Referenced by main(), Nektar::FieldUtils::InputXml::Process(), Nektar::FieldUtils::ProcessDisplacement::Process(), Nektar::FieldUtils::ProcessHomogeneousPlane::Process(), Nektar::FieldUtils::ProcessInterpField::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), SessionReader_CreateInstance(), Nektar::SolverUtils::Driver::v_InitObject(), and Nektar::VortexWaveInteraction::VortexWaveInteraction().
|
inlinestatic |
Creates an instance of the SessionReader class initialised using a separate list of XML documents.
This function should be used by an application to instantiate the session reader. It may be called after processing of command-line arguments. After instantiating the class and setting up any parallel communication, it also calls the main initialisation of the object.
Definition at line 158 of file SessionReader.h.
References CellMLToNektar.cellml_metadata::p.
bool Nektar::LibUtilities::SessionReader::DefinesCmdLineArgument | ( | const std::string & | pName | ) | const |
Checks if a specified cmdline argument has been given.
Definition at line 1440 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesElement | ( | const std::string & | pPath | ) | const |
Tests if a specified element is defined in the XML document.
Definition at line 620 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
bool Nektar::LibUtilities::SessionReader::DefinesFunction | ( | const std::string & | name | ) | const |
Checks if a specified function is defined in the XML document.
Definition at line 1156 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesFunction | ( | const std::string & | name, |
const std::string & | variable, | ||
const int | pDomain = 0 |
||
) | const |
Checks if a specified function has a given variable defined.
Definition at line 1166 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesGeometricInfo | ( | const std::string & | name | ) | const |
Checks if a geometric info property is defined.
Definition at line 1022 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesGlobalSysSolnInfo | ( | const std::string & | variable, |
const std::string & | property | ||
) | const |
Definition at line 930 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesParameter | ( | const std::string & | name | ) | const |
Checks if a parameter is specified in the XML document.
Definition at line 702 of file BasicUtils/SessionReader.cpp.
Referenced by export_SessionReader().
bool Nektar::LibUtilities::SessionReader::DefinesSolverInfo | ( | const std::string & | name | ) | const |
Checks if a solver info property is specified.
Definition at line 826 of file BasicUtils/SessionReader.cpp.
Referenced by GetSolverInfoAsEnum().
bool Nektar::LibUtilities::SessionReader::DefinesTag | ( | const std::string & | pName | ) | const |
bool Nektar::LibUtilities::SessionReader::DefinesTimeIntScheme | ( | ) | const |
Returns true if the TIMEINTEGRATIONSCHEME section is defined in the session file.
Definition at line 973 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::Finalise | ( | ) |
Finalises the session.
This routine finalises any parallel communication.
Definition at line 693 of file BasicUtils/SessionReader.cpp.
Referenced by export_SessionReader().
|
staticprivate |
CmdLine argument map.
Lists the possible command-line argument which can be specified for this executable.
This list is populated through the RegisterCmdLineArgument static member function which is called statically from various classes to register command-line arguments they need.
Definition at line 173 of file BasicUtils/SessionReader.cpp.
Referenced by RegisterCmdLineArgument(), and RegisterCmdLineFlag().
|
inline |
Retrieves a command-line argument value.
Definition at line 411 of file SessionReader.h.
References m_cmdLineOptions.
CommSharedPtr Nektar::LibUtilities::SessionReader::GetComm | ( | ) |
Returns the communication object.
Definition at line 677 of file BasicUtils/SessionReader.cpp.
Referenced by export_SessionReader().
TiXmlDocument & Nektar::LibUtilities::SessionReader::GetDocument | ( | ) |
Provides direct access to the TiXmlDocument object.
Definition at line 568 of file BasicUtils/SessionReader.cpp.
References ASSERTL1.
TiXmlElement * Nektar::LibUtilities::SessionReader::GetElement | ( | const std::string & | pPath | ) |
Provides direct access to the TiXmlElement specified.
The single parameter specifies a path to the requested element in a similar format to the filesystem path. Given the following XML:
the PARAMETERS element would be retrieved by requesting the path:
pPath | Path to requested element. |
Definition at line 597 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
const std::vector< std::string > & Nektar::LibUtilities::SessionReader::GetFilenames | ( | ) | const |
Returns the filename of the loaded XML document.
Definition at line 642 of file BasicUtils/SessionReader.cpp.
const FilterMap & Nektar::LibUtilities::SessionReader::GetFilters | ( | ) | const |
Definition at line 1431 of file BasicUtils/SessionReader.cpp.
EquationSharedPtr Nektar::LibUtilities::SessionReader::GetFunction | ( | const std::string & | name, |
const std::string & | variable, | ||
const int | pDomain = 0 |
||
) | const |
Returns an EquationSharedPtr to a given function variable.
Definition at line 1191 of file BasicUtils/SessionReader.cpp.
References ASSERTL0, and Nektar::LibUtilities::eFunctionTypeExpression.
EquationSharedPtr Nektar::LibUtilities::SessionReader::GetFunction | ( | const std::string & | name, |
const unsigned int & | var, | ||
const int | pDomain = 0 |
||
) | const |
Returns an EquationSharedPtr to a given function variable index.
Definition at line 1234 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
std::string Nektar::LibUtilities::SessionReader::GetFunctionFilename | ( | const std::string & | name, |
const std::string & | variable, | ||
const int | pDomain = 0 |
||
) | const |
Returns the filename to be loaded for a given variable.
Definition at line 1301 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
std::string Nektar::LibUtilities::SessionReader::GetFunctionFilename | ( | const std::string & | name, |
const unsigned int & | var, | ||
const int | pDomain = 0 |
||
) | const |
Returns the filename to be loaded for a given variable index.
Definition at line 1342 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
std::string Nektar::LibUtilities::SessionReader::GetFunctionFilenameVariable | ( | const std::string & | name, |
const std::string & | variable, | ||
const int | pDomain = 0 |
||
) | const |
Returns the filename variable to be loaded for a given variable index.
Definition at line 1355 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
enum FunctionType Nektar::LibUtilities::SessionReader::GetFunctionType | ( | const std::string & | name, |
const std::string & | variable, | ||
const int | pDomain = 0 |
||
) | const |
Returns the type of a given function variable.
Definition at line 1234 of file BasicUtils/SessionReader.cpp.
enum FunctionType Nektar::LibUtilities::SessionReader::GetFunctionType | ( | const std::string & | pName, |
const unsigned int & | pVar, | ||
const int | pDomain = 0 |
||
) | const |
Returns the type of a given function variable index.
Definition at line 1234 of file BasicUtils/SessionReader.cpp.
std::string Nektar::LibUtilities::SessionReader::GetGeometryType | ( | ) | const |
Definition at line 987 of file BasicUtils/SessionReader.cpp.
const std::string & Nektar::LibUtilities::SessionReader::GetGlobalSysSolnInfo | ( | const std::string & | variable, |
const std::string & | property | ||
) | const |
|
staticprivate |
GlobalSysSoln Info map.
List of values for GlobalSysSoln parameters to be used to override details given in SolverInfo
This list is populated by ReadGlobalSysSoln if the GLOBALSYSSOLNINFO section is defined in the input file. This List allows for details to define for the Global Sys solver for each variable.
Definition at line 159 of file BasicUtils/SessionReader.cpp.
InterpreterSharedPtr Nektar::LibUtilities::SessionReader::GetInterpreter | ( | ) |
Returns the instance of the Interpreter specific to this session.
Definition at line 2575 of file BasicUtils/SessionReader.cpp.
const NekDouble & Nektar::LibUtilities::SessionReader::GetParameter | ( | const std::string & | pName | ) | const |
Returns the value of the specified parameter.
If the parameter is not defined, termination occurs. Therefore, the parameters existence should be tested for using DefinesParameter before calling this function.
pName | The name of a floating-point parameter. |
Definition at line 717 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
Referenced by export_SessionReader().
const std::string & Nektar::LibUtilities::SessionReader::GetSessionName | ( | ) | const |
Returns the session name of the loaded XML document.
Definition at line 651 of file BasicUtils/SessionReader.cpp.
Referenced by export_SessionReader().
const std::string Nektar::LibUtilities::SessionReader::GetSessionNameRank | ( | ) | const |
Returns the session name with process rank.
Output is of the form [sessionName]_P[idx] where idx is the rank of the process.
Definition at line 661 of file BasicUtils/SessionReader.cpp.
References Nektar::LibUtilities::PortablePath().
bool Nektar::LibUtilities::SessionReader::GetSharedFilesystem | ( | ) |
Returns if file system shared.
Definition at line 682 of file BasicUtils/SessionReader.cpp.
const std::string & Nektar::LibUtilities::SessionReader::GetSolverInfo | ( | const std::string & | pProperty | ) | const |
Returns the value of the specified solver info property.
Definition at line 837 of file BasicUtils/SessionReader.cpp.
References ASSERTL1.
Referenced by GetSolverInfoAsEnum().
|
inline |
Returns the value of the specified solver info property as enum.
Definition at line 556 of file SessionReader.h.
References ASSERTL0, DefinesSolverInfo(), GetSolverInfo(), and GetSolverInfoEnums().
|
staticprivate |
Default solver info options.
List of default values for solver information parameters to be used in the case of them not being provided.
This list is populated through the RegisterDefaultSolverInfo static member variable which is called statically from various classes to register the default value for a given parameter.
Definition at line 143 of file BasicUtils/SessionReader.cpp.
Referenced by RegisterDefaultSolverInfo().
|
staticprivate |
String to enumeration map for Solver Info parameters.
This map of maps stores the list of valid string values for a number of solver information parameters. The top level map connects different parameter names to their list of possible values. The list of possible values is also a map, mapping a valid string to a corresponding enum value.
This list is populated through the RegisterEnumValue static member function which is called statically from various classes to register the valid values for solver info parameters associated with them. The map is therefore fully populated before the SessionReader class is instantiated and a file is read in and parsed.
Definition at line 128 of file BasicUtils/SessionReader.cpp.
Referenced by GetSolverInfoAsEnum(), GetValueAsEnum(), and RegisterEnumValue().
const std::string & Nektar::LibUtilities::SessionReader::GetTag | ( | const std::string & | pName | ) | const |
Returns the value of a specified tag.
Definition at line 1418 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
const TimeIntScheme & Nektar::LibUtilities::SessionReader::GetTimeIntScheme | ( | ) | const |
Returns the time integration scheme structure m_timeIntScheme from the session file.
Definition at line 982 of file BasicUtils/SessionReader.cpp.
|
inline |
Returns the value of the specified property and value as enum.
Definition at line 582 of file SessionReader.h.
References ASSERTL0, and GetSolverInfoEnums().
const std::string & Nektar::LibUtilities::SessionReader::GetVariable | ( | const unsigned int & | idx | ) | const |
Returns the name of the variable specified by the given index.
Definition at line 1124 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
Referenced by export_SessionReader().
std::vector< std::string > Nektar::LibUtilities::SessionReader::GetVariables | ( | ) | const |
Returns the names of all variables.
Definition at line 1147 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::InitSession | ( | const std::vector< std::string > & | filenames = std::vector<std::string>() | ) |
Performs the main initialisation of the object. The XML file provided on the command-line is loaded and any mesh partitioning is done. The resulting process-specific XML file (containing the process's geometry partition) is then reloaded and parsed.
Definition at line 283 of file BasicUtils/SessionReader.cpp.
|
private |
Loads an xml file into a tinyxml doc and decompresses if needed.
Definition at line 1461 of file BasicUtils/SessionReader.cpp.
References ASSERTL0, CellMLToNektar.pycml::copy(), CellMLToNektar.pycml::format, NEKERROR, and Nektar::LibUtilities::PortablePath().
void Nektar::LibUtilities::SessionReader::LoadGeometricInfo | ( | const std::string & | name, |
bool & | var, | ||
const bool & | def = false |
||
) | const |
Checks for and loads a geometric info boolean property.
Definition at line 1053 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadGeometricInfo | ( | const std::string & | name, |
NekDouble & | var, | ||
const NekDouble & | def = 0.0 |
||
) | const |
Checks for and loads a geometric info double-precision property.
Definition at line 1081 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadGeometricInfo | ( | const std::string & | name, |
std::string & | var, | ||
const std::string & | def = "" |
||
) | const |
Checks for and load a geometric info string property.
Definition at line 1032 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
int & | var | ||
) | const |
Load an integer parameter.
Definition at line 733 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
int & | var, | ||
const int & | def | ||
) | const |
Check for and load an integer parameter.
Definition at line 748 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) | const |
Load a double precision parameter.
Definition at line 768 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
NekDouble & | var, | ||
const NekDouble & | def | ||
) | const |
Check for and load a double-precision parameter.
Definition at line 782 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadSolverInfo | ( | const std::string & | name, |
std::string & | var, | ||
const std::string & | def = "" |
||
) | const |
Check for and load a solver info property.
Definition at line 867 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::MatchGeometricInfo | ( | const std::string & | name, |
const std::string & | trueval, | ||
bool & | var, | ||
const bool & | def = false |
||
) | const |
Check if the value of a geometric info string property matches.
Definition at line 1102 of file BasicUtils/SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::MatchSolverInfo | ( | const std::string & | name, |
const std::string & | trueval | ||
) | const |
Check if the value of a solver info property matches.
Definition at line 910 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::MatchSolverInfo | ( | const std::string & | name, |
const std::string & | trueval, | ||
bool & | var, | ||
const bool & | def = false |
||
) | const |
Check if the value of a solver info property matches.
Definition at line 888 of file BasicUtils/SessionReader.cpp.
|
inline |
Check if the value of a solver info property matches.
Definition at line 545 of file SessionReader.h.
References CellMLToNektar.pycml::name.
|
private |
Creates an XML document from a list of input files.
Definition at line 1510 of file BasicUtils/SessionReader.cpp.
References ASSERTL0, NEKERROR, and CellMLToNektar.cellml_metadata::p.
|
private |
Parse the program arguments and fill m_cmdLineOptions.
Parses the command-line arguments for known options and filenames.
Definition at line 377 of file BasicUtils/SessionReader.cpp.
References Nektar::NekConstants::kGitBranch, Nektar::NekConstants::kGitSha1, NEKTAR_VERSION, CellMLToNektar.cellml_metadata::p, and CellMLToNektar.translators::run().
|
private |
Loads and parses the specified file.
Definition at line 1577 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Parse a string in the form lhs = rhs.
Pull out lhs and rhs and eliminate any spaces.
Definition at line 2458 of file BasicUtils/SessionReader.cpp.
|
private |
Parse the session name.
Definition at line 530 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Partitions the comm object based on session parameters.
Splits the processes into a cartesian grid and creates communicators for each row and column of the grid. The grid is defined by the PROC_X parameter which, if specified, gives the number of processes spanned by the Fourier direction. PROC_X must exactly divide the total number of processes or an error is thrown.
Definition at line 1638 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the EXPRESSIONS section of the XML document.
Definition at line 2075 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the FILTERS section of the XML document.
Definition at line 2417 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the FUNCTIONS section of the XML document.
Definition at line 2209 of file BasicUtils/SessionReader.cpp.
References ASSERTL0, Nektar::LibUtilities::eFunctionTypeExpression, Nektar::LibUtilities::eFunctionTypeFile, Nektar::LibUtilities::eFunctionTypeTransientFile, Nektar::LibUtilities::FunctionVariableDefinition::m_expression, Nektar::LibUtilities::FunctionVariableDefinition::m_filename, Nektar::LibUtilities::FunctionVariableDefinition::m_fileVariable, Nektar::LibUtilities::FunctionVariableDefinition::m_type, and NEKERROR.
|
private |
Reads the GLOBALSYSSOLNINFO section of the XML document.
Definition at line 1845 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the PARAMETERS section of the XML document.
Definition at line 1685 of file BasicUtils/SessionReader.cpp.
References Nektar::LibUtilities::Equation::Evaluate(), and NEKERROR.
|
private |
Reads the SOLVERINFO section of the XML document.
Definition at line 1770 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the TIMEINTEGRATIONSCHEME section of the XML document.
Read the time-integration scheme structure, if present.
Definition at line 1972 of file BasicUtils/SessionReader.cpp.
|
private |
Reads the VARIABLES section of the XML document.
All elements are of the form: "<V ID="#"> name = value </V>", with ? being the element type.
Definition at line 2126 of file BasicUtils/SessionReader.cpp.
References ASSERTL0, and Nektar::StdRegions::find().
|
inlinestatic |
Registers a command-line argument with the session reader.
Definition at line 672 of file SessionReader.h.
References ASSERTL0, Nektar::LibUtilities::CmdLineArg::description, GetCmdLineArgMap(), Nektar::LibUtilities::CmdLineArg::isFlag, and Nektar::LibUtilities::CmdLineArg::shortName.
|
inlinestatic |
Registers a command-line flag with the session reader.
Definition at line 690 of file SessionReader.h.
References ASSERTL0, Nektar::LibUtilities::CmdLineArg::description, GetCmdLineArgMap(), Nektar::LibUtilities::CmdLineArg::isFlag, and Nektar::LibUtilities::CmdLineArg::shortName.
|
inlinestatic |
Registers the default string value of a solver info property.
A default value for a given solver info property may be registered using this function. The property will take this value until it is overwritten by a value specified in the XML document, or specified as a command-line argument. Usage has the form:
pName | The name of the property. |
pValue | The default value of the property. |
Definition at line 659 of file SessionReader.h.
References GetSolverInfoDefaults().
|
inlinestatic |
Registers an enumeration value.
A set of valid values for a given solver info property may be registered using this function. It must be called statically during the initialisation of a static variable. For example:
pEnum | The name of the property. |
pString | A valid value for the property. |
pEnumValue | An enumeration value corresponding to this value. |
Definition at line 625 of file SessionReader.h.
References GetSolverInfoEnums().
void Nektar::LibUtilities::SessionReader::SetParameter | ( | const std::string & | name, |
int & | var | ||
) |
Set an integer parameter.
Definition at line 804 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) |
Set a double precision parameter.
Definition at line 814 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetSolverInfo | ( | const std::string & | pProperty, |
const std::string & | pValue | ||
) |
Sets the value of the specified solver info property.
Definition at line 852 of file BasicUtils/SessionReader.cpp.
References ASSERTL1.
void Nektar::LibUtilities::SessionReader::SetTag | ( | const std::string & | pName, |
const std::string & | pValue | ||
) |
Sets a specified tag.
Definition at line 1406 of file BasicUtils/SessionReader.cpp.
Definition at line 2570 of file BasicUtils/SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetVariable | ( | const unsigned int & | idx, |
std::string | newname | ||
) |
void Nektar::LibUtilities::SessionReader::SubstituteExpressions | ( | std::string & | expr | ) |
Substitutes expressions defined in the XML document.
Definition at line 1450 of file BasicUtils/SessionReader.cpp.
|
private |
Definition at line 335 of file BasicUtils/SessionReader.cpp.
References ASSERTL1, and Nektar::LibUtilities::ReduceSum.
|
private |
Check values of solver info options are valid.
Definition at line 2551 of file BasicUtils/SessionReader.cpp.
References ASSERTL0.
|
friend |
Support creation through MemoryManager.
Definition at line 112 of file SessionReader.h.
|
private |
Definition at line 435 of file SessionReader.h.
Referenced by GetCmdLineArgument().
|
private |
Communication object.
Definition at line 438 of file SessionReader.h.
|
private |
Expressions.
Definition at line 452 of file SessionReader.h.
|
private |
Filenames.
Definition at line 440 of file SessionReader.h.
|
private |
Filters map.
Definition at line 462 of file SessionReader.h.
|
private |
Functions.
Definition at line 456 of file SessionReader.h.
|
private |
Geometric information properties.
Definition at line 450 of file SessionReader.h.
|
private |
Interpreter instance.
Definition at line 454 of file SessionReader.h.
|
private |
Parameters.
Definition at line 446 of file SessionReader.h.
|
private |
Session name of the loaded XML document (filename minus ext).
Definition at line 442 of file SessionReader.h.
|
private |
Running on a shared filesystem.
Definition at line 468 of file SessionReader.h.
|
private |
Solver information properties.
Definition at line 448 of file SessionReader.h.
|
private |
Custom tags.
Definition at line 460 of file SessionReader.h.
|
private |
Time integration scheme information.
Definition at line 464 of file SessionReader.h.
|
private |
Variables.
Definition at line 458 of file SessionReader.h.
|
private |
Be verbose.
Definition at line 466 of file SessionReader.h.
|
private |
Pointer to the loaded XML document.
Definition at line 444 of file SessionReader.h.