46#include <ginac/ginac.h>
47#include <xercesc/dom/DOM.hpp>
51XERCES_CPP_NAMESPACE_USE
56typedef double (*FUNCP_4P) (double, double, double, double);
70 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const double& val) {
Initialize(name,proto,pub,obs,val); };
71 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const int& val) {
Initialize(name,proto,pub,obs,val); };
72 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const long& val) {
Initialize(name,proto,pub,obs,val); };
73 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const unsigned& val) {
Initialize(name,proto,pub,obs,val); };
74 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const bool& val) {
Initialize(name,proto,pub,obs,val); };
75 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const std::string& val) {
Initialize(name,proto,pub,obs,val); };
76 Attribute (
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const PulseAxis& val) {
Initialize(name,proto,pub,obs,val); };
237 bool SetMember (std::string expr,
const std::vector<Attribute*>& obs_attribs,
const std::vector<std::string>& obs_attrib_keyword,
bool verbose =
false);
324 template <
typename T>
bool Notify (
const T& val) {
329 for (
unsigned int i=0; i<
m_observers.size(); i++) {
332 if (
m_observers.at(i)->GetNumberFunctionPointers()>0) {
349 template <
typename T>
bool NewState(
const T& val) {
350 if ( *((T*)
m_backup) == val )
return false;
399 if (std::isnan(d))
return 0;
412 template <
typename T>
void Initialize(
const std::string& name,
Prototype* proto,
const bool& pub,
const bool& obs,
const T& val){
452 std::vector<GiNaC::FUNCP_1P>
m_fp;
Implementation of JEMRIS Declarations.
Implementation of JEMRIS StrX.
Attribute class. Attributes are private member variables of a Prototype which are accessible through ...
Definition Attribute.h:62
double m_imaginary
The imaginary part of complex expression evaluation.
Definition Attribute.h:457
Prototype * m_prototype
Pointer to the Prototype object, which instantiated this attribute.
Definition Attribute.h:442
bool m_observable
Indicating whether the attribute is observable.
Definition Attribute.h:436
bool IsDynamic() const
Check, if this attribute is dynamic. This is needed for exporting static XML Files of the Sequence.
Definition Attribute.h:144
bool m_dynamic
Indicating whether the attribute dynamically changes its value in runtime.
Definition Attribute.h:437
std::vector< Attribute * > GetSubjects()
Return the subjects.
Definition Attribute.h:256
bool m_complex
If symbolic expressions are complex, the imaginary part is considered.
Definition Attribute.h:456
std::vector< Attribute * > GetObservers()
Return the observers.
Definition Attribute.h:251
Prototype * GetPrototype() const
Get the pointer to the Prototype to which this attribute belongs.
Definition Attribute.h:208
void SetDiff(int val=0, std::string sym="diff")
Set the number of symbolic differentiations of the attribute's expression.
Definition Attribute.h:180
unsigned int m_num_fp
Number of GiNaC expression function pointers owned by this attribute.
Definition Attribute.h:449
void SetObservable(bool val)
Set this attribute to be observable by other attributes.
Definition Attribute.h:136
GiNaC::lst m_symlist
GiNaC list of all symbols involved in the calculation.
Definition Attribute.h:447
virtual ~Attribute()
Destructor deletes local copies of Prototype member variables.
Definition Attribute.cpp:37
bool m_public
Indicating whether the attribute is accessible through XML.
Definition Attribute.h:435
bool NewState(const T &val)
Check the state of the value represented by this attribute.
Definition Attribute.h:349
int GetNumberFunctionPointers()
Return the total number of function pointers.
Definition Attribute.h:299
bool Notify(const T &val)
Notify all observers.
Definition Attribute.h:324
void StepCurrentFunctionPointer()
Increase the counter to the current function pointer by one.
Definition Attribute.h:314
int m_diff
Number of symbolic differentiations of the attribute's expression.
Definition Attribute.h:455
GiNaC::ex m_expression
GiNaC Mathematical expression of the attribute.
Definition Attribute.h:446
bool IsObservable() const
Check, if this attribute is observable by other attributes.
Definition Attribute.h:129
void WriteMember(const T &val)
write the member variable of this attribute
Definition Attribute.h:387
int GetDiff()
Get the number of symbolic differentiations of the attribute's expression.
Definition Attribute.h:158
void UpdatePrototype()
Update a Prototype which holds an observing Attribute.
Definition Attribute.cpp:71
std::string m_sym_diff
GiNaC symbol name for symbolic derivative.
Definition Attribute.h:444
void EvalExpression()
Evaluate the GiNaC expression of this attribute.
Definition Attribute.cpp:156
std::string m_formula
Mathematical formula of the attribute (in XML) for GiNaC evaluation.
Definition Attribute.h:445
void SetPublic(bool val)
Set this attribute to be public for manipulation through XML.
Definition Attribute.h:122
void * m_address
Pointer to the Prototype member variable, which is represented by this attribute.
Definition Attribute.h:439
std::string GetFormula()
Get the GiNaC formula of this attribute.
Definition Attribute.h:222
void ResetCurrentFunctionPointer()
Set the counter to the current function pointer to zero.
Definition Attribute.h:309
bool HasGinacExCompiler()
True, if GiNaC external compiler is available on this system.
Definition Attribute.h:294
std::vector< bool > m_compiled
True, if GiNaC expression is compiled successfully in run time.
Definition Attribute.h:451
T GetMember()
get the member variable of this attribute
Definition Attribute.h:397
bool IsPublic() const
Check, if this attribute is public for manipulation through XML.
Definition Attribute.h:115
std::string GetSymbol()
Get the GiNaC symbol of this attribute.
Definition Attribute.h:215
std::string m_name
Name of the attribute (in XML).
Definition Attribute.h:438
void SetDynamic(bool val)
Set this attribute to be dynamic.
Definition Attribute.h:151
void Initialize(const std::string &name, Prototype *proto, const bool &pub, const bool &obs, const T &val)
Initialize private members.
Definition Attribute.h:412
std::vector< Attribute * > m_subjects
Vector of attributes under observation by this attribute.
Definition Attribute.h:458
Attribute(const std::string &name, Prototype *proto, const bool &pub, const bool &obs, const double &val)
Constructors: must provide name (XML), Prototype, public/observable status, and the member variable.
Definition Attribute.h:70
double EvalCompiledExpression(double const val, std::string const attrib)
Evaluate the compiled GiNaC expression of this attribute.
Definition Attribute.cpp:207
void AttachSubject(Attribute *attrib)
Append a new subject observed by this this attribute.
Definition Attribute.cpp:59
std::string m_datatype
Type of the Prototype member variable, which is represented by this attribute.
Definition Attribute.h:440
bool IsComplex() const
Check, if this attribute's evaluation is complex.
Definition Attribute.h:172
void * GetAddress() const
Get the pointer to the value represented by this attribute.
Definition Attribute.h:201
bool SetMember(std::string expr, const std::vector< Attribute * > &obs_attribs, const std::vector< std::string > &obs_attrib_keyword, bool verbose=false)
Set the Prototype's private member represented by this attribute. The function performs the following...
Definition Attribute.cpp:86
void * m_backup
Backup value of the Prototype member variable, which is represented by this attribute.
Definition Attribute.h:441
std::vector< GiNaC::FUNCP_1P > m_fpi
Function pointers to GiNaC expression evaluation of imaginary part.
Definition Attribute.h:453
double GetImaginary()
Get the imaginary part the attribute's evaluation.
Definition Attribute.h:165
std::vector< GiNaC::FUNCP_1P > m_fp
Function pointers to GiNaC expression evaluation.
Definition Attribute.h:452
Attribute(const std::string &name, Prototype *proto, const bool &pub, const bool &obs)
Constructor for an unobservable Attribute which does not represent a member variable.
Definition Attribute.h:82
std::string m_symbol_name
GiNaC symbol name of the attribute.
Definition Attribute.h:443
int GetCurrentFunctionPointer()
Return the counter to the current function pointer.
Definition Attribute.h:304
bool m_ginac_excomp
True, if GiNaC external compiler is available on this system.
Definition Attribute.h:448
unsigned int m_cur_fp
Current GiNaC expression function pointer.
Definition Attribute.h:450
void AttachObserver(Attribute *attrib)
Append a new observer of this attribute.
Definition Attribute.cpp:48
FUNCP_4P m_nlgfp
Function pointer to GiNaC expression evaluation of nonlinear gradients.
Definition Attribute.h:454
double EvalCompiledNLGExpression(double const x, double const y, double const z, double const g)
Evaluate the compiled GiNaC expression of the NLG attribute (nonlinear gradients)
Definition Attribute.cpp:273
std::vector< Attribute * > m_observers
Vector of attributes observing this attribute
Definition Attribute.h:459
std::string GetName() const
Get the name of the attribute.
Definition Attribute.h:187
std::string GetTypeID() const
Get the type ID of the attribute.
Definition Attribute.h:194
Prototype super class.
Definition Prototype.h:71