Documentation of CSL
equation.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 EQUATION_H_INCLUDED
24 #define EQUATION_H_INCLUDED
25 
26 #include "abstract.h"
27 
28 namespace cslEquation{
29 
30  enum Type{
31 
32  Regular,
33  Indicial,
34  };
35 }
36 
37 namespace csl {
38 
39 std::ostream& operator<<(std::ostream& fout, cslEquation::Type type);
40 
41 csl::vector_expr listBuildingBlocks(const Expr& expr);
42 
43 class Equation{
44 
45  protected:
46 
47  Expr leftHandSide;
48  Expr rightHandSide;
49 
50  // Contains all concerned building blocks
51  csl::vector_expr buildingBlocks;
52 
53  protected:
54 
55  void searchBuildingBlocks();
56  void isolationStep(const Expr& expr);
57 
58  public:
59 
60  Equation();
61  explicit Equation(const Expr& leftHandSide);
62  Equation(const Expr& leftHandSide, const Expr& rightHandSide);
63  Equation(const Equation&);
64  virtual ~Equation();
65 
66  cslEquation::Type getType() const;
67  Expr getLHS() const;
68  Expr getRHS() const;
69  const csl::vector_expr& getBuildingBlocks() const;
70 
71  void setBuildingBlocks(const csl::vector_expr& t_buildingBlocks);
72 
73  void replace(const Expr& oldE, const Expr& newE);
74  void simplify();
75  void makeLHSimple();
76  void isolate(const Expr& expr);
77 
78  bool operator==(const Equation& eq) const;
79  bool operator!=(const Equation& eq) const;
80 
81  friend std::ostream& operator<<(std::ostream& fout, const Equation& eq);
82 };
83 
84 class IndicialEquation: public Equation{
85 
86  public:
87 
89  explicit IndicialEquation(const Expr& leftHandSide);
90  IndicialEquation(const Expr& leftHandSide, const Expr& rightHandSide);
91  explicit IndicialEquation(const Equation&);
93  ~IndicialEquation(){};
94 };
95 
96 Equation* equation_(const Expr& leftHandSide);
97 Equation* equation_(const Expr& leftHandSide, const Expr& rightHandSide);
98 Equation* equation_(const Equation& eq);
99 Equation* equation_(Equation* eq);
100 } // End of namespace csl
101 
102 #endif
Namespace for csl library.
Definition: abreviation.h:34
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
Definition: equation.h:28
Definition: equation.h:84
bool operator==(const Expr &a, const Expr &b)
see Abstract::operator==()
Definition: abstract.cpp:1398
Base classes for all exprs in the program.
Definition: equation.h:43
bool operator!=(const Expr &a, const Expr &b)
see Abstract::operator!=()
Definition: abstract.cpp:1404
Expression type/.
Definition: abstract.h:1573