Merge remote-tracking branch 'origin/feature-cellSetRemove' into develop

This commit is contained in:
Mark Olesen
2016-12-07 14:13:00 +00:00
58 changed files with 860 additions and 116 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

@ -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;
@ -658,6 +659,13 @@ void writeMesh
meshRefiner.printMeshInfo(debugLevel, msg);
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
processorMeshes::removeFiles(mesh);
if (!debugLevel)
{
topoSet::removeFiles(mesh);
}
refinementHistory::removeFiles(mesh);
//label flag = meshRefinement::MESH;
//if (writeLevel)
//{

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

@ -79,6 +79,7 @@ Note
#include "ReadFields.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -537,6 +538,8 @@ int main(int argc, char *argv[])
Info<< "Writing mesh to time " << runTime.timeName() << endl;
mesh.write();
topoSet::removeFiles(mesh);
processorMeshes::removeFiles(mesh);
// Dump duplicated points (if any)
const labelList& pointMap = map().pointMap();

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

@ -6,7 +6,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/renumber/renumberMethods/lnInclude \
-I$(LIB_SRC)/renumber/zoltanRenumber/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-lmeshTools \
@ -14,5 +15,6 @@ EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-lrenumberMethods \
-lreconstruct \
$(LINK_FLAGS) \
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp

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,8 @@ Description
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "processorMeshes.H"
#include "hexRef8.H"
#ifdef FOAM_USE_ZOLTAN
#include "zoltanRenumber.H"
@ -696,7 +698,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 +757,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 +883,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);
}
@ -1183,6 +1148,7 @@ int main(int argc, char *argv[])
}
// Move mesh (since morphing might not do this)
if (map().hasMotionPoints())
{
@ -1288,9 +1254,20 @@ int main(int argc, char *argv[])
{
mesh.setInstance(oldInstance);
}
else
{
mesh.setInstance(runTime.timeName());
}
Info<< "Writing mesh to " << mesh.facesInstance() << endl;
processorMeshes::removeFiles(mesh);
hexRef8::removeFiles(mesh);
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 +1414,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.

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 "fvMeshAdder.H"
#include "polyTopoChange.H"
#include "extrapolatedCalculatedFvPatchFields.H"
#include "topoSet.H"
using namespace Foam;
@ -731,6 +732,7 @@ int main(int argc, char *argv[])
<< "Failed writing polyMesh."
<< exit(FatalError);
}
topoSet::removeFiles(masterMesh);
if (writeCellDist)
{

View File

@ -4,7 +4,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -14,4 +15,5 @@ EXE_LIBS = \
-ldecompose \
-lmeshTools \
-llagrangian \
-ldynamicMesh
-ldynamicMesh \
-lsnappyHexMesh

View File

@ -75,11 +75,15 @@ Usage
#include "loadOrCreateMesh.H"
#include "processorFvPatchField.H"
#include "zeroGradientFvPatchFields.H"
#include "decompositionModel.H"
#include "topoSet.H"
#include "parFvFieldReconstructor.H"
#include "parLagrangianRedistributor.H"
#include "unmappedPassiveParticleCloud.H"
#include "hexRef8Data.H"
#include "meshRefinement.H"
#include "pointFields.H"
using namespace Foam;
@ -837,6 +841,8 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
PtrList<DimensionedField<symmTensor, volMesh>> dimSymmTensorFields;
PtrList<DimensionedField<tensor, volMesh>> dimTensorFields;
DynamicList<word> pointFieldNames;
if (doReadFields)
{
@ -1050,6 +1056,40 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
);
// pointFields currently not supported. Read their names so we
// can delete them.
{
// Get my objects of type
pointFieldNames.append
(
objects.lookupClass(pointScalarField::typeName).sortedNames()
);
pointFieldNames.append
(
objects.lookupClass(pointVectorField::typeName).sortedNames()
);
pointFieldNames.append
(
objects.lookupClass
(
pointSphericalTensorField::typeName
).sortedNames()
);
pointFieldNames.append
(
objects.lookupClass
(
pointSymmTensorField::typeName
).sortedNames()
);
pointFieldNames.append
(
objects.lookupClass(pointTensorField::typeName).sortedNames()
);
// Make sure all processors have the same set
Pstream::scatter(pointFieldNames);
}
if (Pstream::master() && decompose)
{
@ -1136,6 +1176,20 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
runTime.TimePaths::caseName() = baseRunTime.caseName();
mesh.write();
topoSet::removeFiles(mesh);
forAll(pointFieldNames, i)
{
IOobject io
(
pointFieldNames[i],
runTime.timeName(),
mesh
);
fileName fieldFile(io.objectPath());
if (topoSet::debug) DebugVar(fieldFile);
rm(fieldFile);
}
// Now we've written all. Reset caseName on master
Info<< "Restoring caseName to " << proc0CaseName << endl;
@ -1145,6 +1199,20 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
else
{
mesh.write();
topoSet::removeFiles(mesh);
forAll(pointFieldNames, i)
{
IOobject io
(
pointFieldNames[i],
runTime.timeName(),
mesh
);
fileName fieldFile(io.objectPath());
if (topoSet::debug) DebugVar(fieldFile);
rm(fieldFile);
}
}
Info<< "Written redistributed mesh to " << mesh.facesInstance() << nl
<< endl;
@ -1180,14 +1248,18 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
{
runTime.TimePaths::caseName() = proc0CaseName;
}
// Make sure all processors have valid data (since only some will
// read)
refData.sync(io);
// Distribute
refData.distribute(map);
// Now we've read refinement data we can remove it
meshRefinement::removeFiles(mesh);
if (nDestProcs == 1)
{
if (Pstream::master())
@ -1209,6 +1281,55 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
}
}
//// Sets. Disabled for now.
//{
// // Read sets
// if (Pstream::master() && decompose)
// {
// runTime.TimePaths::caseName() = baseRunTime.caseName();
// }
// IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
//
// PtrList<cellSet> cellSets;
// ReadFields(objects, cellSets);
//
// if (Pstream::master() && decompose)
// {
// runTime.TimePaths::caseName() = proc0CaseName;
// }
//
// forAll(cellSets, i)
// {
// cellSets[i].distribute(map);
// }
//
// if (nDestProcs == 1)
// {
// if (Pstream::master())
// {
// Info<< "Setting caseName to " << baseRunTime.caseName()
// << " to write reconstructed refinement data." << endl;
// runTime.TimePaths::caseName() = baseRunTime.caseName();
//
// forAll(cellSets, i)
// {
// cellSets[i].distribute(map);
// }
//
// // Now we've written all. Reset caseName on master
// Info<< "Restoring caseName to " << proc0CaseName << endl;
// runTime.TimePaths::caseName() = proc0CaseName;
// }
// }
// else
// {
// forAll(cellSets, i)
// {
// cellSets[i].distribute(map);
// }
// }
//}
return autoPtr<mapDistributePolyMesh>
(

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.
@ -5751,9 +5751,42 @@ bool Foam::hexRef8::write() const
{
writeOk = writeOk && history_.write();
}
else
{
refinementHistory::removeFiles(mesh_);
}
return writeOk;
}
void Foam::hexRef8::removeFiles(const polyMesh& mesh)
{
IOobject io
(
"dummy",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
);
fileName setsDir(io.path());
if (topoSet::debug) DebugVar(setsDir);
if (exists(setsDir/"cellLevel"))
{
rm(setsDir/"cellLevel");
}
if (exists(setsDir/"pointLevel"))
{
rm(setsDir/"pointLevel");
}
if (exists(setsDir/"level0Edge"))
{
rm(setsDir/"level0Edge");
}
refinementHistory::removeFiles(mesh);
}
// ************************************************************************* //

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.
@ -568,6 +568,9 @@ public:
//- Force writing refinement+history to polyMesh directory.
bool write() const;
//- Helper: remove all relevant files from mesh instance
static void removeFiles(const polyMesh&);
};

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.
@ -28,6 +28,7 @@ License
#include "mapDistributePolyMesh.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "topoSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1736,6 +1737,26 @@ bool Foam::refinementHistory::writeData(Ostream& os) const
}
void Foam::refinementHistory::removeFiles(const polyMesh& mesh)
{
IOobject io
(
"dummy",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
);
fileName setsDir(io.path());
if (topoSet::debug) DebugVar(setsDir);
if (exists(setsDir/typeName))
{
rm(setsDir/typeName);
}
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, refinementHistory& rh)

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.
@ -87,7 +87,7 @@ namespace Foam
// Forward declaration of classes
class mapPolyMesh;
class mapDistributePolyMesh;
class polyMesh;
// Forward declaration of friend functions and operators
@ -401,6 +401,10 @@ public:
) const;
//- Helper: remove all sets files from mesh instance
static void removeFiles(const polyMesh&);
// IOstream Operators
//- Istream operator. Note: does not do a reduction - does not set

