35 void Foam::fvMeshAdder::MapVolField
37 const mapAddedPolyMesh& meshMap,
40 const VolField<Type>& fldToAdd
43 const fvMesh& mesh =
fld.mesh();
50 Field<Type> oldInternalField(
fld.primitiveField());
53 Field<Type>& intFld =
fld.primitiveFieldRef();
55 intFld.setSize(mesh.nCells());
57 intFld.rmap(oldInternalField, meshMap.oldCellMap());
58 intFld.rmap(fldToAdd.primitiveField(), meshMap.addedCellMap());
65 typename VolField<Type>::
66 Boundary& bfld =
fld.boundaryFieldRef();
69 const labelList& oldPatchMap = meshMap.oldPatchMap();
70 const labelList& oldPatchStarts = meshMap.oldPatchStarts();
71 const labelList& oldPatchSizes = meshMap.oldPatchSizes();
75 label unusedPatchi = 0;
87 label nUsedPatches = unusedPatchi;
98 oldToNew[
patchi] = newPatchi;
102 oldToNew[
patchi] = unusedPatchi++;
108 bfld.reorder(oldToNew);
110 bfld.setSize(mesh.boundaryMesh().size());
114 label newPatchi = nUsedPatches;
115 newPatchi < bfld.size();
119 bfld.set(newPatchi,
nullptr);
138 meshMap.oldFaceMap(),
139 mesh.boundaryMesh()[newPatchi],
157 mesh.boundary()[newPatchi],
159 forwardFieldMapper(newToOld)
172 const labelList& addedPatchMap = meshMap.addedPatchMap();
181 const polyPatch& newPatch = mesh.boundaryMesh()[newPatchi];
182 const polyPatch& oldPatch =
183 fldToAdd.mesh().boundaryMesh()[
patchi];
185 if (!bfld(newPatchi))
197 meshMap.addedFaceMap(),
208 fldToAdd.boundaryField()[
patchi],
209 mesh.boundary()[newPatchi],
211 forwardFieldMapper(newToAdded)
220 labelList addedToNew(oldPatch.size(), -1);
223 const label addedFacei = oldPatch.start() + i;
224 const label newFacei =
225 meshMap.addedFaceMap()[addedFacei];
226 const label patchFacei = newFacei-newPatch.start();
228 if (patchFacei >= 0 && patchFacei < newPatch.size())
230 addedToNew[i] = patchFacei;
236 fldToAdd.boundaryField()[
patchi],
237 reverseFieldMapper(addedToNew)
267 iterator fieldIter =
fields.begin();
268 fieldIter !=
fields.end();
283 *fieldsToAdd[
fld.name()];
287 Pout<<
"MapVolFields : mapping " <<
fld.name()
288 <<
" and " << fldToAdd.
name() <<
endl;
291 MapVolField<Type>(meshMap,
fld, fldToAdd);
296 <<
"Not mapping field " <<
fld.name()
297 <<
" since not present on mesh to add"
305 void Foam::fvMeshAdder::MapSurfaceField
317 Boundary& bfld =
fld.boundaryFieldRef();
350 intFld[newFacei] = pf[i];
366 label unusedPatchi = 0;
378 label nUsedPatches = unusedPatchi;
389 oldToNew[
patchi] = newPatchi;
393 oldToNew[
patchi] = unusedPatchi++;
399 bfld.reorder(oldToNew);
405 label newPatchi = nUsedPatches;
406 newPatchi < bfld.
size();
410 bfld.set(newPatchi,
nullptr);
450 forwardFieldMapper(newToOld)
472 const polyPatch& newPatch = mesh.
boundaryMesh()[newPatchi];
473 const polyPatch& oldPatch =
476 if (!bfld(newPatchi))
502 forwardFieldMapper(newToAdded)
511 labelList addedToNew(oldPatch.size(), -1);
514 const label addedFacei = oldPatch.start() + i;
515 const label newFacei =
517 const label patchFacei = newFacei-newPatch.start();
519 if (patchFacei >= 0 && patchFacei < newPatch.size())
521 addedToNew[i] = patchFacei;
528 reverseFieldMapper(addedToNew)
558 iterator fieldIter =
fields.begin();
559 fieldIter !=
fields.end();
573 Pout<<
"MapSurfaceFields : mapping " <<
fld.name()
574 <<
" and " << fldToAdd.
name() <<
endl;
577 MapSurfaceField<Type>(meshMap,
fld, fldToAdd);
582 <<
"Not mapping field " <<
fld.name()
583 <<
" since not present on mesh to add"
591 void Foam::fvMeshAdder::MapPointField
606 Boundary& bfld =
fld.boundaryFieldRef();
633 label unusedPatchi = 0;
645 label nUsedPatches = unusedPatchi;
656 oldToNew[
patchi] = newPatchi;
660 oldToNew[
patchi] = unusedPatchi++;
666 bfld.reorder(oldToNew);
674 label newPatchi = nUsedPatches;
675 newPatchi < bfld.
size();
679 bfld.set(newPatchi,
nullptr);
693 const pointPatch& newPp = mesh.
boundary()[newPatchi];
694 const labelList& newMeshPoints = newPp.meshPoints();
697 Map<label> newMeshPointMap(2*newMeshPoints.size());
698 forAll(newMeshPoints, ppi)
700 newMeshPointMap.insert(newMeshPoints[ppi], ppi);
711 if (fnd == newMeshPointMap.end())
718 newToOld[fnd()] = oldPointi;
737 forwardFieldMapper(newToOld)
759 const pointPatch& oldPatch = fldToAdd.
mesh().boundary()[
patchi];
760 const labelList& oldMp = oldPatch.meshPoints();
761 const pointPatch& newPp = mesh.
boundary()[newPatchi];
762 const labelList& newMeshPoints = newPp.meshPoints();
765 Map<label> newMpm(2*newMeshPoints.size());
766 forAll(newMeshPoints, ppi)
768 newMpm.insert(newMeshPoints[ppi], ppi);
771 if (!bfld(newPatchi))
782 if (fnd == newMpm.end())
789 newToAdded[fnd()] = oldPointi;
801 forwardFieldMapper(newToAdded)
816 if (fnd != newMpm.end())
819 oldToNew[oldPointi] = fnd();
826 reverseFieldMapper(oldToNew)
857 iterator fieldIter =
fields.begin();
858 fieldIter !=
fields.end();
872 Pout<<
"MapPointFields : mapping " <<
fld.name()
873 <<
" and " << fldToAdd.
name() <<
endl;
881 <<
"Not mapping field " <<
fld.name()
882 <<
" since not present on mesh to add"
890 void Foam::fvMeshAdder::MapDimField
932 iterator fieldIter =
fields.begin();
933 fieldIter !=
fields.end();
946 Pout<<
"MapDimFields : mapping " <<
fld.name()
947 <<
" and " << fldToAdd.name() <<
endl;
950 MapDimField<Type>(meshMap,
fld, fldToAdd);
954 WarningIn(
"fvMeshAdder::MapDimFields(..)")
955 <<
"Not mapping field " <<
fld.name()
956 <<
" 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.
friend class const_iterator
Declare friendship with the const_iterator.
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.
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 const HashSet< word > geometryFields
Set of names of registered geometric fields.
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.
word name(const bool)
Return a word representation of a bool.
typename VolField< Type >::Internal VolInternalField
prefixOSstream Pout(cout, "Pout")