OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
MSLang.h
Go to the documentation of this file.
1 #ifndef MSLANG_H
2 #define MSLANG_H
3 
6 #include "Algorithms/Vektor.h"
7 
8 #include <string>
9 #include <iostream>
10 #include <fstream>
11 #include <list>
12 #include <memory>
13 
14 namespace mslang {
16 
17  inline
19  v[2] = 0.0;
20  return euclidean_norm(v);
21  }
22 
23  struct Base;
24 
25  struct Function {
26  virtual ~Function() {};
27 
28  virtual void print(int indent) = 0;
29  virtual void apply(std::vector<std::shared_ptr<Base>> &bfuncs) = 0;
30 
31  static bool parse(iterator &it, const iterator &end, Function* &fun);
32 
33  static const std::string UDouble;
34  static const std::string Double;
35  static const std::string UInt;
36  static const std::string FCall;
37  };
38 
39  struct Base: public Function {
42  std::vector<std::shared_ptr<Base> > divisor_m;
43 
44  Base():
45  trafo_m()
46  { }
47 
48  Base(const Base &right):
49  trafo_m(right.trafo_m),
50  bb_m(right.bb_m)
51  { }
52 
53  virtual ~Base() {
54  // for (auto item: divisor_m) {
55  // item.reset();
56  // }
57  divisor_m.clear();
58  }
59 
60  virtual std::shared_ptr<Base> clone() const = 0;
61  virtual void writeGnuplot(std::ofstream &out) const = 0;
62  virtual void computeBoundingBox() = 0;
63  virtual bool isInside(const Vector_t &R) const = 0;
64  virtual void divideBy(std::vector<std::shared_ptr<Base> > &divisors) {
65  for (auto item: divisors) {
66  if (bb_m.doesIntersect(item->bb_m)) {
67  divisor_m.emplace_back(item->clone());
68  }
69  }
70  }
71  };
72 
73  bool parse(std::string str, Function* &fun);
74 }
75 
76 #endif
bool doesIntersect(const BoundingBox2D &bb) const
virtual void divideBy(std::vector< std::shared_ptr< Base > > &divisors)
Definition: MSLang.h:64
static const std::string FCall
Definition: MSLang.h:36
double euclidean_norm2D(Vector_t v)
Definition: MSLang.h:18
AffineTransformation trafo_m
Definition: MSLang.h:40
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition: LICENSE:43
virtual void writeGnuplot(std::ofstream &out) const =0
virtual void computeBoundingBox()=0
virtual ~Function()
Definition: MSLang.h:26
static const std::string Double
Definition: MSLang.h:34
Base(const Base &right)
Definition: MSLang.h:48
virtual void print(int indent)=0
std::vector< std::shared_ptr< Base > > divisor_m
Definition: MSLang.h:42
static const std::string UInt
Definition: MSLang.h:35
BoundingBox2D bb_m
Definition: MSLang.h:41
static bool parse(iterator &it, const iterator &end, Function *&fun)
Definition: MSLang.cpp:48
std::string::iterator iterator
Definition: MSLang.h:15
T euclidean_norm(const Vector< T > &)
Euclidean norm.
Definition: Vector.h:243
bool parse(std::string str, Function *&fun)
Definition: MSLang.cpp:37
virtual std::shared_ptr< Base > clone() const =0
static const std::string UDouble
Definition: MSLang.h:33
virtual bool isInside(const Vector_t &R) const =0
virtual ~Base()
Definition: MSLang.h:53
virtual void apply(std::vector< std::shared_ptr< Base >> &bfuncs)=0
end
Definition: multipole_t.tex:9