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];
87 const label len = elements.
size();
89 if (len != fcs.
size())
93 <<
"sampled elements (" << len
94 <<
") != faces (" << fcs.
size() <<
')' 101 auto&
values = tvalues.ref();
107 const face&
f = fcs[facei];
108 const label celli = elements[facei];
110 for (
const label pointi :
f)
112 if (pointDone.set(pointi))
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();
180 template<
class Type,
class GeoMeshType>
184 const word& fieldName,
190 polySurface* surfptr = this->getRegistrySurface(obr, lookupName);
204 template<
class Type,
class GeoMeshType>
208 const word& fieldName,
214 polySurface* surfptr = this->getRegistrySurface(obr, lookupName);
220 fieldName, dims, std::move(
values)
A surface mesh consisting of general polygon faces and capable of holding fields. ...
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static tmp< VolumeField< Type > > pointAverage(const PointField< Type > &pfld)
Create cell values by averaging the point values.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#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.
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).
Generic dimensioned Type class.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
static autoPtr< sampledSurface > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected surface.
#define forAll(list, i)
Loop across all elements in list.
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.
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.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
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.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
A class for handling words, derived from Foam::string.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
const labelListList & pointCells() const
const Mesh & mesh() const noexcept
Return mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
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)
label nCells() const noexcept
Number of mesh cells.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class for volume field interpolation.
A class for managing temporary objects.
Registry of regIOobjects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Do not request registration (bool: false)
static constexpr const zero Zero
Global zero (0)