WaveBEM: Unsteady Nonlinear Potential Flow Solver for Ship-Wave Interaction.
octree_block.cc
Go to the documentation of this file.
1 #include "../include/octree_block.h"
2 
3 template <int dim>
5 {
6  this->parentId = 0;
7  this->level = 0;
8  for (int i=0; i<dim; i++)
9  this->pMin(i) = 0.0;
10  this->delta = 0;
11  this->nodesId.resize(0);
12  this->numChildren = 0;
13  this->nearNeigh.resize(1);
14  this->intList.resize(1);
15  this->nonIntList.resize(1);
16 }
17 
18 
19 template <int dim>
20 OctreeBlock<dim>::OctreeBlock(unsigned int level, unsigned int parent, Point<dim> pMin, double delta)
21 {
22  this->parentId = parent;
23  this->level = level;
24  this->pMin = pMin;
25  this->delta = delta;
26  this->nodesId.resize(0);
27  this->numChildren = 0;
28  this->nearNeigh.resize(1);
29  this->intList.resize(1);
30  this->nonIntList.resize(1);
31 }
32 
33 
34 template <int dim>
36 {
37  this->parentId = other.parentId;
38  this->level = other.level;
39  this->pMin = other.pMin;
40  this->delta = other.delta;
41  for (unsigned int i=0; i < other.nodesId.size(); i++)
42  this->nodesId.push_back(other.nodesId[i]);
43  this->quadPointsId = other.quadPointsId;
44  this->numChildren = other.numChildren;
45  for (unsigned int i=0; i < this->numChildren; i++)
46  this->childrenId[i] = other.childrenId[i];
47  this->nearNeigh = other.nearNeigh;
48  this->intList = other.intList;
49  this->nonIntList = other.nonIntList;
50 }
51 
52 
53 template <int dim>
55 {
56  this->nearNeigh.clear();
57  this->intList.clear();
58  this->nonIntList.clear();
59  this->nodesId.clear();
60  this->quadPointsId.clear();
61 }
62 
63 
64 template <int dim>
66 {
67  this->parentId = other->parentId;
68  this->level = other->level;
69  this->pMin = other->pMin;
70  this->delta = other->delta;
71  for (unsigned int i=0; i < other->nodesId.size(); i++)
72  this->nodesId.push_back(other->nodesId[i]);
73  this->quadPointsId = other->quadPointsId;
74  this->numChildren = other->numChildren;
75  for (unsigned int i=0; i < this->numChildren; i++)
76  this->childrenId[i] = other->childrenId[i];
77  this->nearNeigh = other->nearNeigh;
78  this->intList = other->intList;
79  this->nonIntList = other->nonIntList;
80 }
81 
82 
83 template <int dim>
84 void OctreeBlock<dim>::AddNode(unsigned int nodeId)
85 {
86  this->nodesId.push_back(nodeId);
87 }
88 
89 
90 template <int dim>
91 void OctreeBlock<dim>::AddQuadPoint(cell_it elemPointer, unsigned int quadPointId)
92 {
93  this->quadPointsId[elemPointer].push_back(quadPointId);
94 }
95 
96 
97 template <int dim>
98 inline std::vector <unsigned int> OctreeBlock<dim>::GetBlockNodeList() const
99 {
100  return this->nodesId;
101 }
102 
103 
104 template <int dim>
106 {
107  this->nodesId.clear();
108 }
109 
110 
111 template <int dim>
112 inline std::map <typename DoFHandler<dim-1,dim>::active_cell_iterator, std::vector<unsigned int> >
114 {
115  return this->quadPointsId;
116 }
117 
118 
119 template <int dim>
121 {
122  this->quadPointsId.clear();
123 }
124 
125 
126 template <int dim>
127 inline unsigned int OctreeBlock<dim>::GetBlockNodesNum() const
128 {
129  return this->nodesId.size();
130 }
131 
132 
133 template <int dim>
134 inline unsigned int OctreeBlock<dim>::GetBlockChildrenNum() const
135 {
136  return this->numChildren;
137 }
138 
139 
140 template <int dim>
141 inline unsigned int OctreeBlock<dim>::GetParentId() const
142 {
143  return this->parentId;
144 }
145 
146 
147 template <int dim>
148 inline void OctreeBlock<dim>::AddChild(unsigned int childId)
149 {
150  this->childrenId[numChildren] = childId;
151  this->numChildren +=1;
152 }
153 
154 
155 template <int dim>
156 inline unsigned int OctreeBlock<dim>::GetChildId(unsigned int idInList) const
157 {
158  return this->childrenId[idInList];
159 }
160 
161 
162 template <int dim>
164 {
165  return this->pMin;
166 }
167 
168 
169 template <int dim>
170 inline double OctreeBlock<dim>::GetDelta() const
171 {
172  return this->delta;
173 }
174 
175 
176 template <int dim>
177 inline void OctreeBlock<dim>::AddNearNeigh(unsigned int sublevel, const unsigned int nnBlockId)
178 {
179  (this->nearNeigh.at(sublevel)).insert(nnBlockId);
180 }
181 
182 
183 template <int dim>
184 inline unsigned int OctreeBlock<dim>::NumNearNeigh(unsigned int sublevel) const
185 {
186  return (this->nearNeigh.at(sublevel)).size();
187 }
188 
189 
190 template <int dim>
191 inline unsigned int OctreeBlock<dim>::NumNearNeighLevels() const
192 {
193  return this->nearNeigh.size();
194 }
195 
196 
197 template <int dim>
198 inline std::set <unsigned int> OctreeBlock<dim>::GetNearNeighs(unsigned int sublevel) const
199 {
200  return this->nearNeigh.at(sublevel);
201 }
202 
203 
204 template <int dim>
205 inline void OctreeBlock<dim>::AddBlockToIntList(unsigned int sublevel, const unsigned int intListBlockId)
206 {
207  (this->intList.at(sublevel)).insert(intListBlockId);
208 }
209 
210 
211 template <int dim>
212 inline unsigned int OctreeBlock<dim>::NumIntList(unsigned int sublevel) const
213 {
214  return (this->intList.at(sublevel)).size();
215 }
216 
217 
218 template <int dim>
219 inline unsigned int OctreeBlock<dim>::NumIntListLevels() const
220 {
221  return this->intList.size();
222 }
223 
224 
225 template <int dim>
226 inline std::set <unsigned int> OctreeBlock<dim>::GetIntList(unsigned int sublevel) const
227 {
228  return this->intList.at(sublevel);
229 }
230 
231 
232 template <int dim>
233 inline std::vector<std::set <unsigned int> > OctreeBlock<dim>::GetIntList() const
234 {
235  return this->intList;
236 }
237 
238 
239 template <int dim>
240 inline void OctreeBlock<dim>::AddBlockToNonIntList(unsigned int sublevel, const unsigned int intListBlockId)
241 {
242  (this->nonIntList.at(sublevel)).insert(intListBlockId);
243 }
244 
245 
246 template <int dim>
247 inline unsigned int OctreeBlock<dim>::NumNonIntList(unsigned int sublevel) const
248 {
249  return (this->nonIntList.at(sublevel)).size();
250 }
251 
252 
253 template <int dim>
254 inline unsigned int OctreeBlock<dim>::NumNonIntListLevels() const
255 {
256  return this->nonIntList.size();
257 }
258 
259 
260 template <int dim>
261 inline std::set <unsigned int> OctreeBlock<dim>::GetNonIntList(unsigned int sublevel) const
262 {
263  return this->nonIntList.at(sublevel);
264 }
265 
266 
267 template <int dim>
268 inline void OctreeBlock<dim>::SetNearNeighSize(unsigned int sublevels)
269 {
270  this->nearNeigh.resize(sublevels);
271 }
272 
273 
274 template <int dim>
275 inline void OctreeBlock<dim>::SetIntListSize(unsigned int sublevels)
276 {
277  this->intList.resize(sublevels);
278 }
279 
280 
281 template <int dim>
282 inline void OctreeBlock<dim>::SetNonIntListSize(unsigned int sublevels)
283 {
284  this->nonIntList.resize(sublevels);
285 }
286 
287 
288 template <int dim>
289 inline unsigned int OctreeBlock<dim>::GetNearNeighSize() const
290 {
291  return this->nearNeigh.size();
292 }
293 
294 
295 template <int dim>
296 inline unsigned int OctreeBlock<dim>::GetIntListSize() const
297 {
298  return this->intList.size();
299 }
300 
301 
302 template <int dim>
303 inline unsigned int OctreeBlock<dim>::GetNonIntListSize() const
304 {
305  return this->nonIntList.size();
306 }
307 
308 
309 template class OctreeBlock<3>;
void AddQuadPoint(cell_it elemPointer, unsigned int quadPointId)
Definition: octree_block.cc:91
unsigned int GetNearNeighSize() const
unsigned int GetParentId() const
std::map< cell_it, std::vector< unsigned int > > GetBlockQuadPointsList() const
std::vector< std::set< unsigned int > > intList
Definition: octree_block.h:75
unsigned int NumNonIntList(unsigned int sublevel) const
std::vector< std::set< unsigned int > > nonIntList
Definition: octree_block.h:77
void DelNodeList()
unsigned int NumNonIntListLevels() const
unsigned int NumNearNeighLevels() const
std::set< unsigned int > GetNearNeighs(unsigned int sublevel) const
void SetNonIntListSize(unsigned int sublevels)
std::vector< unsigned int > nodesId
Definition: octree_block.h:83
unsigned int GetChildId(unsigned int idInList) const
double delta
Definition: octree_block.h:81
std::vector< std::set< unsigned int > > nearNeigh
Definition: octree_block.h:73
void AddChild(unsigned int childId)
unsigned int level
Definition: octree_block.h:65
unsigned int GetBlockNodesNum() const
unsigned int numChildren
Definition: octree_block.h:69
std::vector< unsigned int > GetBlockNodeList() const
Definition: octree_block.cc:98
void AddBlockToIntList(unsigned int sublevel, const unsigned int intListBlockId)
std::set< unsigned int > GetNonIntList(unsigned int sublevel) const
unsigned int GetIntListSize() const
void SetNearNeighSize(unsigned int sublevels)
void AddNode(unsigned int nodeId)
Definition: octree_block.cc:84
unsigned int NumIntList(unsigned int sublevel) const
DoFHandler< dim-1, dim >::active_cell_iterator cell_it
Definition: octree_block.h:60
Point< dim > GetPMin() const
::Triangulation< dim, spacedim >::active_cell_iterator active_cell_iterator
void DelQuadPointsList()
unsigned int NumIntListLevels() const
unsigned int parentId
Definition: octree_block.h:67
unsigned int NumNearNeigh(unsigned int sublevel) const
Point< dim > pMin
Definition: octree_block.h:79
void AddBlockToNonIntList(unsigned int sublevel, const unsigned int intListBlockId)
std::vector< std::set< unsigned int > > GetIntList() const
unsigned int GetNonIntListSize() const
unsigned int GetBlockChildrenNum() const
void SetIntListSize(unsigned int sublevels)
void AddNearNeigh(unsigned int sublevel, const unsigned int nnBlockId)
std::map< cell_it, std::vector< unsigned int > > quadPointsId
Definition: octree_block.h:85
double GetDelta() const
void CopyContent(const OctreeBlock *other)
Definition: octree_block.cc:65
unsigned int childrenId[8]
Definition: octree_block.h:71