41 for (
const VolFieldType&
fld :
obr_.csorted<VolFieldType>())
45 if (fieldMapIter.good())
47 const word& sampleFldName = fieldMapIter.val();
49 if (
obr_.found(sampleFldName))
52 <<
" a field named " << sampleFldName
53 <<
" already exists on the mesh"
61 io.rename(sampleFldName);
64 const label newFieldi = sflds.size();
65 sflds.resize(newFieldi+1);
79 Log <<
" created " <<
io.name()
80 <<
" to sample " <<
fld.name() <<
endl;
90 const interpolationCellPoint<Type>& interpolator,
91 GeometricField<Type, fvPatchField, volMesh>&
fld
95 Field<Type> sampledValues(getPatchDataMapPtr_().constructSize());
97 forAll(cellToWalls_, celli)
99 const labelList& cData = cellToWalls_[celli];
103 const point& samplePt = cellToSamples_[celli][i];
104 sampledValues[cData[i]] = interpolator.interpolate(samplePt, celli);
109 getPatchDataMapPtr_().reverseDistribute
111 getPatchDataMapPtr_().constructSize(),
115 typename GeometricField<Type, fvPatchField, volMesh>::
116 Boundary& fldBf =
fld.boundaryFieldRef();
119 label nPatchFaces = 0;
120 for (
const label patchi : patchIDs_)
122 fvPatchField<Type>& pfld = fldBf[patchi];
124 Field<Type> newFld(pfld.size());
127 newFld[i] = sampledValues[nPatchFaces++];
145 const word& fldName = reverseFieldMap_[sflds[i].name()];
146 const VolFieldType&
fld = obr_.lookupObject<VolFieldType>(fldName);
155 sampleBoundaryField(interpolator, sflds[i]);
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))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
@ 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,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void size(const label n)
Older name for setAddressableSize.
HashTable< word > reverseFieldMap_
From resulting back to original field.
autoPtr< mapDistribute > getPatchDataMapPtr_
Map from cell based data back to patch based data.
List< List< point > > cellToSamples_
From cell to tracked end point.
labelListList cellToWalls_
From cell to seed patch faces.
void createFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Create the local fields.
void sampleBoundaryField(const interpolationCellPoint< Type > &interpolator, GeometricField< Type, fvPatchField, volMesh > &fld) const
Override boundary fields with sampled values.
void sampleFields(PtrList< GeometricField< Type, fvPatchField, volMesh > > &) const
Sample the fields.
labelList patchIDs_
Patches to sample.
HashTable< word > fieldMap_
From original field to sampled result.
const objectRegistry & obr_
Reference to the region objectRegistry.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Type interpolate(const cellPointWeight &cpw) const
Interpolate field for the given cellPointWeight.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
#define forAll(list, i)
Loop across all elements in list.