ENH: fvMeshSubset improvements (issue #951)

- what was previously termed 'setLargeCellSubset()' is now simply
  'setCellSubset()' and supports memory efficient interfaces.

  The new parameter ordering avoids ambiguities caused by default
  parameters.

  Old parameter order:

      setLargeCellSubset
      (
          const labelList& region,
          const label currentRegion,
          const label patchID = -1,
          const bool syncCouples = true
      );

  New parameter order:

      setCellSubset
      (
          const label regioni,
          const labelUList& regions,
          const label patchID = -1,
          const bool syncCouples = true
      );

   And without ambiguity:

      setCellSubset
      (
          const labelUList& selectedCells,
          const label patchID = -1,
          const bool syncCouples = true
      );

- support bitSet directly for specifying the selectedCells for
  memory efficiency and ease of use.

- Additional constructors to perform setCellSubset() immediately,
  which simplifies coding.

  For example,

      meshParts.set
      (
          zonei,
          new fvMeshSubset(mesh, selectedCells)
      );

  Or even

      return autoPtr<fvMeshSubset>::New(mesh, selectedCells);
This commit is contained in:
Mark Olesen 2018-07-25 18:58:00 +02:00
parent 7446d30fbd
commit dbe0db1d9a
23 changed files with 1737 additions and 1412 deletions

View File

@ -25,10 +25,15 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
PtrList<fvMeshSubset> meshParts(nZones);
labelList nCellsPerZone(nZones, 0);
forAll(nCellsPerZone, zoneI)
// A mesh subset for each zone
forAll(meshParts, zonei)
{
meshParts.set(zoneI, new fvMeshSubset(mesh));
meshParts[zoneI].setLargeCellSubset(zoneID, zoneI);
meshParts.set
(
zonei,
// Select cells where the zoneID == zonei
new fvMeshSubset(mesh, zonei, zoneID)
);
}
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)

View File

@ -51,6 +51,7 @@ Description
#include "fvMeshSubset.H"
#include "argList.H"
#include "cellSet.H"
#include "BitOps.H"
#include "IOobjectList.H"
#include "volFields.H"
#include "mapPolyMesh.H"
@ -774,19 +775,19 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Create mesh subsetting engine
fvMeshSubset subsetter(mesh);
{
cellSet blockedCells(mesh, blockedSetName);
// invert
blockedCells.invert(mesh.nCells());
// Create subsetted mesh.
subsetter.setLargeCellSubset(blockedCells, defaultPatchi, true);
}
// Mesh subsetting engine
fvMeshSubset subsetter
(
mesh,
BitSetOps::create
(
mesh.nCells(),
cellSet(mesh, blockedSetName), // Blocked cells as labelHashSet
false // on=false: invert logic => retain the unblocked cells
),
defaultPatchi,
true
);
// Subset wantedPatch. Note that might also include boundary faces

View File

