ENH: topoSet: clear sets upon writing modified mesh. Fixes #129.

This commit is contained in:
mattijs
2016-11-16 14:58:46 +00:00
parent cb872a90af
commit ae3d2f4d57
50 changed files with 674 additions and 108 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,7 +56,9 @@ Description
#include "mapPolyMesh.H"
#include "faceSet.H"
#include "cellSet.H"
#include "pointSet.H"
#include "syncTools.H"
#include "ReadFields.H"
#include "polyTopoChange.H"
#include "polyModifyFace.H"
#include "polyAddFace.H"
@ -315,6 +317,59 @@ void initCreatedPatches
}
template<class TopoSet>
void subsetTopoSets
(
const fvMesh& mesh,
const IOobjectList& objectsList,
const labelList& map,
const fvMesh& subMesh,
PtrList<TopoSet>& subSets
)
{
// Read original sets
PtrList<TopoSet> sets;
ReadFields<TopoSet>(objectsList, sets);
subSets.setSize(sets.size());
forAll(sets, i)
{
TopoSet& set = sets[i];
Info<< "Subsetting " << set.type() << " " << set.name() << endl;
// Map the data
PackedBoolList isSet(set.maxSize(mesh));
forAllConstIter(labelHashSet, set, iter)
{
isSet[iter.key()] = true;
}
label nSet = 0;
forAll(map, i)
{
if (isSet[map[i]])
{
nSet++;
}
}
subSets.set
(
i,
new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE)
);
TopoSet& subSet = subSets[i];
forAll(map, i)
{
if (isSet[map[i]])
{
subSet.insert(i);
}
}
}
}
void createCoupledBaffles
(
fvMesh& mesh,
@ -923,6 +978,41 @@ int main(int argc, char *argv[])
surfTensorFlds
);
// Set handling
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
{
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
subsetTopoSets
(
mesh,
objects,
subsetter.cellMap(),
subsetter.subMesh(),
cellSets
);
subsetTopoSets
(
mesh,
objects,
subsetter.faceMap(),
subsetter.subMesh(),
faceSets
);
subsetTopoSets
(
mesh,
objects,
subsetter.pointMap(),
subsetter.subMesh(),
pointSets
);
}
if (!overwrite)
{
runTime++;
@ -1134,6 +1224,11 @@ int main(int argc, char *argv[])
Zero
);
// Update numbering of topoSets
topoSet::updateMesh(subsetter.subMesh().facesInstance(), map, cellSets);
topoSet::updateMesh(subsetter.subMesh().facesInstance(), map, faceSets);
topoSet::updateMesh(subsetter.subMesh().facesInstance(), map, pointSets);
// Move mesh (since morphing might not do this)
if (map().hasMotionPoints())

View File

@ -1,9 +1,11 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
EXE_LIBS = \
-lfiniteVolume \
-lreconstruct \
-ldynamicMesh

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,6 +60,8 @@ Description
#include "mapPolyMesh.H"
#include "unitConversion.H"
#include "motionSmoother.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -450,6 +452,8 @@ int main(int argc, char *argv[])
Info<< "Writing morphed mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
}
else
{

View File

@ -1,7 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lmeshTools \
-lreconstruct \
-ldynamicMesh

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,6 +62,8 @@ Description
#include "meshTools.H"
#include "Pair.H"
#include "globalIndex.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -567,6 +569,8 @@ int main(int argc, char *argv[])
// Write resulting mesh
Info<< "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
}
else if (edgeToPos.size())
{
@ -641,6 +645,8 @@ int main(int argc, char *argv[])
// Write resulting mesh
Info<< "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
}
else
{
@ -684,6 +690,8 @@ int main(int argc, char *argv[])
// Write resulting mesh
Info<< "Writing modified mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
}

View File

@ -1,11 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lreconstruct \
-ldynamicMesh \
-lmeshTools \
-lfiniteVolume \
-lgenericPatchFields

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,6 +49,7 @@ Description
#include "surfaceFields.H"
#include "pointFields.H"
#include "ReadFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -197,6 +198,8 @@ int main(int argc, char *argv[])
mesh.write();
meshCutter.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< "End\n" << endl;

View File

