meshOctreeI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "meshOctree.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 inline bool meshOctree::isQuadtree() const
37 {
38  return isQuadtree_;
39 }
40 
41 //- return octant vectors
43 {
44  return octantVectors_;
45 }
46 
47 //- return leaves of the octree
49 {
50  if( leaves_.size() == 0 )
52  (
53  "inline const label& meshOctree::numberOfLeaves() const"
54  ) << "Leaves are not yet created!!" << exit(FatalError);
55 
56  return leaves_.size();
57 }
58 
60 (
61  const label leafI
62 ) const
63 {
64  return *leaves_[leafI];
65 }
66 
67 inline short meshOctree::leafAtProc(const label leafI) const
68 {
69  return leaves_[leafI]->procNo();
70 }
71 
72 inline bool meshOctree::hasContainedTriangles(const label leafI) const
73 {
74  if( leaves_[leafI]->hasContainedElements() )
75  return true;
76 
77  return false;
78 }
79 
81 (
82  const label leafI,
83  DynList<label>& triangles
84 ) const
85 {
86  triangles.clear();
87 
88  if( !leaves_[leafI]->hasContainedElements() )
89  {
90  triangles.clear();
91  return;
92  }
93 
94  const VRWGraph& containedTriangles =
95  leaves_[leafI]->slotPtr()->containedTriangles_;
96  constRow elmts = containedTriangles[leaves_[leafI]->containedElements()];
97  forAll(elmts, elI)
98  triangles.append(elmts[elI]);
99 }
100 
101 inline bool meshOctree::hasContainedEdges(const label leafI) const
102 {
103  if( leaves_[leafI]->hasContainedEdges() )
104  return true;
105 
106  return false;
107 }
108 
109 inline void meshOctree::containedEdges
110 (
111  const label leafI,
112  DynList<label>& edges
113 ) const
114 {
115  edges.clear();
116 
117  if( !leaves_[leafI]->hasContainedEdges() )
118  {
119  edges.clear();
120  return;
121  }
122 
123  const VRWGraph& containedEdges =
124  leaves_[leafI]->slotPtr()->containedEdges_;
125  constRow elmts = containedEdges[leaves_[leafI]->containedEdges()];
126  forAll(elmts, eI)
127  edges.append(elmts[eI]);
128 }
129 
130 inline const triSurf& meshOctree::surface() const
131 {
132  return surface_;
133 }
134 
135 inline const boundBox& meshOctree::rootBox() const
136 {
137  return rootBox_;
138 }
139 
142 {
143  return regularityPositions_;
144 }
145 
148 {
149  return vrtLeavesPos_;
150 }
151 
152 inline const labelList& meshOctree::neiProcs() const
153 {
154  return neiProcs_;
155 }
156 
158 (
159  const label leafI,
160  const label nodeI
161 ) const
162 {
163  return findNeighbourOverNode(leaves_[leafI]->coordinates(), nodeI);
164 }
165 
167 (
168  const label leafI,
169  const label eI,
170  DynList<label>& neighbourLeaves
171 ) const
172 {
173  findNeighboursOverEdge(leaves_[leafI]->coordinates(), eI, neighbourLeaves);
174 }
175 
177 (
178  const label leafI,
179  const label dir,
180  DynList<label>& neiLeaves
181 ) const
182 {
183  findNeighboursInDirection(leaves_[leafI]->coordinates(), dir, neiLeaves);
184 }
185 
187 (
188  const label leafI,
189  DynList<label>& neighbourLeaves
190 ) const
191 {
192  findNeighboursForLeaf(leaves_[leafI]->coordinates(), neighbourLeaves);
193 }
194 
196 (
197  const label leafI,
198  DynList<label>& neighbourLeaves
199 ) const
200 {
201  findAllLeafNeighbours(leaves_[leafI]->coordinates(), neighbourLeaves);
202 }
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::meshOctree::octantVectors_
FixedList< Vector< label >, 8 > octantVectors_
Definition: meshOctree.H:81
Foam::meshOctree::regularityPositions_
FixedList< meshOctreeCubeCoordinates, 26 > regularityPositions_
Definition: meshOctree.H:83
Foam::meshOctree::findAllLeafNeighbours
void findAllLeafNeighbours(const meshOctreeCubeCoordinates &, DynList< label > &neighbourLeaves) const
find neighbour leaves over nodes, edges and faces
Definition: meshOctreeNeighbourSearches.C:387
Foam::meshOctree::regularityPositions
const FixedList< meshOctreeCubeCoordinates, 26 > & regularityPositions() const
Definition: meshOctreeI.H:141
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::meshOctree::containedTriangles
void containedTriangles(const label, DynList< label > &) const
Definition: meshOctreeI.H:81
Foam::meshOctree::findNeighboursForLeaf
void findNeighboursForLeaf(const meshOctreeCubeCoordinates &, DynList< label > &neighbourLeaves) const
find neighbour leaf cubes over all faces
Definition: meshOctreeNeighbourSearches.C:372
Foam::meshOctree::isQuadtree
bool isQuadtree() const
is octree a quadtree or an octree
Definition: meshOctreeI.H:36
Foam::meshOctree::positionsOfLeavesAtNodes
const FixedList< FixedList< meshOctreeCubeCoordinates, 8 >, 8 > & positionsOfLeavesAtNodes() const
return positions to find the leaves at each cube node
Definition: meshOctreeI.H:147
Foam::meshOctree::neiProcs
const labelList & neiProcs() const
neighbour processors of the current one
Definition: meshOctreeI.H:152
Foam::meshOctree::vrtLeavesPos_
FixedList< FixedList< meshOctreeCubeCoordinates, 8 >, 8 > vrtLeavesPos_
Definition: meshOctree.H:82
meshOctree.H
Foam::meshOctree::findNeighboursInDirection
void findNeighboursInDirection(const meshOctreeCubeCoordinates &, const label dir, DynList< label > &neighbourLeaves) const
find neighbours over a leaf cube face in the given direction
Definition: meshOctreeNeighbourSearches.C:262
Foam::meshOctree::numberOfLeaves
label numberOfLeaves() const
return leaves of the octree
Definition: meshOctreeI.H:48
Foam::constRow
const typedef graphRow< const VRWGraph > constRow
Definition: graphRow.H:134
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::meshOctree::isQuadtree_
const bool isQuadtree_
a flag whether is true if is it a quadtree
Definition: meshOctree.H:92
Foam::meshOctree::hasContainedEdges
bool hasContainedEdges(const label) const
Definition: meshOctreeI.H:101
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::FatalError
error FatalError
Foam::meshOctree::findNeighboursOverEdge
void findNeighboursOverEdge(const meshOctreeCubeCoordinates &, const label eI, DynList< label > &neighbourLeaves) const
find neighbours over a cube's edge
Definition: meshOctreeNeighbourSearches.C:185
Foam::meshOctree::leaves_
LongList< meshOctreeCube * > leaves_
list of cubes which are leaves of the octree
Definition: meshOctree.H:89
Foam::meshOctree::containedEdges
void containedEdges(const label, DynList< label > &) const
Definition: meshOctreeI.H:110
Foam::meshOctree::findNeighbourOverNode
label findNeighbourOverNode(const meshOctreeCubeCoordinates &, const label nodeI) const
find a neighbour over a cube's node
Definition: meshOctreeNeighbourSearches.C:115
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshOctree::neiProcs_
labelList neiProcs_
Definition: meshOctree.H:63
Foam::DynList< label >
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::meshOctree::rootBox_
boundBox rootBox_
Definition: meshOctree.H:73
Foam::meshOctree::rootBox
const boundBox & rootBox() const
return rootBox
Definition: meshOctreeI.H:135
Foam::meshOctree::leafAtProc
short leafAtProc(const label) const
Definition: meshOctreeI.H:67
Foam::meshOctree::surface_
const triSurf & surface_
Reference to surface to work on.
Definition: meshOctree.H:59
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::FixedList
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:53
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::meshOctree::hasContainedTriangles
bool hasContainedTriangles(const label) const
Definition: meshOctreeI.H:72
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::meshOctree::octantVectors
const FixedList< Vector< label >, 8 > & octantVectors() const
return octant vectors
Definition: meshOctreeI.H:42
Foam::meshOctree::surface
const triSurf & surface() const
return a reference to the surface
Definition: meshOctreeI.H:130
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::triSurf
Definition: triSurf.H:59
Foam::meshOctree::returnLeaf
const meshOctreeCubeBasic & returnLeaf(const label) const
Definition: meshOctreeI.H:60
Foam::DynList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: DynListI.H:279
Foam::meshOctreeCubeBasic
Definition: meshOctreeCubeBasic.H:49
Foam::DynList::append
void append(const T &e)
Append an element at the end of the list.
Definition: DynListI.H:304