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 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 class polyMesh;
53 class tetMatcher;
54 
55 /*---------------------------------------------------------------------------*\
56  Class isoSurfaceTopo Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class isoSurfaceTopo
60 :
61  public isoSurfaceBase
62 {
63  // Private Data
64 
65  enum cellCutType
66  {
67  NOTCUT,
68  SPHERE,
69  CUT
70  };
71 
72 
73  //- Reference to mesh
74  const polyMesh& mesh_;
75 
76  const scalarField& cVals_;
77 
78  const scalarField& pVals_;
79 
80  //- Optional cells to ignore
81  const bitSet& ignoreCells_;
82 
83  //- Optional boundary faces to ignore. Used to exclude cyclicACMI
84  // (since duplicate faces)
85  bitSet ignoreBoundaryFaces_;
86 
87  //- Corrected version of tetBasePtIs
88  labelList tetBasePtIs_;
89 
90  //- Per point: originating mesh vertex/cc. See encoding above
91  edgeList pointToVerts_;
92 
93  //- For every point the originating face in mesh
94  labelList pointToFace_;
95 
96 
97  // Private Member Functions
98 
99  scalar minTetQ
100  (
101  const label facei,
102  const label faceBasePtI
103  ) const;
104 
105  void fixTetBasePtIs();
106 
107  //- Determine whether cell is cut
108  cellCutType calcCutType
109  (
110  const bool isTet,
111  const label
112  ) const;
113 
114  //- Determine for all mesh whether cell is cut
115  // \return number of cells cut
116  label calcCutTypes
117  (
118  tetMatcher& tet,
119  List<cellCutType>& cellCutTypes
120  );
121 
122  //- Generate single point on edge
123  label generatePoint
124  (
125  const label facei,
126  const bool edgeIsDiag,
127  const edge& vertices,
128 
131  DynamicList<bool>& pointFromDiag,
132  EdgeMap<label>& vertsToPoint
133  ) const;
134 
135  //- Generate triangles from tet
136  void generateTriPoints
137  (
138  const label facei,
139  const FixedList<scalar, 4>& s,
140  const FixedList<point, 4>& p,
141  const FixedList<label, 4>& pIndex,
142  const FixedList<bool, 6>& edgeIsDiag,
143 
146  DynamicList<bool>& pointFromDiag,
147 
148  EdgeMap<label>& vertsToPoint,
149  DynamicList<label>& verts
150  ) const;
151 
152  //- Generate triangles from cell
153  void generateTriPoints
154  (
155  const label celli,
156  const bool isTet,
157 
160  DynamicList<bool>& pointFromDiag,
161 
162  EdgeMap<label>& vertsToPoint,
163  DynamicList<label>& verts,
164  DynamicList<label>& faceLabels
165  ) const;
166 
167 
168  // Simplification
169 
170  void triangulateOutside
171  (
172  const bool filterDiag,
174  const boolList& pointFromDiag,
175  const labelList& pointToFace,
176  const label cellID,
177 
178  DynamicList<face>& compactFaces,
179  DynamicList<label>& compactCellIDs
180  ) const;
181 
182  MeshStorage removeInsidePoints
183  (
184  const bool filterDiag,
185  const MeshStorage& s,
186  const boolList& pointFromDiag,
187  const labelList& pointToFace,
188  const labelList& start, // Per cell:starting tri
189  DynamicList<label>& pointCompactMap, // Per point the original
190  DynamicList<label>& compactCellIDs // Per face the cellID
191  ) const;
192 
193 
194 public:
195 
196  //- Filtering type
198 
199 
200  //- Runtime type information
201  TypeName("isoSurfaceTopo");
202 
203 
204  // Constructors
205 
206  //- Construct from dictionary
208  (
209  const polyMesh& mesh,
210  const scalarField& cellValues,
211  const scalarField& pointValues,
212  const scalar iso,
213  const filterType filter = filterType::DIAGCELL,
214  const boundBox& bounds = boundBox::invertedBox,
215  const bitSet& ignoreCells = bitSet()
216  );
217 
218 
219  // Member Functions
220 
221  //- For every point originating face (pyramid) in mesh
222  const labelList& pointToFace() const
223  {
224  return pointToFace_;
225  }
226 
227  //- Per point: originating mesh vertex/cc. See encoding above
228  const edgeList& pointToVerts() const
229  {
230  return pointToVerts_;
231  }
232 
233  //- Interpolates cCoords,pCoords.
234  template<class Type>
236  (
237  const Field<Type>& cCoords,
238  const Field<Type>& pCoords
239  ) const;
240 };
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #ifdef NoRepository
250  #include "isoSurfaceTopoTemplates.C"
251 #endif
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
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:57
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:227
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::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:62
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:221
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::EdgeMap< label >
Foam::List< label >
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::pointToFace
A topoSetFaceSource to select faces based on use of points.
Definition: pointToFace.H:83
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:58
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:90