Moving cfMesh into place. Updated contibutors list
[foam-extend-3.2.git] / src / mesh / cfMesh / meshLibrary / utilities / octrees / meshOctree / meshOctreeI.H
blobeae37b281994dfb69ccc3071dea12114a7745fcd
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.
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
19     for more details.
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/>.
24 Description
27 \*---------------------------------------------------------------------------*/
29 #include "meshOctree.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
36 inline bool meshOctree::isQuadtree() const
38     return isQuadtree_;
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 )
51         FatalErrorIn
52         (
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
61     const label leafI
62 ) const
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() )
75         return true;
77     return false;
80 inline void meshOctree::containedTriangles
82     const label leafI,
83     DynList<label>& triangles
84 ) const
86     triangles.clear();
88     if( !leaves_[leafI]->hasContainedElements() )
89     {
90         triangles.clear();
91         return;
92     }
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]);
101 inline bool meshOctree::hasContainedEdges(const label leafI) const
103     if( leaves_[leafI]->hasContainedEdges() )
104         return true;
106     return false;
109 inline void meshOctree::containedEdges
111     const label leafI,
112     DynList<label>& edges
113 ) const
115     edges.clear();
117     if( !leaves_[leafI]->hasContainedEdges() )
118     {
119         edges.clear();
120         return;
121     }
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]);
130 inline const triSurf& meshOctree::surface() const
132     return surface_;
135 inline const boundBox& meshOctree::rootBox() const
137     return rootBox_;
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
154     return neiProcs_;
157 inline label meshOctree::findNeighbourOverNode
159     const label leafI,
160     const label nodeI
161 ) const
163     return findNeighbourOverNode(leaves_[leafI]->coordinates(), nodeI);
166 inline void meshOctree::findNeighboursOverEdge
168     const label leafI,
169     const label eI,
170     DynList<label>& neighbourLeaves
171 ) const
173     findNeighboursOverEdge(leaves_[leafI]->coordinates(), eI, neighbourLeaves);
176 inline void meshOctree::findNeighboursInDirection
178     const label leafI,
179     const label dir,
180     DynList<label>& neiLeaves
181 ) const
183     findNeighboursInDirection(leaves_[leafI]->coordinates(), dir, neiLeaves);
186 inline void meshOctree::findNeighboursForLeaf
188     const label leafI,
189     DynList<label>& neighbourLeaves
190 ) const
192     findNeighboursForLeaf(leaves_[leafI]->coordinates(), neighbourLeaves);
195 inline void meshOctree::findAllLeafNeighbours
197     const label leafI,
198     DynList<label>& neighbourLeaves
199 ) const
201     findAllLeafNeighbours(leaves_[leafI]->coordinates(), neighbourLeaves);
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //