Go to the documentation of this file.
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];
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();
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();
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)
228 template<
class Type,
class GeoMeshType>
231 const word& fieldName,
237 surfMesh* surfptr = this->getSurfMesh(lookupName);
251 template<
class Type,
class GeoMeshType>
254 const word& fieldName,
260 surfMesh* surfptr = this->getSurfMesh(lookupName);
266 fieldName, dims, std::move(
values)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
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.
void storeField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values)
Copy/store named field as face or point data (template parameter).
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
A surface mesh consisting of general polygon faces that has IO capabilities and a registry for storin...
void storeField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values)
Copy/store named field as face or point data (template parameter).
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
static tmp< GeometricField< Type, fvPatchField, volMesh > > pointAverage(const GeometricField< Type, pointPatchField, pointMesh > &pfld)
Create cell values by averaging the point values.
#define forAll(list, i)
Loop across all elements in list.
Registry of regIOobjects.
A surface mesh consisting of general polygon faces and capable of holding fields.
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)
Abstract base class for interpolation.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
A face is a list of labels corresponding to mesh vertices.
void size(const label n)
Older name for setAddressableSize.
Generic GeometricField class.
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.
const dimensionSet dimless
Dimensionless.
bool storeSurfMeshField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values, word lookupName="") const
Copy/store sampled Face field onto surfMesh (if it exists)