isoSurfaceTopo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2019 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::isoSurfaceTopo
29 
30 Description
31  Marching tet iso surface algorithm with optional filtering to keep only
32  points originating from mesh edges.
33 
34 SourceFiles
35  isoSurfaceTopo.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef isoSurfaceTopo_H
40 #define isoSurfaceTopo_H
41 
42 #include "labelPair.H"
43 #include "bitSet.H"
44 #include "edgeList.H"
45 #include "isoSurfaceBase.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class polyMesh;
54 class tetMatcher;
55 
56 /*---------------------------------------------------------------------------*\
57  Class isoSurfaceTopo Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class isoSurfaceTopo
61 :
62  public isoSurfaceBase
63 {
64  // Private Data
65 
66  enum cellCutType
67  {
68  NOTCUT,
69  SPHERE,
70  CUT
71  };
72 
73 
74  //- Reference to mesh
75  const polyMesh& mesh_;
76 
77  const scalarField& cVals_;
78 
79  const scalarField& pVals_;
80 
81  //- Optional cells to ignore
82  const bitSet& ignoreCells_;
83 
84  //- Optional boundary faces to ignore. Used to exclude cyclicACMI
85  // (since duplicate faces)
86  bitSet ignoreBoundaryFaces_;
87 
88  //- Corrected version of tetBasePtIs
89  labelList tetBasePtIs_;
90 
91  //- Per point: originating mesh vertex/cc. See encoding above
92  edgeList pointToVerts_;
93 
94  //- For every point the originating face in mesh
95  labelList pointToFace_;
96 
97 
98  // Private Member Functions
99 
100  scalar minTetQ
101  (
102  const label facei,
103  const label faceBasePtI
104  ) const;
105 
106  void fixTetBasePtIs();
107 
108  //- Determine whether cell is cut
109  cellCutType calcCutType
110  (
111  const bool isTet,
112  const label
113  ) const;
114 
115  //- Determine for all mesh whether cell is cut
116  // \return number of cells cut
117  label calcCutTypes
118  (
119  tetMatcher& tet,
120  List<cellCutType>& cellCutTypes
121  );
122 
123  //- Generate single point on edge
124  label generatePoint
125  (
126  const label facei,
127  const bool edgeIsDiag,
128  const edge& vertices,
129 
132  DynamicList<bool>& pointFromDiag,
133  EdgeMap<label>& vertsToPoint
134  ) const;
135 
136  //- Generate triangles from tet
137  void generateTriPoints
138  (
139  const label facei,
140  const FixedList<scalar, 4>& s,
141  const FixedList<point, 4>& p,
142  const FixedList<label, 4>& pIndex,
143  const FixedList<bool, 6>& edgeIsDiag,
144 
147  DynamicList<bool>& pointFromDiag,
148 
149  EdgeMap<label>& vertsToPoint,
150  DynamicList<label>& verts
151  ) const;
152 
153  //- Generate triangles from cell
154  void generateTriPoints
155  (
156  const label celli,
157  const bool isTet,
158 
161  DynamicList<bool>& pointFromDiag,
162 
163  EdgeMap<label>& vertsToPoint,
164  DynamicList<label>& verts,
165  DynamicList<label>& faceLabels
166  ) const;
167 
168 
169  // Simplification
170 
171  void triangulateOutside
172  (
173  const bool filterDiag,
174  const primitivePatch& pp,
175  const boolList& pointFromDiag,
176  const labelList& pointToFace,
177  const label cellID,
178 
179  DynamicList<face>& compactFaces,
180  DynamicList<label>& compactCellIDs
181  ) const;
182 
183  MeshStorage removeInsidePoints
184  (
185  const bool filterDiag,
186  const MeshStorage& s,
187  const boolList& pointFromDiag,
188  const labelList& pointToFace,
189  const labelList& start, // Per cell:starting tri
190  DynamicList<label>& pointCompactMap, // Per point the original
191  DynamicList<label>& compactCellIDs // Per face the cellID
192  ) const;
193 
194 
195 public:
196 
197  //- Filtering type
199 
200 
201  //- Runtime type information
202  TypeName("isoSurfaceTopo");
203 
204 
205  // Constructors
206 
207  //- Construct from dictionary
209  (
210  const polyMesh& mesh,
211  const scalarField& cellValues,
212  const scalarField& pointValues,
213  const scalar iso,
214  const filterType filter = filterType::DIAGCELL,
215  const boundBox& bounds = boundBox::invertedBox,
216  const bitSet& ignoreCells = bitSet()
217  );
218 
219 
220  // Member Functions
221 
222  //- For every point originating face (pyramid) in mesh
223  const labelList& pointToFace() const
224  {
225  return pointToFace_;
226  }
227 
228  //- Per point: originating mesh vertex/cc. See encoding above
229  const edgeList& pointToVerts() const
230  {
231  return pointToVerts_;
232  }
233 
234  //- Interpolates cCoords,pCoords.
235  template<class Type>
237  (
238  const Field<Type>& cCoords,
239  const Field<Type>& pCoords
240  ) const;
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #ifdef NoRepository
251  #include "isoSurfaceTopoTemplates.C"
252 #endif
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::isoSurfaceBase
Low-level components common to various iso-surface algorithms.
Definition: isoSurfaceBase.H:54
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::boundBox::invertedBox
static const boundBox invertedBox
A large inverted boundBox: min/max == +/- ROOTVGREAT.
Definition: boundBox.H:86
Foam::isoSurfaceTopo::pointToVerts
const edgeList & pointToVerts() const
Per point: originating mesh vertex/cc. See encoding above.
Definition: isoSurfaceTopo.H:228
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::isoSurfaceTopo::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &cCoords, const Field< Type > &pCoords) const
Interpolates cCoords,pCoords.
Foam::tetMatcher
A cellMatcher for tet cells (cellModel::TET)
Definition: tetMatcher.H:53
isoSurfaceTopoTemplates.C
bitSet.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
isoSurfaceBase.H
Foam::isoSurfaceTopo::isoSurfaceTopo
isoSurfaceTopo(const polyMesh &mesh, const scalarField &cellValues, const scalarField &pointValues, const scalar iso, const filterType filter=filterType::DIAGCELL, const boundBox &bounds=boundBox::invertedBox, const bitSet &ignoreCells=bitSet())
Construct from dictionary.
Definition: isoSurfaceTopo.C:1192
Foam::Field< scalar >
edgeList.H
Foam::vertices
pointField vertices(const blockVertexList &bvl)
Definition: blockVertexList.H:49
Foam::isoSurfaceTopo::pointToFace
const labelList & pointToFace() const
For every point originating face (pyramid) in mesh.
Definition: isoSurfaceTopo.H:222
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::EdgeMap< label >
Foam::List< label >
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::isoSurfaceTopo
Marching tet iso surface algorithm with optional filtering to keep only points originating from mesh ...
Definition: isoSurfaceTopo.H:59
Foam::MeshedSurface< face >
Foam::isoSurfaceTopo::TypeName
TypeName("isoSurfaceTopo")
Runtime type information.
Foam::isoSurfaceBase::filterType
filterType
The filtering (regularization) to apply.
Definition: isoSurfaceBase.H:87
labelPair.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85