55 const bool triangulate
74 triangulate_(
dict.getOrDefault(
"triangulate", false)),
83 if (patchIDs_.
empty())
91 for (
const label patchi : selected)
103 label nGood = (selected.size() - bad.
size());
107 os <<
"Cannot sample an empty patch" <<
nl;
109 for (
const label patchi : bad)
117 os <<
"No non-empty patches selected" <<
endl
122 os <<
"Selected " << nGood <<
" non-empty patches" <<
nl;
125 patchIDs_.resize(nGood);
127 for (
const label patchi : selected)
129 if (!bad.found(patchi))
131 patchIDs_[nGood] = patchi;
138 patchIDs_ = std::move(selected);
167 patchFaceLabels_.clear();
183 for (
const label patchi :
patchIDs())
186 numFaces +=
pp.size();
189 patchStart_.resize(
patchIDs().size());
192 patchIndex_.resize(numFaces);
193 patchFaceLabels_.resize(numFaces);
196 labelList& meshFaceIds = selectedFaces.addressing();
197 meshFaceIds.resize(numFaces);
203 const label patchi =
patchIDs()[idx];
205 const label len =
pp.
size();
207 patchStart_[idx] = numFaces;
221 this->storedPoints() = allPatches.localPoints();
222 this->storedFaces() = allPatches.localFaces();
240 needsUpdate_ =
false;
261 if (patchIndex_.size())
263 patchStart_[patchIndex_[0]] = 0;
264 for (label i = 1; i < patchIndex_.size(); ++i)
266 if (patchIndex_[i] != patchIndex_[i-1])
268 patchStart_[patchIndex_[i]] = i;
281 return sampleOnFaces(sampler);
290 return sampleOnFaces(sampler);
299 return sampleOnFaces(sampler);
308 return sampleOnFaces(sampler);
317 return sampleOnFaces(sampler);
332 return sampleOnFaces(sField);
341 return sampleOnFaces(sField);
350 return sampleOnFaces(sField);
359 return sampleOnFaces(sField);
368 return sampleOnFaces(sField);
377 return sampleOnPoints(interpolator);
386 return sampleOnPoints(interpolator);
395 return sampleOnPoints(interpolator);
404 return sampleOnPoints(interpolator);
413 return sampleOnPoints(interpolator);
419 os <<
"sampledPatch: " <<
name() <<
" :"
420 <<
" patches:" <<
flatOutput(selectionNames_);
424 os <<
" faces:" << faces().size()
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
const word & name() const noexcept
Return the object name.
label size() const noexcept
The number of elements in the list.
A List with indirect addressing.
const Addr & addressing() const noexcept
The list addressing.
void resize(const label len)
Adjust allocated size of list.
pointField & storedPoints()
virtual label triangulate()
List< face > & storedFaces()
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
A non-owning sub-view of a List (allocated or unallocated storage).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
bool get(const label i) const
void size(const label n)
Older name for setAddressableSize.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base class for volume field interpolation.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
A sampledSurface on patches. Non-triangulated by default.
virtual void print(Ostream &os, int level=0) const
Print information.
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample boundary of volume field onto surface faces.
const labelList & patchIDs() const
The patches selected.
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 withSurfaceFields() const
Can it sample surface-fields?
virtual bool update()
Update the surface as required.
const wordRes & patchNames() const
The selection (word/regex) of patches.
sampledPatch(const word &name, const polyMesh &mesh, const UList< wordRe > &patchNames, const bool triangulate=false)
Construct from components.
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().
A class for managing temporary objects.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Namespace for handling debugging switches.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< label > labelList
A List of labels.
UIndirectList< label > labelUIndList
UIndirectList of labels.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
GeometricField< sphericalTensor, fvsPatchField, surfaceMesh > surfaceSphericalTensorField
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
GeometricField< symmTensor, fvsPatchField, surfaceMesh > surfaceSymmTensorField
constexpr char nl
The newline '\n' character (0x0a).
wordList patchNames(nPatches)
#define forAll(list, i)
Loop across all elements in list.