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>
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;
43  typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
44  typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
45  typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
46  class TemplateVE;
47  class DistanceFunction;
48  typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;
49 
50 
51  class AbstractDataWithGhostNodes;
52  typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
53 
55 
58  class BCond: public NumMethod
59  {
60  protected:
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 
73 
74  void loadIndicesToACL();
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 
88  typedef std::shared_ptr<BCond> SPBCond;
89 
91 
100  class BCondWithMap:public NumMethod
101  {
102  protected:
106  const VectorTemplate * const templ;
107 
116 
117  unique_ptr<TemplateVE> mapTVE;
118  unique_ptr<TemplateVE> cDomainTVE;
119 
123 
126  acl::VectorOfElements isGhostNode(unsigned int i);
128 
133 
136  acl::VectorOfElements isComputationNode(const vector<unsigned int> & ii);
141 
151  BCondWithMap(SPDistanceFunction m, const Block & b, const VectorTemplate * const vt);
159  const VectorTemplate * const vt);
166  SPDistanceFunction cd,
167  const VectorTemplate * const vt);
176  const Block & b,
177  const VectorTemplate * const vt);
178  public:
179  inline const VectorTemplate * getVT();
180  };
181 
182 
184 
190  {
191  protected:
194 
195  std::vector<int> indices1;
196  std::vector<int> directions1;
197  std::vector<int> indices2;
198  std::vector<int> directions2;
199 
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:
231  const VectorTemplate * const templ;
232 
233  int pointB;
234  int pointE;
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 
259  {
260  protected:
263  const VectorTemplate * const templ;
264 
265  int point1B;
266  int point1E;
270 
271  int point2B;
272  int point2E;
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:
296  const VectorTemplate * const templ;
297 
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 
347  {
348  return templ;
349  }
350 
351 }
352 
353 #endif //ASLBCOND_H
acl::SPVectorOfElementsData neighbourIndicesACL
Definition: aslBCond.h:70
const VectorTemplate * getVT()
Definition: aslBCond.h:346
AVec< int > sliceIncrements1
Definition: aslBCond.h:268
std::vector< int > indices1
Definition: aslBCond.h:195
acl::SPVectorOfElementsData indices2ACL
Definition: aslBCond.h:202
virtual void initMapInfrastructure(acl::ExpressionContainer &ec)
initialize mapTVE and cDomainTVE
void addSliceX0(BCond &)
const Block & getBlock()
Block bl
block
Definition: aslBCond.h:109
std::vector< double > fractions
Definition: aslBCond.h:66
void addSliceXE(BCond &)
std::vector< int > indices2
Definition: aslBCond.h:197
const VectorTemplate * getVT()
void addSliceZ(BCond &, int z)
Advanced Simulation Library.
Definition: aslDataInc.h:30
Advanced Computational Language.
Definition: acl.h:40
const Block & getBlock()
BCondConnector(const Block &b1, const Block &b2)
BCondWithMap(SPAbstractDataWithGhostNodes m, const VectorTemplate *const vt)
unique_ptr< TemplateVE > mapTVE
Definition: aslBCond.h:117
std::shared_ptr< DistanceFunction > SPDistanceFunction
Definition: aslGeomInc.h:44
void addSliceZ0(BCond &)
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData
Definition: aslGenerators.h:47
const Block & getBlock()
void addSliceY0(BCond &)
void addGhostPoint(AVec< int > a1, AVec< int > a2)
AVec< int > sliceIncrements
Definition: aslBCond.h:236
Virtual class describes general interface for boundary conditions.
Definition: aslBCond.h:58
std::vector< int > directions
Definition: aslBCond.h:65
void addSliceZE(BCond &)
void loadfractionsACL()
Block block
Definition: aslBCond.h:61
bool pointsListFlag
flag whether the point list to be generated or not
Definition: aslBCond.h:104
std::vector< int > directions1
Definition: aslBCond.h:196
AVec< int > sliceDimentions1
Definition: aslBCond.h:267
Virtual class describes general interface for boundary conditions which connect two datas.
Definition: aslBCond.h:189
acl::SPVectorOfElementsData directionsACL
Definition: aslBCond.h:71
Virtual class describes general interface for boundary conditions.
Definition: aslBCond.h:292
acl::VectorOfElements currentPoint
Definition: aslBCond.h:105
void addSlices(BCond &, const vector< SlicesNames > &)
BCondConnectorSlice(const Block &b1, const Block &b2, const VectorTemplate *const t)
acl::VectorOfElements isComputationNode()
returns expression corresponding to check if the current node is computation one
const VectorTemplate *const templ
Definition: aslBCond.h:62
std::vector< int > indices
Definition: aslBCond.h:64
const VectorTemplate *const templ
Definition: aslBCond.h:106
void addGhostSlice(AVec< int > pB, AVec< int > pE, int dir)
DataWithGhostNodes< acl::VectorOfElementsData > DataWithGhostNodesACLData
Definition: aslGenerators.h:45
AVec< int > sliceDimentions
Definition: aslBCond.h:235
std::shared_ptr< BCond > SPBCond
Definition: aslBCond.h:88
void loadDirectionsToACL()
void loadIndicesToACL()
SlicesNames
defines names of walls of a box
Definition: aslBCond.h:309
SPAbstractDataWithGhostNodes computationalDomain
Computational domain which contains all boundaries and the particular boundary as well.
Definition: aslBCond.h:114
shared_ptr< VectorOfElementsData > SPVectorOfElementsData
SPDistanceFunction mapDF
Definition: aslBCond.h:112
const VectorTemplate *const templ
Definition: aslBCond.h:231
acl::SPVectorOfElementsData pointsACL
Definition: aslBCond.h:298
const VectorTemplate * getVT()
Definition: aslBCond.h:341
void addSliceYE(BCond &)
const VectorTemplate *const templ
Definition: aslBCond.h:263
const Block & getBlock2()
acl::SPVectorOfElementsData normalsACL
Definition: aslBCond.h:299
SPAbstractDataWithGhostNodes map
boundary description for the particular BC
Definition: aslBCond.h:111
acl::SPVectorOfElementsData directions1ACL
Definition: aslBCond.h:201
AVec< int > sliceDimentions2
Definition: aslBCond.h:273
std::vector< int > neighbourIndices
Definition: aslBCond.h:67
acl::SPVectorOfElementsData directions2ACL
Definition: aslBCond.h:203
std::vector< int > directions2
Definition: aslBCond.h:198
BCond(const Block &b)
acl::SPVectorOfElementsData indices1ACL
Definition: aslBCond.h:200
The class represents several Element.
unique_ptr< TemplateVE > cDomainTVE
Definition: aslBCond.h:118
void addSliceY(BCond &, int y)
void addSliceX(BCond &, int x)
const Block & getBlock1()
Virtual class describes general interface for boundary conditions.
Definition: aslBCond.h:100
AVec< int > sliceIncrements2
Definition: aslBCond.h:274
const Block & getBlock1()
void addGhostSlice2(AVec< int > pB, AVec< int > pE, int dir)
void loadNeighbourIndicesToACL()
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
acl::VectorOfElements isGhostNode()
returns expression corresponding to check if the current node is ghost one
const Block & getBlock2()
BCondSlice(const Block &b)
const VectorTemplate *const templ
Definition: aslBCond.h:296
acl::SPVectorOfElementsData indicesACL
Definition: aslBCond.h:69
Defines set of vectros with several properties.
Definition: aslTemplates.h:87
void addGhostSlice1(AVec< int > pB, AVec< int > pE, int dir)
acl::SPVectorOfElementsData fractionsACL
Definition: aslBCond.h:72
void addPoint(AVec< int > a, int d=0, double fr=0)
BCondDynamic(const Block &b)
SPDistanceFunction computationalDomainDF
Definition: aslBCond.h:115
Virtual class describes general interface for boundary conditions which connect two datas.
Definition: aslBCond.h:258