37 void Foam::fvMeshAdder::MapVolField
39 const mapAddedPolyMesh& meshMap,
42 const VolField<Type>& fldToAdd
45 const fvMesh& mesh =
fld.mesh();
52 Field<Type> oldInternalField(
fld.primitiveField());
55 Field<Type>& intFld =
fld.primitiveFieldRef();
57 intFld.setSize(mesh.nCells());
59 intFld.rmap(oldInternalField, meshMap.oldCellMap());
60 intFld.rmap(fldToAdd.primitiveField(), meshMap.addedCellMap());
67 typename VolField<Type>::
68 Boundary& bfld =
fld.boundaryFieldRef();
71 const labelList& oldPatchMap = meshMap.oldPatchMap();
72 const labelList& oldPatchStarts = meshMap.oldPatchStarts();
73 const labelList& oldPatchSizes = meshMap.oldPatchSizes();
77 label unusedPatchi = 0;
89 label nUsedPatches = unusedPatchi;
100 oldToNew[
patchi] = newPatchi;
104 oldToNew[
patchi] = unusedPatchi++;
110 bfld.reorder(oldToNew);
112 bfld.setSize(mesh.boundaryMesh().size());
116 label newPatchi = nUsedPatches;
117 newPatchi < bfld.size();
121 bfld.set(newPatchi,
nullptr);
140 meshMap.oldFaceMap(),
141 mesh.boundaryMesh()[newPatchi],
146 directFvPatchFieldMapper patchMapper(newToOld);
162 mesh.boundary()[newPatchi],
177 const labelList& addedPatchMap = meshMap.addedPatchMap();
186 const polyPatch& newPatch = mesh.boundaryMesh()[newPatchi];
187 const polyPatch& oldPatch =
188 fldToAdd.mesh().boundaryMesh()[
patchi];
190 if (!bfld(newPatchi))
202 meshMap.addedFaceMap(),
208 directFvPatchFieldMapper patchMapper(newToAdded);
215 fldToAdd.boundaryField()[
patchi],
216 mesh.boundary()[newPatchi],
227 labelList addedToNew(oldPatch.size(), -1);
230 const label addedFacei = oldPatch.start() + i;
231 const label newFacei =
232 meshMap.addedFaceMap()[addedFacei];
233 const label patchFacei = newFacei-newPatch.start();
235 if (patchFacei >= 0 && patchFacei < newPatch.size())
237 addedToNew[i] = patchFacei;
243 fldToAdd.boundaryField()[
patchi],
244 reverseFvPatchFieldMapper(addedToNew)
274 iterator fieldIter =
fields.begin();
275 fieldIter !=
fields.end();
288 *fieldsToAdd[
fld.name()];
292 Pout<<
"MapVolFields : mapping " <<
fld.name()
293 <<
" and " << fldToAdd.
name() <<
endl;
296 MapVolField<Type>(meshMap,
fld, fldToAdd);
301 <<
"Not mapping field " <<
fld.name()
302 <<
" since not present on mesh to add"
310 void Foam::fvMeshAdder::MapSurfaceField
322 Boundary& bfld =
fld.boundaryFieldRef();
355 intFld[newFacei] = pf[i];
371 label unusedPatchi = 0;
383 label nUsedPatches = unusedPatchi;
394 oldToNew[
patchi] = newPatchi;
398 oldToNew[
patchi] = unusedPatchi++;
404 bfld.reorder(oldToNew);
410 label newPatchi = nUsedPatches;
411 newPatchi < bfld.
size();
415 bfld.set(newPatchi,
nullptr);
440 directFvPatchFieldMapper patchMapper(newToOld);
479 const polyPatch& newPatch = mesh.
boundaryMesh()[newPatchi];
480 const polyPatch& oldPatch =
483 if (!bfld(newPatchi))
501 directFvPatchFieldMapper patchMapper(newToAdded);
520 labelList addedToNew(oldPatch.size(), -1);
523 const label addedFacei = oldPatch.start() + i;
524 const label newFacei =
526 const label patchFacei = newFacei-newPatch.start();
528 if (patchFacei >= 0 && patchFacei < newPatch.size())
530 addedToNew[i] = patchFacei;
537 reverseFvPatchFieldMapper(addedToNew)
567 iterator fieldIter =
fields.begin();
568 fieldIter !=
fields.end();
580 Pout<<
"MapSurfaceFields : mapping " <<
fld.name()
581 <<
" and " << fldToAdd.
name() <<
endl;
584 MapSurfaceField<Type>(meshMap,
fld, fldToAdd);
589 <<
"Not mapping field " <<
fld.name()
590 <<
" since not present on mesh to add"
598 void Foam::fvMeshAdder::MapPointField
613 Boundary& bfld =
fld.boundaryFieldRef();
640 label unusedPatchi = 0;
652 label nUsedPatches = unusedPatchi;
663 oldToNew[
patchi] = newPatchi;
667 oldToNew[
patchi] = unusedPatchi++;
673 bfld.reorder(oldToNew);
681 label newPatchi = nUsedPatches;
682 newPatchi < bfld.
size();
686 bfld.set(newPatchi,
nullptr);
700 const pointPatch& newPp = mesh.
boundary()[newPatchi];
701 const labelList& newMeshPoints = newPp.meshPoints();
704 Map<label> newMeshPointMap(2*newMeshPoints.size());
705 forAll(newMeshPoints, ppi)
707 newMeshPointMap.insert(newMeshPoints[ppi], ppi);
718 if (fnd == newMeshPointMap.end())
725 newToOld[fnd()] = oldPointi;
729 directPointPatchFieldMapper patchMapper(newToOld);
768 const pointPatch& oldPatch = fldToAdd.
mesh().boundary()[
patchi];
769 const labelList& oldMp = oldPatch.meshPoints();
770 const pointPatch& newPp = mesh.
boundary()[newPatchi];
771 const labelList& newMeshPoints = newPp.meshPoints();
774 Map<label> newMpm(2*newMeshPoints.size());
775 forAll(newMeshPoints, ppi)
777 newMpm.insert(newMeshPoints[ppi], ppi);
780 if (!bfld(newPatchi))
791 if (fnd == newMpm.end())
798 newToAdded[fnd()] = oldPointi;
802 directPointPatchFieldMapper patchMapper(newToAdded);
827 if (fnd != newMpm.end())
830 oldToNew[oldPointi] = fnd();
837 reversePointPatchFieldMapper(oldToNew)
868 iterator fieldIter =
fields.begin();
869 fieldIter !=
fields.end();
881 Pout<<
"MapPointFields : mapping " <<
fld.name()
882 <<
" and " << fldToAdd.
name() <<
endl;
890 <<
"Not mapping field " <<
fld.name()
891 <<
" since not present on mesh to add"
899 void Foam::fvMeshAdder::MapDimField
941 iterator fieldIter =
fields.begin();
942 fieldIter !=
fields.end();
955 Pout<<
"MapDimFields : mapping " <<
fld.name()
956 <<
" and " << fldToAdd.name() <<
endl;
959 MapDimField<Type>(meshMap,
fld, fldToAdd);
963 WarningIn(
"fvMeshAdder::MapDimFields(..)")
964 <<
"Not mapping field " <<
fld.name()
965 <<
" since not present on mesh to add"
#define forAll(list, i)
Loop across all elements in list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const
Return mesh.
Pre-declare SubField and related Field type.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
An STL-conforming hash table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Map point field on topology change. This is a partial template specialisation for GeoMesh=pointMesh.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
label size() const
Return the number of elements in the UPtrList.
static void MapVolFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all volFields of Type.
static void MapDimFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all DimensionedFields of Type.
static void MapSurfaceFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all surfaceFields of Type.
static void MapPointFields(const mapAddedPolyMesh &, const pointMesh &mesh, const labelListList &oldMeshPoints, const objectRegistry &meshToAdd)
Map all surfaceFields of Type.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
static tmp< fvPatchField< Type > > New(const word &, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
static tmp< fvsPatchField< Type > > New(const word &, const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Return a pointer to a new patchField created on freestore given.
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
const labelList & addedFaceMap() const
const labelList & oldPatchMap() const
From old patch index to new patch index or -1 if patch.
const labelList & addedCellMap() const
const labelList & addedPatchMap() const
From added mesh patch index to new patch index or -1 if.
const labelList & oldPointMap() const
From old mesh point/face/cell to new mesh point/face/cell.
const labelList & oldCellMap() const
const labelList & oldPatchStarts() const
Return list of the old patch start labels.
const labelList & addedPointMap() const
From added mesh point/face/cell to new mesh point/face/cell.
const labelList & oldFaceMap() const
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
Registry of regIOobjects.
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
Mesh representing a set of points created from polyMesh.
const objectRegistry & thisDb() const
Return database. For now is its polyMesh.
label size() const
Return number of points.
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
static autoPtr< pointPatchField< Type > > New(const word &, const pointPatch &, const DimensionedField< Type, pointMesh > &)
Return a pointer to a new patchField created on freestore given.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
label nInternalFaces() const
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#define WarningInFunction
Report a warning using Foam::Warning.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
typename VolField< Type >::Internal VolInternalField
prefixOSstream Pout(cout, "Pout")