sampledIsoSurfaceSurface.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) 2022-2026 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::sampledSurfaces::sampledIsoSurfaceSurface
26 
27 Description
28  A base class for sampled surfaces constructed from iso-surfaces
29 
30 SourceFiles
31  sampledIsoSurfaceSurface.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef sampledIsoSurfaceSurface_H
36 #define sampledIsoSurfaceSurface_H
37 
38 #include "sampledSurface.H"
39 #include "generatedCellZone.H"
40 #include "cutPolyIsoSurface.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace sampledSurfaces
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class sampledIsoSurfaceSurface Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public sampledSurface
56 {
57 private:
58 
59  // Private Data
60 
61  //- Optional cellZone in which to compute the iso-surface
62  mutable generatedCellZone zone_;
63 
64  //- Constructed iso-surface
65  mutable autoPtr<cutPolyIsoSurface> isoSurfPtr_;
66 
67  //- Time index at last surface generation
68  mutable label isoSurfTimeIndex_;
69 
70 
71  // Private Member Functions
72 
73  //- Generate the iso-surface
74  virtual autoPtr<cutPolyIsoSurface> calcIsoSurf() const = 0;
75 
76  //- Sample field on the surface's faces
77  template<class Type>
78  tmp<Field<Type>> sampleField
79  (
80  const VolField<Type>& vField
81  ) const;
82 
83  //- Interpolate field to the surface's points
84  template<class Type>
85  tmp<Field<Type>> interpolateField(const interpolation<Type>&) const;
86 
87 
88 protected:
89 
90  // Protected Member Functions
91 
92  //- Generate the iso-surface for given point and iso-values
93  autoPtr<cutPolyIsoSurface> calcIsoSurf
94  (
95  const scalarField& pointValues,
96  const scalar isoValue
97  ) const;
98 
99  //- Access the time index
100  inline const label& timeIndex() const
101  {
102  return isoSurfTimeIndex_;
103  }
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("sampledIsoSurfaceSurface");
110 
111 
112  // Constructors
113 
114  //- Construct from dictionary
116  (
117  const word& name,
118  const polyMesh& mesh,
119  const dictionary& dict
120  );
121 
122 
123  //- Destructor
124  virtual ~sampledIsoSurfaceSurface();
125 
126 
127  // Member Functions
128 
129  //- Update the surface as required.
130  // Do nothing (and return false) if no update was needed
131  virtual bool update();
132 
133  //- Update the surface as required.
134  // Do nothing (and return false) if no update was needed
135  virtual bool update() const;
136 
137  //- Points of surface
138  virtual const pointField& points() const
139  {
140  return isoSurfPtr_->points();
141  }
142 
143  //- Faces of surface
144  virtual const faceList& faces() const
145  {
146  return isoSurfPtr_->faces();
147  }
148 
149  //- Sample field on the surface's faces
150  #define DEFINE_SAMPLE(Type, nullArg) \
151  virtual tmp<Field<Type>> sample \
152  ( \
153  const VolField<Type>& \
154  ) const;
156  #undef DEFINE_SAMPLE
157 
158  //- Interpolate field to the surface's points
159  #define DEFINE_INTERPOLATE(Type, nullArg) \
160  virtual tmp<Field<Type>> interpolate \
161  ( \
162  const interpolation<Type>& \
163  ) const;
165  #undef DEFINE_INTERPOLATE
166 
167 
168  // Mesh changes
169 
170  //- Update for mesh point-motion
171  virtual void movePoints();
172 
173  //- Update topology using the given map
174  virtual void topoChange(const polyTopoChangeMap&);
175 
176  //- Update from another mesh using the given map
177  virtual void mapMesh(const polyMeshMap&);
178 
179  //- Redistribute or update using the given distribution map
180  virtual void distribute(const polyDistributionMap&);
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace sampledSurfaces
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
cellZone selection or generation class
Abstract base class for interpolation.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
An abstract class for surfaces with sampling.
const word & name() const
Name of surface.
const polyMesh & mesh() const
Access to the underlying mesh.
A base class for sampled surfaces constructed from iso-surfaces.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void movePoints()
Update for mesh point-motion.
sampledIsoSurfaceSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
TypeName("sampledIsoSurfaceSurface")
Runtime type information.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
const label & timeIndex() const
Access the time index.
virtual bool update()
Update the surface as required.
virtual const faceList & faces() const
Faces of surface.
virtual const pointField & points() const
Points of surface.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
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
#define DEFINE_SAMPLE(Type, nullArg)
Sample field on the surface's faces.
#define DEFINE_INTERPOLATE(Type, nullArg)
Interpolate field to the surface's points.
dictionary dict