diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index 6ab578d7224bc9fa40d5293c831a7971a225eede..78df05d1927b95807c3ce86d16cafe72e773b688 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -45,7 +45,6 @@ Description #include "volFields.H" #include "topoDistanceData.H" #include "FaceCellWave.H" -#include "BitOps.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" @@ -56,16 +55,33 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Get the exposed patchId or define the exposedPatchName in fvMeshSubset +label getExposedPatchId(const polyMesh& mesh, const word& patchName) +{ + const label patchId = mesh.boundaryMesh().findPatchID(patchName); + + if (patchId == -1) + { + fvMeshSubset::exposedPatchName = patchName; + } + + Info<< "Adding exposed internal faces to " + << (patchId == -1 ? "new" : "existing") + << " patch \"" << patchName << "\"" << nl << endl; + + return patchId; +} + + labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs) { const polyBoundaryMesh& pbm = mesh.boundaryMesh(); // Count number of faces in exposedPatchIDs label nFaces = 0; - forAll(patchIDs, i) + for (const label patchi : patchIDs) { - const polyPatch& pp = pbm[patchIDs[i]]; - nFaces += pp.size(); + nFaces += pbm[patchi].size(); } // Field on cells and faces. @@ -76,16 +92,15 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs) labelList patchFaces(nFaces); List<topoDistanceData> patchData(nFaces); nFaces = 0; - forAll(patchIDs, i) + for (const label patchi : patchIDs) { - label patchI = patchIDs[i]; - const polyPatch& pp = pbm[patchI]; + const polyPatch& pp = pbm[patchi]; forAll(pp, i) { patchFaces[nFaces] = pp.start()+i; - patchData[nFaces] = topoDistanceData(patchI, 0); - nFaces++; + patchData[nFaces] = topoDistanceData(patchi, 0); + ++nFaces; } } @@ -150,15 +165,17 @@ void subsetFields const fvMesh& baseMesh = subsetter.baseMesh(); - if (fieldNames.empty()) - { - return; - } - Info<< "Subsetting " << fieldType << " ("; - forAll(fieldNames, i) + label nFields = 0; + for (const word& fieldName : fieldNames) { - const word& fieldName = fieldNames[i]; - if (i) Info<< ' '; + if (!nFields) + { + Info<< "Subsetting " << fieldType << " ("; + } + else + { + Info<< ' '; + } Info<< fieldName; FieldType fld @@ -174,12 +191,18 @@ void subsetFields baseMesh ); - subFields.set(i, subsetter.interpolate(fld)); + subFields.set(nFields, subsetter.interpolate(fld)); // Subsetting adds 'subset' prefix - rename to match original. - subFields[i].rename(fieldName); + subFields[nFields].rename(fieldName); + + ++nFields; + } + + if (nFields) + { + Info<< ')' << nl; } - Info<< ")" << nl; } @@ -200,15 +223,17 @@ void subsetPointFields const fvMesh& baseMesh = subsetter.baseMesh(); - if (fieldNames.empty()) - { - return; - } - Info<< "Subsetting " << fieldType << " ("; - forAll(fieldNames, i) + label nFields = 0; + for (const word& fieldName : fieldNames) { - const word& fieldName = fieldNames[i]; - if (i) Info<< ' '; + if (!nFields) + { + Info<< "Subsetting " << fieldType << " ("; + } + else + { + Info<< ' '; + } Info<< fieldName; FieldType fld @@ -224,12 +249,18 @@ void subsetPointFields pMesh ); - subFields.set(i, subsetter.interpolate(fld)); + subFields.set(nFields, subsetter.interpolate(fld)); // Subsetting adds 'subset' prefix - rename to match original. - subFields[i].rename(fieldName); + subFields[nFields].rename(fieldName); + + ++nFields; + } + + if (nFields) + { + Info<< ')' << nl; } - Info<< ")" << nl; } @@ -249,15 +280,17 @@ void subsetDimensionedFields const fvMesh& baseMesh = subsetter.baseMesh(); - if (fieldNames.empty()) - { - return; - } - Info<< "Subsetting " << fieldType << " ("; - forAll(fieldNames, i) + label nFields = 0; + for (const word& fieldName : fieldNames) { - const word& fieldName = fieldNames[i]; - if (i) Info<< ' '; + if (!nFields) + { + Info<< "Subsetting " << fieldType << " ("; + } + else + { + Info<< ' '; + } Info<< fieldName; FieldType fld @@ -273,12 +306,18 @@ void subsetDimensionedFields baseMesh ); - subFields.set(i, subsetter.interpolate(fld)); + subFields.set(nFields, subsetter.interpolate(fld)); // Subsetting adds 'subset' prefix - rename to match original. - subFields[i].rename(fieldName); + subFields[nFields].rename(fieldName); + + ++nFields; + } + + if (nFields) + { + Info<< ')' << nl; } - Info<< ")" << nl; } @@ -297,40 +336,33 @@ void subsetTopoSets ReadFields<TopoSet>(objects, sets); subSets.setSize(sets.size()); - forAll(sets, i) + forAll(sets, seti) { - TopoSet& set = sets[i]; + const TopoSet& set = sets[seti]; Info<< "Subsetting " << set.type() << " " << set.name() << endl; - // Map the data - bitSet isSet(set.maxSize(mesh)); - forAllConstIters(set, iter) - { - isSet.set(iter.key()); - } - label nSet = 0; - forAll(map, i) + labelHashSet subset(2*min(set.size(), map.size())); + + for (const label id : map) { - if (isSet.test(map[i])) + if (set.found(id)) { - ++nSet; + subset.insert(id); } } subSets.set ( - i, - new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE) + seti, + new TopoSet + ( + subMesh, + set.name(), + std::move(subset), + IOobject::AUTO_WRITE + ) ); - TopoSet& subSet = subSets[i]; - forAll(map, i) - { - if (isSet.test(map[i])) - { - subSet.insert(i); - } - } } } @@ -340,25 +372,32 @@ int main(int argc, char *argv[]) { argList::addNote ( - "Select a mesh subset based on a cellSet" + "Select a mesh subset based on a cellSet or on cellZone(s) specified " + "as the first command argument." ); #include "addOverwriteOption.H" #include "addRegionOption.H" - argList::addArgument("cellSet"); + argList::addArgument("setOrZoneName"); argList::addOption ( "patch", "name", - "Add exposed internal faces to specified patch instead of to " - "'oldInternalFaces'" + "Add exposed internal faces to specified patch " + "instead of \"oldInternalFaces\"" ); argList::addOption ( "patches", - "names", - "Add exposed internal faces to nearest of specified patches" - " instead of to 'oldInternalFaces'" + "wordRes", + "Add exposed internal faces to closest of specified patches " + "instead of \"oldInternalFaces\"" + ); + argList::addBoolOption + ( + "zone", + "Subset with cellZone(s) instead of cellSet. " + "The command argument may be a list of words or regexs" ); argList::addOption ( @@ -374,11 +413,13 @@ int main(int argc, char *argv[]) #include "createNamedMesh.H" - const word selectionName = args[1]; + // arg[1] = word (cellSet) or wordRes (cellZone) + // const word selectionName = args[1]; word meshInstance = mesh.pointsInstance(); word fieldsInstance = runTime.timeName(); + const bool useCellZone = args.found("zone"); const bool overwrite = args.found("overwrite"); const bool specifiedInstance = args.readIfPresent ( @@ -391,8 +432,6 @@ int main(int argc, char *argv[]) meshInstance = fieldsInstance; } - Info<< "Reading cell set from " << selectionName << nl << endl; - // Default exposed patch id labelList exposedPatchIDs(one(), -1); @@ -401,51 +440,81 @@ int main(int argc, char *argv[]) { const wordRes patchNames(args.getList<wordRe>("patches")); - exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc(); + if (patchNames.size() == 1 && !patchNames.first().isPattern()) + { + exposedPatchIDs.first() = + getExposedPatchId(mesh, patchNames.first()); + } + else + { + exposedPatchIDs = + mesh.boundaryMesh().patchSet(patchNames).sortedToc(); - Info<< "Adding exposed internal faces to nearest of patches " - << flatOutput(patchNames) << nl << endl; + Info<< "Adding exposed internal faces to nearest of patches " + << flatOutput(patchNames) << nl << endl; - if (exposedPatchIDs.empty()) - { - FatalErrorInFunction - << nl << "No patches matched. Patches: " - << mesh.boundaryMesh().names() - << exit(FatalError); + if (exposedPatchIDs.empty()) + { + FatalErrorInFunction + << nl << "No patches matched. Patches: " + << mesh.boundaryMesh().names() << nl + << exit(FatalError); + } } } else if (args.found("patch")) { - const word patchName = args["patch"]; + exposedPatchIDs.first() = + getExposedPatchId(mesh, args["patch"]); + } + else + { + Info<< "Adding exposed internal faces to patch \"" + << fvMeshSubset::exposedPatchName + << "\" (created if necessary)" << nl + << nl; + } - exposedPatchIDs.first() = mesh.boundaryMesh().findPatchID(patchName); - Info<< "Adding exposed internal faces to patch " << patchName - << nl << endl; + autoPtr<cellSet> cellSetPtr; - if (exposedPatchIDs.first() == -1) + // arg[1] can be a word (for cellSet) or wordRes (for cellZone) + + wordRes zoneNames; + if (useCellZone) + { + List<wordRe> selectionNames = args.getList<wordRe>(1); + zoneNames.transfer(selectionNames); + + Info<< "Using cellZone " << flatOutput(zoneNames) << nl << endl; + + if (mesh.cellZones().findIndex(zoneNames) == -1) { FatalErrorInFunction - << nl << "No such patch. Patches: " - << mesh.boundaryMesh().names() + << "No cellZones found: " << flatOutput(zoneNames) << nl << nl << exit(FatalError); } } else { - Info<< "Adding exposed internal faces to a patch called" - << " \"oldInternalFaces\" (created if necessary)" << endl - << endl; + const word selectionName = args[1]; + + Info<< "Using cellSet " << selectionName << nl << endl; + + cellSetPtr = autoPtr<cellSet>::New(mesh, selectionName); } // Mesh subsetting engine fvMeshSubset subsetter(mesh); - cellSet currentSet(mesh, selectionName); - { - bitSet selectedCells = BitSetOps::create(mesh.nCells(), currentSet); + bitSet selectedCells = + ( + cellSetPtr + ? BitSetOps::create(mesh.nCells(), *cellSetPtr) + : mesh.cellZones().selection(zoneNames) + ); if (exposedPatchIDs.size() == 1) { @@ -475,6 +544,12 @@ int main(int argc, char *argv[]) true ); } + + Info<< "Subset " + << returnReduce(subsetter.subMesh().nCells(), sumOp<label>()) + << " of " + << returnReduce(mesh.nCells(), sumOp<label>()) + << " cells" << nl << nl; } @@ -485,39 +560,39 @@ int main(int argc, char *argv[]) // Read vol fields and subset // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - PtrList<volScalarField> scalarFlds; - subsetFields(subsetter, availableFields, scalarFlds); + PtrList<volScalarField> vScalarFlds; + subsetFields(subsetter, availableFields, vScalarFlds); - PtrList<volVectorField> vectorFlds; - subsetFields(subsetter, availableFields, vectorFlds); + PtrList<volVectorField> vVectorFlds; + subsetFields(subsetter, availableFields, vVectorFlds); - PtrList<volSphericalTensorField> sphTensorFlds; - subsetFields(subsetter, availableFields, sphTensorFlds); + PtrList<volSphericalTensorField> vSphTensorFlds; + subsetFields(subsetter, availableFields, vSphTensorFlds); - PtrList<volSymmTensorField> symmTensorFlds; - subsetFields(subsetter, availableFields, symmTensorFlds); + PtrList<volSymmTensorField> vSymmTensorFlds; + subsetFields(subsetter, availableFields, vSymmTensorFlds); - PtrList<volTensorField> tensorFlds; - subsetFields(subsetter, availableFields, tensorFlds); + PtrList<volTensorField> vTensorFlds; + subsetFields(subsetter, availableFields, vTensorFlds); // Read surface fields and subset // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - PtrList<surfaceScalarField> surfScalarFlds; - subsetFields(subsetter, availableFields, surfScalarFlds); + PtrList<surfaceScalarField> sScalarFlds; + subsetFields(subsetter, availableFields, sScalarFlds); - PtrList<surfaceVectorField> surfVectorFlds; - subsetFields(subsetter, availableFields, surfVectorFlds); + PtrList<surfaceVectorField> sVectorFlds; + subsetFields(subsetter, availableFields, sVectorFlds); - PtrList<surfaceSphericalTensorField> surfSphTensorFlds; - subsetFields(subsetter, availableFields, surfSphTensorFlds); + PtrList<surfaceSphericalTensorField> sSphTensorFlds; + subsetFields(subsetter, availableFields, sSphTensorFlds); - PtrList<surfaceSymmTensorField> surfSymmTensorFlds; - subsetFields(subsetter, availableFields, surfSymmTensorFlds); + PtrList<surfaceSymmTensorField> sSymmTensorFlds; + subsetFields(subsetter, availableFields, sSymmTensorFlds); - PtrList<surfaceTensorField> surfTensorFlds; - subsetFields(subsetter, availableFields, surfTensorFlds); + PtrList<surfaceTensorField> sTensorFlds; + subsetFields(subsetter, availableFields, sTensorFlds); // Read point fields and subset @@ -525,43 +600,43 @@ int main(int argc, char *argv[]) const pointMesh& pMesh = pointMesh::New(mesh); - PtrList<pointScalarField> pointScalarFlds; - subsetPointFields(subsetter, pMesh, availableFields, pointScalarFlds); + PtrList<pointScalarField> pScalarFlds; + subsetPointFields(subsetter, pMesh, availableFields, pScalarFlds); - PtrList<pointVectorField> pointVectorFlds; - subsetPointFields(subsetter, pMesh, availableFields, pointVectorFlds); + PtrList<pointVectorField> pVectorFlds; + subsetPointFields(subsetter, pMesh, availableFields, pVectorFlds); - PtrList<pointSphericalTensorField> pointSphTensorFlds; - subsetPointFields(subsetter, pMesh, availableFields, pointSphTensorFlds); + PtrList<pointSphericalTensorField> pSphTensorFlds; + subsetPointFields(subsetter, pMesh, availableFields, pSphTensorFlds); - PtrList<pointSymmTensorField> pointSymmTensorFlds; - subsetPointFields(subsetter, pMesh, availableFields, pointSymmTensorFlds); + PtrList<pointSymmTensorField> pSymmTensorFlds; + subsetPointFields(subsetter, pMesh, availableFields, pSymmTensorFlds); - PtrList<pointTensorField> pointTensorFlds; - subsetPointFields(subsetter, pMesh, availableFields, pointTensorFlds); + PtrList<pointTensorField> pTensorFlds; + subsetPointFields(subsetter, pMesh, availableFields, pTensorFlds); // Read dimensioned fields and subset // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - PtrList<volScalarField::Internal> scalarDimFlds; - subsetDimensionedFields(subsetter, availableFields, scalarDimFlds); + PtrList<volScalarField::Internal> dScalarFlds; + subsetDimensionedFields(subsetter, availableFields, dScalarFlds); - PtrList<volVectorField::Internal> vectorDimFlds; - subsetDimensionedFields(subsetter, availableFields, vectorDimFlds); + PtrList<volVectorField::Internal> dVectorFlds; + subsetDimensionedFields(subsetter, availableFields, dVectorFlds); - PtrList<volSphericalTensorField::Internal> sphTensorDimFlds; - subsetDimensionedFields(subsetter, availableFields, sphTensorDimFlds); + PtrList<volSphericalTensorField::Internal> dSphTensorFlds; + subsetDimensionedFields(subsetter, availableFields, dSphTensorFlds); - PtrList<volSymmTensorField::Internal> symmTensorDimFlds; - subsetDimensionedFields(subsetter, availableFields, symmTensorDimFlds); + PtrList<volSymmTensorField::Internal> dSymmTensorFlds; + subsetDimensionedFields(subsetter, availableFields, dSymmTensorFlds); - PtrList<volTensorField::Internal> tensorDimFlds; - subsetDimensionedFields(subsetter, availableFields, tensorDimFlds); + PtrList<volTensorField::Internal> dTensorFlds; + subsetDimensionedFields(subsetter, availableFields, dTensorFlds); - // topoSets and subset - // ~~~~~~~~~~~~~~~~~~~ + // Read topoSets and subset + // ~~~~~~~~~~~~~~~~~~~~~~~~ PtrList<cellSet> cellSets; PtrList<faceSet> faceSets; @@ -569,7 +644,10 @@ int main(int argc, char *argv[]) { IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets"); - objects.remove(currentSet); + if (cellSetPtr) + { + objects.remove(*cellSetPtr); + } subsetTopoSets ( mesh, @@ -621,94 +699,34 @@ int main(int argc, char *argv[]) // Volume fields - forAll(scalarFlds, i) - { - scalarFlds[i].write(); - } - forAll(vectorFlds, i) - { - vectorFlds[i].write(); - } - forAll(sphTensorFlds, i) - { - sphTensorFlds[i].write(); - } - forAll(symmTensorFlds, i) - { - symmTensorFlds[i].write(); - } - forAll(tensorFlds, i) - { - tensorFlds[i].write(); - } - - // Surface fields. - forAll(surfScalarFlds, i) - { - surfScalarFlds[i].write(); - } - forAll(surfVectorFlds, i) - { - surfVectorFlds[i].write(); - } - forAll(surfSphTensorFlds, i) - { - surfSphTensorFlds[i].write(); - } - forAll(surfSymmTensorFlds, i) - { - surfSymmTensorFlds[i].write(); - } - forAll(surfTensorFlds, i) - { - surfTensorFlds[i].write(); - } + for (const auto& fld : vScalarFlds) { fld.write(); } + for (const auto& fld : vVectorFlds) { fld.write(); } + for (const auto& fld : vSphTensorFlds) { fld.write(); } + for (const auto& fld : vSymmTensorFlds) { fld.write(); } + for (const auto& fld : vTensorFlds) { fld.write(); } + + // Surface fields + for (const auto& fld : sScalarFlds) { fld.write(); } + for (const auto& fld : sVectorFlds) { fld.write(); } + for (const auto& fld : sSphTensorFlds) { fld.write(); } + for (const auto& fld : sSymmTensorFlds) { fld.write(); } + for (const auto& fld : sTensorFlds) { fld.write(); } // Point fields - forAll(pointScalarFlds, i) - { - pointScalarFlds[i].write(); - } - forAll(pointVectorFlds, i) - { - pointVectorFlds[i].write(); - } - forAll(pointSphTensorFlds, i) - { - pointSphTensorFlds[i].write(); - } - forAll(pointSymmTensorFlds, i) - { - pointSymmTensorFlds[i].write(); - } - forAll(pointTensorFlds, i) - { - pointTensorFlds[i].write(); - } + for (const auto& fld : pScalarFlds) { fld.write(); } + for (const auto& fld : pVectorFlds) { fld.write(); } + for (const auto& fld : pSphTensorFlds) { fld.write(); } + for (const auto& fld : pSymmTensorFlds) { fld.write(); } + for (const auto& fld : pTensorFlds) { fld.write(); } // Dimensioned fields - forAll(scalarDimFlds, i) - { - scalarDimFlds[i].write(); - } - forAll(vectorDimFlds, i) - { - vectorDimFlds[i].write(); - } - forAll(sphTensorDimFlds, i) - { - sphTensorDimFlds[i].write(); - } - forAll(symmTensorDimFlds, i) - { - symmTensorDimFlds[i].write(); - } - forAll(tensorDimFlds, i) - { - tensorDimFlds[i].write(); - } + for (const auto& fld : dScalarFlds) { fld.write(); } + for (const auto& fld : dVectorFlds) { fld.write(); } + for (const auto& fld : dSphTensorFlds) { fld.write(); } + for (const auto& fld : dSymmTensorFlds) { fld.write(); } + for (const auto& fld : dTensorFlds) { fld.write(); } - Info<< "End\n" << endl; + Info<< "\nEnd\n" << endl; return 0; } diff --git a/etc/config.sh/completion_cache b/etc/config.sh/completion_cache index 37a5eb21a37a87c53ad9b46b3f6c05ec4171aa67..54597aa34f51672a8e7cf05c5a755d4df481c9df 100644 --- a/etc/config.sh/completion_cache +++ b/etc/config.sh/completion_cache @@ -18,7 +18,7 @@ _of_complete_cache_[ansysToFoam]="-case -fileHandler -scale | -noFunctionObjects _of_complete_cache_[applyBoundaryLayer]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -region -roots -ybl | -listFunctionObjects -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -parallel -write-nut -doc -doc-source -help" _of_complete_cache_[attachMesh]="-case -fileHandler | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -doc -doc-source -help" _of_complete_cache_[autoPatch]="-case -fileHandler | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -doc -doc-source -help" -_of_complete_cache_[blockMesh]="-case -dict -fileHandler -region | -blockTopology -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noClean -noFunctionObjects -sets -doc -doc-source -help" +_of_complete_cache_[blockMesh]="-case -dict -fileHandler -region -time | -blockTopology -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noClean -noFunctionObjects -sets -doc -doc-source -help" _of_complete_cache_[boundaryFoam]="-case -fileHandler -listScalarBCs -listVectorBCs | -dry-run -dry-run-write -listFunctionObjects -listFvOptions -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -doc -doc-source -help" _of_complete_cache_[boxTurb]="-case -fileHandler -listScalarBCs -listVectorBCs | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -doc -doc-source -help" _of_complete_cache_[buoyantBoussinesqPimpleFoam]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -roots | -dry-run -dry-run-write -listFunctionObjects -listFvOptions -listRegisteredSwitches -listSwitches -listTurbulenceModels -listUnsetSwitches -noFunctionObjects -parallel -postProcess -doc -doc-source -help" @@ -235,7 +235,7 @@ _of_complete_cache_[SRFSimpleFoam]="-case -decomposeParDict -fileHandler -hostRo _of_complete_cache_[star4ToFoam]="-case -fileHandler -scale | -ascii -noFunctionObjects -solids -doc -doc-source -help" _of_complete_cache_[steadyParticleTracks]="-case -dict -fileHandler -region -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -newTimes -noFunctionObjects -noZero -doc -doc-source -help" _of_complete_cache_[stitchMesh]="-case -dict -fileHandler -listScalarBCs -listVectorBCs -region -toleranceDict | -integral -intermediate -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -partial -perfect -doc -doc-source -help" -_of_complete_cache_[subsetMesh]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -patch -patches -region -resultTime -roots | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -parallel -doc -doc-source -help" +_of_complete_cache_[subsetMesh]="-case -decomposeParDict -fileHandler -hostRoots -listScalarBCs -listVectorBCs -patch -patches -region -resultTime -roots | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -overwrite -parallel -zone -doc -doc-source -help" _of_complete_cache_[subsetToPatch]="-case -fileHandler | -noFunctionObjects -doc -doc-source -help" _of_complete_cache_[surfaceAdd]="-case -fileHandler -points -scale | -mergeRegions -noFunctionObjects -doc -doc-source -help" _of_complete_cache_[surfaceBooleanFeatures]="-case -fileHandler -scale -trim | -invertedSpace -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -perturb -surf1Baffle -surf2Baffle -doc -doc-source -help" diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C index 239f9e1704b6d3487b0f31778899eccb440750b9..dbadbabc21e851f225a8974fc6cfcb206fdb1fb5 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C @@ -56,6 +56,11 @@ inline void markUsed } // End anonymous namespace +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +Foam::word Foam::fvMeshSubset::exposedPatchName("oldInternalFaces"); + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // bool Foam::fvMeshSubset::checkCellSubset() const @@ -571,7 +576,7 @@ void Foam::fvMeshSubset::setCellSubset { // No explicit patch specified. Put in oldInternalFaces patch. // Check if patch with this name already exists. - wantedPatchID = oldPatches.findPatchID("oldInternalFaces"); + wantedPatchID = oldPatches.findPatchID(exposedPatchName); } else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size()) { @@ -1078,7 +1083,7 @@ void Foam::fvMeshSubset::setCellSubset { newBoundary[nNewPatches] = new emptyPolyPatch ( - "oldInternalFaces", + exposedPatchName, boundaryPatchSizes[oldInternalPatchID], patchStart, nNewPatches, @@ -1086,7 +1091,7 @@ void Foam::fvMeshSubset::setCellSubset emptyPolyPatch::typeName ); - //Pout<< " oldInternalFaces : " + //Pout<< " " << exposedPatchName << " : " // << boundaryPatchSizes[oldInternalPatchID] << endl; // The index for the first patch is -1 as it originates from diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H index d7ae52a66131114758ee39547f940e202fb7908a..c6e83c361f010fb2de687191bd824212bc97bbae 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H @@ -153,6 +153,12 @@ class fvMeshSubset public: + // Static Data Members + + //- Name for exposed internal faces (default: oldInternalFaces) + static word exposedPatchName; + + // Constructors //- Construct given a mesh to subset