mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support different iso-algorithms (#1374)
- add an 'isoAlgorithm' keyword to distance surface and cutting plane to advance further testing of the isoSurfaceTopo algorithm. Does not yet handle the full spectrum of bound boxes, cellZones etc.
This commit is contained in:
committed by
Andrew Heather
parent
ba3f0734c0
commit
7805fb45cf
@ -29,6 +29,7 @@ surface/cutting/cuttingSurfaceBase.C
|
|||||||
surface/cutting/cuttingSurfaceBaseSelection.C
|
surface/cutting/cuttingSurfaceBaseSelection.C
|
||||||
surface/distanceSurface/distanceSurface.C
|
surface/distanceSurface/distanceSurface.C
|
||||||
surface/isoSurface/isoSurface.C
|
surface/isoSurface/isoSurface.C
|
||||||
|
surface/isoSurface/isoSurfaceBase.C
|
||||||
surface/isoSurface/isoSurfaceCell.C
|
surface/isoSurface/isoSurfaceCell.C
|
||||||
surface/isoSurface/isoSurfaceTopo.C
|
surface/isoSurface/isoSurfaceTopo.C
|
||||||
surface/thresholdCellFaces/thresholdCellFaces.C
|
surface/thresholdCellFaces/thresholdCellFaces.C
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Usage
|
|||||||
(
|
(
|
||||||
surface1
|
surface1
|
||||||
{
|
{
|
||||||
type dDistanceSurface;
|
type distanceSurface;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
\endverbatim
|
\endverbatim
|
||||||
@ -46,16 +46,18 @@ Usage
|
|||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
type | distanceSurface | yes |
|
type | distanceSurface | yes |
|
||||||
distance | distance from surface | yes |
|
distance | Distance from surface | yes |
|
||||||
signed | apply sign for +ve/-ve distance | yes |
|
signed | Use sign when distance is positive | partly |
|
||||||
cell | use isoSurfaceCell algorithm | no | true
|
isoAlgorithm | (cell/topo/point) | no | cell
|
||||||
regularise | point snapping | yes |
|
regularise | Point snapping for iso-surface | no | true
|
||||||
average | cell values from averaged point values | no | false
|
average | Cell values from averaged point values | no | false
|
||||||
bounds | limit with bounding box | no |
|
bounds | Limit with bounding box | no |
|
||||||
surfaceType | type of surface | yes |
|
surfaceType | Type of surface | yes |
|
||||||
surfaceName | name of surface in triSurface/ | no | dict name
|
surfaceName | Name of surface in \c triSurface/ | no | dict name
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
For compatibility, the keyword 'cell' (as a bool) is accepted
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
sampledDistanceSurface.C
|
sampledDistanceSurface.C
|
||||||
|
|||||||
@ -102,7 +102,9 @@ void Foam::sampledCuttingPlane::createGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear any stored topologies
|
// Clear any stored topologies
|
||||||
isoSurfPtr_.ptr();
|
isoSurfPtr_.clear();
|
||||||
|
isoSurfCellPtr_.clear();
|
||||||
|
isoSurfTopoPtr_.clear();
|
||||||
pointDistance_.clear();
|
pointDistance_.clear();
|
||||||
cellDistancePtr_.clear();
|
cellDistancePtr_.clear();
|
||||||
|
|
||||||
@ -291,28 +293,54 @@ void Foam::sampledCuttingPlane::createGeometry()
|
|||||||
pDist.write();
|
pDist.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Direct from cell field and point field.
|
|
||||||
|
// Direct from cell field and point field.
|
||||||
|
if (isoAlgo_ == isoSurfaceBase::ALGO_CELL)
|
||||||
|
{
|
||||||
|
isoSurfCellPtr_.reset
|
||||||
|
(
|
||||||
|
new isoSurfaceCell
|
||||||
|
(
|
||||||
|
fvm,
|
||||||
|
cellDistance,
|
||||||
|
pointDistance_,
|
||||||
|
0,
|
||||||
|
regularise_,
|
||||||
|
bounds_,
|
||||||
|
mergeTol_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (isoAlgo_ == isoSurfaceBase::ALGO_TOPO)
|
||||||
|
{
|
||||||
|
isoSurfTopoPtr_.reset
|
||||||
|
(
|
||||||
|
new isoSurfaceTopo
|
||||||
|
(
|
||||||
|
fvm,
|
||||||
|
cellDistance,
|
||||||
|
pointDistance_,
|
||||||
|
0,
|
||||||
|
(regularise_ ? isoSurfaceTopo::DIAGCELL : isoSurfaceTopo::NONE),
|
||||||
|
bounds_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
isoSurfPtr_.reset
|
isoSurfPtr_.reset
|
||||||
(
|
(
|
||||||
new isoSurface
|
new isoSurface
|
||||||
(
|
(
|
||||||
cellDistance,
|
cellDistance,
|
||||||
pointDistance_,
|
pointDistance_,
|
||||||
0.0,
|
0,
|
||||||
regularise_,
|
regularise_,
|
||||||
bounds_,
|
bounds_,
|
||||||
mergeTol_
|
mergeTol_
|
||||||
)
|
)
|
||||||
//new isoSurfaceCell
|
|
||||||
//(
|
|
||||||
// mesh,
|
|
||||||
// cellDistance,
|
|
||||||
// pointDistance_,
|
|
||||||
// 0.0,
|
|
||||||
// regularise_,
|
|
||||||
// mergeTol_
|
|
||||||
//)
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -337,12 +365,23 @@ Foam::sampledCuttingPlane::sampledCuttingPlane
|
|||||||
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", false)),
|
average_(dict.lookupOrDefault("average", false)),
|
||||||
|
isoAlgo_
|
||||||
|
(
|
||||||
|
isoSurfaceBase::algorithmNames.getOrDefault
|
||||||
|
(
|
||||||
|
"isoAlgorithm",
|
||||||
|
dict,
|
||||||
|
isoSurfaceBase::ALGO_POINT
|
||||||
|
)
|
||||||
|
),
|
||||||
zoneNames_(),
|
zoneNames_(),
|
||||||
exposedPatchName_(),
|
exposedPatchName_(),
|
||||||
needsUpdate_(true),
|
needsUpdate_(true),
|
||||||
subMeshPtr_(nullptr),
|
subMeshPtr_(nullptr),
|
||||||
cellDistancePtr_(nullptr),
|
cellDistancePtr_(nullptr),
|
||||||
isoSurfPtr_(nullptr)
|
isoSurfPtr_(nullptr),
|
||||||
|
isoSurfCellPtr_(nullptr),
|
||||||
|
isoSurfTopoPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!dict.readIfPresent("zones", zoneNames_) && dict.found("zone"))
|
if (!dict.readIfPresent("zones", zoneNames_) && dict.found("zone"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Class
|
|||||||
Foam::sampledCuttingPlane
|
Foam::sampledCuttingPlane
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A sampledSurface defined by a plane using the iso-surface algorithm
|
A sampledSurface defined by a plane using an iso-surface algorithm
|
||||||
to \a cut the mesh.
|
to \a cut the mesh.
|
||||||
|
|
||||||
This is often embedded as part of a sampled surfaces function object.
|
This is often embedded as part of a sampled surfaces function object.
|
||||||
@ -55,6 +55,7 @@ Usage
|
|||||||
type | cuttingPlane | yes |
|
type | cuttingPlane | yes |
|
||||||
planeType | plane description (pointAndNormal etc) | yes |
|
planeType | plane description (pointAndNormal etc) | yes |
|
||||||
mergeTol | tolerance for merging points | no | 1e-6
|
mergeTol | tolerance for merging points | no | 1e-6
|
||||||
|
isoAlgorithm | (cell/topo/point) | no | point
|
||||||
regularise | point snapping | no | true
|
regularise | point snapping | no | true
|
||||||
bounds | limit with bounding box | no |
|
bounds | limit with bounding box | no |
|
||||||
zone | limit to cell zone (name or regex) | no |
|
zone | limit to cell zone (name or regex) | no |
|
||||||
@ -77,10 +78,11 @@ SourceFiles
|
|||||||
#define sampledCuttingPlane_H
|
#define sampledCuttingPlane_H
|
||||||
|
|
||||||
#include "sampledSurface.H"
|
#include "sampledSurface.H"
|
||||||
#include "isoSurface.H"
|
|
||||||
//#include "isoSurfaceCell.H"
|
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "fvMeshSubset.H"
|
#include "fvMeshSubset.H"
|
||||||
|
#include "isoSurface.H"
|
||||||
|
#include "isoSurfaceCell.H"
|
||||||
|
#include "isoSurfaceTopo.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -112,6 +114,9 @@ class sampledCuttingPlane
|
|||||||
//- Whether to recalculate cell values as average of point values
|
//- Whether to recalculate cell values as average of point values
|
||||||
const bool average_;
|
const bool average_;
|
||||||
|
|
||||||
|
//- The iso-surface algorithm type
|
||||||
|
const isoSurfaceBase::algorithmType isoAlgo_;
|
||||||
|
|
||||||
//- The zone or zones in which cutting is to occur
|
//- The zone or zones in which cutting is to occur
|
||||||
wordRes zoneNames_;
|
wordRes zoneNames_;
|
||||||
|
|
||||||
@ -131,10 +136,15 @@ class sampledCuttingPlane
|
|||||||
//- Distance to points
|
//- Distance to points
|
||||||
scalarField pointDistance_;
|
scalarField pointDistance_;
|
||||||
|
|
||||||
//- Constructed iso surface
|
//- Constructed iso surface (ALGO_POINT)
|
||||||
//autoPtr<isoSurfaceCell> isoSurfCellPtr_;
|
|
||||||
autoPtr<isoSurface> isoSurfPtr_;
|
autoPtr<isoSurface> isoSurfPtr_;
|
||||||
|
|
||||||
|
//- Constructed iso surface (ALGO_CELL)
|
||||||
|
autoPtr<isoSurfaceCell> isoSurfCellPtr_;
|
||||||
|
|
||||||
|
//- Constructed iso surface (ALGO_TOPO)
|
||||||
|
autoPtr<isoSurfaceTopo> isoSurfTopoPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -162,6 +172,13 @@ class sampledCuttingPlane
|
|||||||
const interpolation<Type>& interpolator
|
const interpolation<Type>& interpolator
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Interpolates cCoords,pCoords.
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type>> isoSurfaceInterpolate
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
|
||||||
|
const Field<Type>& pCoords
|
||||||
|
) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -186,12 +203,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//const isoSurfaceCell& surface() const
|
|
||||||
const isoSurface& surface() const
|
|
||||||
{
|
|
||||||
return *isoSurfPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Does the surface need an update?
|
//- Does the surface need an update?
|
||||||
virtual bool needsUpdate() const;
|
virtual bool needsUpdate() const;
|
||||||
|
|
||||||
@ -241,21 +252,59 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- The underlying surface
|
||||||
|
const meshedSurface& surface() const
|
||||||
|
{
|
||||||
|
if (isoSurfCellPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfCellPtr_;
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfTopoPtr_;
|
||||||
|
}
|
||||||
|
return *isoSurfPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
//- The underlying surface
|
//- The underlying surface
|
||||||
meshedSurface& surface()
|
meshedSurface& surface()
|
||||||
{
|
{
|
||||||
|
if (isoSurfCellPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfCellPtr_;
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfTopoPtr_;
|
||||||
|
}
|
||||||
return *isoSurfPtr_;
|
return *isoSurfPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
//- For each face, the original cell in mesh
|
||||||
const labelList& meshCells() const
|
const labelList& meshCells() const
|
||||||
{
|
{
|
||||||
|
if (isoSurfCellPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfCellPtr_->meshCells();
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->meshCells();
|
||||||
|
}
|
||||||
return isoSurfPtr_->meshCells();
|
return isoSurfPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
//- For each face, the original cell in mesh
|
||||||
labelList& meshCells()
|
labelList& meshCells()
|
||||||
{
|
{
|
||||||
|
if (isoSurfCellPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfCellPtr_->meshCells();
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->meshCells();
|
||||||
|
}
|
||||||
return isoSurfPtr_->meshCells();
|
return isoSurfPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -67,7 +67,7 @@ Foam::sampledCuttingPlane::sampleOnPoints
|
|||||||
auto tpointFld =
|
auto tpointFld =
|
||||||
volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);
|
volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);
|
||||||
|
|
||||||
return surface().interpolate
|
return this->isoSurfaceInterpolate
|
||||||
(
|
(
|
||||||
(average_ ? pointAverage(tpointFld())() : volSubFld),
|
(average_ ? pointAverage(tpointFld())() : volSubFld),
|
||||||
tpointFld()
|
tpointFld()
|
||||||
@ -78,7 +78,7 @@ Foam::sampledCuttingPlane::sampleOnPoints
|
|||||||
auto tpointFld =
|
auto tpointFld =
|
||||||
volPointInterpolation::New(volFld.mesh()).interpolate(volFld);
|
volPointInterpolation::New(volFld.mesh()).interpolate(volFld);
|
||||||
|
|
||||||
return surface().interpolate
|
return this->isoSurfaceInterpolate
|
||||||
(
|
(
|
||||||
(average_ ? pointAverage(tpointFld())() : volFld),
|
(average_ ? pointAverage(tpointFld())() : volFld),
|
||||||
tpointFld()
|
tpointFld()
|
||||||
@ -86,4 +86,27 @@ Foam::sampledCuttingPlane::sampleOnPoints
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type>>
|
||||||
|
Foam::sampledCuttingPlane::isoSurfaceInterpolate
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
|
||||||
|
const Field<Type>& pCoords
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (isoSurfCellPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfCellPtr_->interpolate(cCoords, pCoords);
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->interpolate(cCoords, pCoords);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return isoSurfPtr_->interpolate(cCoords, pCoords);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -92,7 +92,7 @@ class sampledThresholdCellFaces
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Field to get isoSurface of
|
//- Threshold field
|
||||||
const word fieldName_;
|
const word fieldName_;
|
||||||
|
|
||||||
//- Threshold value
|
//- Threshold value
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -40,6 +40,48 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
static isoSurfaceBase::algorithmType getIsoAlgorithm(const dictionary& dict)
|
||||||
|
{
|
||||||
|
// Previously 'cell' (bool), but now 'isoAlgorithm' (enum)
|
||||||
|
|
||||||
|
// Default (bool) for 1906 and earlier
|
||||||
|
bool useCell = true;
|
||||||
|
|
||||||
|
// Default (enum) after 1906
|
||||||
|
isoSurfaceBase::algorithmType algo = isoSurfaceBase::ALGO_CELL;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!isoSurfaceBase::algorithmNames.readIfPresent
|
||||||
|
(
|
||||||
|
"isoAlgorithm", dict, algo
|
||||||
|
)
|
||||||
|
// When above fails, use 'compat' to also get upgrade messages
|
||||||
|
&& dict.readIfPresentCompat
|
||||||
|
(
|
||||||
|
"isoAlgorithm", {{"cell", 1906}}, useCell
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
useCell
|
||||||
|
? isoSurfaceBase::ALGO_CELL
|
||||||
|
: isoSurfaceBase::ALGO_POINT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return algo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::distanceSurface::distanceSurface
|
Foam::distanceSurface::distanceSurface
|
||||||
@ -57,7 +99,7 @@ Foam::distanceSurface::distanceSurface
|
|||||||
dict.get<word>("surfaceType"),
|
dict.get<word>("surfaceType"),
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dict.lookupOrDefault("surfaceName", defaultSurfaceName),
|
dict.getOrDefault("surfaceName", defaultSurfaceName),
|
||||||
mesh.time().constant(), // directory
|
mesh.time().constant(), // directory
|
||||||
"triSurface", // instance
|
"triSurface", // instance
|
||||||
mesh.time(), // registry
|
mesh.time(), // registry
|
||||||
@ -72,11 +114,12 @@ Foam::distanceSurface::distanceSurface
|
|||||||
(
|
(
|
||||||
distance_ < 0 || equal(distance_, Zero) || dict.get<bool>("signed")
|
distance_ < 0 || equal(distance_, Zero) || dict.get<bool>("signed")
|
||||||
),
|
),
|
||||||
cell_(dict.lookupOrDefault("cell", true)),
|
regularise_(dict.getOrDefault("regularise", true)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
isoAlgo_(getIsoAlgorithm(dict)),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
bounds_(dict.getOrDefault("bounds", boundBox::invertedBox)),
|
||||||
|
isoSurfPtr_(nullptr),
|
||||||
isoSurfCellPtr_(nullptr),
|
isoSurfCellPtr_(nullptr),
|
||||||
isoSurfPtr_(nullptr)
|
isoSurfTopoPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +131,7 @@ Foam::distanceSurface::distanceSurface
|
|||||||
const word& surfaceName,
|
const word& surfaceName,
|
||||||
const scalar distance,
|
const scalar distance,
|
||||||
const bool signedDistance,
|
const bool signedDistance,
|
||||||
const bool cell,
|
const isoSurfaceBase::algorithmType algo,
|
||||||
const bool regularise,
|
const bool regularise,
|
||||||
const boundBox& bounds
|
const boundBox& bounds
|
||||||
)
|
)
|
||||||
@ -116,11 +159,12 @@ Foam::distanceSurface::distanceSurface
|
|||||||
(
|
(
|
||||||
signedDistance || distance_ < 0 || equal(distance_, Zero)
|
signedDistance || distance_ < 0 || equal(distance_, Zero)
|
||||||
),
|
),
|
||||||
cell_(cell),
|
|
||||||
regularise_(regularise),
|
regularise_(regularise),
|
||||||
|
isoAlgo_(algo),
|
||||||
bounds_(bounds),
|
bounds_(bounds),
|
||||||
|
isoSurfPtr_(nullptr),
|
||||||
isoSurfCellPtr_(nullptr),
|
isoSurfCellPtr_(nullptr),
|
||||||
isoSurfPtr_(nullptr)
|
isoSurfTopoPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -134,8 +178,9 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear any stored topologies
|
// Clear any stored topologies
|
||||||
isoSurfCellPtr_.clear();
|
|
||||||
isoSurfPtr_.clear();
|
isoSurfPtr_.clear();
|
||||||
|
isoSurfCellPtr_.clear();
|
||||||
|
isoSurfTopoPtr_.clear();
|
||||||
|
|
||||||
const fvMesh& fvm = static_cast<const fvMesh&>(mesh_);
|
const fvMesh& fvm = static_cast<const fvMesh&>(mesh_);
|
||||||
|
|
||||||
@ -165,7 +210,11 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
// to limit the extent of open edges.
|
// to limit the extent of open edges.
|
||||||
|
|
||||||
const bool isZeroDist = equal(distance_, Zero);
|
const bool isZeroDist = equal(distance_, Zero);
|
||||||
const bool filterCells = (cell_ && isZeroDist);
|
const bool filterCells =
|
||||||
|
(
|
||||||
|
isZeroDist
|
||||||
|
&& isoAlgo_ != isoSurfaceBase::ALGO_POINT
|
||||||
|
);
|
||||||
|
|
||||||
bitSet ignoreCells;
|
bitSet ignoreCells;
|
||||||
if (filterCells)
|
if (filterCells)
|
||||||
@ -209,6 +258,9 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
cellBb.clear();
|
cellBb.clear();
|
||||||
cellBb.add(fvm.points(), fvm.cellPoints(i));
|
cellBb.add(fvm.points(), fvm.cellPoints(i));
|
||||||
|
|
||||||
|
// Expand slightly to catch corners
|
||||||
|
cellBb.inflate(0.1);
|
||||||
|
|
||||||
if (!cellBb.contains(nearest[i].hitPoint()))
|
if (!cellBb.contains(nearest[i].hitPoint()))
|
||||||
{
|
{
|
||||||
ignoreCells.set(i);
|
ignoreCells.set(i);
|
||||||
@ -349,7 +401,7 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
|
|
||||||
|
|
||||||
// Direct from cell field and point field.
|
// Direct from cell field and point field.
|
||||||
if (cell_)
|
if (isoAlgo_ == isoSurfaceBase::ALGO_CELL)
|
||||||
{
|
{
|
||||||
isoSurfCellPtr_.reset
|
isoSurfCellPtr_.reset
|
||||||
(
|
(
|
||||||
@ -366,6 +418,22 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else if (isoAlgo_ == isoSurfaceBase::ALGO_TOPO)
|
||||||
|
{
|
||||||
|
isoSurfTopoPtr_.reset
|
||||||
|
(
|
||||||
|
new isoSurfaceTopo
|
||||||
|
(
|
||||||
|
fvm,
|
||||||
|
cellDistance,
|
||||||
|
pointDistance_,
|
||||||
|
distance_,
|
||||||
|
(regularise_ ? isoSurfaceTopo::DIAGCELL : isoSurfaceTopo::NONE),
|
||||||
|
bounds_,
|
||||||
|
ignoreCells
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isoSurfPtr_.reset
|
isoSurfPtr_.reset
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -28,7 +28,7 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
A surface defined by a distance from an input searchable surface.
|
A surface defined by a distance from an input searchable surface.
|
||||||
Uses an isoSurfaceCell or an isoSurface algorithm for constructing the
|
Uses an iso-surface algorithm (cell, topo, point) for constructing the
|
||||||
distance surface.
|
distance surface.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -37,8 +37,8 @@ Usage
|
|||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
distance | distance from surface | yes |
|
distance | distance from surface | yes |
|
||||||
signed | Use sign when distance is positive | partly |
|
signed | Use sign when distance is positive | partly |
|
||||||
cell | use isoSurfaceCell algorithm | no | true
|
isoAlgorithm | (cell/topo/point) | no | cell
|
||||||
regularise | Point snapping for iso-surface | yes |
|
regularise | Point snapping for iso-surface | no | true
|
||||||
bounds | Limit with bounding box | no |
|
bounds | Limit with bounding box | no |
|
||||||
surfaceType | Type of surface | yes |
|
surfaceType | Type of surface | yes |
|
||||||
surfaceName | Name of surface in \c triSurface/ | no | dict name
|
surfaceName | Name of surface in \c triSurface/ | no | dict name
|
||||||
@ -53,6 +53,8 @@ Note
|
|||||||
surface. The resulting surface elements will not, however, contain
|
surface. The resulting surface elements will not, however, contain
|
||||||
partial cell coverage.
|
partial cell coverage.
|
||||||
|
|
||||||
|
For compatibility, the keyword 'cell' (as a bool) is accepted
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
distanceSurface.C
|
distanceSurface.C
|
||||||
|
|
||||||
@ -63,8 +65,9 @@ SourceFiles
|
|||||||
|
|
||||||
#include "sampledSurface.H"
|
#include "sampledSurface.H"
|
||||||
#include "searchableSurface.H"
|
#include "searchableSurface.H"
|
||||||
#include "isoSurfaceCell.H"
|
|
||||||
#include "isoSurface.H"
|
#include "isoSurface.H"
|
||||||
|
#include "isoSurfaceCell.H"
|
||||||
|
#include "isoSurfaceTopo.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -91,12 +94,12 @@ class distanceSurface
|
|||||||
//- Signed distance
|
//- Signed distance
|
||||||
const bool signed_;
|
const bool signed_;
|
||||||
|
|
||||||
//- Use isoSurfaceCell (true) or isoSurface (false) algorithm
|
|
||||||
const bool cell_;
|
|
||||||
|
|
||||||
//- Whether to coarsen iso-surface triangles
|
//- Whether to coarsen iso-surface triangles
|
||||||
const bool regularise_;
|
const bool regularise_;
|
||||||
|
|
||||||
|
//- The iso-surface algorithm type
|
||||||
|
const isoSurfaceBase::algorithmType isoAlgo_;
|
||||||
|
|
||||||
//- Optional bounding box to trim against
|
//- Optional bounding box to trim against
|
||||||
const boundBox bounds_;
|
const boundBox bounds_;
|
||||||
|
|
||||||
@ -106,12 +109,14 @@ class distanceSurface
|
|||||||
//- Distance to points
|
//- Distance to points
|
||||||
scalarField pointDistance_;
|
scalarField pointDistance_;
|
||||||
|
|
||||||
//- Constructed iso surface
|
//- Constructed iso surface (ALGO_POINT)
|
||||||
autoPtr<isoSurfaceCell> isoSurfCellPtr_;
|
|
||||||
|
|
||||||
//- Constructed iso surface
|
|
||||||
autoPtr<isoSurface> isoSurfPtr_;
|
autoPtr<isoSurface> isoSurfPtr_;
|
||||||
|
|
||||||
|
//- Constructed iso surface (ALGO_CELL)
|
||||||
|
autoPtr<isoSurfaceCell> isoSurfCellPtr_;
|
||||||
|
|
||||||
|
//- Constructed iso surface (ALGO_TOPO)
|
||||||
|
autoPtr<isoSurfaceTopo> isoSurfTopoPtr_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -138,7 +143,7 @@ public:
|
|||||||
const word& surfaceName,
|
const word& surfaceName,
|
||||||
const scalar distance,
|
const scalar distance,
|
||||||
const bool signedDistance,
|
const bool signedDistance,
|
||||||
const bool cell,
|
const isoSurfaceBase::algorithmType algo,
|
||||||
const bool regularise,
|
const bool regularise,
|
||||||
const boundBox& bounds = boundBox::invertedBox
|
const boundBox& bounds = boundBox::invertedBox
|
||||||
);
|
);
|
||||||
@ -169,10 +174,14 @@ public:
|
|||||||
//- The underlying surface
|
//- The underlying surface
|
||||||
const meshedSurface& surface() const
|
const meshedSurface& surface() const
|
||||||
{
|
{
|
||||||
if (cell_)
|
if (isoSurfCellPtr_)
|
||||||
{
|
{
|
||||||
return *isoSurfCellPtr_;
|
return *isoSurfCellPtr_;
|
||||||
}
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfTopoPtr_;
|
||||||
|
}
|
||||||
return *isoSurfPtr_;
|
return *isoSurfPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,30 +189,42 @@ public:
|
|||||||
//- The underlying surface
|
//- The underlying surface
|
||||||
meshedSurface& surface()
|
meshedSurface& surface()
|
||||||
{
|
{
|
||||||
if (cell_)
|
if (isoSurfCellPtr_)
|
||||||
{
|
{
|
||||||
return *isoSurfCellPtr_;
|
return *isoSurfCellPtr_;
|
||||||
}
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return *isoSurfTopoPtr_;
|
||||||
|
}
|
||||||
return *isoSurfPtr_;
|
return *isoSurfPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
//- For each face, the original cell in mesh
|
||||||
const labelList& meshCells() const
|
const labelList& meshCells() const
|
||||||
{
|
{
|
||||||
if (cell_)
|
if (isoSurfCellPtr_)
|
||||||
{
|
{
|
||||||
return isoSurfCellPtr_->meshCells();
|
return isoSurfCellPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->meshCells();
|
||||||
|
}
|
||||||
return isoSurfPtr_->meshCells();
|
return isoSurfPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
//- For each face, the original cell in mesh
|
||||||
labelList& meshCells()
|
labelList& meshCells()
|
||||||
{
|
{
|
||||||
if (cell_)
|
if (isoSurfCellPtr_)
|
||||||
{
|
{
|
||||||
return isoSurfCellPtr_->meshCells();
|
return isoSurfCellPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->meshCells();
|
||||||
|
}
|
||||||
return isoSurfPtr_->meshCells();
|
return isoSurfPtr_->meshCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,13 +35,17 @@ Foam::distanceSurface::interpolate
|
|||||||
const Field<Type>& pointValues
|
const Field<Type>& pointValues
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (cell_)
|
if (isoSurfCellPtr_)
|
||||||
{
|
{
|
||||||
return isoSurfCellPtr_().interpolate(cellValues, pointValues);
|
return isoSurfCellPtr_->interpolate(cellValues, pointValues);
|
||||||
|
}
|
||||||
|
else if (isoSurfTopoPtr_)
|
||||||
|
{
|
||||||
|
return isoSurfTopoPtr_->interpolate(cellValues, pointValues);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return isoSurfPtr_().interpolate(cellValues, pointValues);
|
return isoSurfPtr_->interpolate(cellValues, pointValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1344,12 +1344,10 @@ Foam::isoSurface::isoSurface
|
|||||||
const scalar mergeTol
|
const scalar mergeTol
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
MeshStorage(),
|
isoSurfaceBase(iso, bounds),
|
||||||
mesh_(cellValues.mesh()),
|
mesh_(cellValues.mesh()),
|
||||||
pVals_(pointValues),
|
pVals_(pointValues),
|
||||||
iso_(iso),
|
|
||||||
regularise_(regularise),
|
regularise_(regularise),
|
||||||
bounds_(bounds),
|
|
||||||
mergeDistance_(mergeTol*mesh_.bounds().mag())
|
mergeDistance_(mergeTol*mesh_.bounds().mag())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -68,8 +68,7 @@ SourceFiles
|
|||||||
#include "bitSet.H"
|
#include "bitSet.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "slicedVolFields.H"
|
#include "slicedVolFields.H"
|
||||||
#include "MeshedSurface.H"
|
#include "isoSurfaceBase.H"
|
||||||
#include "MeshedSurfacesFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -89,12 +88,8 @@ class triSurface;
|
|||||||
|
|
||||||
class isoSurface
|
class isoSurface
|
||||||
:
|
:
|
||||||
public meshedSurface
|
public isoSurfaceBase
|
||||||
{
|
{
|
||||||
// Private typedefs for convenience
|
|
||||||
typedef meshedSurface MeshStorage;
|
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
enum segmentCutType
|
enum segmentCutType
|
||||||
@ -120,15 +115,9 @@ class isoSurface
|
|||||||
//- Input volScalarField with separated coupled patches rewritten
|
//- Input volScalarField with separated coupled patches rewritten
|
||||||
autoPtr<slicedVolScalarField> cValsPtr_;
|
autoPtr<slicedVolScalarField> cValsPtr_;
|
||||||
|
|
||||||
//- Isosurface value
|
|
||||||
const scalar iso_;
|
|
||||||
|
|
||||||
//- Regularise?
|
//- Regularise?
|
||||||
const bool regularise_;
|
const bool regularise_;
|
||||||
|
|
||||||
//- Optional bounds
|
|
||||||
const boundBox bounds_;
|
|
||||||
|
|
||||||
//- When to merge points
|
//- When to merge points
|
||||||
const scalar mergeDistance_;
|
const scalar mergeDistance_;
|
||||||
|
|
||||||
@ -141,9 +130,6 @@ class isoSurface
|
|||||||
//- Estimated number of cut cells
|
//- Estimated number of cut cells
|
||||||
label nCutCells_;
|
label nCutCells_;
|
||||||
|
|
||||||
//- For every triangle the original cell in mesh
|
|
||||||
labelList meshCells_;
|
|
||||||
|
|
||||||
//- For every unmerged triangle point the point in the triSurface
|
//- For every unmerged triangle point the point in the triSurface
|
||||||
labelList triPointMergeMap_;
|
labelList triPointMergeMap_;
|
||||||
|
|
||||||
@ -395,8 +381,9 @@ class isoSurface
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Declare friendship with isoSurfaceCell to share some functionality
|
//- Declare friendship to share some functionality
|
||||||
friend class isoSurfaceCell;
|
friend class isoSurfaceCell;
|
||||||
|
friend class isoSurfaceTopo;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -424,19 +411,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
|
||||||
const labelList& meshCells() const
|
|
||||||
{
|
|
||||||
return meshCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
|
||||||
labelList& meshCells()
|
|
||||||
{
|
|
||||||
return meshCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Interpolates cCoords, pCoords.
|
//- Interpolates cCoords, pCoords.
|
||||||
// Uses the references to the original fields used to create the
|
// Uses the references to the original fields used to create the
|
||||||
// iso surface.
|
// iso surface.
|
||||||
|
|||||||
56
src/sampling/surface/isoSurface/isoSurfaceBase.C
Normal file
56
src/sampling/surface/isoSurface/isoSurfaceBase.C
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2019 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "isoSurfaceBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::isoSurfaceBase::algorithmType
|
||||||
|
>
|
||||||
|
Foam::isoSurfaceBase::algorithmNames
|
||||||
|
({
|
||||||
|
{ algorithmType::ALGO_CELL, "cell" },
|
||||||
|
{ algorithmType::ALGO_TOPO, "topo" },
|
||||||
|
{ algorithmType::ALGO_POINT, "point" },
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::isoSurfaceBase::isoSurfaceBase
|
||||||
|
(
|
||||||
|
const scalar iso,
|
||||||
|
const boundBox& bounds
|
||||||
|
)
|
||||||
|
:
|
||||||
|
meshedSurface(),
|
||||||
|
iso_(iso),
|
||||||
|
bounds_(bounds)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
129
src/sampling/surface/isoSurface/isoSurfaceBase.H
Normal file
129
src/sampling/surface/isoSurface/isoSurfaceBase.H
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2019 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::isoSurfaceBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Low-level components common to various iso-surface algorithms.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
isoSurfaceBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef isoSurfaceBase_H
|
||||||
|
#define isoSurfaceBase_H
|
||||||
|
|
||||||
|
#include "scalar.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
#include "boundBox.H"
|
||||||
|
#include "MeshedSurface.H"
|
||||||
|
#include "MeshedSurfacesFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class isoSurfaceBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class isoSurfaceBase
|
||||||
|
:
|
||||||
|
public meshedSurface
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected typedefs for convenience
|
||||||
|
typedef meshedSurface MeshStorage;
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Iso value
|
||||||
|
const scalar iso_;
|
||||||
|
|
||||||
|
//- Optional bounds
|
||||||
|
const boundBox bounds_;
|
||||||
|
|
||||||
|
//- For every face, the original cell in mesh
|
||||||
|
labelList meshCells_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- The algorithm types
|
||||||
|
enum algorithmType : uint8_t
|
||||||
|
{
|
||||||
|
ALGO_POINT,
|
||||||
|
ALGO_CELL,
|
||||||
|
ALGO_TOPO
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Public Data
|
||||||
|
|
||||||
|
//- Names for the iso-surface algorithms
|
||||||
|
static const Enum<algorithmType> algorithmNames;
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct with iso value
|
||||||
|
explicit isoSurfaceBase
|
||||||
|
(
|
||||||
|
const scalar iso,
|
||||||
|
const boundBox& bounds = boundBox::invertedBox
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- The iso-value associated with the surface
|
||||||
|
inline scalar isoValue() const
|
||||||
|
{
|
||||||
|
return iso_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- For each face, the original cell in mesh
|
||||||
|
const labelList& meshCells() const
|
||||||
|
{
|
||||||
|
return meshCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- For each face, the original cell in mesh
|
||||||
|
labelList& meshCells()
|
||||||
|
{
|
||||||
|
return meshCells_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -36,7 +36,6 @@ License
|
|||||||
#include "triSurfaceTools.H"
|
#include "triSurfaceTools.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "triPoints.H"
|
#include "triPoints.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1291,12 +1290,10 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
const bitSet& ignoreCells
|
const bitSet& ignoreCells
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
MeshStorage(),
|
isoSurfaceBase(iso, bounds),
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
cVals_(cellValues),
|
cVals_(cellValues),
|
||||||
pVals_(pointValues),
|
pVals_(pointValues),
|
||||||
iso_(iso),
|
|
||||||
bounds_(bounds),
|
|
||||||
ignoreCells_(ignoreCells),
|
ignoreCells_(ignoreCells),
|
||||||
mergeDistance_(mergeTol*mesh.bounds().mag())
|
mergeDistance_(mergeTol*mesh.bounds().mag())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -50,9 +50,7 @@ SourceFiles
|
|||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
#include "bitSet.H"
|
#include "bitSet.H"
|
||||||
#include "boundBox.H"
|
#include "isoSurfaceBase.H"
|
||||||
#include "MeshedSurface.H"
|
|
||||||
#include "MeshedSurfacesFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -70,12 +68,8 @@ class triSurface;
|
|||||||
|
|
||||||
class isoSurfaceCell
|
class isoSurfaceCell
|
||||||
:
|
:
|
||||||
public meshedSurface
|
public isoSurfaceBase
|
||||||
{
|
{
|
||||||
// Private typedefs for convenience
|
|
||||||
typedef meshedSurface MeshStorage;
|
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
enum segmentCutType
|
enum segmentCutType
|
||||||
@ -100,13 +94,7 @@ class isoSurfaceCell
|
|||||||
|
|
||||||
const scalarField& pVals_;
|
const scalarField& pVals_;
|
||||||
|
|
||||||
//- isoSurfaceCell value
|
//- Optional cells to ignore
|
||||||
const scalar iso_;
|
|
||||||
|
|
||||||
//- Optional bounds
|
|
||||||
const boundBox bounds_;
|
|
||||||
|
|
||||||
//- Optional cells to ignore.
|
|
||||||
const bitSet& ignoreCells_;
|
const bitSet& ignoreCells_;
|
||||||
|
|
||||||
//- When to merge points
|
//- When to merge points
|
||||||
@ -118,9 +106,6 @@ class isoSurfaceCell
|
|||||||
//- Estimated number of cut cells
|
//- Estimated number of cut cells
|
||||||
label nCutCells_;
|
label nCutCells_;
|
||||||
|
|
||||||
//- For every triangle the original cell in mesh
|
|
||||||
labelList meshCells_;
|
|
||||||
|
|
||||||
//- For every unmerged triangle point the point in the triSurface
|
//- For every unmerged triangle point the point in the triSurface
|
||||||
labelList triPointMergeMap_;
|
labelList triPointMergeMap_;
|
||||||
|
|
||||||
@ -349,19 +334,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
|
||||||
const labelList& meshCells() const
|
|
||||||
{
|
|
||||||
return meshCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- For each face, the original cell in mesh
|
|
||||||
labelList& meshCells()
|
|
||||||
{
|
|
||||||
return meshCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Interpolates cCoords, pCoords.
|
//- Interpolates cCoords, pCoords.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type>> interpolate
|
tmp<Field<Type>> interpolate
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "isoSurfaceTopo.H"
|
#include "isoSurfaceTopo.H"
|
||||||
|
#include "isoSurface.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "tetMatcher.H"
|
#include "tetMatcher.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetPointRef.H"
|
||||||
@ -63,6 +64,11 @@ Foam::isoSurfaceTopo::cellCutType Foam::isoSurfaceTopo::calcCutType
|
|||||||
const label celli
|
const label celli
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
if (ignoreCells_.test(celli))
|
||||||
|
{
|
||||||
|
return NOTCUT;
|
||||||
|
}
|
||||||
|
|
||||||
const cell& cFaces = mesh_.cells()[celli];
|
const cell& cFaces = mesh_.cells()[celli];
|
||||||
|
|
||||||
if (isTet)
|
if (isTet)
|
||||||
@ -1154,17 +1160,32 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
|
|||||||
const scalarField& cVals,
|
const scalarField& cVals,
|
||||||
const scalarField& pVals,
|
const scalarField& pVals,
|
||||||
const scalar iso,
|
const scalar iso,
|
||||||
const filterType filter
|
const filterType filter,
|
||||||
|
const boundBox& bounds,
|
||||||
|
const bitSet& ignoreCells
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
isoSurfaceBase(iso, bounds),
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
cVals_(cVals),
|
cVals_(cVals),
|
||||||
pVals_(pVals),
|
pVals_(pVals),
|
||||||
iso_(iso)
|
ignoreCells_(ignoreCells)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "isoSurfaceTopo : iso:" << iso_ << " filter:" << filter << endl;
|
Pout<< "isoSurfaceTopo::"
|
||||||
|
<< " cell min/max : "
|
||||||
|
<< min(cVals_) << " / "
|
||||||
|
<< max(cVals_) << nl
|
||||||
|
<< " point min/max : "
|
||||||
|
<< min(pVals_) << " / "
|
||||||
|
<< max(pVals_) << nl
|
||||||
|
<< " isoValue : " << iso << nl
|
||||||
|
<< " filter : " << filter << nl
|
||||||
|
<< " mesh span : " << mesh.bounds().mag() << nl
|
||||||
|
<< " ignoreCells : " << ignoreCells_.count()
|
||||||
|
<< " / " << cVals_.size() << nl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixTetBasePtIs();
|
fixTetBasePtIs();
|
||||||
@ -1314,8 +1335,11 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (filter == DIAGCELL)
|
if (filter == DIAGCELL && ignoreCells_.empty())
|
||||||
{
|
{
|
||||||
|
// Note that the following only works without cell subsets
|
||||||
|
// thus we skip this when ignoreCells_ is non-empty
|
||||||
|
|
||||||
// We remove verts on face diagonals. This is in fact just
|
// We remove verts on face diagonals. This is in fact just
|
||||||
// straightening the edges of the face through the cell. This can
|
// straightening the edges of the face through the cell. This can
|
||||||
// close off 'pockets' of triangles and create open or
|
// close off 'pockets' of triangles and create open or
|
||||||
@ -1324,10 +1348,9 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
|
|||||||
// Solved by eroding open-edges
|
// Solved by eroding open-edges
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
// Mark points on mesh outside. Note that we extend with nCells
|
// Mark points on mesh outside. Note that we extend with nCells
|
||||||
// so we can easily index with pointToVerts_.
|
// so we can easily index with pointToVerts_.
|
||||||
PackedBoolList isBoundaryPoint(mesh.nPoints() + mesh.nCells());
|
bitSet isBoundaryPoint(mesh.nPoints() + mesh.nCells());
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label facei = mesh.nInternalFaces();
|
label facei = mesh.nInternalFaces();
|
||||||
@ -1343,7 +1366,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
|
|||||||
{
|
{
|
||||||
const labelList& mp = meshPoints();
|
const labelList& mp = meshPoints();
|
||||||
|
|
||||||
PackedBoolList removeFace(this->size());
|
bitSet removeFace(this->size());
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
{
|
{
|
||||||
const labelListList& edgeFaces =
|
const labelListList& edgeFaces =
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2019 OpenFOAM Foundation
|
| Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
@ -39,10 +39,9 @@ SourceFiles
|
|||||||
#define isoSurfaceTopo_H
|
#define isoSurfaceTopo_H
|
||||||
|
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
#include "pointIndexHit.H"
|
#include "bitSet.H"
|
||||||
#include "PackedBoolList.H"
|
|
||||||
#include "MeshedSurface.H"
|
|
||||||
#include "edgeList.H"
|
#include "edgeList.H"
|
||||||
|
#include "isoSurfaceBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -58,11 +57,8 @@ class tetMatcher;
|
|||||||
|
|
||||||
class isoSurfaceTopo
|
class isoSurfaceTopo
|
||||||
:
|
:
|
||||||
public MeshedSurface<face>
|
public isoSurfaceBase
|
||||||
{
|
{
|
||||||
// Private typedefs for convenience
|
|
||||||
typedef MeshedSurface<face> MeshStorage;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum filterType
|
enum filterType
|
||||||
@ -80,9 +76,9 @@ private:
|
|||||||
|
|
||||||
enum cellCutType
|
enum cellCutType
|
||||||
{
|
{
|
||||||
NOTCUT, // Not cut
|
NOTCUT, //!< Not cut
|
||||||
SPHERE, // All edges to cell centre cut
|
SPHERE, //!< All edges to cell centre cut
|
||||||
CUT // Normal cut
|
CUT //!< Normal cut
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -93,8 +89,8 @@ private:
|
|||||||
|
|
||||||
const scalarField& pVals_;
|
const scalarField& pVals_;
|
||||||
|
|
||||||
//- Iso value
|
//- Optional cells to ignore
|
||||||
const scalar iso_;
|
const bitSet& ignoreCells_;
|
||||||
|
|
||||||
//- Corrected version of tetBasePtIs
|
//- Corrected version of tetBasePtIs
|
||||||
labelList tetBasePtIs_;
|
labelList tetBasePtIs_;
|
||||||
@ -102,9 +98,6 @@ private:
|
|||||||
//- Per point: originating mesh vertex/cc. See encoding above
|
//- Per point: originating mesh vertex/cc. See encoding above
|
||||||
edgeList pointToVerts_;
|
edgeList pointToVerts_;
|
||||||
|
|
||||||
//- For every face the original cell in mesh
|
|
||||||
labelList meshCells_;
|
|
||||||
|
|
||||||
//- For every point the originating face in mesh
|
//- For every point the originating face in mesh
|
||||||
labelList pointToFace_;
|
labelList pointToFace_;
|
||||||
|
|
||||||
@ -134,6 +127,7 @@ private:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Determine for all mesh whether cell is cut
|
//- Determine for all mesh whether cell is cut
|
||||||
|
// \return number of cells cut
|
||||||
label calcCutTypes
|
label calcCutTypes
|
||||||
(
|
(
|
||||||
tetMatcher& tet,
|
tetMatcher& tet,
|
||||||
@ -227,18 +221,14 @@ public:
|
|||||||
const scalarField& cellValues,
|
const scalarField& cellValues,
|
||||||
const scalarField& pointValues,
|
const scalarField& pointValues,
|
||||||
const scalar iso,
|
const scalar iso,
|
||||||
const filterType filter = DIAGCELL
|
const filterType filter = DIAGCELL,
|
||||||
|
const boundBox& bounds = boundBox::invertedBox,
|
||||||
|
const bitSet& ignoreCells = bitSet()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- For every face original cell in mesh
|
|
||||||
const labelList& meshCells() const
|
|
||||||
{
|
|
||||||
return meshCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- For every point originating face (pyramid) in mesh
|
//- For every point originating face (pyramid) in mesh
|
||||||
const labelList& pointToFace() const
|
const labelList& pointToFace() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user