Loading...
Searching...
No Matches
sampledCuttingPlane.C
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-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "sampledCuttingPlane.H"
30#include "dictionary.H"
31#include "fvMesh.H"
32#include "volFields.H"
34#include "cartesianCS.H"
36#include "PtrList.H"
37
38// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39
40namespace Foam
41{
44 (
47 word,
49 );
50}
51
52
53// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
54
55Foam::plane Foam::sampledCuttingPlane::definePlane
56(
57 const polyMesh& mesh,
58 const dictionary& dict
59)
60{
61 plane pln(dict);
62
63 // Optional (cartesian) coordinate transform.
64 // - with registry to allow lookup from globally defined systems
65
66 auto csysPtr = coordinateSystem::NewIfPresent(mesh, dict);
67
68 if (!csysPtr)
69 {
70 csysPtr = coordinateSystem::NewIfPresent(dict, "transform");
71 }
72
73 // Make plane relative to the Cartesian coordinate system
74 if (csysPtr)
75 {
76 coordSystem::cartesian cs(csysPtr());
77
78 const point orig = cs.globalPosition(pln.origin());
79 const vector norm = cs.globalVector(pln.normal());
80
82 << "plane "
83 << " origin:" << pln.origin()
84 << " normal:" << pln.normal()
85 << " =>"
86 << " origin:" << orig << " normal:" << norm
87 << endl;
88
89 // Reassign the plane
90 pln = plane(orig, norm);
91 }
92
93 return pln;
94}
95
96
97void Foam::sampledCuttingPlane::checkBoundsIntersection
98(
99 const plane& pln,
100 const boundBox& meshBb
101) const
102{
103 // Verify specified bounding box
104 const boundBox& clipBb = isoParams_.getClipBounds();
105
106 if (clipBb.good())
107 {
108 // Bounding box does not overlap with (global) mesh!
109 if (!clipBb.overlaps(meshBb))
110 {
112 << nl
113 << name() << " : "
114 << "Bounds " << clipBb
115 << " do not overlap the mesh bounding box " << meshBb
116 << nl << endl;
117 }
118
119 // Plane does not intersect the bounding box
120 if (!clipBb.intersects(pln))
121 {
123 << nl
124 << name() << " : "
125 << "Plane "<< pln << " does not intersect the bounds "
126 << clipBb
127 << nl << endl;
128 }
129 }
130
131 // Plane does not intersect the (global) mesh!
132 if (!meshBb.intersects(pln))
133 {
135 << nl
136 << name() << " : "
137 << "Plane "<< pln << " does not intersect the mesh bounds "
138 << meshBb
139 << nl << endl;
140 }
141}
142
143
144void Foam::sampledCuttingPlane::setDistanceFields(const plane& pln)
145{
146 volScalarField& cellDistance = cellDistancePtr_();
147
148 // Get mesh from volField,
149 // so automatically submesh or baseMesh
150
151 const fvMesh& mesh = cellDistance.mesh();
152
153 // Distance to cell centres
154 // ~~~~~~~~~~~~~~~~~~~~~~~~
155
156 // Internal field
157 {
158 const auto& cc = mesh.cellCentres();
159 scalarField& fld = cellDistance.primitiveFieldRef();
160
161 forAll(cc, i)
162 {
163 fld[i] = pln.signedDistance(cc[i]);
164 }
165 }
166
167 // Patch fields
168 {
169 volScalarField::Boundary& cellDistanceBf =
170 cellDistance.boundaryFieldRef();
171
172 forAll(cellDistanceBf, patchi)
173 {
174 if
175 (
177 (
178 cellDistanceBf[patchi]
179 )
180 )
181 {
182 cellDistanceBf.set
183 (
184 patchi,
185 new calculatedFvPatchScalarField
186 (
187 mesh.boundary()[patchi],
188 cellDistance
189 )
190 );
191
192 const polyPatch& pp = mesh.boundary()[patchi].patch();
193 pointField::subField cc = pp.patchSlice(mesh.faceCentres());
194
195 fvPatchScalarField& fld = cellDistanceBf[patchi];
196 fld.setSize(pp.size());
197 forAll(fld, i)
198 {
199 fld[i] = pln.signedDistance(cc[i]);
200 }
201 }
202 else
203 {
204 // Other side cell centres?
205 const pointField& cc = mesh.C().boundaryField()[patchi];
206 fvPatchScalarField& fld = cellDistanceBf[patchi];
207
208 forAll(fld, i)
209 {
210 fld[i] = pln.signedDistance(cc[i]);
211 }
212 }
213 }
214 }
215
216
217 // On processor patches the mesh.C() will already be the cell centre
218 // on the opposite side so no need to swap cellDistance.
219
220 // Distance to points
221 pointDistance_.resize(mesh.nPoints());
222 {
223 const pointField& pts = mesh.points();
224
225 forAll(pointDistance_, i)
226 {
227 pointDistance_[i] = pln.signedDistance(pts[i]);
228 }
229 }
230}
231
232
233void Foam::sampledCuttingPlane::combineSurfaces
234(
235 PtrList<isoSurfaceBase>& isoSurfPtrs
236)
237{
238 isoSurfacePtr_.reset(nullptr);
239
240 // Already checked previously for ALGO_POINT, but do it again
241 // - ALGO_POINT still needs fields (for interpolate)
242 // The others can do straight transfer
243 if
244 (
245 isoParams_.algorithm() == isoSurfaceParams::ALGO_POINT
246 && isoSurfPtrs.size() == 1
247 )
248 {
249 // Shift ownership from list to autoPtr
250 isoSurfacePtr_.reset(isoSurfPtrs.release(0));
251 }
252 else if (isoSurfPtrs.size() == 1)
253 {
254 autoPtr<isoSurfaceBase> ptr(isoSurfPtrs.release(0));
255 auto& surf = *ptr;
256
257 surface_.transfer(static_cast<meshedSurface&>(surf));
258 meshCells_.transfer(surf.meshCells());
259 }
260 else
261 {
262 // Combine faces with point offsets
263 //
264 // Note: use points().size() from surface, not nPoints()
265 // since there may be uncompacted dangling nodes
266
267 label nFaces = 0, nPoints = 0;
268
269 for (const auto& surf : isoSurfPtrs)
270 {
271 nFaces += surf.size();
272 nPoints += surf.points().size();
273 }
274
275 faceList newFaces(nFaces);
276 pointField newPoints(nPoints);
277 meshCells_.resize(nFaces);
278
279 surfZoneList newZones(isoSurfPtrs.size());
280
281 nFaces = 0;
282 nPoints = 0;
283 forAll(isoSurfPtrs, surfi)
284 {
285 autoPtr<isoSurfaceBase> ptr(isoSurfPtrs.release(surfi));
286 auto& surf = *ptr;
287
288 SubList<face> subFaces(newFaces, surf.size(), nFaces);
289 SubList<point> subPoints(newPoints, surf.points().size(), nPoints);
290 SubList<label> subCells(meshCells_, surf.size(), nFaces);
291
292 newZones[surfi] = surfZone
293 (
295 subFaces.size(), // size
296 nFaces, // start
297 surfi // index
298 );
299
300 subFaces = surf.surfFaces();
301 subPoints = surf.points();
302 subCells = surf.meshCells();
303
304 if (nPoints)
305 {
306 for (face& f : subFaces)
307 {
308 for (label& pointi : f)
309 {
310 pointi += nPoints;
311 }
312 }
313 }
314
315 nFaces += subFaces.size();
316 nPoints += subPoints.size();
317 }
318
319 meshedSurface combined
320 (
321 std::move(newPoints),
322 std::move(newFaces),
323 newZones
324 );
325
326 surface_.transfer(combined);
327 }
328
329 // Addressing into the full mesh
330 if (subMeshPtr_ && meshCells_.size())
331 {
332 meshCells_ =
333 UIndirectList<label>(subMeshPtr_->cellMap(), meshCells_);
334 }
335}
336
337
338void Foam::sampledCuttingPlane::createGeometry()
339{
340 if (debug)
341 {
342 Pout<< "sampledCuttingPlane::createGeometry :updating geometry."
343 << endl;
344 }
345
346 // Clear any previously stored topologies
347 surface_.clear();
348 meshCells_.clear();
349 isoSurfacePtr_.reset(nullptr);
350
351 // Clear derived data
353
354 // Clear any stored fields
355 pointDistance_.clear();
356 cellDistancePtr_.clear();
357
358 const bool hasCellZones =
359 (-1 != mesh().cellZones().findIndex(zoneNames_));
360
361 const fvMesh& fvm = static_cast<const fvMesh&>(this->mesh());
362
363 // Geometry
364 if
365 (
366 simpleSubMesh_
367 && isoParams_.algorithm() != isoSurfaceParams::ALGO_POINT
368 )
369 {
370 subMeshPtr_.reset(nullptr);
371
372 // Handle cell zones as inverse (blocked) selection
373 if (!ignoreCellsPtr_)
374 {
375 ignoreCellsPtr_.reset(new bitSet);
376
377 if (hasCellZones)
378 {
379 bitSet select(mesh().cellZones().selection(zoneNames_));
380
381 if (select.any() && !select.all())
382 {
383 // From selection to blocking
384 select.flip();
385
386 *ignoreCellsPtr_ = std::move(select);
387 }
388 }
389 }
390 }
391 else
392 {
393 // A standard subMesh treatment
394
395 if (ignoreCellsPtr_)
396 {
397 ignoreCellsPtr_->clearStorage();
398 }
399 else
400 {
401 ignoreCellsPtr_.reset(new bitSet);
402 }
403
404 // Get sub-mesh if any
405 if (!subMeshPtr_ && hasCellZones)
406 {
407 const label exposedPatchi =
408 mesh().boundaryMesh().findPatchID(exposedPatchName_);
409
410 bitSet cellsToSelect(mesh().cellZones().selection(zoneNames_));
411
413 << "Allocating subset of size "
414 << cellsToSelect.count() << " with exposed faces into patch "
415 << exposedPatchi << endl;
416
417
418 // If we will use a fvMeshSubset so can apply bounds as well to make
419 // the initial selection smaller.
420
421 const boundBox& clipBb = isoParams_.getClipBounds();
422 if (clipBb.good() && cellsToSelect.any())
423 {
424 const auto& cellCentres = fvm.C();
425
426 for (const label celli : cellsToSelect)
427 {
428 const point& cc = cellCentres[celli];
429
430 if (!clipBb.contains(cc))
431 {
432 cellsToSelect.unset(celli);
433 }
434 }
435
437 << "Bounded subset of size "
438 << cellsToSelect.count() << endl;
439 }
440
441 subMeshPtr_.reset
442 (
443 new fvMeshSubset(fvm, cellsToSelect, exposedPatchi)
444 );
445 }
446 }
447
448
449 // Select either the submesh or the underlying mesh
450 const fvMesh& mesh =
451 (
452 subMeshPtr_
453 ? subMeshPtr_->subMesh()
454 : fvm
455 );
456
457 checkBoundsIntersection(plane_, mesh.bounds());
458
459
460 // Distance to cell centres
461 // ~~~~~~~~~~~~~~~~~~~~~~~~
462
463 cellDistancePtr_.reset
464 (
466 (
467 mesh.newIOobject("cellDistance"),
468 mesh,
470 )
471 );
472 const auto& cellDistance = *cellDistancePtr_;
473
474 setDistanceFields(plane_);
475
476 if (debug)
477 {
478 Pout<< "Writing cell distance:" << cellDistance.objectPath() << endl;
479 cellDistance.write();
480 auto tpointDist = pointScalarField::New
481 (
482 "pointDistance",
486 );
487 auto& pointDist = tpointDist.ref();
488
489 pointDist.primitiveFieldRef() = pointDistance_;
490
491 Pout<< "Writing point distance:" << pointDist.objectPath() << endl;
492 pointDist.write();
493 }
494
495
496 // Create surfaces for each offset
497
498 PtrList<isoSurfaceBase> isoSurfPtrs(offsets_.size());
499
500 forAll(offsets_, surfi)
501 {
502 isoSurfPtrs.set
503 (
504 surfi,
506 (
507 isoParams_,
508 cellDistance,
509 pointDistance_,
510 offsets_[surfi],
511 *ignoreCellsPtr_
512 )
513 );
514 }
515
516 // And flatten
517 combineSurfaces(isoSurfPtrs);
518
519
520 // Discard fields if not required by an iso-surface
521 if (!isoSurfacePtr_)
522 {
523 cellDistancePtr_.reset(nullptr);
524 pointDistance_.clear();
525 }
526
527 if (debug)
528 {
529 print(Pout, debug);
531 }
532}
533
534
535// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
536
538(
539 const word& name,
540 const polyMesh& mesh,
541 const dictionary& dict
542)
543:
544 sampledSurface(name, mesh, dict),
545 plane_(definePlane(mesh, dict)),
546 offsets_(),
547 isoParams_
548 (
549 dict,
550 isoSurfaceParams::ALGO_TOPO,
551 isoSurfaceParams::filterType::DIAGCELL
552 ),
553 average_(dict.getOrDefault("average", false)),
554 simpleSubMesh_(dict.getOrDefault("simpleSubMesh", false)),
555 zoneNames_(),
556 exposedPatchName_(),
557 needsUpdate_(true),
558
559 surface_(),
560 meshCells_(),
561 isoSurfacePtr_(nullptr),
562
563 subMeshPtr_(nullptr),
564 ignoreCellsPtr_(nullptr),
565 cellDistancePtr_(nullptr),
566 pointDistance_()
567{
568 dict.readIfPresent("offsets", offsets_);
569
570 if (offsets_.empty())
571 {
572 offsets_.resize(1);
573 offsets_.first() = Zero;
574 }
575
576 if (offsets_.size() > 1)
577 {
578 const label nOrig = offsets_.size();
579
580 inplaceUniqueSort(offsets_);
581
582 if (nOrig != offsets_.size())
583 {
584 IOWarningInFunction(dict)
585 << "Removed non-unique offsets" << nl;
586 }
587 }
588
589 if (isoParams_.algorithm() == isoSurfaceParams::ALGO_POINT)
590 {
591 // Not possible for ALGO_POINT
592 simpleSubMesh_ = false;
593
594 // Not possible for ALGO_POINT
595 if (offsets_.size() > 1)
596 {
597 FatalIOErrorInFunction(dict)
598 << "Multiple offsets with iso-surface (point) not supported"
599 << " since needs original interpolators." << nl
600 << exit(FatalIOError);
601 }
602 }
603
604
605 // Zones
606
607 if (!dict.readIfPresent("zones", zoneNames_) && dict.found("zone"))
608 {
609 zoneNames_.resize(1);
610 dict.readEntry("zone", zoneNames_.first());
611 }
612
613 if (-1 != mesh.cellZones().findIndex(zoneNames_))
614 {
615 dict.readIfPresent("exposedPatchName", exposedPatchName_);
616
617 DebugInfo
618 << "Restricting to cellZone(s) " << flatOutput(zoneNames_)
619 << " with exposed internal faces into patch "
620 << mesh.boundaryMesh().findPatchID(exposedPatchName_) << endl;
621 }
622}
623
624
625// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
628{
629 return needsUpdate_;
630}
631
632
634{
635 if (debug)
636 {
637 Pout<< "sampledCuttingPlane::expire :"
638 << " needsUpdate:" << needsUpdate_ << endl;
639 }
640
641 surface_.clear();
642 meshCells_.clear();
643 isoSurfacePtr_.reset(nullptr);
644
645 // Clear derived data
647
648 // Already marked as expired
649 if (needsUpdate_)
650 {
651 return false;
653
654 needsUpdate_ = true;
655 return true;
656}
657
658
660{
661 if (debug)
662 {
663 Pout<< "sampledCuttingPlane::update :"
664 << " needsUpdate:" << needsUpdate_ << endl;
665 }
666
667 if (!needsUpdate_)
668 {
669 return false;
670 }
671
672 createGeometry();
674 needsUpdate_ = false;
675 return true;
676}
677
678
681(
682 const interpolation<scalar>& sampler
683) const
684{
685 return sampleOnFaces(sampler);
686}
687
688
691(
692 const interpolation<vector>& sampler
693) const
694{
695 return sampleOnFaces(sampler);
696}
697
698
701(
702 const interpolation<sphericalTensor>& sampler
703) const
704{
705 return sampleOnFaces(sampler);
706}
707
708
711(
712 const interpolation<symmTensor>& sampler
713) const
714{
715 return sampleOnFaces(sampler);
716}
717
718
721(
722 const interpolation<tensor>& sampler
723) const
724{
725 return sampleOnFaces(sampler);
726}
727
728
731(
732 const interpolation<scalar>& interpolator
733) const
734{
735 return sampleOnPoints(interpolator);
736}
737
738
741(
742 const interpolation<vector>& interpolator
743) const
744{
745 return sampleOnPoints(interpolator);
746}
747
748
751(
752 const interpolation<sphericalTensor>& interpolator
753) const
754{
755 return sampleOnPoints(interpolator);
756}
757
758
761(
762 const interpolation<symmTensor>& interpolator
763) const
764{
765 return sampleOnPoints(interpolator);
766}
767
768
771(
772 const interpolation<tensor>& interpolator
773) const
774{
775 return sampleOnPoints(interpolator);
776}
777
778
779void Foam::sampledCuttingPlane::print(Ostream& os, int level) const
780{
781 os << "sampledCuttingPlane: " << name() << " :"
782 << " plane:" << plane_
783 << " offsets:" << flatOutput(offsets_);
784
785 if (level)
786 {
787 os << " faces:" << faces().size()
788 << " points:" << points().size();
789 }
790}
791
792
793// ************************************************************************* //
if(maxValue - minValue< SMALL)
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
if(patchID !=-1)
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
SubField< vector > subField
Definition Field.H:183
static tmp< GeometricField< scalar, pointPatchField, pointMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=pointPatchField< scalar >::calculatedType())
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
void resize(label newCapacity)
Rehash the hash table with new number of buckets. Currently identical to setCapacity().
Definition HashTable.C:722
@ NO_REGISTER
Do not request registration (bool: false).
label size() const noexcept
The number of elements in the list.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
A non-owning sub-view of a List (allocated or unallocated storage).
Definition SubList.H:61
A List with indirect addressing. Like IndirectList but does not store addressing.
bool any() const
True if any entries are 'true'.
Definition UList.H:821
bool empty() const noexcept
True if List is empty (ie, size() is zero).
Definition UList.H:701
bool all() const
True if all entries are 'true' or if the list is empty.
Definition UList.H:806
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
label findIndex(const wordRe &key) const
Zone index for the first match, return -1 if not found.
Definition ZoneMesh.C:729
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition bitSet.H:61
A bounding box defined in terms of min/max extrema points.
Definition boundBox.H:71
void reset()
Reset to an inverted box.
Definition boundBoxI.H:295
Constructs cutting plane through a mesh.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const volVectorField & C() const
Return cell centres as volVectorField.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Definition fvMesh.H:395
Abstract base class for volume field interpolation.
static autoPtr< isoSurfaceBase > New(const isoSurfaceParams &params, const volScalarField &cellValues, const scalarField &pointValues, const scalar iso, const bitSet &ignoreCells=bitSet())
Create for specified algorithm type.
Preferences for controlling iso-surface algorithms.
IOobject newIOobject(const word &name, IOobjectOption ioOpt) const
Create an IOobject at the current time instance (timeName) with the specified options.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition plane.H:91
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Definition polyMesh.H:609
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Definition polyMesh.H:679
const boundBox & bounds() const noexcept
Return mesh bounding box.
Definition polyMesh.H:617
virtual const pointField & points() const
Return raw points.
Definition polyMesh.C:1063
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
const vectorField & faceCentres() const
const vectorField & cellCentres() const
label nPoints() const noexcept
Number of mesh points.
A sampledSurface defined by a plane using an iso-surface algorithm to cut the mesh.
virtual void print(Ostream &os, int level=0) const
Print information.
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
virtual const faceList & faces() const
Faces of surface.
virtual bool expire()
Mark the surface as needing an update.
virtual bool needsUpdate() const
Does the surface need an update?
virtual bool update()
Update the surface as required.
sampledCuttingPlane(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
An abstract class for surfaces with sampling.
sampledSurface(const word &name, std::nullptr_t)
Construct null.
const word & name() const noexcept
Name of surface.
virtual void clearGeom() const
Additional cleanup when clearing the geometry.
const polyMesh & mesh() const noexcept
Access to the underlying mesh.
bool interpolate() const noexcept
Same as isPointData().
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
A surface zone on a MeshedSurface.
Definition surfZone.H:55
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
auto & name
const pointField & points
label nPoints
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
Definition BitOps.C:139
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Definition BitOps.H:320
Namespace for handling debugging switches.
Definition debug.C:45
Namespace of functions to calculate implicit derivatives returning a matrix.
Namespace for OpenFOAM.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< surfZone > surfZoneList
List of surfZone.
List< face > faceList
List of faces.
Definition faceListFwd.H:41
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
MeshedSurface< face > meshedSurface
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition FlatOutput.H:217
vector point
Point is a vector.
Definition point.H:37
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Vector< scalar > vector
Definition vector.H:57
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
labelList f(nPoints)
dictionary dict
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
const pointField & pts
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299