@ -570,17 +570,16 @@ labelList regionRenumber
label celli = 0;
forAll(regionToCells, regionI)
forAll(regionToCells, regioni)
{
Info<< " region " << regionI << " starts at " << celli << endl;
Info<< " region " << regioni << " starts at " << celli << endl;
// Make sure no parallel comms
bool oldParRun = UPstream::parRun();
const bool oldParRun = UPstream::parRun();
UPstream::parRun() = false;
// Per region do a reordering.
fvMeshSubset subsetter(mesh);
subsetter.setLargeCellSubset(cellToRegion, regionI);
fvMeshSubset subsetter(mesh, regioni, cellToRegion);
const fvMesh& subMesh = subsetter.subMesh();

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) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,6 +45,7 @@ Description
#include "volFields.H"
#include "topoDistanceData.H"
#include "FaceCellWave.H"
#include "BitOps.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
@ -311,7 +312,7 @@ void subsetTopoSets
label nSet = 0;
forAll(map, i)
{
if (isSet[map[i]])
if (isSet.test(map[i]))
{
++nSet;
}
@ -325,7 +326,7 @@ void subsetTopoSets
TopoSet& subSet = subSets[i];
forAll(map, i)
{
if (isSet[map[i]])
if (isSet.test(map[i]))
{
subSet.insert(i);
}
@ -371,7 +372,7 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
const word setName = args[1];
const word selectionName = args[1];
word meshInstance = mesh.pointsInstance();
word fieldsInstance = runTime.timeName();
@ -389,30 +390,13 @@ int main(int argc, char *argv[])
}
Info<< "Reading cell set from " << setName << nl << endl;
Info<< "Reading cell set from " << selectionName << nl << endl;
// Create mesh subsetting engine
fvMeshSubset subsetter(mesh);
labelList exposedPatchIDs;
// Default exposed patch id
labelList exposedPatchIDs(one(), -1);
if (args.found("patch"))
{
const word patchName = args["patch"];
exposedPatchIDs = { mesh.boundaryMesh().findPatchID(patchName) };
if (exposedPatchIDs[0] == -1)
{
FatalErrorInFunction
<< nl << "Valid patches are " << mesh.boundaryMesh().names()
<< exit(FatalError);
}
Info<< "Adding exposed internal faces to patch " << patchName
<< nl << endl;
}
else if (args.found("patches"))
if (args.found("patches"))
{
const wordRes patchNames(args.readList<wordRe>("patches"));
@ -420,42 +404,77 @@ int main(int argc, char *argv[])
Info<< "Adding exposed internal faces to nearest of patches "
<< patchNames << nl << endl;
if (exposedPatchIDs.empty())
{
FatalErrorInFunction
<< nl << "No patches matched. Patches: "
<< mesh.boundaryMesh().names()
<< exit(FatalError);
}
}
else if (args.found("patch"))
{
const word patchName = args["patch"];
exposedPatchIDs.first() = mesh.boundaryMesh().findPatchID(patchName);
Info<< "Adding exposed internal faces to patch " << patchName
<< nl << endl;
if (exposedPatchIDs.first() == -1)
{
FatalErrorInFunction
<< nl << "No such patch. Patches: "
<< mesh.boundaryMesh().names()
<< exit(FatalError);
}
}
else
{
Info<< "Adding exposed internal faces to a patch called"
<< " \"oldInternalFaces\" (created if necessary)" << endl
<< endl;
exposedPatchIDs = { -1 };
}
cellSet currentSet(mesh, setName);
// Mesh subsetting engine
fvMeshSubset subsetter(mesh);
if (exposedPatchIDs.size() == 1)
{
subsetter.setLargeCellSubset(currentSet, exposedPatchIDs[0], true);
}
else
{
// Find per face the nearest patch
labelList nearestExposedPatch(nearestPatch(mesh, exposedPatchIDs));
cellSet currentSet(mesh, selectionName);
labelList region(mesh.nCells(), 0);
forAllConstIter(cellSet, currentSet, iter)
{
bitSet selectedCells = BitSetOps::create(mesh.nCells(), currentSet);
if (exposedPatchIDs.size() == 1)
{
region[iter.key()] = 1;
// Single patch for exposed faces
subsetter.setCellSubset
(
selectedCells,
exposedPatchIDs.first(),
true
);
}
else
{
// The nearest patch per face
labelList nearestExposedPatch(nearestPatch(mesh, exposedPatchIDs));
labelList exposedFaces(subsetter.getExposedFaces(region, 1, true));
subsetter.setLargeCellSubset
(
region,
1,
exposedFaces,
labelUIndList(nearestExposedPatch, exposedFaces)(),
true
);
labelList exposedFaces
(
subsetter.getExposedFaces(selectedCells, true)
);
subsetter.setCellSubset
(
selectedCells,
exposedFaces,
labelUIndList(nearestExposedPatch, exposedFaces)(),
true
);
}
}

View File

@ -872,30 +872,23 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
// Find last non-processor patch.
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label nonProcI = -1;
const label nonProcI = (patches.nNonProcessor() - 1);
forAll(patches, patchI)
{
if (isA<processorPolyPatch>(patches[patchI]))
{
break;
}
nonProcI++;
}
if (nonProcI == -1)
if (nonProcI < 0)
{
FatalErrorInFunction
<< "Cannot find non-processor patch on processor "
<< Pstream::myProcNo() << endl
<< Pstream::myProcNo() << nl
<< " Current patches:" << patches.names()
<< abort(FatalError);
}
// Subset 0 cells, no parallel comms. This is used to create
// zero-sized fields.
subsetterPtr.reset(new fvMeshSubset(mesh));
subsetterPtr().setLargeCellSubset(labelHashSet(0), nonProcI, false);
// Subset 0 cells, no parallel comms.
// This is used to create zero-sized fields.
subsetterPtr.reset
(
new fvMeshSubset(mesh, bitSet(), nonProcI, false)
);
}

View File

@ -423,8 +423,7 @@ void Foam::vtkPVFoam::convertMeshCellZones()
if (!vtkgeom)
{
fvMeshSubset subsetter(mesh);
subsetter.setLargeCellSubset(zMesh[zoneId]);
fvMeshSubset subsetter(mesh, zMesh[zoneId]);
vtkgeom = vtuData.subset(subsetter, this->decomposePoly_);
}
@ -490,8 +489,7 @@ void Foam::vtkPVFoam::convertMeshCellSets()
if (!vtkgeom)
{
fvMeshSubset subsetter(mesh);
subsetter.setLargeCellSubset(cellSet(mesh, partName));
fvMeshSubset subsetter(mesh, cellSet(mesh, partName));
vtkgeom = vtuData.subset(subsetter, this->decomposePoly_);
}

View File

@ -2022,14 +2022,12 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
//OPstream str(Pstream::commsTypes::blocking, recvProc);
UOPstream str(recvProc, pBufs);
// Mesh subsetting engine
fvMeshSubset subsetter(mesh_);
// Subset the cells of the current domain.
subsetter.setLargeCellSubset
// Mesh subsetting engine - subset the cells of the current domain.
fvMeshSubset subsetter
(
distribution,
mesh_,
recvProc,
distribution,
oldInternalPatchi, // oldInternalFaces patch
false // no parallel sync
);

File diff suppressed because it is too large Load Diff

View File

@ -25,18 +25,15 @@ Class
Foam::fvMeshSubset
Description
Post-processing mesh subset tool. Given the original mesh and the
list of selected cells, it creates the mesh consisting only of the
desired cells, with the mapping list for points, faces, and cells.
Given the original mesh and the list of selected cells, it creates the
mesh consisting only of the desired cells, with the mapping list for
points, faces, and cells.
Puts all exposed internal faces into either
- a user supplied patch
- a newly created patch "oldInternalFaces"
- setLargeCellSubset is for largish subsets (>10% of mesh).
Uses labelLists instead.
- setLargeCellSubset does coupled patch subsetting as well. If it detects
- setCellSubset does coupled patch subsetting as well. If it detects
a face on a coupled patch 'losing' its neighbour it will move the
face into the oldInternalFaces patch.
@ -58,6 +55,7 @@ SourceFiles
#include "fvMesh.H"
#include "pointMesh.H"
#include "GeometricField.H"
#include "bitSet.H"
#include "HashSet.H"
#include "surfaceMesh.H"
@ -77,9 +75,12 @@ class fvMeshSubset
//- Mesh to subset from
const fvMesh& baseMesh_;
//- Subset mesh pointer
//- Demand-driven subset mesh pointer
autoPtr<fvMesh> fvMeshSubsetPtr_;
//- Optional face mapping array with flip encoded (-1/+1)
mutable autoPtr<labelList> faceFlipMapPtr_;
//- Point mapping array
labelList pointMap_;
@ -92,21 +93,14 @@ class fvMeshSubset
//- Patch mapping array
labelList patchMap_;
//- Optional face mapping array with flip encoded
mutable autoPtr<labelList> faceFlipMapPtr_;
// Private Member Functions
//- Check if subset has been performed
bool checkCellSubset() const;
//- Mark points (with 0) in labelList
static void markPoints
(
const labelUList& curPoints,
labelList& pointMap
);
//- Calculate face flip map
void calcFaceFlipMap() const;
//- Adapt nCellsUsingFace for coupled faces becoming 'uncoupled'.
void doCoupledPatches
@ -115,24 +109,41 @@ class fvMeshSubset
labelList& nCellsUsingFace
) const;
//- Forwarding to Foam::removeCells
void removeCellsImpl
(
const bitSet& cellsToRemove,
const labelList& exposedFaces,
const labelList& patchIDs,
const bool syncCouples
);
//- Subset of subset
static labelList subset
static labelList subsetSubset
(
const label nElems,
const labelList& selectedElements,
const labelList& subsetMap
const labelUList& selectedElements,
const labelUList& subsetMap
);
//- Create zones for submesh
void subsetZones();
//- Helper: extract cells-to-remove from cells-to-keep
labelList getCellsToRemove
bitSet getCellsToRemove
(
const labelList& region,
const label currentRegion
const bitSet& selectedCells
) const;
//- Helper: extract cells-to-remove from cells-to-keep
bitSet getCellsToRemove
(
const label regioni,
const labelUList& regions
) const;
//- No copy construct
fvMeshSubset(const fvMeshSubset&) = delete;
@ -145,173 +156,316 @@ public:
// Constructors
//- Construct given a mesh to subset
explicit fvMeshSubset(const fvMesh&);
explicit fvMeshSubset(const fvMesh& baseMesh);
//- Construct for a cell-subset of the given mesh
// See setCellSubset() for more details.
fvMeshSubset
(
const fvMesh& baseMesh,
const bitSet& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Construct for a cell-subset of the given mesh
// See setCellSubset() for more details.
fvMeshSubset
(
const fvMesh& baseMesh,
const labelUList& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Construct for a cell-subset of the given mesh
// See setCellSubset() for more details.
fvMeshSubset
(
const fvMesh& baseMesh,
const labelHashSet& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Construct for a cell-subset of the given mesh
// See setCellSubset() for more details.
fvMeshSubset
(
const fvMesh& baseMesh,
const label regioni,
const labelUList& regions,
const label patchID = -1,
const bool syncPar = true
);
// Member Functions
// Edit
// Access
//- Set the subset from all cells with region == currentRegion.
// Create "oldInternalFaces" patch for exposed
// internal faces (patchID==-1) or use supplied patch.
// Handles coupled patches by if necessary making coupled patch
// face part of patchID (so uncoupled)
void setLargeCellSubset
//- Original mesh
inline const fvMesh& baseMesh() const;
//- Have subMesh?
inline bool hasSubMesh() const;
//- Return reference to subset mesh
inline const fvMesh& subMesh() const;
//- Return reference to subset mesh
inline fvMesh& subMesh();
//- Return point map
inline const labelList& pointMap() const;
//- Return face map
inline const labelList& faceMap() const;
//- Return face map with sign to encode flipped faces
inline const labelList& faceFlipMap() const;
//- Return cell map
inline const labelList& cellMap() const;
//- Return patch map
inline const labelList& patchMap() const;
// Edit
//- Reset maps and subsetting
void clear();
//- Define the cell subset based on the selectedCells.
// Create "oldInternalFaces" patch for exposed
// internal faces (patchID==-1) or use supplied patch.
// Handles coupled patches by if necessary making coupled patch
// face part of patchID (so uncoupled)
void setCellSubset
(
const bitSet& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Define the cell subset, using the specified cells
//- to define the selection
void setCellSubset
(
const labelUList& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Define the cell subset, using the specified cells
//- labelHashSet to define the selection
void setCellSubset
(
const labelHashSet& selectedCells,
const label patchID = -1,
const bool syncPar = true
);
//- Define the cell subset, using the cells for which
// region == regioni.
void setCellSubset
(
const label regioni,
const labelUList& regions,
const label patchID = -1,
const bool syncCouples = true
);
// Two step subsetting
//- Get labels of exposed faces.
// These are
// - internal faces that become boundary faces
// - coupled faces that become uncoupled (since one of the
// sides gets deleted)
labelList getExposedFaces
(
const bitSet& selectedCells,
const bool syncCouples = true
) const;
//- Get labels of exposed faces.
// These are
// - internal faces that become boundary faces
// - coupled faces that become uncoupled (since one of the
// sides gets deleted)
labelList getExposedFaces
(
const label regioni,
const labelUList& regions,
const bool syncCouples = true
) const;
//- For every exposed face (from above getExposedFaces)
// used supplied (existing!) patch
void setCellSubset
(
const bitSet& selectedCells,
const labelList& exposedFaces,
const labelList& patchIDs,
const bool syncCouples = true
);
//- For every exposed face (from above getExposedFaces)
// used supplied (existing!) patch
void setCellSubset
(
const label regioni,
const labelList& regions,
const labelList& exposedFaces,
const labelList& patchIDs,
const bool syncCouples = true
);
// Field mapping
//- Map volume field
template<class Type>
static tmp<GeometricField<Type, fvPatchField, volMesh>>
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&,
const fvMesh& sMesh,
const labelList& patchMap,
const labelList& cellMap,
const labelList& faceMap
);
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&
) const;
//- Map surface field. Optionally negates value if flipping
// a face (from exposing an internal face)
template<class Type>
static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
const fvMesh& sMesh,
const labelList& patchMap,
const labelList& cellMap,
const labelList& faceMap
);
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&
) const;
//- Map point field
template<class Type>
static tmp<GeometricField<Type, pointPatchField, pointMesh>>
interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>&,
const pointMesh& sMesh,
const labelList& patchMap,
const labelList& pointMap
);
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>>
interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>&
) const;
//- Map dimensioned field
template<class Type>
static tmp<DimensionedField<Type, volMesh>>
interpolate
(
const DimensionedField<Type, volMesh>&,
const fvMesh& sMesh,
const labelList& cellMap
);
template<class Type>
tmp<DimensionedField<Type, volMesh>>
interpolate(const DimensionedField<Type, volMesh>&) const;
// Compatibility
//- Old method name and old parameter ordering.
// \deprecated use setCellSubset instead (JUL-2018)
inline void setLargeCellSubset
(
const labelUList& region,
const label currentRegion,
const label patchID = -1,
const bool syncCouples = true
)
{
Info<< "WARNING: using highly deprecated method: "
<< "fvMeshSubset::setLargeCellSubset()" << nl;
setCellSubset
(
const labelList& region,
const label currentRegion,
const label patchID = -1,
const bool syncCouples = true
currentRegion,
region,
patchID,
syncCouples
);
}
//- setLargeCellSubset but only marking certain cells
void setLargeCellSubset
//- Old method name.
// \deprecated use setCellSubset instead (JUL-2018)
inline void setLargeCellSubset
(
const labelHashSet& globalCellMap,
const label patchID = -1,
const bool syncPar = true
)
{
Info<< "WARNING: using highly deprecated method: "
<< "fvMeshSubset::setLargeCellSubset()" << nl;
setCellSubset(globalCellMap, patchID, syncPar);
}
//- For every exposed face (from getExposedFaces) use supplied
//- (existing!) patch ids
// \deprecated use setCellSubset instead (JUL-2018)
inline void setLargeCellSubset
(
const labelList& regions,
const label regioni,
const labelList& exposedFaces,
const labelList& patchIDs,
const bool syncCouples = true
)
{
Info<< "WARNING: using highly deprecated method: "
<< "fvMeshSubset::setLargeCellSubset()" << nl;
setCellSubset
(
const labelUList& globalCellMap,
const label patchID = -1,
const bool syncPar = true
regioni,
regions,
exposedFaces,
patchIDs,
syncCouples
);
}
//- setLargeCellSubset but with labelHashSet.
void setLargeCellSubset
(
const labelHashSet& globalCellMap,
const label patchID = -1,
const bool syncPar = true
);
//- Two step subsetting
//- Get labels of exposed faces.
// These are
// - internal faces that become boundary faces
// - coupled faces that become uncoupled (since one of the
// sides gets deleted)
labelList getExposedFaces
(
const labelList& region,
const label currentRegion,
const bool syncCouples = true
) const;
//- For every exposed face (from above getExposedFaces)
// used supplied (existing!) patch
void setLargeCellSubset
(
const labelList& region,
const label currentRegion,
const labelList& exposedFaces,
const labelList& patchIDs,
const bool syncCouples = true
);
// Access
//- Original mesh
const fvMesh& baseMesh() const
{
return baseMesh_;
}
//- Have subMesh?
bool hasSubMesh() const;
//- Return reference to subset mesh
const fvMesh& subMesh() const;
fvMesh& subMesh();
//- Return point map
const labelList& pointMap() const;
//- Return face map
const labelList& faceMap() const;
//- Return face map with sign to encode flipped faces
const labelList& faceFlipMap() const;
//- Return cell map
const labelList& cellMap() const;
//- Return patch map
const labelList& patchMap() const;
// Field mapping
//- Map volume field
template<class Type>
static tmp<GeometricField<Type, fvPatchField, volMesh>>
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&,
const fvMesh& sMesh,
const labelList& patchMap,
const labelList& cellMap,
const labelList& faceMap
);
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>>
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&
) const;
//- Map surface field. Optionally negates value if flipping
// a face (from exposing an internal face)
template<class Type>
static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
const fvMesh& sMesh,
const labelList& patchMap,
const labelList& cellMap,
const labelList& faceMap
);
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&
) const;
//- Map point field
template<class Type>
static tmp<GeometricField<Type, pointPatchField, pointMesh>>
interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>&,
const pointMesh& sMesh,
const labelList& patchMap,
const labelList& pointMap
);
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>>
interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>&
) const;
//- Map dimensioned field
template<class Type>
static tmp<DimensionedField<Type, volMesh>>
interpolate
(
const DimensionedField<Type, volMesh>&,
const fvMesh& sMesh,
const labelList& cellMap
);
template<class Type>
tmp<DimensionedField<Type, volMesh>>
interpolate(const DimensionedField<Type, volMesh>&) const;
};
@ -321,6 +475,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "fvMeshSubsetI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fvMeshSubsetInterpolate.C"
#endif

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 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 * * * * * * * * * * * * * //
inline const Foam::fvMesh& Foam::fvMeshSubset::baseMesh() const
{
return baseMesh_;
}
inline bool Foam::fvMeshSubset::hasSubMesh() const
{
return fvMeshSubsetPtr_.valid();
}
inline const Foam::fvMesh& Foam::fvMeshSubset::subMesh() const
{
checkCellSubset();
return *fvMeshSubsetPtr_;
}
inline Foam::fvMesh& Foam::fvMeshSubset::subMesh()
{
checkCellSubset();
return *fvMeshSubsetPtr_;
}
inline const Foam::labelList& Foam::fvMeshSubset::pointMap() const
{
checkCellSubset();
return pointMap_;
}
inline const Foam::labelList& Foam::fvMeshSubset::faceMap() const
{
checkCellSubset();
return faceMap_;
}
inline const Foam::labelList& Foam::fvMeshSubset::faceFlipMap() const
{
if (!faceFlipMapPtr_.valid())
{
calcFaceFlipMap();
}
return *faceFlipMapPtr_;
}
inline const Foam::labelList& Foam::fvMeshSubset::cellMap() const
{
checkCellSubset();
return cellMap_;
}
inline const Foam::labelList& Foam::fvMeshSubset::patchMap() const
{
checkCellSubset();
return patchMap_;
}
// ************************************************************************* //

