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;
67 const point pt = fcs[i].centre(pts);
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();
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>
208 const word& fieldName,
214 polySurface* surfptr = this->getRegistrySurface(obr, lookupName);
220 fieldName, dims, std::move(values)
const Mesh & mesh() const
Return mesh.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const objectRegistry & db() const noexcept
Return the local objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
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.
const Time & time() const
Return the top-level database.
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.
void storeField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values)
Copy/store named field as face or point data (template parameter).
const labelListList & pointCells() const
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
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.
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.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionSet dimless
Dimensionless.
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.