41 const Type& defaultValue
44 const label len = elements.
size();
46 if (len != fcs.
size())
50 <<
"sampled elements (" << len
51 <<
") != faces (" << fcs.
size() <<
')'
56 auto& values = tvalues.ref();
58 for (label i=0; i < len; ++i)
60 const label celli = elements[i];
63 values[i] = defaultValue;
87 const label len = elements.
size();
89 if (len != fcs.
size())
93 <<
"sampled elements (" << len
94 <<
") != faces (" << fcs.
size() <<
')'
101 auto& values = tvalues.ref();
103 bitSet pointDone(
pts.size());
107 const face&
f = fcs[facei];
108 const label celli = elements[facei];
110 for (
const label pointi :
f)
112 if (pointDone.set(pointi))
141 mesh.time().timeName(),
150 auto& cellAvg = tcellAvg.ref();
154 for (label pointi = 0; pointi <
mesh.nPoints(); ++pointi)
156 const Type& val = pfld[pointi];
159 for (
const label celli : pCells)
161 cellAvg[celli] += val;
162 ++nPointCells[celli];
168 cellAvg[celli] /= nPointCells[celli];
172 cellAvg.correctBoundaryConditions();
180template<
class Type,
class GeoMeshType>
184 const word& fieldName,
190 polySurface* surfptr = this->getRegistrySurface(obr, lookupName);
196 fieldName, dims, values
204template<
class Type,
class GeoMeshType>
207 const objectRegistry& obr,
208 const word& fieldName,
209 const dimensionSet& dims,
210 Field<Type>&& values,
214 polySurface* surfptr = this->getRegistrySurface(obr, lookupName);
218 surfptr->storeField<Type, GeoMeshType>
220 fieldName, dims, std::move(values)
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const objectRegistry & db() const noexcept
Return the local objectRegistry.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class for volume field interpolation.
virtual Type interpolate(const vector &position, const label celli, const label facei=-1) const =0
Interpolate field to the given point in the given cell.
Registry of regIOobjects.
A surface mesh consisting of general polygon faces and capable of holding fields.
DimensionedField< Type, GeoMeshType > & storeField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values)
Copy/store named field as face or point data (template parameter).
static tmp< Field< Type > > sampleOnPoints(const interpolation< Type > &interpolator, const labelUList &elements, const faceList &fcs, const pointField &pts)
Loop for interpolating volume elements to face points.
polySurface * getRegistrySurface(const objectRegistry &obr, word lookupName="") const
Get surface from registry if available.
static tmp< Field< Type > > sampleOnFaces(const interpolation< Type > &sampler, const labelUList &elements, const faceList &fcs, const pointField &pts, const Type &defaultValue=Type(Zero))
Loop for sampling volume elements to faces.
static tmp< VolumeField< Type > > pointAverage(const PointField< Type > &pfld)
Create cell values by averaging the point values.
bool storeRegistryField(const objectRegistry &obr, const word &fieldName, const dimensionSet &dims, const Field< Type > &values, word lookupName="") const
Copy/store sampled field onto registered surface (if it exists).
static autoPtr< sampledSurface > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected surface.
const polyMesh & mesh() const noexcept
Access to the underlying mesh.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const dimensionSet dimless
Dimensionless.
List< label > labelList
A List of labels.
List< face > faceList
List of faces.
Field< label > labelField
Specialisation of Field<T> for label.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
GeometricField< Type, pointPatchField, pointMesh > PointField
A point field for a given type.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.