ASL  0.1.7
Advanced Simulation Library
aslDistanceFunction.h
Go to the documentation of this file.
1 /*
2  * Advanced Simulation Library <http://asl.org.il>
3  *
4  * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5  *
6  *
7  * This file is part of Advanced Simulation Library (ASL).
8  *
9  * ASL is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU Affero General Public License as
11  * published by the Free Software Foundation, version 3 of the License.
12  *
13  * ASL is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 #ifndef ASLDISTANCEFUNCTION_H
25 #define ASLDISTANCEFUNCTION_H
26 
27 #include <acl/aclMath/aclVectorOfElementsDef.h>
28 #include <aslUtilities.h>
29 
30 namespace acl
31 {
32  class KernelConfiguration;
33 }
34 
35 namespace asl {
36 
37  template <typename T> class AVec;
38  class Block;
39 
40  class AbstractDataWithGhostNodes;
42 
45 
48  class DistanceFunction
49  {
50  protected:
51  DistanceFunction();
52  public:
53  virtual ~DistanceFunction();
54  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos)=0;
55  };
56 
59 
61  class DistFBinaryOperation: public DistanceFunction
62  {
63  protected:
64  SPDistanceFunction e1;
65  SPDistanceFunction e2;
66  public:
67  DistFBinaryOperation(SPDistanceFunction a, SPDistanceFunction b);
68  };
69 
71  class DistFUnaryOperation: public DistanceFunction
72  {
73  protected:
74  SPDistanceFunction e1;
75  public:
76  DistFUnaryOperation(SPDistanceFunction a);
77  };
78 
80  class DistFOperationAnd: public DistFBinaryOperation
81  {
82  public:
83  DistFOperationAnd(SPDistanceFunction a, SPDistanceFunction b);
84  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
85  };
86 
88  class DistFOperationOr: public DistFBinaryOperation
89  {
90  public:
91  DistFOperationOr(SPDistanceFunction a, SPDistanceFunction b);
92  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
93  };
94 
96  class DistFOperationInversion: public DistFUnaryOperation
97  {
98  public:
99  DistFOperationInversion(SPDistanceFunction a);
100  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
101  };
102 
103 
105  class DistFSphere: public DistanceFunction
106  {
107  private:
108  acl::VectorOfElements radius;
109  acl::VectorOfElements center;
110  public:
111  DistFSphere(double r, const AVec<double> & c);
112  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
113  };
114 
116 
118  class DistFCylinder: public DistanceFunction
119  {
120  private:
121  acl::VectorOfElements radius;
122  acl::VectorOfElements orientation;
123  acl::VectorOfElements center;
124  public:
130  DistFCylinder(double r, const AVec<double> & l, const AVec<double> & c);
131  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
132  };
133 
135 
137  class DistFCone: public DistanceFunction
138  {
139  private:
140  acl::VectorOfElements tanTheta;
141  acl::VectorOfElements orientation;
143  public:
149  DistFCone(double th, const AVec<double> & l, const AVec<double> & a);
150  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
151  };
152 
154 
156  class DistFPlane: public DistanceFunction
157  {
158  private:
159  acl::VectorOfElements normal;
161  public:
162  DistFPlane(AVec<double> n, AVec<double> p0);
163  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
164  };
165 
166 
169  class DistFNormalization: public DistFUnaryOperation
170  {
171  protected:
172  acl::VectorOfElements factor;
173  public:
174  static const double scaleFactor;
175  DistFNormalization(SPDistanceFunction a, double dx);
176  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
177  };
178 
181  class DataInterpolation: public DistanceFunction
182  {
183  protected:
184  SPAbstractDataWithGhostNodes data;
185 
186  public:
187  DataInterpolation(SPAbstractDataWithGhostNodes d);
188  virtual acl::VectorOfElements getDistance(const acl::VectorOfElements & pos);
189  };
190 
191 } // asl
192 
193 #endif // ASLDISTANCEFUNCTION
Advanced Simulation Library.
Definition: aslDataInc.h:30
Advanced Computational Language.
Definition: acl.h:40
std::shared_ptr< DistanceFunction > SPDistanceFunction
Definition: aslGeomInc.h:44
acl::VectorOfElements dx(const TemplateVE &a)
differential operator
The class represents several Element.
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50