ASL  0.1.7
Advanced Simulation Library
aslBCond.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 ASLBCOND_H
25 #define ASLBCOND_H
26 
27 #include "aslNumMethod.h"
28 #include <data/aslBlocks.h>
29 #include <acl/aclMath/aclVectorOfElementsDef.h>
30 
31 
32 namespace acl
33 {
34  class ExpressionContainer;
35 }
36 
37 namespace asl
38 {
39 
40  class VectorTemplate;
41  template <typename V> class DataWithGhostNodes;
42  typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
44  typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
46  class TemplateVE;
47  class DistanceFunction;
49 
50 
51  class AbstractDataWithGhostNodes;
53 
55 
58  class BCond: public NumMethod
59  {
60  protected:
61  Block block;
62  const VectorTemplate * const templ;
63 
64  std::vector<int> indices;
65  std::vector<int> directions;
66  std::vector<double> fractions;
67  std::vector<int> neighbourIndices;
68 
69  acl::SPVectorOfElementsData indicesACL;
70  acl::SPVectorOfElementsData neighbourIndicesACL;
71  acl::SPVectorOfElementsData directionsACL;
72  acl::SPVectorOfElementsData fractionsACL;
73 
74  void loadIndicesToACL();
75  void loadNeighbourIndicesToACL();
76  void loadDirectionsToACL();
77  void loadfractionsACL();
78 
79  public:
80  BCond(const Block & b);
81  BCond(const Block & b, const VectorTemplate * const t);
82  void addPoint(AVec<int> a,int d=0,double fr=0);
83  const Block & getBlock();
84  inline const VectorTemplate * getVT();
85 
86  };
87 
89 
91 
100  class BCondWithMap:public NumMethod
101  {
102  protected:
104  bool pointsListFlag;
105  acl::VectorOfElements currentPoint;
106  const VectorTemplate * const templ;
107 
109  Block bl;
111  SPAbstractDataWithGhostNodes map;
112  SPDistanceFunction mapDF;
114  SPAbstractDataWithGhostNodes computationalDomain;
115  SPDistanceFunction computationalDomainDF;
116 
117  unique_ptr<TemplateVE> mapTVE;
118  unique_ptr<TemplateVE> cDomainTVE;
119 
121  virtual void initMapInfrastructure(acl::ExpressionContainer & ec);
123 
126  acl::VectorOfElements isGhostNode(unsigned int i);
128 
133 
136  acl::VectorOfElements isComputationNode(const vector<unsigned int> & ii);
141 
146  BCondWithMap(SPAbstractDataWithGhostNodes m, const VectorTemplate * const vt);
151  BCondWithMap(SPDistanceFunction m, const Block & b, const VectorTemplate * const vt);
157  BCondWithMap(SPAbstractDataWithGhostNodes m,
158  SPAbstractDataWithGhostNodes cd,
159  const VectorTemplate * const vt);
165  BCondWithMap(SPAbstractDataWithGhostNodes m,
166  SPDistanceFunction cd,
167  const VectorTemplate * const vt);
174  BCondWithMap(SPDistanceFunction m,
175  SPDistanceFunction cd,
176  const Block & b,
177  const VectorTemplate * const vt);
178  public:
179  inline const VectorTemplate * getVT();
180  };
181 
182 
184 
189  class BCondConnector:public NumMethod
190  {
191  protected:
192  Block block1;
193  Block block2;
194 
195  std::vector<int> indices1;
196  std::vector<int> directions1;
197  std::vector<int> indices2;
198  std::vector<int> directions2;
199 
200  acl::SPVectorOfElementsData indices1ACL;
201  acl::SPVectorOfElementsData directions1ACL;
202  acl::SPVectorOfElementsData indices2ACL;
203  acl::SPVectorOfElementsData directions2ACL;
204 
205  void loadIndicesToACL();
206  void loadDirectionsToACL();
207  public:
208  BCondConnector(const Block & b1, const Block & b2);
209  void addGhostPoint(AVec<int> a1,AVec<int> a2);
210  void addGhostPoint(AVec<int> a1,int d1,AVec<int> a2,int d2);
211  const Block & getBlock1();
212  const Block & getBlock2();
213  };
214 
215 
217 
227  class BCondSlice:public NumMethod
228  {
229  protected:
230  Block block;
231  const VectorTemplate * const templ;
232 
233  int pointB;
234  int pointE;
235  AVec<int> sliceDimentions;
236  AVec<int> sliceIncrements;
237  int direction;
238 
239  public:
240  BCondSlice(const Block & b);
241  BCondSlice(const Block & b, const VectorTemplate * const t);
242  void addGhostSlice(AVec<int> pB,AVec<int> pE, int dir);
243  const Block & getBlock();
244  };
245 
247 
258  class BCondConnectorSlice:public NumMethod
259  {
260  protected:
261  Block block1;
262  Block block2;
263  const VectorTemplate * const templ;
264 
265  int point1B;
266  int point1E;
267  AVec<int> sliceDimentions1;
268  AVec<int> sliceIncrements1;
269  int direction1;
270 
271  int point2B;
272  int point2E;
273  AVec<int> sliceDimentions2;
274  AVec<int> sliceIncrements2;
275  int direction2;
276 
277  public:
278  BCondConnectorSlice(const Block & b1, const Block & b2, const VectorTemplate *const t);
279  void addGhostSlice1(AVec<int> pB,AVec<int> pE, int dir);
280  void addGhostSlice2(AVec<int> pB,AVec<int> pE, int dir);
281  const Block & getBlock1();
282  const Block & getBlock2();
283  };
284 
286 
292  class BCondDynamic:public NumMethod
293  {
294  protected:
295  Block block;
296  const VectorTemplate * const templ;
297 
298  acl::SPVectorOfElementsData pointsACL;
299  acl::SPVectorOfElementsData normalsACL;
300 
301  public:
302  BCondDynamic(const Block & b);
303  BCondDynamic(const Block & b, const VectorTemplate * const t);
304  const Block & getBlock();
305  inline const VectorTemplate * getVT();
306  };
307 
309  enum SlicesNames {X0, XE, Y0, YE, Z0, ZE};
310 
313  void addSliceX0(BCond &);
314  void addSliceXE(BCond &);
315  void addSliceY0(BCond &);
316  void addSliceYE(BCond &);
317  void addSliceZ0(BCond &);
318  void addSliceZE(BCond &);
320 
321  void addSlices(BCond &, const vector<SlicesNames> &);
322 
325  void addSliceX(BCond &, int x);
326  void addSliceY(BCond &, int y);
327  void addSliceZ(BCond &, int z);
329 
332  void addSliceX0(BCondSlice &);
333  void addSliceXE(BCondSlice &);
334  void addSliceY0(BCondSlice &);
335  void addSliceYE(BCondSlice &);
336  void addSliceZ0(BCondSlice &);
337  void addSliceZE(BCondSlice &);
339 
340 // --------------------------- Implementation ----------------------
341  inline const VectorTemplate * BCond::getVT()
342  {
343  return templ;
344  }
345 
346  inline const VectorTemplate * BCondWithMap::getVT()
347  {
348  return templ;
349  }
350 
351 }
352 
353 #endif //ASLBCOND_H
acl::VectorOfElements isComputationNode(TemplateVE &distanceTVE, unsigned int i)
returns expression corresponding to check if the node in i^th direction is computation one ...
void addSliceZ(BCond &, int z)
Advanced Simulation Library.
Definition: aslDataInc.h:30
Advanced Computational Language.
Definition: acl.h:40
void addSliceXE(BCondSlice &)
std::shared_ptr< DistanceFunction > SPDistanceFunction
Definition: aslGeomInc.h:44
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData
Definition: aslGenerators.h:47
Virtual class describes general interface for boundary conditions.
Definition: aslBCond.h:58
std::shared_ptr< BCond > SPBCond
Definition: aslBCond.h:88
void addSlices(BCond &, const vector< SlicesNames > &)
DataWithGhostNodes< acl::VectorOfElementsData > DataWithGhostNodesACLData
Definition: aslGenerators.h:45
void addSliceZ0(BCondSlice &)
SlicesNames
defines names of walls of a box
Definition: aslBCond.h:309
The class represents several Element.
void addSliceX0(BCondSlice &)
void addSliceYE(BCondSlice &)
void addSliceZE(BCondSlice &)
void addSliceY(BCond &, int y)
void addSliceX(BCond &, int x)
std::shared_ptr< T > map(ElementData m)
Definition: aclMemBlock.h:68
Virtual class describes general interface for boundary conditions.
Definition: aslBCond.h:227
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50
DataWithGhostNodes< acl::VectorOfElements > DataWithGhostNodesACL
Definition: aslGenerators.h:48
std::shared_ptr< DataWithGhostNodesACL > SPDataWithGhostNodesACL
Definition: aslGenerators.h:49
Defines set of vectros with several properties.
Definition: aslTemplates.h:87
acl::VectorOfElements isGhostNode(TemplateVE &distanceTVE, unsigned int i)
returns expression corresponding to check if the node in i^th direction is ghost one ...
void addSliceY0(BCondSlice &)