20 #include "callstack.h"
23 #include "exceptions.h"
25 #include <xercesc/util/PlatformUtils.hpp>
35 this->default_val = default_val;
36 this->user_set =
false;
47 XMLPlatformUtils::Initialize();
49 this->text_parameters.insert(std::pair<
Hermes2DApiParam, Parameter<std::string>*>(Hermes::Hermes2D::xmlSchemasDirPath,
new Parameter<std::string>(
std::string(H2D_XML_SCHEMAS_DIRECTORY))));
51 ss << H2D_PRECALCULATED_FORMS_DIRECTORY;
52 if (ss.str().at(ss.str().length() - 1) ==
'\\' || ss.str().at(ss.str().length() - 1) ==
'/')
53 this->text_parameters.insert(std::pair<
Hermes2DApiParam, Parameter<std::string>*>(Hermes::Hermes2D::precalculatedFormsDirPath,
new Parameter<std::string>(
std::string(H2D_PRECALCULATED_FORMS_DIRECTORY))));
57 this->text_parameters.insert(std::pair<
Hermes2DApiParam, Parameter<std::string>*>(Hermes::Hermes2D::precalculatedFormsDirPath,
new Parameter<std::string>(
std::string(ss.str()))));
60 XMLPlatformUtils::Terminate();
64 pj_caching_pool_init(&Hermes2DMemoryPoolCache, NULL, 1024 * 1024 * 1024);
70 for (std::map<Hermes2DApiParam, Parameter<std::string>*>::const_iterator it = this->text_parameters.begin(); it != this->text_parameters.end(); ++it)
73 for (std::map<Hermes2DApiParam, Parameter<int>*>::const_iterator it = this->integral_parameters.begin(); it != this->integral_parameters.end(); ++it)
77 pj_caching_pool_destroy(&Hermes2DMemoryPoolCache);
81 int Api2D::get_integral_param_value(Hermes2DApiParam param)
83 if (this->integral_parameters.find(param) == integral_parameters.end())
84 throw Hermes::Exceptions::Exception(
"Wrong Hermes::Api parameter name:%i", param);
85 if (this->integral_parameters.find(param)->second->user_set)
86 return this->integral_parameters.find(param)->second->user_val;
88 return this->integral_parameters.find(param)->second->default_val;
91 void Api2D::set_integral_param_value(Hermes2DApiParam param,
int value)
93 if (this->integral_parameters.find(param) == integral_parameters.end())
94 throw Hermes::Exceptions::Exception(
"Wrong Hermes::Api parameter name:%i", param);
95 this->integral_parameters.find(param)->second->user_set =
true;
96 this->integral_parameters.find(param)->second->user_val = value;
99 std::string Api2D::get_text_param_value(Hermes2DApiParam param)
101 if (this->text_parameters.find(param) == text_parameters.end())
102 throw Hermes::Exceptions::Exception(
"Wrong Hermes::Api parameter name:%i", param);
103 if (this->text_parameters.find(param)->second->user_set)
104 return this->text_parameters.find(param)->second->user_val;
106 return this->text_parameters.find(param)->second->default_val;
109 void Api2D::set_text_param_value(Hermes2DApiParam param,
std::string value)
111 if (this->text_parameters.find(param) == text_parameters.end())
112 throw Hermes::Exceptions::Exception(
"Wrong Hermes::Api parameter name:%i", param);
113 this->text_parameters.find(param)->second->user_val = value;
114 this->text_parameters.find(param)->second->user_set =
true;
119 pj_caching_pool HERMES_API Hermes2DMemoryPoolCache;
HERMES_API Hermes::Hermes2D::Api2D Hermes2DApi
Global instance used inside Hermes which is also accessible to users.
Hermes2DApiParam
Enumeration of potential keys in the Api2D::parameters storage.
API Class containing settings for the whole Hermes2D.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.