60Foam::functionObjects::cellDecomposer::interpolate
67 const bool allowUnmapped
73 forAll(patchFields, patchi)
78 if (patchMap[patchi] == -1)
120 auto& result = tresult.ref();
127 auto& bf = result.boundaryFieldRef();
131 const label basePatchId = patchMap[patchi];
133 if (basePatchId != -1)
137 const fvPatch& basePatch = vf.
mesh().boundary()[basePatchId];
138 const label baseStart = basePatch.
start();
139 const label baseSize = basePatch.
size();
143 forAll(directAddressing, i)
147 if (baseFacei >= baseStart && baseFacei < baseStart+baseSize)
149 directAddressing[i] = baseFacei-baseStart;
155 directAddressing[i] = -1;
178 result.internalField(),
183 if (allowUnmapped && hasUnmapped)
194 forAll(directAddressing, i)
196 if (directAddressing[i] == -1)
201 bf[patchi].fvPatchField<Type>::operator=(value);
211bool Foam::functionObjects::cellDecomposer::mapFieldType()
const
222 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
225 const bool processed = !fieldNames.empty();
227 for (
const word& fieldName : fieldNames)
229 const VolFieldType&
field = lookupObject<VolFieldType>(fieldName);
231 auto* mapFieldPtr = mapRegion.
getObjectPtr<VolFieldType>(fieldName);
235 mapFieldPtr =
new VolFieldType
250 mapFieldPtr->store();
253 auto& mappedField = *mapFieldPtr;
264 Log <<
" " << fieldName <<
": interpolated" <<
nl;
274bool Foam::functionObjects::cellDecomposer::writeFieldType()
const
276 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
278 const fvMesh& mapRegion =
283 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
286 const bool processed = !fieldNames.empty();
288 for (
const word& fieldName : fieldNames)
290 const VolFieldType& mappedField =
291 mapRegion.template lookupObject<VolFieldType>(fieldName);
295 Log <<
" " << fieldName <<
": written" <<
nl;
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
static const this_type & null() noexcept
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
orientedType oriented() const noexcept
Return oriented type.
virtual bool hasUnmapped() const
Any unmapped values?
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
@ REGISTER
Request registration (bool: true).
@ 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 word & name() const noexcept
Return the object name.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
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.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
Generic dimensioned Type class.
This boundary condition provides an 'empty' condition for reduced dimensions cases,...
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
static tmp< fvPatchField< Type > > New(const word &patchFieldType, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual label size() const
Patch size is the number of faces, but can be overloaded.
label start() const noexcept
The patch start within the polyMesh face list.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< word > wordList
List of word.
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.
List< label > labelList
A List of labels.
DirectFieldMapper< fvPatchFieldMapper > directFvPatchFieldMapper
A fvPatchFieldMapper with direct mapping.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
static constexpr const zero Zero
Global zero (0).
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.