View File

@ -39,7 +39,8 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
tmp<GeometricField<Type, fvPatchField, volMesh>>
fvMeshSubset::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const fvMesh& sMesh,
@ -83,33 +84,29 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
}
}
tmp<GeometricField<Type, fvPatchField, volMesh>> tresF
auto tresF = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
(
new GeometricField<Type, fvPatchField, volMesh>
IOobject
(
IOobject
(
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh,
vf.dimensions(),
Field<Type>(vf.primitiveField(), cellMap),
patchFields
)
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
Field<Type>(vf.primitiveField(), cellMap),
patchFields
);
GeometricField<Type, fvPatchField, volMesh>& resF = tresF.ref();
auto& resF = tresF.ref();
resF.oriented() = vf.oriented();
// 2. Change the fvPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& bf = resF.boundaryFieldRef();
auto& bf = resF.boundaryFieldRef();
forAll(bf, patchi)
{
@ -158,7 +155,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
tmp<GeometricField<Type, fvPatchField, volMesh>>
fvMeshSubset::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
@ -175,7 +173,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
fvMeshSubset::interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& vf,
const fvMesh& sMesh,
@ -220,41 +219,37 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
}
// Create the complete field from the pieces
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tresF
auto tresF = tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>::New
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
IOobject
(
IOobject
(
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh,
vf.dimensions(),
Field<Type>
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
Field<Type>
(
vf.primitiveField(),
SubList<label>
(
vf.primitiveField(),
SubList<label>
(
faceMap,
sMesh.nInternalFaces()
)
),
patchFields
)
faceMap,
sMesh.nInternalFaces()
)
),
patchFields
);
GeometricField<Type, fvsPatchField, surfaceMesh>& resF = tresF.ref();
auto& resF = tresF.ref();
resF.oriented() = vf.oriented();
// 2. Change the fvsPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
Boundary& bf = resF.boundaryFieldRef();
auto& bf = resF.boundaryFieldRef();
forAll(bf, patchi)
{
@ -341,7 +336,8 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
fvMeshSubset::interpolate
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sf
) const
@ -403,33 +399,29 @@ fvMeshSubset::interpolate
}
// Create the complete field from the pieces
tmp<GeometricField<Type, pointPatchField, pointMesh>> tresF
auto tresF = tmp<GeometricField<Type, pointPatchField, pointMesh>>::New
(
new GeometricField<Type, pointPatchField, pointMesh>
IOobject
(
IOobject
(
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
Field<Type>(vf.primitiveField(), pointMap),
patchFields
)
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
Field<Type>(vf.primitiveField(), pointMap),
patchFields
);
GeometricField<Type, pointPatchField, pointMesh>& resF = tresF.ref();
auto& resF = tresF.ref();
resF.oriented() = vf.oriented();
// 2. Change the pointPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, pointPatchField, pointMesh>::
Boundary& bf = resF.boundaryFieldRef();
auto& bf = resF.boundaryFieldRef();
forAll(bf, patchi)
{
@ -490,7 +482,8 @@ fvMeshSubset::interpolate
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>> fvMeshSubset::interpolate
tmp<GeometricField<Type, pointPatchField, pointMesh>>
fvMeshSubset::interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>& sf
) const
@ -506,7 +499,8 @@ tmp<GeometricField<Type, pointPatchField, pointMesh>> fvMeshSubset::interpolate
template<class Type>
tmp<DimensionedField<Type, volMesh>> fvMeshSubset::interpolate
tmp<DimensionedField<Type, volMesh>>
fvMeshSubset::interpolate
(
const DimensionedField<Type, volMesh>& df,
const fvMesh& sMesh,
@ -514,24 +508,20 @@ tmp<DimensionedField<Type, volMesh>> fvMeshSubset::interpolate
)
{
// Create the complete field from the pieces
tmp<DimensionedField<Type, volMesh>> tresF
auto tresF = tmp<DimensionedField<Type, volMesh>>::New
(
new DimensionedField<Type, volMesh>
IOobject
(
IOobject
(
"subset"+df.name(),
sMesh.time().timeName(),
sMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"subset"+df.name(),
sMesh.time().timeName(),
sMesh,
df.dimensions(),
Field<Type>(df, cellMap)
)
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
df.dimensions(),
Field<Type>(df, cellMap)
);
tresF.ref().oriented() = df.oriented();
return tresF;
@ -539,7 +529,8 @@ tmp<DimensionedField<Type, volMesh>> fvMeshSubset::interpolate
template<class Type>
tmp<DimensionedField<Type, volMesh>> fvMeshSubset::interpolate
tmp<DimensionedField<Type, volMesh>>
fvMeshSubset::interpolate
(
const DimensionedField<Type, volMesh>& df
) const

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "meshSubsetHelper.H"
#include "cellSet.H"
#include "cellZone.H"
#include "Time.H"
@ -39,7 +38,8 @@ Foam::meshSubsetHelper::meshSubsetHelper
baseMesh_(baseMesh),
subsetter_(baseMesh),
type_(NONE),
name_()
name_(),
exposedPatchId_(-1)
{
correct();
}
@ -49,13 +49,15 @@ Foam::meshSubsetHelper::meshSubsetHelper
(
fvMesh& baseMesh,
const subsetType type,
const word& name
const word& name,
const label exposedPatchId
)
:
baseMesh_(baseMesh),
subsetter_(baseMesh),
type_(name.empty() ? NONE : type),
name_(name)
name_(name),
exposedPatchId_(exposedPatchId)
{
correct();
}
@ -72,9 +74,10 @@ void Foam::meshSubsetHelper::correct(bool verbose)
Info<< "Subsetting mesh based on cellSet " << name_ << endl;
}
subsetter_.setLargeCellSubset
subsetter_.setCellSubset
(
cellSet(baseMesh_, name_)
cellSet(baseMesh_, name_),
exposedPatchId_
);
}
else if (type_ == ZONE)
@ -84,8 +87,11 @@ void Foam::meshSubsetHelper::correct(bool verbose)
Info<< "Subsetting mesh based on cellZone " << name_ << endl;
}
labelHashSet subset(baseMesh_.cellZones()[name_]);
subsetter_.setLargeCellSubset(subset, 0);
subsetter_.setCellSubset
(
baseMesh_.cellZones()[name_],
exposedPatchId_
);
}
}

