29#ifndef Foam_MapConsistentVolFields_H
30#define Foam_MapConsistentVolFields_H
47 fld.boundaryFieldRef().evaluate_if
49 [](
const auto& pfld) ->
bool
53 pfld.type() == pfld.patch().patch().type()
62template<
class Type,
class CombineOp>
73 const fvMesh& meshSource =
static_cast<const fvMesh&
>(interp.srcRegion());
74 const fvMesh& meshTarget =
static_cast<const fvMesh&
>(interp.tgtRegion());
81 selectedFields.empty()
82 ? objects.csorted<fieldType>()
83 : objects.csorted<fieldType>(selectedFields)
87 const fieldType fieldSource(
io, meshSource,
false);
92 meshTarget.time().timeName(),
97 if (targetIO.typeHeaderOk<fieldType>(
true))
99 Info<<
" interpolating onto existing field "
100 << targetIO.name() <<
endl;
102 fieldType fieldTarget(targetIO, meshTarget,
false);
104 interp.mapSrcToTgt(fieldSource, cop, fieldTarget);
112 Info<<
" creating new field "
113 << targetIO.name() <<
endl;
119 interp.mapSrcToTgt(fieldSource, cop)
122 fieldType fieldTarget(targetIO, tfieldTarget);
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 GeometricField class.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
UPtrList< const IOobject > csorted() const
The sorted list of IOobjects with headerClassName == Type::typeName.
readOption readOpt() const noexcept
Get the read option.
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
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 empty() const noexcept
True if List is empty (ie, size() is zero).
static commsTypes defaultCommsType
Default commsType.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Class to calculate the cell-addressing between two overlapping meshes.
const polyMesh & srcRegion() const
Return const access to the source mesh.
void mapSrcToTgt(const UList< Type > &srcFld, const CombineOp &cop, List< Type > &result) const
Map field from src to tgt mesh with defined operation.
const polyMesh & tgtRegion() const
Return const access to the target mesh.
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
A class for managing temporary objects.
A List of wordRe with additional matching capabilities.
void MapVolFields(const IOobjectList &objects, const meshToMesh0 &meshToMesh0Interp, const meshToMesh0::order &mapOrder, const CombineOp &cop)
messageStream Info
Information stream (stdout output on master, null elsewhere).
void evaluateConstraintTypes(GeometricField< Type, fvPatchField, volMesh > &fld)
Ostream & endl(Ostream &os)
Add newline and flush stream.