55 const bool triangulate
60 triangulate_(triangulate),
74 triangulate_(
dict.getOrDefault(
"triangulate", false)),
83 if (patchIDs_.
empty())
91 for (
const label patchi : selected)
95 if (isA<emptyPolyPatch>(
pp))
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;
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);
195 IndirectList<face> selectedFaces(
mesh().faces(),
labelList());
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;
209 SubList<label>(patchIndex_, len, numFaces) = idx;
211 SubList<label>(patchFaceLabels_, len, numFaces) =
identity(len);
213 SubList<label>(meshFaceIds, len, numFaces) =
identity(len,
pp.start());
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;
278 const interpolation<scalar>& sampler
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()
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
bool interpolate() const noexcept
Same as isPointData()
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
const polyMesh & mesh() const noexcept
Access to the underlying mesh.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An abstract class for surfaces with sampling.
virtual void print(Ostream &os, int level=0) const
Print information.
const word & name() const noexcept
Return the object name.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
sampledPatch(const word &name, const polyMesh &mesh, const UList< wordRe > &patchNames, const bool triangulate=false)
Construct from components.
constexpr char nl
The newline '\n' character (0x0a)
virtual bool withSurfaceFields() const
Can it sample surface-fields?
bool empty() const noexcept
True if List is empty (ie, size() is zero)
UIndirectList< label > labelUIndList
UIndirectList of labels.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
A sampledSurface on patches. Non-triangulated by default.
#define forAll(list, i)
Loop across all elements in list.
virtual void clearGeom() const
Additional cleanup when clearing the geometry.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
virtual bool update()
Update the surface as required.
wordList patchNames(nPatches)
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
virtual bool expire()
Mark the surface as needing an update.
A List of wordRe with additional matching capabilities.
void append(const T &val)
Copy append an element to the end of this list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample boundary of volume field onto surface faces.
const labelList & patchIDs() const
The patches selected.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
virtual bool needsUpdate() const
Does the surface need an update?
#define WarningInFunction
Report a warning using Foam::Warning.
const std::string patch
OpenFOAM patch number as a std::string.
Abstract base class for volume field interpolation.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.