AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
State.h
Go to the documentation of this file.
1/*
2 * This file is part of AQUAgpusph, a free CFD program based on SPH.
3 * Copyright (C) 2012 Jose Luis Cercos Pita <jl.cercos@upm.es>
4 *
5 * AQUAgpusph is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * AQUAgpusph is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with AQUAgpusph. If not, see <http://www.gnu.org/licenses/>.
17 */
18
24#ifndef STATE_H_INCLUDED
25#define STATE_H_INCLUDED
26
27#include <ProblemSetup.h>
30
31#include <xercesc/dom/DOM.hpp>
32#include <xercesc/dom/DOMDocument.hpp>
33#include <xercesc/dom/DOMDocumentType.hpp>
34#include <xercesc/dom/DOMElement.hpp>
35#include <xercesc/dom/DOMImplementation.hpp>
36#include <xercesc/dom/DOMImplementationLS.hpp>
37#include <xercesc/dom/DOMNodeIterator.hpp>
38#include <xercesc/dom/DOMNodeList.hpp>
39#include <xercesc/dom/DOMText.hpp>
40#include <xercesc/parsers/XercesDOMParser.hpp>
41#include <xercesc/framework/StdOutFormatTarget.hpp>
42#include <xercesc/framework/LocalFileFormatTarget.hpp>
43#include <xercesc/util/XMLUni.hpp>
44
45#include <string>
46#include <vector>
47
48namespace Aqua {
49namespace InputOutput {
50
71class State
72{
73 public:
76 State();
77
79 ~State();
80
96 void save(ProblemSetup& sim_data, std::vector<Particles*> savers);
97
103 void load(std::string input_file, ProblemSetup& sim_data);
104
105 protected:
117 void parse(std::string filepath,
118 ProblemSetup& sim_data,
119 std::string prefix = "");
120
128 void parseSettings(xercesc::DOMElement* root,
129 ProblemSetup& sim_data,
130 std::string prefix = "");
131
139 void parseVariables(xercesc::DOMElement* root,
140 ProblemSetup& sim_data,
141 std::string prefix = "");
142
150 void parseDefinitions(xercesc::DOMElement* root,
151 ProblemSetup& sim_data,
152 std::string prefix = "");
153
161 void parseTools(xercesc::DOMElement* root,
162 ProblemSetup& sim_data,
163 std::string prefix = "");
164
172 void parseTiming(xercesc::DOMElement* root,
173 ProblemSetup& sim_data,
174 std::string prefix = "");
175
183 void parseSets(xercesc::DOMElement* root,
184 ProblemSetup& sim_data,
185 std::string prefix = "");
186
194 void parseReports(xercesc::DOMElement* root,
195 ProblemSetup& sim_data,
196 std::string prefix = "");
197
204 void write(std::string filepath,
205 ProblemSetup& sim_data,
206 std::vector<Particles*> savers);
207
215 void writeSettings(xercesc::DOMDocument* doc,
216 xercesc::DOMElement* root,
217 ProblemSetup& sim_data);
218
226 void writeVariables(xercesc::DOMDocument* doc,
227 xercesc::DOMElement* root,
228 ProblemSetup& sim_data);
229
237 void writeDefinitions(xercesc::DOMDocument* doc,
238 xercesc::DOMElement* root,
239 ProblemSetup& sim_data);
240
248 void writeTools(xercesc::DOMDocument* doc,
249 xercesc::DOMElement* root,
250 ProblemSetup& sim_data);
251
259 void writeTiming(xercesc::DOMDocument* doc,
260 xercesc::DOMElement* root,
261 ProblemSetup& sim_data);
262
271 void writeSets(xercesc::DOMDocument* doc,
272 xercesc::DOMElement* root,
273 ProblemSetup& sim_data,
274 std::vector<Particles*> savers);
275
283 void writeReports(xercesc::DOMDocument* doc,
284 xercesc::DOMElement* root,
285 ProblemSetup& sim_data);
286
287 private:
289 std::string _output_file;
290}; // class InputOutput
291
292}
293} // namespaces
294
295#endif // STATE_H_INCLUDED
Base class for all the input/output file managers. (See Aqua::InputOutput::InputOutput for details)
Particles files manager. (See Aqua::InputOutput::Particles for details)
Simulation configuration data structures. (See Aqua::InputOutput::ProblemSetup for details)
Simulation configuration data.
Definition: ProblemSetup.h:91
void parseSettings(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the general settings sections.
Definition: State.cpp:298
void writeDefinitions(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the definitions section.
Definition: State.cpp:1598
void parseSets(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Definition: State.cpp:1226
State()
Constructor.
Definition: State.cpp:88
void parseDefinitions(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the definitions sections.
Definition: State.cpp:435
void parseTools(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the tools sections.
Definition: State.cpp:538
void save(ProblemSetup &sim_data, std::vector< Particles * > savers)
Save the configuration file.
Definition: State.cpp:175
~State()
Destructor.
Definition: State.cpp:155
void writeSets(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data, std::vector< Particles * > savers)
Write the particles set sections.
Definition: State.cpp:1737
void load(std::string input_file, ProblemSetup &sim_data)
Load the simulation XML definition files.
Definition: State.cpp:181
void parse(std::string filepath, ProblemSetup &sim_data, std::string prefix="")
Parse the XML file.
Definition: State.cpp:187
void write(std::string filepath, ProblemSetup &sim_data, std::vector< Particles * > savers)
Write the XML file.
Definition: State.cpp:1425
void parseVariables(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the variables sections.
Definition: State.cpp:387
void writeSettings(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the settings section.
Definition: State.cpp:1499
void parseTiming(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the time control sections.
Definition: State.cpp:1141
void writeTools(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the tools section.
Definition: State.cpp:1625
void writeReports(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the reports section.
Definition: State.cpp:1654
void writeTiming(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the time control section.
Definition: State.cpp:1678
void writeVariables(xercesc::DOMDocument *doc, xercesc::DOMElement *root, ProblemSetup &sim_data)
Write the variables section.
Definition: State.cpp:1552
void parseReports(xercesc::DOMElement *root, ProblemSetup &sim_data, std::string prefix="")
Parse the reports sections.
Definition: State.cpp:1284
Main AQUAgpusph namespace.
Definition: ArgumentsManager.cpp:45
Definition: State.py:1