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. | |
TiXmlDocument & | GetDocument () |
Provides direct access to the TiXmlDocument object. | |
TiXmlElement * | GetElement (const std::string &pPath) |
Provides direct access to the TiXmlElement specified. | |
bool | DefinesElement (const std::string &pPath) const |
Tests if a specified element is defined in the XML document. | |
const std::vector< std::string > & | GetFilenames () const |
Returns the filename of the loaded XML document. | |
const std::string & | GetSessionName () const |
Returns the session name of the loaded XML document. | |
const std::string | GetSessionNameRank () const |
Returns the session name with process rank. | |
CommSharedPtr & | GetComm () |
Returns the communication object. | |
void | Finalise () |
Finalises the session. | |
bool | DefinesParameter (const std::string &name) const |
Checks if a parameter is specified in the XML document. | |
const NekDouble & | GetParameter (const std::string &pName) const |
Returns the value of the specified parameter. | |
void | LoadParameter (const std::string &name, int &var) const |
Load an integer parameter. | |
void | LoadParameter (const std::string &name, int &var, const int &def) const |
Check for and load an integer parameter. | |
void | LoadParameter (const std::string &name, NekDouble &var) const |
Load a double precision parameter. | |
void | LoadParameter (const std::string &name, NekDouble &var, const NekDouble &def) const |
Check for and load a double-precision parameter. | |
void | SetParameter (const std::string &name, int &var) |
Set an integer parameter. | |
void | SetParameter (const std::string &name, NekDouble &var) |
Set a double precision parameter. | |
bool | DefinesSolverInfo (const std::string &name) const |
Checks if a solver info property is specified. | |
const std::string & | GetSolverInfo (const std::string &pProperty) const |
Returns the value of the specified solver info property. | |
void | SetSolverInfo (const std::string &pProperty, const std::string &pValue) |
Sets the value of the specified solver info property. | |
template<typename T > | |
const T | GetSolverInfoAsEnum (const std::string &pName) const |
Returns the value of the specified solver info property as enum. | |
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. | |
void | LoadSolverInfo (const std::string &name, std::string &var, const std::string &def="") const |
Check for and load a solver info property. | |
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. | |
bool | MatchSolverInfo (const std::string &name, const std::string &trueval) const |
Check if the value of a solver info property matches. | |
template<typename T > | |
bool | MatchSolverInfoAsEnum (const std::string &name, const T &trueval) const |
Check if the value of a solver info property matches. | |
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 | DefinesGeometricInfo (const std::string &name) const |
Checks if a geometric info property is defined. | |
void | LoadGeometricInfo (const std::string &name, std::string &var, const std::string &def="") const |
Checks for and load a geometric info string property. | |
void | LoadGeometricInfo (const std::string &name, bool &var, const bool &def=false) const |
Checks for and loads a geometric info boolean property. | |
void | LoadGeometricInfo (const std::string &name, NekDouble &var, const NekDouble &def=0.0) const |
Checks for and loads a geometric info double-precision property. | |
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. | |
const std::string & | GetVariable (const unsigned int &idx) const |
Returns the name of the variable specified by the given index. | |
void | SetVariable (const unsigned int &idx, std::string newname) |
std::vector< std::string > | GetVariables () const |
Returns the names of all variables. | |
bool | DefinesFunction (const std::string &name) const |
Checks if a specified function is defined in the XML document. | |
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. | |
EquationSharedPtr | GetFunction (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns an EquationSharedPtr to a given function variable. | |
EquationSharedPtr | GetFunction (const std::string &name, const unsigned int &var, const int pDomain=0) const |
Returns an EquationSharedPtr to a given function variable index. | |
enum FunctionType | GetFunctionType (const std::string &name, const std::string &variable, const int pDomain=0) const |
Returns the type of a given function variable. | |
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. | |
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. | |
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. | |
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. | |
AnalyticExpressionEvaluator & | GetExpressionEvaluator () |
Returns the instance of AnalyticExpressionEvaluator specific to this session. | |
bool | DefinesTag (const std::string &pName) const |
Checks if a specified tag is defined. | |
void | SetTag (const std::string &pName, const std::string &pValue) |
Sets a specified tag. | |
const std::string & | GetTag (const std::string &pName) const |
Returns the value of a specified tag. | |
const FilterMap & | GetFilters () const |
bool | DefinesCmdLineArgument (const std::string &pName) const |
Checks if a specified cmdline argument has been given. | |
template<typename T > | |
T | GetCmdLineArgument (const std::string &pName) const |
Retrieves a command-line argument value. | |
void | SubstituteExpressions (std::string &expr) |
Substitutes expressions defined in the XML document. | |
CompositeOrdering | GetCompositeOrdering () const |
BndRegionOrdering | GetBndRegionOrdering () const |
void | SetUpXmlDoc () |
Static Public Member Functions | |
static SessionReaderSharedPtr | CreateInstance (int argc, char *argv[]) |
Creates an instance of the SessionReader class. | |
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. | |
static std::string | RegisterEnumValue (std::string pEnum, std::string pString, int pEnumValue) |
Registers an enumeration value. | |
static std::string | RegisterDefaultSolverInfo (const std::string &pName, const std::string &pValue) |
Registers the default string value of a solver info property. | |
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. | |
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. |
Private Member Functions | |
SessionReader (int argc, char *argv[]) | |
Main constructor. | |
void | InitSession () |
SessionReaderSharedPtr | GetSharedThisPtr () |
Returns a shared pointer to the current object. | |
std::vector< std::string > | ParseCommandLineArguments (int argc, char *argv[]) |
Parse the program arguments and fill m_cmdLineOptions. | |
std::string | ParseSessionName (std::vector< std::string > &filenames) |
Parse the session name. | |
void | LoadDoc (const std::string &pFilename, TiXmlDocument *pDoc) const |
Loads an xml file into a tinyxml doc and decompresses if needed. | |
TiXmlDocument * | MergeDoc (const std::vector< std::string > &pFilenames) const |
Creates an XML document from a list of input files. | |
void | ParseDocument () |
Loads and parses the specified file. | |
void | CreateComm (int &argc, char *argv[]) |
Loads the given XML document and instantiates an appropriate communication object. | |
void | PartitionMesh () |
Partitions the mesh when running in parallel. | |
void | PartitionComm () |
Partitions the comm object based on session parameters. | |
void | ReadParameters (TiXmlElement *conditions) |
Reads the PARAMETERS section of the XML document. | |
void | ReadSolverInfo (TiXmlElement *conditions) |
Reads the SOLVERINFO section of the XML document. | |
void | ReadGlobalSysSolnInfo (TiXmlElement *conditions) |
Reads the GLOBALSYSSOLNINFO section of the XML document. | |
void | ReadExpressions (TiXmlElement *conditions) |
Reads the EXPRESSIONS section of the XML document. | |
void | ReadVariables (TiXmlElement *conditions) |
Reads the VARIABLES section of the XML document. | |
void | ReadFunctions (TiXmlElement *conditions) |
Reads the FUNCTIONS section of the XML document. | |
void | ReadFilters (TiXmlElement *filters) |
Reads the FILTERS section of the XML document. | |
void | CmdLineOverride () |
Enforce parameters from command line arguments. | |
void | ParseEquals (const std::string &line, std::string &lhs, std::string &rhs) |
Parse a string in the form lhs = rhs. |
Static Private Member Functions | |
static EnumMapList & | GetSolverInfoEnums () |
String to enumeration map for Solver Info parameters. | |
static SolverInfoMap & | GetSolverInfoDefaults () |
Default solver info options. | |
static GloSysSolnInfoList & | GetGloSysSolnList () |
GlobalSysSoln Info map. | |
static CmdLineArgMap & | GetCmdLineArgMap () |
CmdLine argument map. |
Private Attributes | |
boost::program_options::variables_map | m_cmdLineOptions |
CommSharedPtr | m_comm |
Communication object. | |
std::vector< std::string > | m_filenames |
Filenames. | |
std::string | m_sessionName |
Session name of the loaded XML document (filename minus ext). | |
TiXmlDocument * | m_xmlDoc |
Pointer to the loaded XML document. | |
ParameterMap | m_parameters |
Parameters. | |
SolverInfoMap | m_solverInfo |
Solver information properties. | |
GeometricInfoMap | m_geometricInfo |
Geometric information properties. | |
ExpressionMap | m_expressions |
Expressions. | |
AnalyticExpressionEvaluator | m_exprEvaluator |
Analytic expression evaluator instance. | |
FunctionMap | m_functions |
Functions. | |
VariableList | m_variables |
Variables. | |
TagMap | m_tags |
Custom tags. | |
FilterMap | m_filters |
Filters map. | |
bool | m_verbose |
Be verbose. | |
CompositeOrdering | m_compOrder |
Map of original composite ordering for parallel periodic bcs. | |
BndRegionOrdering | m_bndRegOrder |
Map of original boundary region ordering for parallel periodic bcs. |
Friends | |
class | MemoryManager< SessionReader > |
Support creation through MemoryManager. |
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 123 of file SessionReader.h.
Nektar::LibUtilities::SessionReader::SessionReader | ( | int | argc, |
char * | argv[], | ||
const std::vector< std::string > & | pFilenames, | ||
const CommSharedPtr & | pComm | ||
) |
Definition at line 210 of file SessionReader.cpp.
References ASSERTL0.
Nektar::LibUtilities::SessionReader::~SessionReader | ( | ) |
|
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 185 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Enforce parameters from command line arguments.
Definition at line 2563 of file SessionReader.cpp.
References ASSERTL0, and Nektar::lhs.
|
private |
Loads the given XML document and instantiates an appropriate communication object.
Definition at line 1507 of file SessionReader.cpp.
References Nektar::LibUtilities::NekFactory< tKey, tBase, >::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.
Referenced by Diffusion::Diffusion(), main(), Nektar::Utilities::InputNekpp::Process(), Nektar::Utilities::InputXml::Process(), Nektar::Utilities::OutputNekpp::Process(), Nektar::Utilities::ProcessInterpPoints::Process(), Nektar::Utilities::ProcessInterpField::Process(), 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 159 of file SessionReader.h.
bool Nektar::LibUtilities::SessionReader::DefinesCmdLineArgument | ( | const std::string & | pName | ) | const |
Checks if a specified cmdline argument has been given.
Definition at line 1343 of file 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 553 of file 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 1039 of file 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 1055 of file SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesGeometricInfo | ( | const std::string & | name | ) | const |
Checks if a geometric info property is defined.
Definition at line 904 of file SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesGlobalSysSolnInfo | ( | const std::string & | variable, |
const std::string & | property | ||
) | const |
Definition at line 858 of file 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 631 of file SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesSolverInfo | ( | const std::string & | name | ) | const |
Checks if a solver info property is specified.
Definition at line 754 of file SessionReader.cpp.
Referenced by GetSolverInfoAsEnum().
bool Nektar::LibUtilities::SessionReader::DefinesTag | ( | const std::string & | pName | ) | const |
Checks if a specified tag is defined.
Definition at line 1298 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::Finalise | ( | ) |
Finalises the session.
This routine finalises any parallel communication.
Definition at line 622 of file SessionReader.cpp.
BndRegionOrdering Nektar::LibUtilities::SessionReader::GetBndRegionOrdering | ( | ) | const |
Definition at line 1368 of file SessionReader.cpp.
|
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 170 of file SessionReader.cpp.
Referenced by RegisterCmdLineArgument(), and RegisterCmdLineFlag().
|
inline |
Retrieves a command-line argument value.
Definition at line 404 of file SessionReader.h.
References m_cmdLineOptions.
CommSharedPtr & Nektar::LibUtilities::SessionReader::GetComm | ( | ) |
Returns the communication object.
Definition at line 610 of file SessionReader.cpp.
CompositeOrdering Nektar::LibUtilities::SessionReader::GetCompositeOrdering | ( | ) | const |
Definition at line 1363 of file SessionReader.cpp.
TiXmlDocument & Nektar::LibUtilities::SessionReader::GetDocument | ( | ) |
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 530 of file SessionReader.cpp.
References ASSERTL0.
AnalyticExpressionEvaluator & Nektar::LibUtilities::SessionReader::GetExpressionEvaluator | ( | ) |
Returns the instance of AnalyticExpressionEvaluator specific to this session.
Definition at line 1289 of file SessionReader.cpp.
const std::vector< std::string > & Nektar::LibUtilities::SessionReader::GetFilenames | ( | ) | const |
Returns the filename of the loaded XML document.
Definition at line 575 of file SessionReader.cpp.
const FilterMap & Nektar::LibUtilities::SessionReader::GetFilters | ( | ) | const |
Definition at line 1334 of file 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 1081 of file 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 1124 of file 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 1192 of file 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 1234 of file 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 1247 of file 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 1137 of file SessionReader.cpp.
References ASSERTL0.
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 1179 of file SessionReader.cpp.
References ASSERTL0.
const std::string & Nektar::LibUtilities::SessionReader::GetGlobalSysSolnInfo | ( | const std::string & | variable, |
const std::string & | property | ||
) | const |
Definition at line 884 of file SessionReader.cpp.
References ASSERTL0, and Nektar::StdRegions::find().
|
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 156 of file 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 647 of file SessionReader.cpp.
References ASSERTL0.
const std::string & Nektar::LibUtilities::SessionReader::GetSessionName | ( | ) | const |
Returns the session name of the loaded XML document.
Definition at line 584 of file SessionReader.cpp.
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 594 of file SessionReader.cpp.
References Nektar::LibUtilities::PortablePath().
|
inlineprivate |
Returns a shared pointer to the current object.
This allows a member function to pass a shared pointer to itself during a call to another function.
Definition at line 706 of file SessionReader.h.
const std::string & Nektar::LibUtilities::SessionReader::GetSolverInfo | ( | const std::string & | pProperty | ) | const |
Returns the value of the specified solver info property.
Definition at line 765 of file SessionReader.cpp.
References ASSERTL1.
Referenced by GetSolverInfoAsEnum().
|
inline |
Returns the value of the specified solver info property as enum.
Definition at line 552 of file SessionReader.h.
References ASSERTL0, DefinesSolverInfo(), Nektar::StdRegions::find(), GetSolverInfo(), GetSolverInfoEnums(), and Nektar::iterator.
|
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 140 of file 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 125 of file 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 1321 of file SessionReader.cpp.
References ASSERTL0.
|
inline |
Returns the value of the specified property and value as enum.
Definition at line 579 of file SessionReader.h.
References ASSERTL0, Nektar::StdRegions::find(), GetSolverInfoEnums(), and Nektar::iterator.
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 1007 of file SessionReader.cpp.
References ASSERTL0.
std::vector< std::string > Nektar::LibUtilities::SessionReader::GetVariables | ( | ) | const |
Returns the names of all variables.
Definition at line 1030 of file SessionReader.cpp.
|
private |
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 265 of file SessionReader.cpp.
References Nektar::iterator.
|
private |
Loads an xml file into a tinyxml doc and decompresses if needed.
Definition at line 1376 of file SessionReader.cpp.
References ASSERTL0, and Nektar::LibUtilities::PortablePath().
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 915 of file SessionReader.cpp.
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 936 of file 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 964 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
int & | var | ||
) | const |
Load an integer parameter.
Definition at line 663 of file 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 677 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) | const |
Load a double precision parameter.
Definition at line 696 of file 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 710 of file 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 795 of file 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 985 of file 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 816 of file 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 838 of file SessionReader.cpp.
|
inline |
Check if the value of a solver info property matches.
Definition at line 541 of file SessionReader.h.
|
private |
Creates an XML document from a list of input files.
Definition at line 1425 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Parse the program arguments and fill m_cmdLineOptions.
Parses the command-line arguments for known options and filenames.
Definition at line 314 of file SessionReader.cpp.
References Nektar::iterator, Nektar::NekConstants::kGitBranch, Nektar::NekConstants::kGitSha1, and NEKTAR_VERSION.
|
private |
Loads and parses the specified file.
Definition at line 1478 of file 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 2537 of file SessionReader.cpp.
|
private |
Parse the session name.
Definition at line 463 of file 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 1811 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Partitions the mesh when running in parallel.
Definition at line 1531 of file SessionReader.cpp.
References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Gs::Finalise(), Nektar::LibUtilities::GetMeshPartitionFactory(), Nektar::LibUtilities::GetSize(), Nektar::iterator, Nektar::LibUtilities::PortablePath(), and Nektar::LibUtilities::ReduceMax.
|
private |
Reads the EXPRESSIONS section of the XML document.
Definition at line 2158 of file SessionReader.cpp.
References ASSERTL0, and Nektar::iterator.
|
private |
Reads the FILTERS section of the XML document.
Definition at line 2496 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the FUNCTIONS section of the XML document.
Definition at line 2293 of file SessionReader.cpp.
References ASSERTL0, Nektar::LibUtilities::eFunctionTypeExpression, Nektar::LibUtilities::eFunctionTypeFile, Nektar::LibUtilities::eFunctionTypeTransientFile, Nektar::iterator, Nektar::LibUtilities::FunctionVariableDefinition::m_expression, Nektar::LibUtilities::FunctionVariableDefinition::m_filename, Nektar::LibUtilities::FunctionVariableDefinition::m_fileVariable, and Nektar::LibUtilities::FunctionVariableDefinition::m_type.
|
private |
Reads the GLOBALSYSSOLNINFO section of the XML document.
Definition at line 2024 of file SessionReader.cpp.
References ASSERTL0, Nektar::StdRegions::find(), and Nektar::iterator.
|
private |
Reads the PARAMETERS section of the XML document.
Definition at line 1853 of file SessionReader.cpp.
References ASSERTL0, Nektar::LibUtilities::Equation::Evaluate(), and Nektar::lhs.
|
private |
Reads the SOLVERINFO section of the XML document.
Definition at line 1938 of file SessionReader.cpp.
References ASSERTL0.
|
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 2210 of file SessionReader.cpp.
References ASSERTL0, and Nektar::StdRegions::find().
|
inlinestatic |
Registers a command-line argument with the session reader.
Definition at line 669 of file SessionReader.h.
References ASSERTL0, GetCmdLineArgMap(), and Nektar::LibUtilities::CmdLineArg::shortName.
|
inlinestatic |
Registers a command-line flag with the session reader.
Definition at line 687 of file SessionReader.h.
References ASSERTL0, GetCmdLineArgMap(), and Nektar::LibUtilities::CmdLineArg::shortName.
Referenced by main().
|
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 656 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 623 of file SessionReader.h.
References Nektar::StdRegions::find(), GetSolverInfoEnums(), and Nektar::iterator.
void Nektar::LibUtilities::SessionReader::SetParameter | ( | const std::string & | name, |
int & | var | ||
) |
Set an integer parameter.
Definition at line 732 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) |
Set a double precision parameter.
Definition at line 742 of file 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 780 of file SessionReader.cpp.
References ASSERTL1, and Nektar::iterator.
void Nektar::LibUtilities::SessionReader::SetTag | ( | const std::string & | pName, |
const std::string & | pValue | ||
) |
Sets a specified tag.
Definition at line 1309 of file SessionReader.cpp.
Definition at line 2627 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetVariable | ( | const unsigned int & | idx, |
std::string | newname | ||
) |
Definition at line 1019 of file SessionReader.cpp.
References ASSERTL0.
void Nektar::LibUtilities::SessionReader::SubstituteExpressions | ( | std::string & | expr | ) |
Substitutes expressions defined in the XML document.
Definition at line 1353 of file SessionReader.cpp.
References Nektar::iterator.
|
friend |
Support creation through MemoryManager.
Definition at line 128 of file SessionReader.h.
|
private |
Map of original boundary region ordering for parallel periodic bcs.
Definition at line 464 of file SessionReader.h.
|
private |
Definition at line 430 of file SessionReader.h.
Referenced by GetCmdLineArgument().
|
private |
Communication object.
Definition at line 433 of file SessionReader.h.
|
private |
Map of original composite ordering for parallel periodic bcs.
Definition at line 461 of file SessionReader.h.
|
private |
Expressions.
Definition at line 447 of file SessionReader.h.
|
private |
Analytic expression evaluator instance.
Definition at line 449 of file SessionReader.h.
|
private |
Filenames.
Definition at line 435 of file SessionReader.h.
|
private |
Filters map.
Definition at line 457 of file SessionReader.h.
|
private |
Functions.
Definition at line 451 of file SessionReader.h.
|
private |
Geometric information properties.
Definition at line 445 of file SessionReader.h.
|
private |
Parameters.
Definition at line 441 of file SessionReader.h.
|
private |
Session name of the loaded XML document (filename minus ext).
Definition at line 437 of file SessionReader.h.
|
private |
Solver information properties.
Definition at line 443 of file SessionReader.h.
|
private |
Custom tags.
Definition at line 455 of file SessionReader.h.
|
private |
Variables.
Definition at line 453 of file SessionReader.h.
|
private |
Be verbose.
Definition at line 459 of file SessionReader.h.
|
private |
Pointer to the loaded XML document.
Definition at line 439 of file SessionReader.h.