meshOctreeCubeI.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 "meshOctreeCube.H"
30 #include "triSurface.H"
31 #include "meshOctreeSlot.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
39 :
41  activeSlotPtr_(NULL),
42  subCubesPtr_(NULL),
43  cubeLabel_(-1),
44  containedElementsLabel_(-1),
45  containedEdgesLabel_(-1)
46 {}
47 
49 :
50  meshOctreeCubeBasic(moc.coordinates(), moc.cubeType(), moc.procNo()),
51  activeSlotPtr_(moc.activeSlotPtr_),
52  subCubesPtr_(moc.subCubesPtr_),
53  cubeLabel_(moc.cubeLabel_),
54  containedElementsLabel_(moc.containedElementsLabel_),
55  containedEdgesLabel_(moc.containedEdgesLabel_)
56 {}
57 
59 {
60  return activeSlotPtr_;
61 }
62 
63 inline bool meshOctreeCube::isLeaf() const
64 {
65  if( !subCubesPtr_ )
66  return true;
67 
68  return false;
69 }
70 
72 {
73  return subCubesPtr_[scI];
74 }
75 
77 {
78  return cubeLabel_;
79 }
80 
82 {
83  if( containedElementsLabel_ == -1 )
84  return false;
85 
86  return true;
87 }
88 
90 {
92 }
93 
95 {
96  if( containedEdgesLabel_ == -1 )
97  return false;;
98 
99  return true;
100 }
101 
103 {
104  return containedEdgesLabel_;
105 }
106 
108 {
109  static_cast<meshOctreeCubeCoordinates&>(*this) = moc.coordinates();
112  cubeLabel_ = moc.cubeLabel_;
115 }
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::meshOctreeCubeCoordinates
Definition: meshOctreeCubeCoordinates.H:55
Foam::meshOctreeCube::containedEdges
label containedEdges() const
Definition: meshOctreeCubeI.H:102
Foam::meshOctreeCube::cubeLabel
label cubeLabel() const
position of the cube in the list of leaves
Definition: meshOctreeCubeI.H:76
Foam::meshOctreeCube::hasContainedElements
bool hasContainedElements() const
return true if the box contains some triangles
Definition: meshOctreeCubeI.H:81
meshOctreeCube.H
meshOctreeSlot.H
Foam::meshOctreeCube::subCube
meshOctreeCube * subCube(const label) const
return a pointer to a child cubes at given position
Definition: meshOctreeCubeI.H:71
Foam::meshOctreeCube::containedElementsLabel_
label containedElementsLabel_
label of the row which contains elements contained in the cube
Definition: meshOctreeCube.H:70
Foam::meshOctreeCubeBasic::coordinates
const meshOctreeCubeCoordinates & coordinates() const
return coordinates in the octree
Definition: meshOctreeCubeBasicI.H:90
Foam::meshOctreeCube::hasContainedEdges
bool hasContainedEdges() const
returns true if the box contains some edges
Definition: meshOctreeCubeI.H:94
Foam::meshOctreeSlot
Definition: meshOctreeSlot.H:50
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::meshOctreeCube::cubeLabel_
label cubeLabel_
position of the cube in the list of leaves
Definition: meshOctreeCube.H:67
Foam::meshOctreeCube::subCubesPtr_
meshOctreeCube ** subCubesPtr_
pointer to the first child element
Definition: meshOctreeCube.H:64
Foam::meshOctreeCube::isLeaf
bool isLeaf() const
check if the cube is a leaf
Definition: meshOctreeCubeI.H:63
Foam::meshOctreeCube::operator=
void operator=(const meshOctreeCube &)
assignment
Definition: meshOctreeCubeI.H:107
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::meshOctreeCube::slotPtr
const meshOctreeSlot * slotPtr() const
return the pointer to the slot containing the cube
Definition: meshOctreeCubeI.H:58
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshOctreeCube::containedEdgesLabel_
label containedEdgesLabel_
labels of contained surface edges
Definition: meshOctreeCube.H:73
Foam::meshOctreeCube::meshOctreeCube
meshOctreeCube()
Default constructor.
Definition: meshOctreeCubeI.H:38
Foam::meshOctreeCube::activeSlotPtr_
meshOctreeSlot * activeSlotPtr_
pointer the slot containing this cube
Definition: meshOctreeCube.H:61
Foam::meshOctreeCube
Definition: meshOctreeCube.H:56
Foam::meshOctreeCube::containedElements
label containedElements() const
Definition: meshOctreeCubeI.H:89
Foam::meshOctreeCubeBasic
Definition: meshOctreeCubeBasic.H:49