34 void Foam::fvMeshAdder::map
36 const Field<Type>& oldFld,
43 label newCellI = oldToNew[cellI];
45 if (newCellI >= 0 && newCellI < fld.size())
47 fld[newCellI] = oldFld[cellI];
54 void Foam::fvMeshAdder::MapVolField
56 const mapAddedPolyMesh& meshMap,
58 GeometricField<Type, fvPatchField, volMesh>& fld,
59 const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
62 const fvMesh&
mesh = fld.mesh();
69 Field<Type> oldInternalField(fld.internalField());
72 Field<Type>& intFld = fld.internalField();
74 intFld.setSize(mesh.nCells());
76 map(oldInternalField, meshMap.oldCellMap(), intFld);
77 map(fldToAdd.internalField(), meshMap.addedCellMap(), intFld);
85 const labelList& oldPatchMap = meshMap.oldPatchMap();
86 const labelList& oldPatchStarts = meshMap.oldPatchStarts();
87 const labelList& oldPatchSizes = meshMap.oldPatchSizes();
91 label unusedPatchI = 0;
93 forAll(oldPatchMap, patchI)
95 label newPatchI = oldPatchMap[patchI];
103 label nUsedPatches = unusedPatchI;
108 forAll(oldPatchMap, patchI)
110 label newPatchI = oldPatchMap[patchI];
114 oldToNew[patchI] = newPatchI;
118 oldToNew[patchI] = unusedPatchI++;
124 fld.boundaryField().reorder(oldToNew);
126 fld.boundaryField().setSize(mesh.boundaryMesh().size());
130 label newPatchI = nUsedPatches;
131 newPatchI < fld.boundaryField().size();
135 fld.boundaryField().set(newPatchI, NULL);
142 forAll(oldPatchMap, patchI)
144 label newPatchI = oldPatchMap[patchI];
152 oldPatchStarts[patchI],
153 oldPatchSizes[patchI],
154 meshMap.oldFaceMap(),
155 mesh.boundaryMesh()[newPatchI],
160 directFvPatchFieldMapper patchMapper(newToOld);
170 fld.boundaryField().set
173 fvPatchField<Type>::New
175 fld.boundaryField()[newPatchI],
176 mesh.boundary()[newPatchI],
177 fld.dimensionedInternalField(),
191 const labelList& addedPatchMap = meshMap.addedPatchMap();
194 forAll(addedPatchMap, patchI)
196 label newPatchI = addedPatchMap[patchI];
200 const polyPatch& newPatch = mesh.boundaryMesh()[newPatchI];
201 const polyPatch& oldPatch =
202 fldToAdd.mesh().boundaryMesh()[patchI];
204 if (!fld.boundaryField()(newPatchI))
216 meshMap.addedFaceMap(),
222 directFvPatchFieldMapper patchMapper(newToAdded);
224 fld.boundaryField().set
227 fvPatchField<Type>::New
229 fldToAdd.boundaryField()[patchI],
230 mesh.boundary()[newPatchI],
231 fld.dimensionedInternalField(),
249 meshMap.addedFaceMap(),
255 const fvPatchField<Type>& addedFld =
256 fldToAdd.boundaryField()[patchI];
258 fvPatchField<Type>& newFld = fld.boundaryField()[newPatchI];
262 label oldFaceI = newToAdded[i];
264 if (oldFaceI >= 0 && oldFaceI < addedFld.size())
266 newFld[i] = addedFld[oldFaceI];
286 mesh.objectRegistry::lookupClass
293 meshToAdd.objectRegistry::lookupClass
306 iterator fieldIter = fields.
begin();
307 fieldIter != fields.
end();
319 iterator fieldIter = fields.
begin();
320 fieldIter != fields.
end();
335 *fieldsToAdd[fld.
name()];
337 MapVolField<Type>(meshMap, fld, fldToAdd);
342 <<
"Not mapping field " << fld.
name()
343 <<
" since not present on mesh to add"
351 void Foam::fvMeshAdder::MapSurfaceField
384 label start = oldPatchStarts[patchI];
388 label newFaceI = meshMap.
oldFaceMap()[start + i];
392 intFld[newFaceI] = pf[i];
408 label unusedPatchI = 0;
410 forAll(oldPatchMap, patchI)
412 label newPatchI = oldPatchMap[patchI];
420 label nUsedPatches = unusedPatchI;
425 forAll(oldPatchMap, patchI)
427 label newPatchI = oldPatchMap[patchI];
431 oldToNew[patchI] = newPatchI;
435 oldToNew[patchI] = unusedPatchI++;
447 label newPatchI = nUsedPatches;
459 forAll(oldPatchMap, patchI)
461 label newPatchI = oldPatchMap[patchI];
469 oldPatchStarts[patchI],
470 oldPatchSizes[patchI],
477 directFvPatchFieldMapper patchMapper(newToOld);
490 fvsPatchField<Type>::New
511 forAll(addedPatchMap, patchI)
513 label newPatchI = addedPatchMap[patchI];
517 const polyPatch& newPatch = mesh.
boundaryMesh()[newPatchI];
518 const polyPatch& oldPatch =
539 directFvPatchFieldMapper patchMapper(newToAdded);
544 fvsPatchField<Type>::New
572 const fvsPatchField<Type>& addedFld =
575 fvsPatchField<Type>& newFld =
580 label oldFaceI = newToAdded[i];
582 if (oldFaceI >= 0 && oldFaceI < addedFld.size())
584 newFld[i] = addedFld[oldFaceI];
606 mesh.objectRegistry::lookupClass<fldType>()
611 meshToAdd.objectRegistry::lookupClass<fldType>()
622 iterator fieldIter = fields.
begin();
623 fieldIter != fields.
end();
627 const_cast<fldType*
>(fieldIter())
635 iterator fieldIter = fields.
begin();
636 fieldIter != fields.
end();
640 fldType& fld =
const_cast<fldType&
>(*fieldIter());
642 if (fieldsToAdd.
found(fld.name()))
646 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
648 MapSurfaceField<Type>(meshMap, fld, fldToAdd);
652 WarningIn(
"fvMeshAdder::MapSurfaceFields")
653 <<
"Not mapping field " << fld.name()
654 <<
" since not present on mesh to add"