24#ifndef HEMOCELL_CONFIG_H
25#define HEMOCELL_CONFIG_H
29#include "external/tinyxml2/tinyxml2.h"
40 tinyxml2::XMLElement *
orig;
63 const char * text =
orig->GetText();
64 if (!text) {
throw std::invalid_argument(
where() +
" is empty."); }
66 if (!
parseValue(text, ret)) {
throw std::invalid_argument(
where() +
": cannot convert \"" + text +
"\"."); }
73 std::string
path()
const;
77 std::string
where()
const;
80 static bool parseValue(
const std::string & text, V & value) {
81 std::istringstream stream(text);
82 if (!(stream >> value)) {
return false; }
86 static bool parseValue(
const std::string & text,
bool & value);
87 static bool parseValue(
const std::string & text, std::string & value);
92 tinyxml2::XMLDocument *
orig;
101 Config(std::string paramXmlFilename);
104 void reload(std::string paramXmlFilename);
108 tinyxml2::XMLNode *
ShallowClone(tinyxml2::XMLDocument * document)
const;
110 bool Accept(tinyxml2::XMLVisitor * visitor)
const;
113 void load(std::string paramXmlFilename);
bool Accept(tinyxml2::XMLVisitor *visitor) const
void load(std::string paramXmlFilename)
Definition config.cpp:47
tinyxml2::XMLDocument * orig
Definition config.h:92
bool ShallowEqual(const tinyxml2::XMLNode *compare) const
void reload(std::string paramXmlFilename)
Definition config.cpp:42
bool checkpointed
True if the root element is Checkpoint (a checkpoint.xml written by HemoCell).
Definition config.h:99
~Config()
Definition config.cpp:72
tinyxml2::XMLNode * ShallowClone(tinyxml2::XMLDocument *document) const
std::string fileName
Definition config.h:95
hemo::XMLElement operator[](std::string name) const
Definition config.cpp:81
std::string path() const
Path of this element from the root, e.g. hemocell/sim/tmax.
Definition config.cpp:123
T read()
Read the text of this element as a value of type T.
Definition config.h:62
XMLElement(tinyxml2::XMLElement *orig_)
Definition config.h:43
static bool parseValue(const std::string &text, V &value)
Definition config.h:80
std::string where() const
"<file>, line <n>: <path>" of this element, for error messages.
Definition config.cpp:131
tinyxml2::XMLElement * orig
Definition config.h:40
tinyxml2::XMLElement * getOrig()
Definition config.h:70
XMLElement operator[](std::string name) const
Definition config.cpp:113
double T
Definition constant_defaults.h:137
ConfigValues global
Definition config.cpp:204
void loadDirectories(hemo::Config *cfg, bool edit_out_dir)
Definition config.cpp:136
void resetGlobalConfigValues()
Definition config.cpp:206
void loadGlobalConfigValues(hemo::Config *cfg)
Definition config.cpp:216
bool cellsDeletedInfo
Definition config.h:125
bool enableSolidifyMechanics
Definition config.h:129
std::string checkpointDirectory
Definition config.h:133
Profiler statistics
Definition config.h:135
bool hemoCellInitialized
Definition config.h:124
bool enableInteriorViscosity
Definition config.h:131
bool enableCEPACfield
Definition config.h:127