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  isoSurfaceTopoTemplates.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef isoSurfaceTopo_H
41 #define isoSurfaceTopo_H
42 
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 
55 /*---------------------------------------------------------------------------*\
56  Class isoSurfaceTopo Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class isoSurfaceTopo
60 :
61  public isoSurfaceBase
62 {
63  // Private Data
64 
65  //- Corrected version of tetBasePtIs
66  labelList tetBasePtIs_;
67 
68  //- Per point: originating mesh vertex/cc. See encoding above
69  edgeList pointToVerts_;
70 
71  //- For every point the originating face in mesh
72  labelList pointToFace_;
73 
74  //- The cell cut type
75  List<cutType> cellCutType_;
76 
77 
78  // Private Member Functions
79 
80  scalar minTetQ
81  (
82  const label facei,
83  const label faceBasePtI
84  ) const;
85 
86  void fixTetBasePtIs();
87 
88  //- Generate single point on edge
89  label generatePoint
90  (
91  const label facei,
92  const bool edgeIsDiag,
93  const edge& vertices,
94 
97  DynamicList<bool>& pointFromDiag,
98  EdgeMap<label>& vertsToPoint
99  ) const;
100 
101  //- Generate triangles from tet
102  void generateTriPoints
103  (
104  const label facei,
105  const int tetCutIndex,
106  const tetCell& tetLabels,
107  const FixedList<bool, 6>& edgeIsDiag,
108 
111  DynamicList<bool>& pointFromDiag,
112 
113  EdgeMap<label>& vertsToPoint,
114  DynamicList<label>& verts
115  ) const;
116 
117  //- Generate triangles from cell
118  void generateTriPoints
119  (
120  const label celli,
121  const bool isTet,
122 
125  DynamicList<bool>& pointFromDiag,
126 
127  EdgeMap<label>& vertsToPoint,
128  DynamicList<label>& verts,
129  DynamicList<label>& faceLabels
130  ) const;
131 
132 
133  // Simplification
134 
135  static void triangulateOutside
136  (
137  const bool filterDiag,
138  const primitivePatch& pp,
139 
140  const boolUList& pointFromDiag,
141  const labelUList& pointToFace,
142  const label cellID,
143 
144  DynamicList<face>& compactFaces,
145  DynamicList<label>& compactCellIDs
146  );
147 
148  static void removeInsidePoints
149  (
150  Mesh& s, // Modify inplace
151  const bool filterDiag,
152 
153  // Inputs
154  const boolUList& pointFromDiag,
155  const labelUList& pointToFace,
156  const labelUList& start, // Per cell:starting tri
157 
158  // Outputs
159  DynamicList<label>& pointCompactMap, // Per point the original
160  DynamicList<label>& compactCellIDs // Per face the cellID
161  );
162 
163 
164 protected:
165 
166  // Editing
167 
168  //- Subset the surface using the selected faces.
169  //
170  // \param[in] include the faces to select
171  void inplaceSubsetMesh(const bitSet& include);
172 
173 
174  // Sampling
175 
176  //- Interpolates cCoords,pCoords.
177  template<class Type>
179  (
180  const Field<Type>& cCoords,
181  const Field<Type>& pCoords
182  ) const;
183 
184 public:
185 
186  //- Runtime type information
187  TypeName("isoSurfaceTopo");
188 
189 
190  // Constructors
191 
192  //- Construct from cell and point values
193  //
194  // \param ignoreCells cells to ignore in the cellValues
195  //
196  // Control parameters include
197  // - bounds optional bounding box for trimming
198  // - mergeTol fraction of mesh bounding box for merging points
200  (
201  const polyMesh& mesh,
202  const scalarField& cellValues,
203  const scalarField& pointValues,
204  const scalar iso,
205  const isoSurfaceParams& params = isoSurfaceParams(),
206  const bitSet& ignoreCells = bitSet()
207  );
208 
209 
210  //- Destructor
211  virtual ~isoSurfaceTopo() = default;
212 
213 
214  // Member Functions
215 
216  //- For every point originating face (pyramid) in mesh
217  const labelList& pointToFace() const
218  {
219  return pointToFace_;
220  }
221 
222  //- Per point: originating mesh vertex/cc. See encoding above
223  const edgeList& pointToVerts() const
224  {
225  return pointToVerts_;
226  }
227 
228 
229  // Sampling
230 
236 };
237 
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "isoSurfaceTopoTemplates.C"
247 #endif
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::isoSurfaceBase
Low-level components common to various iso-surface algorithms.
Definition: isoSurfaceBase.H:66
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:63
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
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::isoSurfaceTopo::~isoSurfaceTopo
virtual ~isoSurfaceTopo()=default
Destructor.
Foam::isoSurfaceTopo::inplaceSubsetMesh
void inplaceSubsetMesh(const bitSet &include)
Subset the surface using the selected faces.
Definition: isoSurfaceTopo.C:1334
Foam::isoSurfaceTopo::pointToVerts
const edgeList & pointToVerts() const
Per point: originating mesh vertex/cc. See encoding above.
Definition: isoSurfaceTopo.H:222
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::interpolateTemplate
tmp< Field< Type > > interpolateTemplate(const Field< Type > &cCoords, const Field< Type > &pCoords) const
Interpolates cCoords,pCoords.
declareIsoSurfaceInterpolateMethod
#define declareIsoSurfaceInterpolateMethod(Type)
Definition: isoSurfaceBase.H:291
isoSurfaceTopoTemplates.C
bitSet.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
isoSurfaceBase.H
Foam::isoSurfaceBase::mesh
const polyMesh & mesh() const noexcept
The mesh for which the iso-surface is associated.
Definition: isoSurfaceBase.H:214
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::isoSurfaceParams::isoSurfaceParams
isoSurfaceParams(const algorithmType algo=algorithmType::ALGO_DEFAULT, const filterType filter=filterType::DIAGCELL) noexcept
Default construct, or with specified algorithm.
Definition: isoSurfaceParams.C:133
edgeList.H
Foam::isoSurfaceParams
Preferences for controlling iso-surface algorithms.
Definition: isoSurfaceParams.H:91
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:216
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::isoSurfaceBase::cellValues
const scalarField & cellValues() const noexcept
The mesh cell values used for creating the iso-surface.
Definition: isoSurfaceBase.H:220
Foam::EdgeMap< label >
Foam::Vector< scalar >
Foam::List< label >
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::tetCell
A tetrahedral cell primitive.
Definition: tetCell.H:62
Foam::isoSurfaceTopo::isoSurfaceTopo
isoSurfaceTopo(const polyMesh &mesh, const scalarField &cellValues, const scalarField &pointValues, const scalar iso, const isoSurfaceParams &params=isoSurfaceParams(), const bitSet &ignoreCells=bitSet())
Construct from cell and point values.
Definition: isoSurfaceTopo.C:971
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::pointValues
const scalarField & pointValues() const noexcept
The mesh point values used for creating the iso-surface.
Definition: isoSurfaceBase.H:226
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85