1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
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.
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
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/>.
27 \*---------------------------------------------------------------------------*/
29 #include "meshOctree.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 inline bool meshOctree::isQuadtree() const
41 //- return octant vectors
42 inline const FixedList<Vector<label>, 8>& meshOctree::octantVectors() const
44 return octantVectors_;
47 //- return leaves of the octree
48 inline label meshOctree::numberOfLeaves() const
50 if( leaves_.size() == 0 )
53 "inline const label& meshOctree::numberOfLeaves() const"
54 ) << "Leaves are not yet created!!" << exit(FatalError);
56 return leaves_.size();
59 inline const meshOctreeCubeBasic& meshOctree::returnLeaf
64 return *leaves_[leafI];
67 inline short meshOctree::leafAtProc(const label leafI) const
69 return leaves_[leafI]->procNo();
72 inline bool meshOctree::hasContainedTriangles(const label leafI) const
74 if( leaves_[leafI]->hasContainedElements() )
80 inline void meshOctree::containedTriangles
83 DynList<label>& triangles
88 if( !leaves_[leafI]->hasContainedElements() )
94 const VRWGraph& containedTriangles =
95 leaves_[leafI]->slotPtr()->containedTriangles_;
96 constRow elmts = containedTriangles[leaves_[leafI]->containedElements()];
98 triangles.append(elmts[elI]);
101 inline bool meshOctree::hasContainedEdges(const label leafI) const
103 if( leaves_[leafI]->hasContainedEdges() )
109 inline void meshOctree::containedEdges
112 DynList<label>& edges
117 if( !leaves_[leafI]->hasContainedEdges() )
123 const VRWGraph& containedEdges =
124 leaves_[leafI]->slotPtr()->containedEdges_;
125 constRow elmts = containedEdges[leaves_[leafI]->containedEdges()];
127 edges.append(elmts[eI]);
130 inline const triSurf& meshOctree::surface() const
135 inline const boundBox& meshOctree::rootBox() const
140 inline const FixedList<meshOctreeCubeCoordinates, 26>&
141 meshOctree::regularityPositions() const
143 return regularityPositions_;
146 inline const FixedList<FixedList<meshOctreeCubeCoordinates, 8>, 8>&
147 meshOctree::positionsOfLeavesAtNodes() const
149 return vrtLeavesPos_;
152 inline const labelList& meshOctree::neiProcs() const
157 inline label meshOctree::findNeighbourOverNode
163 return findNeighbourOverNode(leaves_[leafI]->coordinates(), nodeI);
166 inline void meshOctree::findNeighboursOverEdge
170 DynList<label>& neighbourLeaves
173 findNeighboursOverEdge(leaves_[leafI]->coordinates(), eI, neighbourLeaves);
176 inline void meshOctree::findNeighboursInDirection
180 DynList<label>& neiLeaves
183 findNeighboursInDirection(leaves_[leafI]->coordinates(), dir, neiLeaves);
186 inline void meshOctree::findNeighboursForLeaf
189 DynList<label>& neighbourLeaves
192 findNeighboursForLeaf(leaves_[leafI]->coordinates(), neighbourLeaves);
195 inline void meshOctree::findAllLeafNeighbours
198 DynList<label>& neighbourLeaves
201 findAllLeafNeighbours(leaves_[leafI]->coordinates(), neighbourLeaves);
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //