mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: preservePatchTypes preserves whole patch dictionary, not just type.
This commit is contained in:
@ -569,21 +569,31 @@ int main(int argc, char *argv[])
|
||||
<< "as type patch. Please reset after mesh conversion as necessary."
|
||||
<< endl;
|
||||
|
||||
wordList patchTypes(patchFaces.size(), polyPatch::typeName);
|
||||
wordList patchPhysicalTypes(patchFaces.size());
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
// Add information to dictionary
|
||||
forAll(patchNames, patchI)
|
||||
{
|
||||
if (!patchDicts.set(patchI))
|
||||
{
|
||||
patchDicts.set(patchI, new dictionary());
|
||||
}
|
||||
// Add but not overwrite
|
||||
patchDicts[patchI].add("type", polyPatch::typeName, false);
|
||||
}
|
||||
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
@ -596,10 +606,9 @@ int main(int argc, char *argv[])
|
||||
cellShapes,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -578,7 +578,6 @@ int main(int argc, char *argv[])
|
||||
wordList patchTypes(npatch);
|
||||
word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = wallPolyPatch::typeName;
|
||||
wordList patchPhysicalTypes(npatch);
|
||||
|
||||
label nCreatedPatches = 0;
|
||||
|
||||
@ -707,18 +706,30 @@ int main(int argc, char *argv[])
|
||||
patchTypes.setSize(nCreatedPatches);
|
||||
patchNames.setSize(nCreatedPatches);
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
// Add information to dictionary
|
||||
forAll(patchNames, patchI)
|
||||
{
|
||||
if (!patchDicts.set(patchI))
|
||||
{
|
||||
patchDicts.set(patchI, new dictionary());
|
||||
}
|
||||
// Add but not overwrite
|
||||
patchDicts[patchI].add("type", patchTypes[patchI], false);
|
||||
}
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
@ -731,10 +742,9 @@ int main(int argc, char *argv[])
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -45,7 +45,6 @@ Description
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellShape.H"
|
||||
#include "faceSet.H"
|
||||
#include "cellSet.H"
|
||||
@ -1542,17 +1541,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
repatcher.repatch();
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(10);
|
||||
|
||||
@ -818,24 +818,32 @@ int main(int argc, char *argv[])
|
||||
// Scale points
|
||||
points *= scaleFactor;
|
||||
|
||||
wordList patchTypes(boundary.size(), polyPatch::typeName);
|
||||
PtrList<dictionary> patchDicts(boundary.size());
|
||||
word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = emptyPolyPatch::typeName;
|
||||
wordList patchPhysicalTypes(boundary.size());
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
// Mesh will auto-write on construction
|
||||
// Add information to dictionary
|
||||
forAll(patchNames, patchI)
|
||||
{
|
||||
if (!patchDicts.set(patchI))
|
||||
{
|
||||
patchDicts.set(patchI, new dictionary());
|
||||
}
|
||||
// Add but not overwrite
|
||||
patchDicts[patchI].add("type", polyPatch::typeName, false);
|
||||
}
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
@ -848,10 +856,9 @@ int main(int argc, char *argv[])
|
||||
cells,
|
||||
boundary,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -459,7 +459,6 @@ wordList patchNames(nPatches);
|
||||
wordList patchTypes(nPatches);
|
||||
word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = emptyPolyPatch::typeName;
|
||||
wordList patchPhysicalTypes(nPatches);
|
||||
|
||||
label nAddedPatches = 0;
|
||||
|
||||
@ -535,17 +534,27 @@ forAll(boundary, patchi)
|
||||
}
|
||||
}
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
// Add information to dictionary
|
||||
forAll(patchNames, patchI)
|
||||
{
|
||||
if (!patchDicts.set(patchI))
|
||||
{
|
||||
patchDicts.set(patchI, new dictionary());
|
||||
}
|
||||
// Add but not overwrite
|
||||
patchDicts[patchI].add("type", patchTypes[patchI], false);
|
||||
}
|
||||
|
||||
// Build the mesh and write it out
|
||||
polyMesh pShapeMesh
|
||||
@ -560,10 +569,9 @@ polyMesh pShapeMesh
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
patchPhysicalTypes
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
Info << "Writing polyMesh" << endl;
|
||||
|
||||
@ -43,7 +43,6 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "mergePoints.H"
|
||||
|
||||
@ -230,17 +230,28 @@ void sammMesh::readBoundary()
|
||||
|
||||
patchPhysicalTypes_.setSize(patchTypes_.size());
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime_,
|
||||
runTime_.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames_,
|
||||
patchTypes_,
|
||||
patchDicts,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_,
|
||||
patchPhysicalTypes_
|
||||
defaultFacesType_
|
||||
);
|
||||
|
||||
forAll(patchDicts, patchI)
|
||||
{
|
||||
if (patchDicts.set(patchI))
|
||||
{
|
||||
const dictionary& dict = patchDicts[patchI];
|
||||
dict.readIfPresent("type", patchTypes_[patchI]);
|
||||
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -228,17 +228,28 @@ void starMesh::readBoundary()
|
||||
|
||||
patchPhysicalTypes_.setSize(patchTypes_.size());
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime_,
|
||||
runTime_.constant(),
|
||||
polyMesh::defaultRegion,
|
||||
polyMesh::meshSubDir,
|
||||
patchNames_,
|
||||
patchTypes_,
|
||||
patchDicts,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_,
|
||||
patchPhysicalTypes_
|
||||
defaultFacesType_
|
||||
);
|
||||
|
||||
forAll(patchDicts, patchI)
|
||||
{
|
||||
if (patchDicts.set(patchI))
|
||||
{
|
||||
const dictionary& dict = patchDicts[patchI];
|
||||
dict.readIfPresent("type", patchTypes_[patchI]);
|
||||
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ Usage
|
||||
|
||||
#include "blockMesh.H"
|
||||
#include "attachPolyTopoChanger.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "cellSet.H"
|
||||
|
||||
@ -219,6 +218,7 @@ int main(int argc, char *argv[])
|
||||
xferCopy(blocks.points()), // could we re-use space?
|
||||
blocks.cells(),
|
||||
blocks.patches(),
|
||||
blocks.patchNames(),
|
||||
blocks.patchDicts(),
|
||||
defaultFacesName,
|
||||
defaultFacesType
|
||||
|
||||
Reference in New Issue
Block a user