@ -1,7 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lreconstruct \
-lmeshTools

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,6 +53,7 @@ Description
#include "cellCuts.H"
#include "cellSet.H"
#include "meshCutter.H"
#include "processorMeshes.H"
using namespace Foam;
@ -257,6 +258,8 @@ int main(int argc, char *argv[])
Info<< "Writing refined mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< "End\n" << endl;

View File

@ -1,10 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume \
-lreconstruct \
-lgenericPatchFields

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,6 +44,7 @@ Description
#include "ReadFields.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -179,6 +180,8 @@ int main(int argc, char *argv[])
// Take over refinement levels and write to new time directory.
Pout<< "Writing mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Pout<< "End\n" << endl;

View File

@ -4,6 +4,7 @@ EXE_INC = \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
EXE_LIBS = \
@ -11,4 +12,5 @@ EXE_LIBS = \
-lsurfMesh \
-lmeshTools \
-ldynamicMesh \
-lreconstruct \
-lextrudeModel

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,6 +56,7 @@ Description
#include "wedgePolyPatch.H"
#include "planeExtrusion.H"
#include "emptyPolyPatch.H"
#include "processorMeshes.H"
using namespace Foam;
@ -1058,6 +1059,8 @@ int main(int argc, char *argv[])
FatalErrorInFunction
<< exit(FatalError);
}
// Remove any left-over files
processorMeshes::removeFiles(mesh);
// Need writing cellSet
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());

View File

@ -3,6 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
EXE_LIBS = \
@ -10,4 +11,5 @@ EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \
-lreconstruct \
-lextrudeModel

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -141,6 +141,7 @@ Notes:
#include "fvMeshTools.H"
#include "OBJstream.H"
#include "PatchTools.H"
#include "processorMeshes.H"
using namespace Foam;
@ -2646,6 +2647,8 @@ int main(int argc, char *argv[])
<< " at location " << regionMesh.facesInstance()
<< exit(FatalError);
}
topoSet::removeFiles(regionMesh);
processorMeshes::removeFiles(regionMesh);
// See if we need to extrude coordinates as well
@ -2847,6 +2850,8 @@ int main(int argc, char *argv[])
<< " at location " << mesh.facesInstance()
<< exit(FatalError);
}
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
}
Info << "End\n" << endl;

View File

@ -2,11 +2,14 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-Iextrude2DMesh/lnInclude \
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
EXE_LIBS = \
-lsurfMesh \
-ldynamicMesh \
-lreconstruct \
-lextrude2DMesh \
-lextrudeModel

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,6 +47,8 @@ Note
#include "addPatchCellLayer.H"
#include "patchToPoly2DMesh.H"
#include "globalIndex.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -323,6 +325,8 @@ int main(int argc, char *argv[])
<< nl << endl;
mesh().write();
topoSet::removeFiles(mesh());
processorMeshes::removeFiles(mesh());
Info<< "End\n" << endl;

View File

@ -9,6 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
@ -22,4 +23,5 @@ EXE_LIBS = \
-lfileFormats \
-ldynamicMesh \
-ldecompose \
-lreconstruct \
-lsnappyHexMesh

View File

@ -63,6 +63,7 @@ Description
#include "decompositionModel.H"
#include "fvMeshTools.H"
#include "profiling.H"
#include "processorMeshes.H"
using namespace Foam;
@ -673,6 +674,11 @@ void writeMesh
meshRefinement::writeType(writeLevel | meshRefinement::WRITEMESH),
mesh.time().path()/meshRefiner.timeName()
);
processorMeshes::removeFiles(mesh);
if (!debugLevel)
{
topoSet::removeFiles(mesh);
}
Info<< "Wrote mesh in = "
<< mesh.time().cpuTimeIncrement() << " s." << endl;
}

View File

@ -2,10 +2,12 @@ EXE_INC = \
-IfaceSelection \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lmeshTools \
-lfiniteVolume \
-lreconstruct \
-lgenericPatchFields

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,6 +53,8 @@ Description
#include "faceSelection.H"
#include "fvMeshTools.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -978,6 +980,8 @@ int main(int argc, char *argv[])
Info<< "Writing mesh to " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< "End\n" << endl;

