tetOverlapVolume.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::tetOverlapVolume
26 
27 Description
28  Calculates the overlap volume of two cells using tetrahedral decomposition
29 
30 SourceFiles
31  tetOverlapVolume.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef tetOverlapVolume_H
36 #define tetOverlapVolume_H
37 
38 #include "FixedList.H"
39 #include "labelList.H"
40 #include "treeBoundBox.H"
41 #include "tetPointRef.H"
42 
43 namespace Foam
44 {
45 
46 class primitiveMesh;
47 class polyMesh;
48 
49 /*---------------------------------------------------------------------------*\
50  Class tetOverlapVolume Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class tetOverlapVolume
54 {
55  // Private Member Functions
56 
57  //- Tet overlap volume
58  scalar tetTetOverlapVol
59  (
60  const tetPointRef& tetA,
61  const tetPointRef& tetB
62  ) const;
63 
64  //- Return a const treeBoundBox
65  treeBoundBox pyrBb
66  (
67  const pointField& points,
68  const face& f,
69  const point& fc
70  ) const;
71 
72 
73  // Private classes
74 
75  //- A fixed list of tets which simulates a dynamic list by incrementing
76  // a counter whenever its append method is called. This is used as an
77  // optimisation for the tetTetOverlapVol method.
78  template<unsigned Size>
79  class cutTetList
80  :
81  public FixedList<FixedList<point, 4>, Size>
82  {
83  private:
84 
85  //- The number of stored elements
86  label n_;
87 
88 
89  public:
90 
91  //- Construct null
92  cutTetList()
93  :
94  n_(0)
95  {}
96 
97  //- Clear the array
98  void clear()
99  {
100  n_ = 0;
101  }
102 
103  //- Get the current size
104  label size() const
105  {
106  return n_;
107  }
108 
109  //- Add a new tet to the end of the array
110  void append(const FixedList<point, 4>& t)
111  {
112  this->operator[](n_) = t;
113  ++ n_;
114  }
115  };
116 
117 
118 public:
119 
120  //- Runtime type information
121  ClassName("tetOverlapVolume");
122 
123 
124  // Constructors
125 
126  //- Null constructor
128 
129 
130  // Public members
131 
132  //- Return a list of cells in meshA which overlaps with cellBI in
133  // meshB
135  (
136  const polyMesh& meshA,
137  const polyMesh& meshB,
138  const label cellBI
139  ) const;
140 
141  //- Return true if olverlap volume is greater than threshold
143  (
144  const primitiveMesh& meshA,
145  const label cellAI,
146  const primitiveMesh& meshB,
147  const label cellBI,
148  const treeBoundBox& cellBbB,
149  const scalar threshold = 0.0
150  ) const;
151 
152  //- Calculates the overlap volume
154  (
155  const primitiveMesh& meshA,
156  const label cellAI,
157 
158  const primitiveMesh& meshB,
159  const label cellBI,
160  const treeBoundBox& cellBbB
161  ) const;
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
A tetrahedron primitive.
Definition: tetrahedron.H:61
tUEqn clear()
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:54
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
const pointField & points
tetOverlapVolume()
Null constructor.
Calculates the overlap volume of two cells using tetrahedral decomposition.
ClassName("tetOverlapVolume")
Runtime type information.
labelList f(nPoints)
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:87
bool cellCellOverlapMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB, const scalar threshold=0.0) const
Return true if olverlap volume is greater than threshold.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
labelList overlappingCells(const polyMesh &meshA, const polyMesh &meshB, const label cellBI) const
Return a list of cells in meshA which overlaps with cellBI in.
scalar cellCellOverlapVolumeMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume.
Namespace for OpenFOAM.