hemocell
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1/*
2This file is part of the HemoCell library
3
4HemoCell is developed and maintained by the Computational Science Lab
5in the University of Amsterdam. Any questions or remarks regarding this library
6can be sent to: info@hemocell.eu
7
8When using the HemoCell library in scientific work please cite the
9corresponding paper: https://doi.org/10.3389/fphys.2017.00563
10
11The HemoCell library is free software: you can redistribute it and/or
12modify it under the terms of the GNU Affero General Public License as
13published by the Free Software Foundation, either version 3 of the
14License, or (at your option) any later version.
15
16The library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU Affero General Public License for more details.
20
21You should have received a copy of the GNU Affero General Public License
22along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24#ifndef HEMOCELL_CONFIG_H
25#define HEMOCELL_CONFIG_H
26
27#include "profiler.h"
28
29#include "external/tinyxml2/tinyxml2.h"
30#include "constant_defaults.h"
31#include <string>
32#include <iostream>
33#include <sstream>
34
35namespace hemo {
36
37 class XMLElement {
38 tinyxml2::XMLElement * orig;
39 public:
40 XMLElement(tinyxml2::XMLElement * orig_) : orig(orig_){}
41 XMLElement operator[] (std::string name) const;
42
43 template<typename T>
44 T read() {
45 std::stringstream value(orig->GetText());
46 T ret = T();
47 if (!(value>>ret)) {
48 std::cout << "Cannot convert value from XML element" << std::endl;
49 }
50 return ret;
51 }
52
53 tinyxml2::XMLElement * getOrig() { return orig;}
54
55 };
56
57
58 class Config {
59 tinyxml2::XMLDocument * orig;
60 public:
62
63 Config(std::string paramXmlFilename);
64 ~Config();
65
66 void reload(std::string paramXmlFilename);
67
68 hemo::XMLElement operator[] (std::string name) const;
69
70 tinyxml2::XMLNode* ShallowClone(tinyxml2::XMLDocument* document) const;
71 bool ShallowEqual(const tinyxml2::XMLNode* compare ) const;
72 bool Accept( tinyxml2::XMLVisitor* visitor ) const;
73 private:
74 void load(std::string paramXmlFilename);
75 };
76
77void loadDirectories(hemo::Config * cfg, bool edit_out_dir = true);
78
80 bool hemoCellInitialized = false; // Keep track since two hemocells cannot run at the same time, because of static variables
81 bool cellsDeletedInfo = false;
82
83 bool enableCEPACfield = false;
84
86
88
89 std::string checkpointDirectory = "./checkpoint/";
90
92};
93
94extern ConfigValues global;
95
97
98}
99#endif
Definition config.h:58
bool Accept(tinyxml2::XMLVisitor *visitor) const
void load(std::string paramXmlFilename)
Definition config.cpp:45
tinyxml2::XMLDocument * orig
Definition config.h:59
bool ShallowEqual(const tinyxml2::XMLNode *compare) const
void reload(std::string paramXmlFilename)
Definition config.cpp:40
bool checkpointed
Definition config.h:61
~Config()
Definition config.cpp:61
tinyxml2::XMLNode * ShallowClone(tinyxml2::XMLDocument *document) const
hemo::XMLElement operator[](std::string name) const
Definition config.cpp:70
Definition profiler.h:47
Definition config.h:37
T read()
Definition config.h:44
XMLElement(tinyxml2::XMLElement *orig_)
Definition config.h:40
tinyxml2::XMLElement * orig
Definition config.h:38
tinyxml2::XMLElement * getOrig()
Definition config.h:53
XMLElement operator[](std::string name) const
Definition config.cpp:80
double T
Definition constant_defaults.h:118
Definition config.cpp:34
ConfigValues global
Definition config.cpp:176
void loadDirectories(hemo::Config *cfg, bool edit_out_dir)
Definition config.cpp:89
void loadGlobalConfigValues(hemo::Config *cfg)
Definition config.cpp:178
Definition config.h:79
bool cellsDeletedInfo
Definition config.h:81
bool enableSolidifyMechanics
Definition config.h:85
std::string checkpointDirectory
Definition config.h:89
Profiler statistics
Definition config.h:91
bool hemoCellInitialized
Definition config.h:80
bool enableInteriorViscosity
Definition config.h:87
bool enableCEPACfield
Definition config.h:83