Debian Codegraph @

src/aslGeomInc.h

raw
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 ASLGEOMINC_H
25 #define ASLGEOMINC_H
26
27 #include <memory>
28 #include <vector>
29 #include "acl/aclHardware.h"
30
31 namespace acl
32 {
33 class KernelConfiguration;
34 }
35
36 namespace asl {
37
38 template <typename T> class AVec;
39 class Block;
40
41 class AbstractDataWithGhostNodes;
42 typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
43
44 class DistanceFunction;
45 typedef std::shared_ptr<DistanceFunction> SPDistanceFunction;
46
47
48
49 ///generates sphere \ingroup Geom
50 /**
51 \param r radius
52 \param c center
53 */
54 SPDistanceFunction generateDFSphere(double r, const AVec<double> & c);
55
56
57 ///generates infinite cylinder \ingroup Geom
58 /**
59 \param r radius
60 \param l orientation
61 \param c center
62 */
63 SPDistanceFunction generateDFCylinderInf(double r,
64 const AVec<double> & l,
65 const AVec<double> & c);
66
67 ///generates cylinder \ingroup Geom
68 /**
69 \param r radius
70 \param l orientation and length
71 \param c center
72 */
73 SPDistanceFunction generateDFCylinder(double r,
74 const AVec<double> & l,
75 const AVec<double> & c);
76
77 ///generates cone \ingroup Geom
78 /**
79 \param r radius
80 \param l orientation and length, from apex to base
81 \param a apex
82 */
83 SPDistanceFunction generateDFCone(double r,
84 const AVec<double> & l,
85 const AVec<double> & a);
86
87 /// generates a plane \ingroup Geom
88 /// \param n vector orthogonal to the plane
89 /// \param p0 point on the plane
90 SPDistanceFunction generateDFPlane(const AVec<double> & n,
91 const AVec<double> & p0);
92
93
94 /// generates infinite prism with convex polygon at its base \ingroup Geom
95 /**
96 \param points list of points in 3D space.
97
98 The prism axis is oriented orthogonal to the plane of the triangle defined by
99 a center and first two points. Points of the base polygon must
100 be provided in continuous manner.
101 */
102 SPDistanceFunction generateDFConvexPolygonPrism(std::vector<AVec<double>> points);
103
104
105 ///generates pyramid with convex polygon at its base and apex \p a \ingroup Geom
106 /**
107 \param points list of points in 3D space.
108
109 the pyramid base plane is defined by a center and fist two points
110 the points should be ordered counter clock rotation for an observer placed in \p a
111 */
112 SPDistanceFunction generateDFConvexPolygonPyramid(std::vector<AVec<double>> points,
113 AVec<double> a);
114
115
116 /// generates map corresponding to external (ghost) part of the block \ingroup Geom
117 SPDistanceFunction generateDFInBlock(const Block & b, unsigned int nG);
118
119
120 /// \ingroup Geom
121 /**
122 If both operands are not initialized - it leads to an error.
123 If only one operand is not initialized - it is ignored and the second is returned.
124 */
125 SPDistanceFunction operator&(SPDistanceFunction a, SPDistanceFunction b);
126 /// \ingroup Geom
127 /**
128 If both operands are not initialized - it leads to an error.
129 If only one operand is not initialized - it is ignored and the second is returned.
130 */
131 SPDistanceFunction operator|(SPDistanceFunction a, SPDistanceFunction b);
132 /// \ingroup Geom
133 SPDistanceFunction operator-(SPDistanceFunction a);
134 /// \ingroup Geom
135 SPDistanceFunction normalize(SPDistanceFunction a, double dx);
136
137 /// \ingroup Geom
138 SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b,
139 SPDistanceFunction df,
140 unsigned int gN,
141 acl::TypeID t);
142
143
144 /// Initialize \p d by \p f
145 void initData(SPAbstractDataWithGhostNodes d,
146 SPDistanceFunction f);
147 /// Initialize \p d by \p f
148 void initData(SPAbstractDataWithGhostNodes d,
149 SPDistanceFunction f,
150 const acl::KernelConfiguration & k);
151
152 } // asl
153
154 #endif // ASLDISTANCEFUNCTION