View File

@ -3038,6 +3038,30 @@ void Foam::meshRefinement::write
}
void Foam::meshRefinement::removeFiles(const polyMesh& mesh)
{
IOobject io
(
"dummy",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
);
fileName setsDir(io.path());
if (topoSet::debug) DebugVar(setsDir);
// Remove local files
if (exists(setsDir/"surfaceIndex"))
{
rm(setsDir/"surfaceIndex");
}
// Remove other files
hexRef8::removeFiles(mesh);
}
Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel()
{
return writeLevel_;

View File

@ -1447,6 +1447,9 @@ public:
const fileName&
) const;
//- Helper: remove all relevant files from mesh instance
static void removeFiles(const polyMesh&);
//- Helper: calculate average
template<class T>
static T gAverage
@ -1468,7 +1471,6 @@ public:
// NamedEnum
template<class Enum>
static int readFlags(const Enum& namedEnum, const wordList&);
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,6 +28,7 @@ License
#include "polyMesh.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
#include "mapDistributePolyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -228,6 +229,37 @@ void cellSet::updateMesh(const mapPolyMesh& morphMap)
}
void cellSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldCells());
forAllConstIter(cellSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributeCellData(inSet);
// Count
label n = 0;
forAll(inSet, celli)
{
if (inSet[celli])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, celli)
{
if (inSet[celli])
{
insert(celli);
}
}
}
void Foam::cellSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -147,9 +147,12 @@ public:
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
//- Update any stored data for new labels
//- Update any stored data for new labels.
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

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.
@ -27,6 +27,7 @@ License
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "mapDistributePolyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -161,6 +162,37 @@ void faceSet::updateMesh(const mapPolyMesh& morphMap)
}
void faceSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldFaces());
forAllConstIter(faceSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributeFaceData(inSet);
// Count
label n = 0;
forAll(inSet, facei)
{
if (inSet[facei])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, facei)
{
if (inSet[facei])
{
insert(facei);
}
}
}
void faceSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -116,6 +116,9 @@ public:
//- Update any stored data for new labels
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

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.
@ -27,6 +27,7 @@ License
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "mapDistributePolyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -156,6 +157,37 @@ void pointSet::updateMesh(const mapPolyMesh& morphMap)
}
void pointSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldPoints());
forAllConstIter(pointSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributePointData(inSet);
// Count
label n = 0;
forAll(inSet, pointi)
{
if (inSet[pointi])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, pointi)
{
if (inSet[pointi])
{
insert(pointi);
}
}
}
void pointSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -119,6 +119,9 @@ public:
//- Update any stored data for new labels
//virtual void updateMesh(const polyTopoChange& meshMod);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

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.
@ -550,6 +550,26 @@ void Foam::topoSet::updateMesh(const mapPolyMesh&)
}
void Foam::topoSet::removeFiles(const polyMesh& mesh)
{
IOobject io
(
"dummy",
mesh.facesInstance(),
mesh.meshSubDir/"sets",
mesh
);
fileName setsDir(io.path());
if (debug) DebugVar(setsDir);
if (isDir(setsDir))
{
rmDir(setsDir);
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::topoSet::operator=(const topoSet& rhs)

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.
@ -32,6 +32,7 @@ Description
SourceFiles
topoSet.C
topoSetTemplates.C
\*---------------------------------------------------------------------------*/
@ -54,6 +55,7 @@ namespace Foam
class mapPolyMesh;
class polyMesh;
class primitiveMesh;
class mapDistributePolyMesh;
/*---------------------------------------------------------------------------*\
Class topoSet Declaration
@ -297,9 +299,28 @@ public:
//- Update any stored data for new labels. Not implemented.
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&) = 0;
//- Return max allowable index (+1). Not implemented.
virtual label maxSize(const polyMesh& mesh) const = 0;
//- Helper: call updateMesh on all sets in container (and
// updates instance)
template<class Container>
static void updateMesh
(
const fileName& instance,
const mapPolyMesh&,
Container&
);
//- Helper: set instance on all sets in container
template<class Container>
static void setInstance(const fileName& instance, Container&);
//- Helper: remove all sets files from mesh instance
static void removeFiles(const polyMesh&);
// Member operators
@ -316,6 +337,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "topoSetTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Container>
void Foam::topoSet::setInstance
(
const fileName& instance,
Container& lst
)
{
forAll(lst, i)
{
lst[i].instance() = instance;
}
}
template<class Container>
void Foam::topoSet::updateMesh
(
const fileName& instance,
const mapPolyMesh& map,
Container& lst
)
{
forAll(lst, i)
{
lst[i].instance() = instance;
lst[i].updateMesh(map);
}
}
// ************************************************************************* //

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.
@ -26,6 +26,15 @@ License
#include "processorMeshes.H"
#include "Time.H"
#include "primitiveMesh.H"
#include "topoSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(processorMeshes, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -259,4 +268,62 @@ void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
}
void Foam::processorMeshes::removeFiles(const polyMesh& mesh)
{
fileName pointPath
(
IOobject
(
"pointProcAddressing",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
).objectPath()
);
if (topoSet::debug) DebugVar(pointPath);
rm(pointPath);
rm
(
IOobject
(
"faceProcAddressing",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
).objectPath()
);
rm
(
IOobject
(
"cellProcAddressing",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
).objectPath()
);
rm
(
IOobject
(
"boundaryProcAddressing",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
).objectPath()
);
rm
(
IOobject
(
"procAddressing",
mesh.facesInstance(),
mesh.meshSubDir,
mesh
).objectPath()
);
}
// ************************************************************************* //

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.
@ -89,6 +89,10 @@ class processorMeshes
public:
//- Runtime type information
ClassName("processorMeshes");
// Constructors
//- Construct from components
@ -133,7 +137,8 @@ public:
return boundaryProcAddressing_;
}
//- Helper: remove all procAddressing files from mesh instance
static void removeFiles(const polyMesh& mesh);
};