View File

@ -39,13 +39,12 @@ SourceFiles
#include "fvMeshSubset.H"
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
// Forward declarations
class Time;
/*---------------------------------------------------------------------------*\
@ -65,6 +64,8 @@ public:
};
private:
// Private data
//- Reference to mesh
@ -79,6 +80,9 @@ public:
//- Name of current cellSet/cellZone (or empty)
const word name_;
//- Patch ID for exposed internal faces
const label exposedPatchId_;
// Private Member Functions
@ -101,7 +105,8 @@ public:
(
fvMesh& baseMesh,
const subsetType,
const word& name
const word& name,
const label exposedPatchId = -1
);
@ -121,13 +126,13 @@ public:
return subsetter_;
}
//- Check if running a sub-mesh is being used
//- Check if a sub-mesh is being used
inline bool useSubMesh() const
{
return type_ != NONE;
}
//- Access either mesh or submesh
//- Access either base-mesh or sub-mesh
inline const fvMesh& mesh() const
{
if (useSubMesh())
@ -164,7 +169,7 @@ public:
Type,
fvPatchField,
volMesh
>::Internal&
>::Internal& fld
);
@ -175,7 +180,7 @@ public:
tmp<GeometricField<Type, fvPatchField, volMesh>>
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& fld
) const;
@ -189,12 +194,11 @@ public:
Type,
fvPatchField,
volMesh
>::Internal&
>::Internal& fld
) const;
//- Map volume field (does in fact do very little interpolation;
// just copied from fvMeshSubset)
//- Map volume field. Just forwards to fvMeshSubset
template<class GeoField>
tmp<GeoField> interpolate(const GeoField& fld) const;
};

View File

@ -24,11 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "meshSubsetHelper.H"
#include "fvMesh.H"
#include "volFields.H"
#include "globalIndex.H"
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
@ -49,20 +45,18 @@ Foam::meshSubsetHelper::zeroGradientField
io.writeOpt() = IOobject::NO_WRITE;
io.registerObject() = false;
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
auto tfield = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
(
new GeometricField<Type, fvPatchField, volMesh>
(
io,
df.mesh(),
dimensioned<Type>(df.dimensions(), Zero),
zeroGradientFvPatchField<Type>::typeName
)
io,
df.mesh(),
dimensioned<Type>(df.dimensions(), Zero),
zeroGradientFvPatchField<Type>::typeName
);
tvf.ref().primitiveFieldRef() = df;
tvf.ref().correctBoundaryConditions();
tfield.ref().primitiveFieldRef() = df;
tfield.ref().oriented() = df.oriented();
tfield.ref().correctBoundaryConditions();
return tvf;
return tfield;
}
@ -75,18 +69,14 @@ Foam::meshSubsetHelper::interpolate
{
if (subsetter_.hasSubMesh())
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
(
subsetter_.interpolate(vf)
);
tfld.ref().checkOut();
tfld.ref().rename(vf.name());
return tfld;
}
else
{
return vf;
auto tfield(subsetter_.interpolate(vf));
tfield.ref().checkOut();
tfield.ref().rename(vf.name());
return tfield;
}
return vf;
}
@ -102,17 +92,14 @@ Foam::meshSubsetHelper::interpolate
>::Internal& df
) const
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf =
zeroGradientField<Type>(df);
auto tfield = zeroGradientField<Type>(df);
if (subsetter_.hasSubMesh())
{
return interpolate<Type>(tvf());
}
else
{
return tvf;
return interpolate<Type>(tfield());
}
return tfield;
}
@ -125,15 +112,13 @@ Foam::meshSubsetHelper::interpolate
{
if (subsetter_.hasSubMesh())
{
tmp<GeoField> subFld = subsetter_.interpolate(fld);
subFld.ref().checkOut();
subFld.ref().rename(fld.name());
return subFld;
}
else
{
return fld;
tmp<GeoField> tfield = subsetter_.interpolate(fld);
tfield.ref().checkOut();
tfield.ref().rename(fld.name());
return tfield;
}
return fld;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,6 +39,7 @@ License
#include "processorPolyPatch.H"
#include "fvMesh.H"
#include "CompactListList.H"
#include "HashOps.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -184,23 +185,6 @@ void Foam::polyTopoChange::countMap
}
Foam::labelHashSet Foam::polyTopoChange::getSetIndices
(
const bitSet& lst
)
{
labelHashSet values(lst.count());
forAll(lst, i)
{
if (lst[i])
{
values.insert(i);
}
}
return values;
}
void Foam::polyTopoChange::writeMeshStats(const polyMesh& mesh, Ostream& os)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -3192,7 +3176,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
labelListList faceZonePointMap(mesh.faceZones().size());
calcFaceZonePointMap(mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
labelHashSet flipFaceFluxSet(HashSetOps::used(flipFaceFlux_));
return autoPtr<mapPolyMesh>::New
(
@ -3483,7 +3467,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
writeMeshStats(mesh, Pout);
}
labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
labelHashSet flipFaceFluxSet(HashSetOps::used(flipFaceFlux_));
return autoPtr<mapPolyMesh>::New
(

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) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -76,7 +76,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward declarations
class face;
class primitiveMesh;
class polyMesh;
@ -240,9 +240,6 @@ class polyTopoChange
labelList& elems
);
//- Get all set elements as a labelHashSet
static labelHashSet getSetIndices(const bitSet& lst);
//- Count number of added and removed quantities from maps.
static void countMap
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2014-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -721,12 +721,16 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
PtrList<fvMeshSubset> meshParts(nZones);
Info<< incrIndent;
forAll(nCellsPerZone, zoneI)
forAll(meshParts, zonei)
{
Info<< indent<< "zone:" << zoneI << " nCells:" << nCellsPerZone[zoneI]
<< endl;
meshParts.set(zoneI, new fvMeshSubset(mesh_));
meshParts[zoneI].setLargeCellSubset(zoneID, zoneI);
Info<< indent<< "zone:" << zonei << " nCells:"
<< nCellsPerZone[zonei] << nl;
meshParts.set
(
zonei,
new fvMeshSubset(mesh_, zonei, zoneID)
);
}
Info<< decrIndent;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1657,11 +1657,14 @@ bool Foam::cellCellStencils::inverseDistance::update()
List<treeBoundBoxList> procBb(Pstream::nProcs());
procBb[Pstream::myProcNo()].setSize(nZones);
forAll(nCellsPerZone, zoneI)
forAll(meshParts, zonei)
{
meshParts.set(zoneI, new fvMeshSubset(mesh_));
meshParts[zoneI].setLargeCellSubset(zoneID, zoneI);
const fvMesh& subMesh = meshParts[zoneI].subMesh();
meshParts.set
(
zonei,
new fvMeshSubset(mesh_, zonei, zoneID)
);
const fvMesh& subMesh = meshParts[zonei].subMesh();
// Trigger early evaluation of mesh dimension (in case there are
// zero cells in mesh)
@ -1669,19 +1672,19 @@ bool Foam::cellCellStencils::inverseDistance::update()
if (subMesh.nPoints())
{
procBb[Pstream::myProcNo()][zoneI] =
procBb[Pstream::myProcNo()][zonei] =
treeBoundBox(subMesh.points());
procBb[Pstream::myProcNo()][zoneI].inflate(1e-6);
procBb[Pstream::myProcNo()][zonei].inflate(1e-6);
}
else
{
// No part of zone on this processor. Make up bb.
procBb[Pstream::myProcNo()][zoneI] = treeBoundBox
procBb[Pstream::myProcNo()][zonei] = treeBoundBox
(
allBb.min() - 2*allBb.span(),
allBb.min() - allBb.span()
);
procBb[Pstream::myProcNo()][zoneI].inflate(1e-6);
procBb[Pstream::myProcNo()][zonei].inflate(1e-6);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -462,10 +462,14 @@ Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance
meshParts_.setSize(nZones);
forAll(meshParts_, zonei)
{
meshParts_.set(zonei, new fvMeshSubset(mesh_));
meshParts_[zonei].setLargeCellSubset(zoneID, zonei);
// Trigger early evaluation of mesh dimension (in case there are
// locally zero cells in mesh)
meshParts_.set
(
zonei,
new fvMeshSubset(mesh_, zonei, zoneID)
);
// Trigger early evaluation of mesh dimension
// (in case there are locally zero cells in mesh)
(void)meshParts_[zonei].subMesh().nGeometricD();
}

View File

@ -89,8 +89,11 @@ Foam::labelList Foam::structuredDecomp::decompose
}
// Subset the layer of cells next to the patch
fvMeshSubset subsetter(dynamic_cast<const fvMesh&>(mesh));
subsetter.setLargeCellSubset(patchCells);
fvMeshSubset subsetter
(
dynamic_cast<const fvMesh&>(mesh),
patchCells
);
const fvMesh& subMesh = subsetter.subMesh();
pointField subCc(cc, subsetter.cellMap());
scalarField subWeights(cWeights, subsetter.cellMap());

View File

@ -179,8 +179,11 @@ Foam::labelList Foam::structuredRenumber::renumber
// Subset the layer of cells next to the patch
{
fvMeshSubset subsetter(dynamic_cast<const fvMesh&>(mesh));
subsetter.setLargeCellSubset(patchCells);
fvMeshSubset subsetter
(
dynamic_cast<const fvMesh&>(mesh),
patchCells
);
const fvMesh& subMesh = subsetter.subMesh();
pointField subPoints(points, subsetter.cellMap());

View File

@ -376,14 +376,16 @@ bool Foam::sampledIsoSurface::updateGeometry() const
<< patches[exposedPatchi].name() << endl;
}
// Remove old mesh if any
subMeshPtr_.clear();
subMeshPtr_.reset
(
new fvMeshSubset(fvm)
);
subMeshPtr_().setLargeCellSubset
(
labelHashSet(mesh().cellZones()[zoneID_.index()]),
exposedPatchi
new fvMeshSubset
(
fvm,
mesh().cellZones()[zoneID_.index()],
exposedPatchi
)
);
}

View File

@ -78,12 +78,12 @@ void Foam::sampledCuttingPlane::createGeometry()
subMeshPtr_.reset
(
new fvMeshSubset(static_cast<const fvMesh&>(mesh()))
);
subMeshPtr_().setLargeCellSubset
(
labelHashSet(mesh().cellZones()[zoneID_.index()]),
exposedPatchi
new fvMeshSubset
(
static_cast<const fvMesh&>(mesh()),
mesh().cellZones()[zoneID_.index()],
exposedPatchi
)
);
}