From 1441f8cab064a79b65e0dc7c80e86b8c45dc2f80 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sun, 15 May 2016 16:36:48 +0100 Subject: [PATCH] Patches contributed by Mattijs Janssens: splitMeshRegions: handle flipping of faces for surface fields subsetMesh: subset dimensionedFields decomposePar: use run-time selection of decomposition constraints. Used to keep cells on particular processors. See the decomposeParDict in $FOAM_UTILITIES/parallel/decomposePar: - preserveBaffles: keep baffle faces on same processor - preserveFaceZones: keep faceZones owner and neighbour on same processor - preservePatches: keep owner and neighbour on same processor. Note: not suitable for cyclicAMI since these are not coupled on the patch level - singleProcessorFaceSets: keep complete faceSet on a single processor - refinementHistory: keep cells originating from a single cell on the same processor. decomposePar: clean up decomposition of refinement data from snappyHexMesh reconstructPar: reconstruct refinement data (refineHexMesh, snappyHexMesh) reconstructParMesh: reconstruct refinement data (refineHexMesh, snappyHexMesh) redistributePar: - corrected mapping surfaceFields - adding processor patches in order consistent with decomposePar argList: check that slaves are running same version as master fvMeshSubset: move to dynamicMesh library fvMeshDistribute: - support for mapping dimensionedFields - corrected mapping of surfaceFields parallel routines: allow parallel running on single processor Field: support for - distributed mapping - mapping with flipping mapDistribute: support for flipping AMIInterpolation: avoid constructing localPoints --- .../splitMeshRegions/splitMeshRegions.C | 7 + .../mesh/manipulation/subsetMesh/Make/options | 4 +- .../mesh/manipulation/subsetMesh/subsetMesh.C | 97 ++ .../decomposePar/Make/options | 4 +- .../decomposePar/decomposePar.C | 14 +- .../decomposePar/decomposeParDict | 55 +- .../decomposePar/domainDecomposition.C | 157 +- .../decomposePar/domainDecomposition.H | 3 - .../domainDecompositionDistribute.C | 12 +- .../decomposePar/readFields.C | 63 +- .../decomposePar/readFields.H | 12 +- .../reconstructPar/Make/options | 2 + .../reconstructPar/reconstructPar.C | 76 +- .../reconstructParMesh/reconstructParMesh.C | 5 +- .../redistributePar/redistributePar.C | 4 +- .../dataConversion/foamToEnsight/Make/options | 5 +- .../foamToTecplot360/Make/options | 4 +- .../PVFoamReader/vtkPVFoam/Make/options | 4 +- src/Allwmake | 2 +- src/OpenFOAM/Make/files | 8 +- src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C | 47 +- .../IOstreams/Pstreams/combineGatherScatter.C | 12 +- src/OpenFOAM/db/IOstreams/Pstreams/exchange.C | 4 +- .../db/IOstreams/Pstreams/gatherScatter.C | 4 +- .../db/IOstreams/Pstreams/gatherScatterList.C | 4 +- .../db/objectRegistry/objectRegistry.C | 2 + .../DimensionedField/DimensionedField.H | 9 + .../DimensionedField/DimensionedFieldIO.C | 18 + src/OpenFOAM/fields/Fields/Field/Field.C | 154 +- src/OpenFOAM/fields/Fields/Field/Field.H | 27 +- .../fields/Fields/Field/FieldMapper.H | 15 + src/OpenFOAM/global/argList/argList.C | 22 +- .../mapPolyMesh/mapDistribute/mapDistribute.C | 911 +---------- .../mapPolyMesh/mapDistribute/mapDistribute.H | 274 +--- .../mapDistribute/mapDistributeBase.C | 1268 +++++++++++++++ .../mapDistribute/mapDistributeBase.H | 486 ++++++ .../mapDistributeBaseTemplates.C | 1368 +++++++++++++++++ .../mapDistribute/mapDistributePolyMesh.C | 190 ++- .../mapDistribute/mapDistributePolyMesh.H | 85 +- .../mapDistribute/mapDistributeTemplates.C | 924 +---------- .../constraint/cyclic/cyclicPolyPatch.C | 2 - .../nonuniformTransformCyclicPolyPatch.H | 4 +- .../meshes/polyMesh/syncTools/syncTools.H | 6 +- .../polyMesh/syncTools/syncToolsTemplates.C | 10 +- .../primitives/ops/flipOp.C} | 76 +- src/OpenFOAM/primitives/ops/flipOp.H | 103 ++ src/dynamicMesh/Make/files | 11 +- src/dynamicMesh/fvMeshAdder/fvMeshAdder.C | 14 + src/dynamicMesh/fvMeshAdder/fvMeshAdder.H | 26 +- .../fvMeshAdder/fvMeshAdderTemplates.C | 103 +- .../fvMeshDistribute/fvMeshDistribute.C | 414 ++++- .../fvMeshDistribute/fvMeshDistribute.H | 23 +- .../fvMeshDistributeTemplates.C | 142 +- .../fvMeshSubset/fvMeshSubset.C | 145 +- .../fvMeshSubset/fvMeshSubset.H | 73 +- .../fvMeshSubset/fvMeshSubsetInterpolate.C | 67 +- .../multiDirRefinement/multiDirRefinement.C | 3 +- .../polyTopoChange/{ => hexRef8}/hexRef8.C | 7 +- .../polyTopoChange/{ => hexRef8}/hexRef8.H | 2 +- .../polyTopoChange/hexRef8/hexRef8Data.C | 339 ++++ .../polyTopoChange/hexRef8/hexRef8Data.H | 136 ++ .../{ => hexRef8}/refinementHistory.C | 660 +++++++- .../{ => hexRef8}/refinementHistory.H | 153 +- src/finiteVolume/Make/files | 1 - .../fixedFluxPressureFvPatchScalarField.C | 8 +- .../meshRefinement/meshRefinement.C | 2 +- .../AMIInterpolation/AMIInterpolation.C | 15 +- .../AMIInterpolationParallelOps.C | 2 +- .../AMIMethod/AMIMethod/AMIMethod.C | 2 +- .../AMIMethod/directAMI/directAMI.C | 6 +- .../mappedPatchBaseTemplates.C | 10 +- src/parallel/decompose/decompose/Make/files | 1 + src/parallel/decompose/decompose/Make/options | 2 + .../decompose/decompose/decompositionModel.C | 164 ++ .../decompose/decompose/decompositionModel.H | 145 ++ .../decompose/decompositionMethods/Make/files | 11 + .../decompositionMethods/Make/options | 2 + .../decompositionConstraint.C | 86 ++ .../decompositionConstraint.H | 155 ++ .../preserveBafflesConstraint.C | 243 +++ .../preserveBafflesConstraint.H | 116 ++ .../preserveFaceZonesConstraint.C | 216 +++ .../preserveFaceZonesConstraint.H | 122 ++ .../preservePatchesConstraint.C | 200 +++ .../preservePatchesConstraint.H | 123 ++ .../refinementHistoryConstraint.C | 212 +++ .../refinementHistoryConstraint.H | 114 ++ .../singleProcessorFaceSetsConstraint.C | 319 ++++ .../singleProcessorFaceSetsConstraint.H | 124 ++ .../decompositionMethod/decompositionMethod.C | 540 +++++-- .../decompositionMethod/decompositionMethod.H | 41 +- .../decompose/ptscotchDecomp/ptscotchDecomp.H | 13 - src/renumber/renumberMethods/Make/options | 4 +- 93 files changed, 9230 insertions(+), 2650 deletions(-) create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C rename src/{parallel/decompose/ptscotchDecomp/ptscotchDecompTemplates.C => OpenFOAM/primitives/ops/flipOp.C} (59%) create mode 100644 src/OpenFOAM/primitives/ops/flipOp.H rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.C (91%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.H (75%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubsetInterpolate.C (89%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.C (99%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.H (99%) create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.C (65%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.H (71%) create mode 100644 src/parallel/decompose/decompose/decompositionModel.C create mode 100644 src/parallel/decompose/decompose/decompositionModel.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.H diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 4bce1fdd9..eddfe5189 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -200,6 +200,7 @@ void subsetSurfaceFields ( const fvMesh& mesh, const fvMesh& subMesh, + const labelList& cellMap, const labelList& faceMap, const labelHashSet& addedPatches ) @@ -223,6 +224,7 @@ void subsetSurfaceFields fld, subMesh, patchMap, + cellMap, faceMap ) ); @@ -828,6 +830,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -835,6 +838,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -842,6 +846,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -849,6 +854,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -856,6 +862,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/options b/applications/utilities/mesh/manipulation/subsetMesh/Make/options index 969020c4a..759535d95 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/options +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/options @@ -1,8 +1,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ + -ldynamicMesh \ -lgenericPatchFields diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index 896ee84bd..adebc93d3 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -150,6 +150,40 @@ void subsetPointFields } +template +void subsetDimensionedFields +( + const fvMeshSubset& subsetter, + const wordList& fieldNames, + PtrList >& subFields +) +{ + const fvMesh& baseMesh = subsetter.baseMesh(); + + forAll(fieldNames, i) + { + const word& fieldName = fieldNames[i]; + + Info<< "Subsetting field " << fieldName << endl; + + DimensionedField fld + ( + IOobject + ( + fieldName, + baseMesh.time().timeName(), + baseMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + baseMesh + ); + + subFields.set(i, subsetter.interpolate(fld)); + } +} + + int main(int argc, char *argv[]) { @@ -361,6 +395,42 @@ int main(int argc, char *argv[]) subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds); + // Read dimensioned fields and subset + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + typedef volScalarField::Internal dimScalType; + wordList scalarDimNames(objects.names(dimScalType::typeName)); + PtrList scalarDimFlds(scalarDimNames.size()); + subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds); + + typedef volVectorField::Internal dimVecType; + wordList vectorDimNames(objects.names(dimVecType::typeName)); + PtrList vectorDimFlds(vectorDimNames.size()); + subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds); + + typedef volSphericalTensorField::Internal dimSphereType; + wordList sphericalTensorDimNames(objects.names(dimSphereType::typeName)); + PtrList sphericalTensorDimFlds + ( + sphericalTensorDimNames.size() + ); + subsetDimensionedFields + ( + subsetter, + sphericalTensorDimNames, + sphericalTensorDimFlds + ); + + typedef volSymmTensorField::Internal dimSymmTensorType; + wordList symmTensorDimNames(objects.names(dimSymmTensorType::typeName)); + PtrList symmTensorDimFlds(symmTensorDimNames.size()); + subsetDimensionedFields(subsetter, symmTensorDimNames, symmTensorDimFlds); + + typedef volTensorField::Internal dimTensorType; + wordList tensorDimNames(objects.names(dimTensorType::typeName)); + PtrList tensorDimFlds(tensorDimNames.size()); + subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds); + // Write mesh and fields to new time // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -461,6 +531,33 @@ int main(int argc, char *argv[]) pointTensorFlds[i].write(); } + // DimensionedFields + forAll(scalarDimFlds, i) + { + scalarDimFlds[i].rename(scalarDimNames[i]); + scalarDimFlds[i].write(); + } + forAll(vectorDimFlds, i) + { + vectorDimFlds[i].rename(vectorDimNames[i]); + vectorDimFlds[i].write(); + } + forAll(sphericalTensorDimFlds, i) + { + sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]); + sphericalTensorDimFlds[i].write(); + } + forAll(symmTensorDimFlds, i) + { + symmTensorDimFlds[i].rename(symmTensorDimNames[i]); + symmTensorDimFlds[i].write(); + } + forAll(tensorDimFlds, i) + { + tensorDimFlds[i].rename(tensorDimNames[i]); + tensorDimFlds[i].write(); + } + Info<< "End\n" << endl; diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index 5d5d67f98..3fa418594 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -2,15 +2,15 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude EXE_LIBS = \ - -lfiniteVolume \ + -ldynamicMesh \ -ldecompose \ -lgenericPatchFields \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \ -llagrangian \ - -lmeshTools \ -lregionModels diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index bb3c80ab7..4958b521e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -96,6 +96,7 @@ Usage #include "fvFieldDecomposer.H" #include "pointFieldDecomposer.H" #include "lagrangianFieldDecomposer.H" +#include "decompositionModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -260,7 +261,8 @@ int main(int argc, char *argv[]) ++nProcs; } - // get requested numberOfSubdomains + // get requested numberOfSubdomains. Note: have no mesh yet so + // cannot use decompositionModel::New const label nDomains = readLabel ( IOdictionary @@ -819,16 +821,6 @@ int main(int argc, char *argv[]) processorDb.setTime(runTime); - // remove files remnants that can cause horrible problems - // - mut and nut are used to mark the new turbulence models, - // their existence prevents old models from being upgraded - { - fileName timeDir(processorDb.path()/processorDb.timeName()); - - rm(timeDir/"mut"); - rm(timeDir/"nut"); - } - // read the mesh if (!procMeshList.set(proci)) { diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index 39483a01e..0beef4f76 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -17,11 +17,61 @@ FoamFile numberOfSubdomains 2; + +// Optional decomposition constraints +//constraints +//{ +// preserveBaffles +// { +// //- Keep owner and neighbour of baffles on same processor (i.e. +// // keep it detectable as a baffle). Baffles are two boundary face +// // sharing the same points +// type preserveBaffles; +// } +// preserveFaceZones +// { +// //- Keep owner and neighbour on same processor for faces in zones +// type preserveFaceZones; +// zones (".*"); +// } +// preservePatches +// { +// //- Keep owner and neighbour on same processor for faces in patches +// // (only makes sense for cyclic patches. Not suitable for e.g. +// // cyclicAMI since these are not coupled on the patch level. Use +// // singleProcessorFaceSets for those) +// type preservePatches; +// patches (".*"); +// } +// singleProcessorFaceSets +// { +// //- Keep all of faceSet on a single processor. This puts all cells +// // connected with a point, edge or face on the same processor. +// // (just having face connected cells might not guarantee a balanced +// // decomposition) +// // The processor can be -1 (the decompositionMethod chooses the +// // processor for a good load balance) or explicitly provided (upsets +// // balance) +// type singleProcessorFaceSets; +// singleProcessorFaceSets ((f1 -1)); +// } +// refinementHistory +// { +// //- Decompose cells such that all cell originating from single cell +// // end up on same processor +// type refinementHistory; +// } +//} + + +// Deprecated form of specifying decomposition constraints: //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); //- Keep owner and neighbour on same processor for faces in patches: -// (makes sense only for cyclic patches) +// (makes sense only for cyclic patches. Not suitable for e.g. cyclicAMI +// since these are not coupled on the patch level. Use +// singleProcessorFaceSets for those) //preservePatches (cyclic_half0 cyclic_half1); //- Keep all of faceSet on a single processor. This puts all cells @@ -32,12 +82,13 @@ numberOfSubdomains 2; // for a good load balance) or explicitly provided (upsets balance). //singleProcessorFaceSets ((f0 -1)); - //- Keep owner and neighbour of baffles on same processor (i.e. keep it // detectable as a baffle). Baffles are two boundary face sharing the // same points. //preserveBaffles true; + + //- Use the volScalarField named here as a weight for each cell in the // decomposition. For example, use a particle population field to decompose // for a balanced number of particles in a lagrangian simulation. diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 0010965f8..d54d25b38 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -31,14 +31,14 @@ License #include "fvMesh.H" #include "OSspecific.H" #include "Map.H" -#include "globalMeshData.H" #include "DynamicList.H" #include "fvFieldDecomposer.H" #include "IOobjectList.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" -#include "uniformDimensionedFields.H" +#include "decompositionModel.H" +#include "hexRef8Data.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -90,18 +90,16 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) ) : NULL ), - decompositionDict_ + nProcs_ ( - IOobject + readInt ( - "decomposeParDict", - time().system(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + decompositionModel::New + ( + *this + ).lookup("numberOfSubdomains") ) ), - nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), cellToProc_(nCells()), procPointAddressing_(nProcs_), @@ -115,7 +113,10 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procProcessorPatchSubPatchIDs_(nProcs_), procProcessorPatchSubPatchStarts_(nProcs_) { - decompositionDict_.readIfPresent("distributed", distributed_); + decompositionModel::New + ( + *this + ).readIfPresent("distributed", distributed_); } @@ -195,57 +196,20 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - autoPtr cellLevelPtr; - { - IOobject io + // Load refinement data (if any) + hexRef8Data baseMeshData + ( + IOobject ( - "cellLevel", + "dummy", facesInstance(), polyMesh::meshSubDir, *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - cellLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr pointLevelPtr; - { - IOobject io - ( - "pointLevel", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - pointLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr level0EdgePtr; - { - IOobject io - ( - "level0Edge", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - level0EdgePtr.reset(new uniformDimensionedScalarField(io)); - } - } + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); @@ -771,8 +735,8 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } } - // Set the precision of the points data to 10 - IOstream::defaultPrecision(10); + // Set the precision of the points data to be min 10 + IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); procMesh.write(); @@ -842,64 +806,23 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - // hexRef8 data - if (cellLevelPtr.valid()) - { - labelIOList + // Optional hexRef8 data + hexRef8Data + ( + IOobject ( - IOobject - ( - cellLevelPtr().name(), - facesInstance(), - polyMesh::meshSubDir, - procMesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - UIndirectList