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... | |
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... | |
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 | 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... | |
AnalyticExpressionEvaluator & | GetExpressionEvaluator () |
Returns the instance of AnalyticExpressionEvaluator 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... | |
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. 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 | InitSession () |
SessionReaderSharedPtr | GetSharedThisPtr () |
Returns a shared pointer to the current object. More... | |
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 | PartitionMesh () |
Partitions the mesh when running in parallel. 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 | 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... | |
AnalyticExpressionEvaluator | m_exprEvaluator |
Analytic expression evaluator instance. More... | |
FunctionMap | m_functions |
Functions. More... | |
VariableList | m_variables |
Variables. More... | |
TagMap | m_tags |
Custom tags. More... | |
FilterMap | m_filters |
Filters map. More... | |
bool | m_verbose |
Be verbose. More... | |
CompositeOrdering | m_compOrder |
Map of original composite ordering for parallel periodic bcs. More... | |
BndRegionOrdering | m_bndRegOrder |
Map of original boundary region ordering for parallel periodic bcs. 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 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 | ( | ) |
Destructor.
Definition at line 253 of file 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 185 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Enforce parameters from command line arguments.
Definition at line 2588 of file SessionReader.cpp.
References ASSERTL0, and Nektar::lhs.
|
private |
Loads the given XML document and instantiates an appropriate communication object.
Definition at line 1528 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 main(), Nektar::Utilities::InputCAD::Process(), Nektar::Utilities::InputNekpp::Process(), Nektar::Utilities::InputXml::Process(), Nektar::Utilities::ProcessDisplacement::Process(), Nektar::Utilities::ProcessInterpField::Process(), Nektar::Utilities::ProcessInterpPoints::Process(), Nektar::Utilities::OutputNekpp::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 1350 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 560 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 1046 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 1062 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 911 of file SessionReader.cpp.
bool Nektar::LibUtilities::SessionReader::DefinesGlobalSysSolnInfo | ( | const std::string & | variable, |
const std::string & | property | ||
) | const |
Definition at line 865 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 638 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 761 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 1305 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::Finalise | ( | ) |
Finalises the session.
This routine finalises any parallel communication.
Definition at line 629 of file SessionReader.cpp.
BndRegionOrdering Nektar::LibUtilities::SessionReader::GetBndRegionOrdering | ( | ) | const |
Definition at line 1375 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 617 of file SessionReader.cpp.
CompositeOrdering Nektar::LibUtilities::SessionReader::GetCompositeOrdering | ( | ) | const |
Definition at line 1370 of file SessionReader.cpp.
TiXmlDocument & Nektar::LibUtilities::SessionReader::GetDocument | ( | ) |
Provides direct access to the TiXmlDocument object.
Definition at line 508 of file 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 537 of file SessionReader.cpp.
References ASSERTL0.
AnalyticExpressionEvaluator & Nektar::LibUtilities::SessionReader::GetExpressionEvaluator | ( | ) |
Returns the instance of AnalyticExpressionEvaluator specific to this session.
Definition at line 1296 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 582 of file SessionReader.cpp.
const FilterMap & Nektar::LibUtilities::SessionReader::GetFilters | ( | ) | const |
Definition at line 1341 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 1088 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 1131 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 1199 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 1241 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 1254 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 1144 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 1186 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 891 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 654 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 591 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 601 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 708 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 772 of file SessionReader.cpp.
References ASSERTL1.
Referenced by GetSolverInfoAsEnum().
|
inline |
Returns the value of the specified solver info property as enum.
Definition at line 554 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 1328 of file SessionReader.cpp.
References ASSERTL0.
|
inline |
Returns the value of the specified property and value as enum.
Definition at line 581 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 1014 of file SessionReader.cpp.
References ASSERTL0.
std::vector< std::string > Nektar::LibUtilities::SessionReader::GetVariables | ( | ) | const |
Returns the names of all variables.
Definition at line 1037 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 1383 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 922 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 943 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 971 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
int & | var | ||
) | const |
Load an integer parameter.
Definition at line 670 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 684 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::LoadParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) | const |
Load a double precision parameter.
Definition at line 703 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 717 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 802 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 992 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 823 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 845 of file SessionReader.cpp.
|
inline |
Check if the value of a solver info property matches.
Definition at line 543 of file SessionReader.h.
|
private |
Creates an XML document from a list of input files.
Definition at line 1432 of file SessionReader.cpp.
References ASSERTL0, and WARNINGL0.
|
private |
Parse the program arguments and fill m_cmdLineOptions.
Parses the command-line arguments for known options and filenames.
Definition at line 317 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 1499 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 2562 of file SessionReader.cpp.
|
private |
|
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 1842 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Partitions the mesh when running in parallel.
Definition at line 1552 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 2183 of file SessionReader.cpp.
References ASSERTL0, and Nektar::iterator.
|
private |
Reads the FILTERS section of the XML document.
Definition at line 2521 of file SessionReader.cpp.
References ASSERTL0.
|
private |
Reads the FUNCTIONS section of the XML document.
Definition at line 2318 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 2049 of file SessionReader.cpp.
References ASSERTL0, Nektar::StdRegions::find(), and Nektar::iterator.
|
private |
Reads the PARAMETERS section of the XML document.
Definition at line 1889 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 1974 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 2235 of file SessionReader.cpp.
References ASSERTL0, and Nektar::StdRegions::find().
|
inlinestatic |
Registers a command-line argument with the session reader.
Definition at line 671 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 689 of file SessionReader.h.
References ASSERTL0, GetCmdLineArgMap(), 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 658 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 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 739 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetParameter | ( | const std::string & | name, |
NekDouble & | var | ||
) |
Set a double precision parameter.
Definition at line 749 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 787 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 1316 of file SessionReader.cpp.
Definition at line 2674 of file SessionReader.cpp.
void Nektar::LibUtilities::SessionReader::SetVariable | ( | const unsigned int & | idx, |
std::string | newname | ||
) |
Definition at line 1026 of file SessionReader.cpp.
References ASSERTL0.
void Nektar::LibUtilities::SessionReader::SubstituteExpressions | ( | std::string & | expr | ) |
Substitutes expressions defined in the XML document.
Definition at line 1360 of file SessionReader.cpp.
References Nektar::iterator.
|
private |
Check values of solver info options are valid.
Definition at line 2652 of file SessionReader.cpp.
References ASSERTL0.
|
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.