Documentation of CSL
element.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef ELEMENT_H_INCLUDED
24 #define ELEMENT_H_INCLUDED
25 
26 #include "parent.h"
27 #include "literal.h"
28 #include "numerical.h"
29 
30 namespace csl {
31 
38 
39  protected:
40 
44 
45  public:
46 
49  explicit
51 
55  explicit
57 
60 
63  Parent getParent() const override;
64 
65  Parent_info getParent_info() const override;
66 
67  std::string const &getName() const override;
68 
69  std::string const &getLatexName() const override;
70 
71  bool getCommutable() const override;
72 
73  csl::ComplexProperty getComplexProperty() const override;
74 
75  std::vector<Parent> getSubSymbols() const override;
76 
81  void setParent(const Parent& t_parent) override;
82 
83  void setName(const std::string& t_name) override;
84 
85  void setCommutable(bool t_commutable) override;
86 
87  void setComplexProperty(csl::ComplexProperty t_prop) override;
88 
89  int isPolynomial(Expr_info variable) const override;
90 
91  std::optional<Expr> getPolynomialTerm(
92  Expr_info variable, int order) const override;
93 
94  std::optional<Expr> evaluate(
95  csl::eval::mode user_mode = csl::eval::base
96  ) const override;
97 };
98 
99 } // End of namespace std
100 
101 #endif
bool getCommutable() const override
Allows to know if the object commutes with all the others.
Definition: element.cpp:58
std::shared_ptr< AbstractParent > parent
Pointer to the parent that gave birth to this element.
Definition: element.h:43
void setParent(const Parent &t_parent) override
Changes the Parent of the Element, as the name and the commutability property from those of t_parent...
Definition: element.cpp:73
Definition: buildingBlock.h:69
Namespace for csl library.
Definition: abreviation.h:34
void setCommutable(bool t_commutable) override
Allows the abstract to commute or not.
Definition: element.cpp:83
Definition: parent.h:439
Base classes for parents and elements.
std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const override
Evaluates the Abstract.
Definition: element.cpp:111
AbstractElement()
Definition: element.cpp:24
Parent getParent() const override
Definition: element.cpp:38
ComplexProperty
Contains all possible complex properties of objects. Real, purely imaginary, or complex.
Definition: enum.h:127
~AbstractElement()
Destructor.
Definition: element.h:59
std::optional< Expr > getPolynomialTerm(Expr_info variable, int order) const override
Calculates and returns the polynomial term corresponding to *this with the variable t_variable at ord...
Definition: element.cpp:101
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
Base class for all parents (indicial, fields etc). All parents derive from this class.
Definition: parent.h:81
int isPolynomial(Expr_info variable) const override
Determines if the expression is a mononomial term in expr, i.e. a term of the form C*expr^n with C in...
Definition: element.cpp:93
std::string const & getName() const override
Returns the Abstract&#39;s name.
Definition: element.cpp:48
Base class for all elements. Objects that are constructed by a parent (see AbstractParent) when the u...
Definition: element.h:37
void setName(const std::string &t_name) override
Change the name of the abstract.
Definition: element.cpp:78