View File

@ -1,7 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lreconstruct \
-lmeshTools

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,6 +52,7 @@ Description
#include "polyTopoChange.H"
#include "polyModifyFace.H"
#include "wordReList.H"
#include "processorMeshes.H"
using namespace Foam;
@ -900,6 +901,8 @@ int main(int argc, char *argv[])
// Write resulting mesh
Info<< "Writing repatched mesh to " << runTime.timeName() << nl << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< "End\n" << endl;

View File

@ -1,6 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lmeshTools
-lreconstruct

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,6 +35,8 @@ Description
#include "argList.H"
#include "Time.H"
#include "mergePolyMesh.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -163,6 +165,8 @@ int main(int argc, char *argv[])
}
masterMesh.write();
topoSet::removeFiles(masterMesh);
processorMeshes::removeFiles(masterMesh);
Info<< "End\n" << endl;

View File

@ -1,10 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools \
-lreconstruct \
-ldynamicMesh

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -63,6 +63,7 @@ Description
#include "ReadFields.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -362,6 +363,8 @@ int main(int argc, char *argv[])
}
Pout<< "Writing mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
// Dump duplicated points (if any)
if (split)

View File

@ -1,10 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-ldynamicMesh \
-lreconstruct \
-lmeshTools

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -74,6 +74,8 @@ Note
#include "ReadFields.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "topoSet.H"
#include "processorMeshes.H"
using namespace Foam;
@ -552,6 +554,8 @@ int main(int argc, char *argv[])
Info<< "Writing dual mesh to " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< "End\n" << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -696,7 +696,6 @@ int main(int argc, char *argv[])
bool writeMaps = false;
bool orderPoints = false;
label blockSize = 0;
bool renumberSets = true;
// Construct renumberMethod
autoPtr<IOdictionary> renumberDictPtr;
@ -756,8 +755,6 @@ int main(int argc, char *argv[])
Info<< "Writing renumber maps (new to old) to polyMesh." << nl
<< endl;
}
renumberSets = renumberDict.lookupOrDefault("renumberSets", true);
}
else
{
@ -884,46 +881,12 @@ int main(int argc, char *argv[])
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
if (renumberSets)
{
// Read sets
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
{
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
if (cSets.size())
{
Info<< "Reading cellSets:" << endl;
forAllConstIter(IOobjectList, cSets, iter)
{
cellSets.append(new cellSet(*iter()));
Info<< " " << cellSets.last().name() << endl;
}
}
}
{
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
if (fSets.size())
{
Info<< "Reading faceSets:" << endl;
forAllConstIter(IOobjectList, fSets, iter)
{
faceSets.append(new faceSet(*iter()));
Info<< " " << faceSets.last().name() << endl;
}
}
}
{
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
if (pSets.size())
{
Info<< "Reading pointSets:" << endl;
forAllConstIter(IOobjectList, pSets, iter)
{
pointSets.append(new pointSet(*iter()));
Info<< " " << pointSets.last().name() << endl;
}
}
}
ReadFields(objects, cellSets);
ReadFields(objects, faceSets);
ReadFields(objects, pointSets);
}
@ -1288,9 +1251,18 @@ int main(int argc, char *argv[])
{
mesh.setInstance(oldInstance);
}
else
{
mesh.setInstance(runTime.timeName());
}
Info<< "Writing mesh to " << mesh.facesInstance() << endl;
topoSet::updateMesh(mesh.facesInstance(), map(), cellSets);
topoSet::updateMesh(mesh.facesInstance(), map(), faceSets);
topoSet::updateMesh(mesh.facesInstance(), map(), pointSets);
mesh.write();
if (cellProcAddressing.headerOk())
@ -1437,27 +1409,6 @@ int main(int argc, char *argv[])
).write();
}
if (renumberSets)
{
forAll(cellSets, i)
{
cellSets[i].updateMesh(map());
cellSets[i].instance() = mesh.facesInstance();
cellSets[i].write();
}
forAll(faceSets, i)
{
faceSets[i].updateMesh(map());
faceSets[i].instance() = mesh.facesInstance();
faceSets[i].write();
}
forAll(pointSets, i)
{
pointSets[i].updateMesh(map());
pointSets[i].instance() = mesh.facesInstance();
pointSets[i].write();
}
}
Info<< "End\n" << endl;

