AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
Aqua::InputOutput::State Class Reference

Load/Save the XML simulation definition files. More...

#include <InputOutput/State.h>

Public Member Functions

 State ()
 Constructor.
 
 ~State ()
 Destructor.
 
void save (ProblemSetup &sim_data, std::vector< Particles * > savers)
 Save the configuration file.
 
void load (std::string input_file, ProblemSetup &sim_data)
 Load the simulation XML definition files.
 

Protected Member Functions

void parse (std::string filepath, ProblemSetup &sim_data, std::string prefix="")
 Parse the XML file.
 
void parseSettings (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the general settings sections.
 
void parseVariables (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the variables sections.
 
void parseDefinitions (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the definitions sections.
 
void parseTools (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the tools sections.
 
void parseTiming (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the time control sections.
 
void parseSets (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 
void parseReports (xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
 Parse the reports sections.
 
void write (std::string filepath, ProblemSetup &sim_data, std::vector< Particles * > savers)
 Write the XML file.
 
void writeSettings (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the settings section.
 
void writeVariables (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the variables section.
 
void writeDefinitions (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the definitions section.
 
void writeTools (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the tools section.
 
void writeTiming (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the time control section.
 
void writeSets (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data, std::vector< Particles * > savers)
 Write the particles set sections.
 
void writeReports (xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
 Write the reports section.
 

Detailed Description

Load/Save the XML simulation definition files.

In AQUAgpusph the input/output managers are divided in 3 different types:

  1. The simulation configuration files manager
  2. The report file managers
  3. The particles output file managers

This class is based in the xerces-c library, to learn more please visit the following web page:

http://xerces.apache.org/xerces-c

You can find more information about how to create simulation configuration files in the examples provided with the package and in the Aqua::InputOutput::ProblemSetup class documentation.

See also
Aqua::InputOutput::Report
Aqua::InputOutput::Particles

Constructor & Destructor Documentation

◆ State()

Aqua::InputOutput::State::State ( )

Constructor.

Here is the call graph for this function:

◆ ~State()

Aqua::InputOutput::State::~State ( )

Destructor.

Here is the call graph for this function:

Member Function Documentation

◆ load()

void Aqua::InputOutput::State::load ( std::string  input_file,
ProblemSetup sim_data 
)

Load the simulation XML definition files.

Parameters
input_fileXML file to load
sim_dataSimulation data
Here is the call graph for this function:

◆ parse()

void Aqua::InputOutput::State::parse ( std::string  filepath,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the XML file.

Parameters
filepathfile to be parsed.
sim_dataSimulation data
prefixString to be inserted before the variable names defined in the file.
Returns
false if all gone right, true otherwise
Note
This function is calling himself for each <Include> tag found, conveniently changing filepath and prefix. If no prefix is specified in the <Include> tag, the same received prefix will be used.
Here is the call graph for this function:

◆ parseDefinitions()

void Aqua::InputOutput::State::parseDefinitions ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the definitions sections.

Parameters
rootroot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphDefinitions
Here is the call graph for this function:

◆ parseReports()

void Aqua::InputOutput::State::parseReports ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the reports sections.

Parameters
rootroot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTool
Here is the call graph for this function:

◆ parseSets()

void Aqua::InputOutput::State::parseSets ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Look for particles set sections.

Parameters
rootRoot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphParticlesSet
Here is the call graph for this function:

◆ parseSettings()

void Aqua::InputOutput::State::parseSettings ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the general settings sections.

Parameters
rootroot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphSettings
Here is the call graph for this function:

◆ parseTiming()

void Aqua::InputOutput::State::parseTiming ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the time control sections.

Parameters
rootRoot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTimingParameters

◆ parseTools()

void Aqua::InputOutput::State::parseTools ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the tools sections.

Parameters
rootroot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTool
Here is the call graph for this function:

◆ parseVariables()

void Aqua::InputOutput::State::parseVariables ( xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::string  prefix = "" 
)
protected

Parse the variables sections.

Parameters
rootroot XML node.
sim_dataSimulation data
prefixString to be inserted before the variable names.
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphVariables
Here is the call graph for this function:

◆ save()

void Aqua::InputOutput::State::save ( ProblemSetup sim_data,
std::vector< Particles * >  savers 
)

Save the configuration file.

The saved XML file can be used to continue the simulation from the last saved time instant.

The output XML file will be the first non existing file named "AQUAgpusph.save.%d.xml", where "%d" is an unsigned integer.

Of course, to can load a saved simulation, the output particles file should be saved as well.

See also
Aqua::InputOutput::Particles::save()
Parameters
sim_dataSimulation data
saversParticles savers list
Here is the call graph for this function:

◆ write()

void Aqua::InputOutput::State::write ( std::string  filepath,
ProblemSetup sim_data,
std::vector< Particles * >  savers 
)
protected

Write the XML file.

Parameters
filepathfile to be written.
sim_dataSimulation data
saversParticles savers list
Returns
false if all gone right, true otherwise
Here is the call graph for this function:

◆ writeDefinitions()

void Aqua::InputOutput::State::writeDefinitions ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the definitions section.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphDefinitions

◆ writeReports()

void Aqua::InputOutput::State::writeReports ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the reports section.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTool

◆ writeSets()

void Aqua::InputOutput::State::writeSets ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data,
std::vector< Particles * >  savers 
)
protected

Write the particles set sections.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
saversParticles savers list
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphParticlesSet
Here is the call graph for this function:

◆ writeSettings()

void Aqua::InputOutput::State::writeSettings ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the settings section.

Parameters
docXML generated document.
rootroot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphSettings

◆ writeTiming()

void Aqua::InputOutput::State::writeTiming ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the time control section.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTimingParameters

◆ writeTools()

void Aqua::InputOutput::State::writeTools ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the tools section.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphTool

◆ writeVariables()

void Aqua::InputOutput::State::writeVariables ( xercesc::DOMDocument *  doc,
xercesc::DOMElement *  root,
ProblemSetup sim_data 
)
protected

Write the variables section.

Parameters
docXML generated document.
rootRoot XML node.
sim_dataSimulation data
Returns
false if all gone right, true otherwise
See also
Aqua::InputOutput::ProblemSetup::sphVariables
Here is the call graph for this function:

The documentation for this class was generated from the following files: