OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
Translation.cpp
Go to the documentation of this file.
4 #include "Physics/Physics.h"
5 
6 #include <boost/regex.hpp>
7 #include <string>
8 
9 namespace mslang {
10  void Translation::print(int indentwidth) {
11  std::string indent(indentwidth, ' ');
12  std::string indent2(indentwidth + 8, ' ');
13  std::cout << indent << "translate, " << std::endl;
14  func_m->print(indentwidth + 8);
15  std::cout << ",\n"
16  << indent2 << "dx: " << shiftx_m << ", \n"
17  << indent2 << "dy: " << shifty_m;
18  }
19 
20  void Translation::applyTranslation(std::vector<std::shared_ptr<Base> > &bfuncs) {
21  AffineTransformation shift(Vector_t(1.0, 0.0, -shiftx_m),
22  Vector_t(0.0, 1.0, -shifty_m));
23 
24  const unsigned int size = bfuncs.size();
25  for (unsigned int j = 0; j < size; ++ j) {
26  std::shared_ptr<Base> &obj = bfuncs[j];
27  obj->trafo_m = obj->trafo_m.mult(shift);
28 
29  if (!obj->divisor_m.empty())
30  applyTranslation(obj->divisor_m);
31  }
32  }
33 
34  void Translation::apply(std::vector<std::shared_ptr<Base> > &bfuncs) {
35  func_m->apply(bfuncs);
36  applyTranslation(bfuncs);
37  }
38 
40  Translation *trans = static_cast<Translation*>(fun);
41  if (!parse(it, end, trans->func_m)) return false;
42 
43  ArgumentExtractor arguments(std::string(++ it, end));
44  try {
45  trans->shiftx_m = parseMathExpression(arguments.get(0));
46  trans->shifty_m = parseMathExpression(arguments.get(1));
47  } catch (std::runtime_error &e) {
48  std::cout << e.what() << std::endl;
49  return false;
50  }
51 
52  it += (arguments.getLengthConsumed() + 1);
53 
54  return true;
55  }
56 }
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
double parseMathExpression(const std::string &str)
Definition: matheval.cpp:4
void applyTranslation(std::vector< std::shared_ptr< Base > > &bfuncs)
Definition: Translation.cpp:20
Vektor< double, 3 > Vector_t
Definition: Vektor.h:6
virtual void print(int indent)=0
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
static bool parse(iterator &it, const iterator &end, Function *&fun)
Definition: MSLang.cpp:48
std::string::iterator iterator
Definition: MSLang.h:15
Function * func_m
Definition: Translation.h:8
unsigned int getLengthConsumed() const
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)
Definition: Translation.cpp:34
static bool parse_detail(iterator &it, const iterator &end, Function *&fun)
Definition: Translation.cpp:39
std::string get(unsigned int i) const
virtual void print(int indentwidth)
Definition: Translation.cpp:10
constexpr double e
The value of .
Definition: Physics.h:39
virtual void apply(std::vector< std::shared_ptr< Base >> &bfuncs)=0
end
Definition: multipole_t.tex:9