View File

@ -34,9 +34,6 @@ sortCoupledFaceCells false;
// Optional entry: sort points into internal and boundary points
//orderPoints false;
// Optional: suppress renumbering cellSets,faceSets,pointSets
//renumberSets false;
method CuthillMcKee;
//method Sloan;

View File

@ -1,7 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lreconstruct \
-lmeshTools

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,6 +56,7 @@ Description
#include "attachPolyTopoChanger.H"
#include "regionSide.H"
#include "primitiveFacePatch.H"
#include "processorMeshes.H"
using namespace Foam;
@ -287,6 +288,9 @@ int main(int argc, char *argv[])
<< "Failed writing polyMesh."
<< exit(FatalError);
}
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
Info<< nl << "End" << nl << endl;

View File

@ -1,10 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-lreconstruct \
-ldynamicMesh \
-lmeshTools
-lgenericPatchFields

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -107,6 +107,7 @@ Description
#include "mappedWallPolyPatch.H"
#include "fvMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -941,6 +942,8 @@ void createAndWriteRegion
newMesh().setInstance(newMeshInstance);
newMesh().write();
topoSet::removeFiles(newMesh());
processorMeshes::removeFiles(newMesh());
// Write addressing files like decomposePar
Info<< "Writing addressing to base mesh" << endl;

View File

@ -1,9 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-ldynamicMesh \
-lreconstruct \
-lgenericPatchFields

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,11 +41,15 @@ Description
#include "fvMeshSubset.H"
#include "argList.H"
#include "cellSet.H"
#include "IOobjectList.H"
#include "volFields.H"
#include "topoDistanceData.H"
#include "FaceCellWave.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "ReadFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -262,6 +266,59 @@ void subsetDimensionedFields
}
template<class TopoSet>
void subsetTopoSets
(
const fvMesh& mesh,
const IOobjectList& objectsList,
const labelList& map,
const fvMesh& subMesh,
PtrList<TopoSet>& subSets
)
{
// Read original sets
PtrList<TopoSet> sets;
ReadFields<TopoSet>(objectsList, sets);
subSets.setSize(sets.size());
forAll(sets, i)
{
TopoSet& set = sets[i];
Info<< "Subsetting " << set.type() << " " << set.name() << endl;
// Map the data
PackedBoolList isSet(set.maxSize(mesh));
forAllConstIter(labelHashSet, set, iter)
{
isSet[iter.key()] = true;
}
label nSet = 0;
forAll(map, i)
{
if (isSet[map[i]])
{
nSet++;
}
}
subSets.set
(
i,
new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE)
);
TopoSet& subSet = subSets[i];
forAll(map, i)
{
if (isSet[map[i]])
{
subSet.insert(i);
}
}
}
}
int main(int argc, char *argv[])
{
@ -557,6 +614,43 @@ int main(int argc, char *argv[])
subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
// topoSets and subset
// ~~~~~~~~~~~~~~~~~~~
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
{
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
objects.remove(currentSet);
subsetTopoSets
(
mesh,
objects,
subsetter.cellMap(),
subsetter.subMesh(),
cellSets
);
subsetTopoSets
(
mesh,
objects,
subsetter.faceMap(),
subsetter.subMesh(),
faceSets
);
subsetTopoSets
(
mesh,
objects,
subsetter.pointMap(),
subsetter.subMesh(),
pointSets
);
}
// Write mesh and fields to new time
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -564,15 +658,22 @@ int main(int argc, char *argv[])
{
runTime.setTime(instant(fieldsInstance), 0);
subsetter.subMesh().setInstance(meshInstance);
topoSet::setInstance(meshInstance, cellSets);
topoSet::setInstance(meshInstance, faceSets);
topoSet::setInstance(meshInstance, pointSets);
}
else
{
runTime++;
subsetter.subMesh().setInstance(runTime.timeName());
}
Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()
<< endl;
subsetter.subMesh().write();
processorMeshes::removeFiles(subsetter.subMesh());
// Subsetting adds 'subset' prefix. Rename field to be like original.