ENH: code consistency in sampling

TUT: dictionary form of surfaces instead of list
This commit is contained in:
Mark Olesen
2020-12-02 10:01:48 +01:00
parent 4421021e99
commit 61dd6aa701
27 changed files with 230 additions and 256 deletions

View File

@ -36,12 +36,12 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type distanceSurface;
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -44,6 +44,13 @@ namespace Foam
word,
isoSurface
);
addNamedToRunTimeSelectionTable
(
sampledSurface,
sampledIsoSurface,
word,
isoSurfacePoint
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -519,7 +526,8 @@ bool Foam::sampledIsoSurface::update()
}
Foam::tmp<Foam::scalarField> Foam::sampledIsoSurface::sample
Foam::tmp<Foam::scalarField>
Foam::sampledIsoSurface::sample
(
const interpolation<scalar>& sampler
) const
@ -528,7 +536,8 @@ Foam::tmp<Foam::scalarField> Foam::sampledIsoSurface::sample
}
Foam::tmp<Foam::vectorField> Foam::sampledIsoSurface::sample
Foam::tmp<Foam::vectorField>
Foam::sampledIsoSurface::sample
(
const interpolation<vector>& sampler
) const
@ -537,7 +546,8 @@ Foam::tmp<Foam::vectorField> Foam::sampledIsoSurface::sample
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledIsoSurface::sample
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledIsoSurface::sample
(
const interpolation<sphericalTensor>& sampler
) const
@ -546,7 +556,8 @@ Foam::tmp<Foam::sphericalTensorField> Foam::sampledIsoSurface::sample
}
Foam::tmp<Foam::symmTensorField> Foam::sampledIsoSurface::sample
Foam::tmp<Foam::symmTensorField>
Foam::sampledIsoSurface::sample
(
const interpolation<symmTensor>& sampler
) const
@ -555,7 +566,8 @@ Foam::tmp<Foam::symmTensorField> Foam::sampledIsoSurface::sample
}
Foam::tmp<Foam::tensorField> Foam::sampledIsoSurface::sample
Foam::tmp<Foam::tensorField>
Foam::sampledIsoSurface::sample
(
const interpolation<tensor>& sampler
) const
@ -564,7 +576,8 @@ Foam::tmp<Foam::tensorField> Foam::sampledIsoSurface::sample
}
Foam::tmp<Foam::scalarField> Foam::sampledIsoSurface::interpolate
Foam::tmp<Foam::scalarField>
Foam::sampledIsoSurface::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -573,7 +586,8 @@ Foam::tmp<Foam::scalarField> Foam::sampledIsoSurface::interpolate
}
Foam::tmp<Foam::vectorField> Foam::sampledIsoSurface::interpolate
Foam::tmp<Foam::vectorField>
Foam::sampledIsoSurface::interpolate
(
const interpolation<vector>& interpolator
) const
@ -581,7 +595,8 @@ Foam::tmp<Foam::vectorField> Foam::sampledIsoSurface::interpolate
return sampleOnPoints(interpolator);
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledIsoSurface::interpolate
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledIsoSurface::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
@ -590,7 +605,8 @@ Foam::tmp<Foam::sphericalTensorField> Foam::sampledIsoSurface::interpolate
}
Foam::tmp<Foam::symmTensorField> Foam::sampledIsoSurface::interpolate
Foam::tmp<Foam::symmTensorField>
Foam::sampledIsoSurface::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -599,7 +615,8 @@ Foam::tmp<Foam::symmTensorField> Foam::sampledIsoSurface::interpolate
}
Foam::tmp<Foam::tensorField> Foam::sampledIsoSurface::interpolate
Foam::tmp<Foam::tensorField>
Foam::sampledIsoSurface::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,42 +28,43 @@ Class
Foam::sampledIsoSurface
Description
A sampledSurface defined by a surface of iso value. Always triangulated.
To be used in sampleSurfaces / functionObjects. Recalculates iso surface
only if time changes.
This is often embedded as part of a sampled surfaces function object.
A sampledSurface defined by a surface of iso value using a
\em point algorithm (always triangulated!).
It only recalculates the iso-surface if time changes.
To be used in sampleSurfaces / functionObjects.
Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type sampledIsoSurface;
cell false;
type isoSurfacePoint;
isoField T;
isoValue 373;
}
}
);
\endverbatim
Where the sub-entries comprise:
\table
Property | Description | Required | Default
type | sampledIsoSurface | yes |
type | isoSurfacePoint / isoSurface | yes |
isoField | field name for obtaining iso-surface | yes |
isoValue | value of iso-surface | yes |
mergeTol | tolerance for merging points | no | 1e-6
regularise | point snapping (bool or enum) | no | true
average | cell values from averaged point values | no | false
bounds | limit with bounding box | no |
zone | limit to cell zone (name or regex) | no |
zones | limit to cell zones (names, regexs) | no |
exposedPatchName | name for zone subset | partly |
regularise | point snapping (bool or enum) | no | true
mergeTol | tolerance for merging points | no | 1e-6
\endtable
SourceFiles
sampledIsoSurface.C
sampledIsoSurfaceTemplates.C
\*---------------------------------------------------------------------------*/
@ -87,7 +88,7 @@ class sampledIsoSurface
:
public sampledSurface
{
// Private data
// Private Data
//- Field to get isoSurface of
const word isoField_;
@ -128,6 +129,7 @@ class sampledIsoSurface
//- Cached pointfield
mutable const pointScalarField* pointFieldPtr_;
// And on subsetted mesh
//- Cached submesh
@ -243,11 +245,6 @@ public:
}
//- Lookup or read isoField.
// Sets volFieldPtr_ and pointFieldPtr_.
void getIsoField();
// Sample
//- Sample volume field onto surface faces
@ -317,7 +314,7 @@ public:
// Output
//- Write
virtual void print(Ostream&) const;
virtual void print(Ostream& os) const;
};

View File

@ -111,10 +111,15 @@ bool Foam::sampledIsoSurfaceCell::updateGeometry() const
auto tpointFld = volPointInterpolation::New(fvm).interpolate(cellFld);
// Non-averaged? Use reference
tmp<scalarField> tcellValues(cellFld.primitiveField());
if (average_)
{
//- From point field and interpolated cell.
scalarField cellAvg(fvm.nCells(), Zero);
// From point field and interpolated cell.
tcellValues = tmp<scalarField>::New(fvm.nCells(), Zero);
auto& cellAvg = tcellValues.ref();
labelField nPointCells(fvm.nCells(), Zero);
for (label pointi = 0; pointi < fvm.nPoints(); ++pointi)
@ -132,47 +137,29 @@ bool Foam::sampledIsoSurfaceCell::updateGeometry() const
{
cellAvg[celli] /= nPointCells[celli];
}
}
isoSurfaceCell surf
(
fvm,
cellAvg,
tcellValues(),
tpointFld().primitiveField(),
isoVal_,
filter_,
bounds_
bounds_,
1e-6 // mergeTol
);
// Replace current geomety
const_cast<sampledIsoSurfaceCell&>
(
*this
).transfer(static_cast<meshedSurface&>(surf));
meshCells_.transfer(surf.meshCells());
}
else
{
//- Direct from cell field and point field. Gives bad continuity.
isoSurfaceCell surf
(
fvm,
cellFld.primitiveField(),
tpointFld().primitiveField(),
isoVal_,
filter_,
bounds_
);
const_cast<sampledIsoSurfaceCell&>
(
*this
).transfer(static_cast<meshedSurface&>(surf));
meshCells_.transfer(surf.meshCells());
}
if (debug)
{
Pout<< "sampledIsoSurfaceCell::updateGeometry() : constructed iso:"
Pout<< "isoSurfaceCell::updateGeometry() : constructed iso:"
<< nl
<< " filter : " << Switch(bool(filter_)) << nl
<< " average : " << Switch(average_) << nl
@ -180,7 +167,7 @@ bool Foam::sampledIsoSurfaceCell::updateGeometry() const
<< " isoValue : " << isoVal_ << nl
<< " bounds : " << bounds_ << nl
<< " points : " << points().size() << nl
<< " faces : " << MeshStorage::size() << nl
<< " faces : " << Mesh::size() << nl
<< " cut cells : " << meshCells_.size() << endl;
}
@ -198,7 +185,7 @@ Foam::sampledIsoSurfaceCell::sampledIsoSurfaceCell
)
:
sampledSurface(name, mesh, dict),
MeshStorage(),
Mesh(),
isoField_(dict.get<word>("isoField")),
isoVal_(dict.get<scalar>("isoValue")),
filter_
@ -356,7 +343,7 @@ Foam::sampledIsoSurfaceCell::interpolate
void Foam::sampledIsoSurfaceCell::print(Ostream& os) const
{
os << "sampledIsoSurfaceCell: " << name() << " :"
os << "isoSurfaceCell: " << name() << " :"
<< " field:" << isoField_
<< " value:" << isoVal_;
//<< " faces:" << faces().size() // possibly no geom yet

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,35 +28,35 @@ Class
Foam::sampledIsoSurfaceCell
Description
A sampledSurface defined by a surface of iso value. Always triangulated.
To be used in sampleSurfaces / functionObjects. Recalculates iso surface
only if time changes.
This is often embedded as part of a sampled surfaces function object.
A sampledSurface defined by a surface of iso value using a
\em cell algorithm.
It only recalculates the iso-surface if time changes.
To be used in sampleSurfaces / functionObjects.
Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type sampledIsoSurfaceCell;
cell true;
type isoSurfaceCell;
isoField T;
isoValue 373;
}
}
);
\endverbatim
Where the sub-entries comprise:
\table
Property | Description | Required | Default
type | sampledIsoSurfaceCell | yes |
type | isoSurfaceCell | yes |
isoField | field name for obtaining iso-surface | yes |
isoValue | value of iso-surface | yes |
mergeTol | tolerance for merging points | no | 1e-6
regularise | point snapping | yes |
average | cell values from averaged point values | no | false
bounds | limit with bounding box | no |
regularise | point snapping | yes |
mergeTol | tolerance for merging points | no | 1e-6
\endtable
Note
@ -64,6 +64,7 @@ Note
SourceFiles
sampledIsoSurfaceCell.C
sampledIsoSurfaceCellTemplates.C
\*---------------------------------------------------------------------------*/
@ -90,9 +91,10 @@ class sampledIsoSurfaceCell
public meshedSurface
{
// Private typedefs for convenience
typedef meshedSurface MeshStorage;
typedef meshedSurface Mesh;
// Private data
// Private Data
//- Field to get isoSurface of
const word isoField_;
@ -112,7 +114,7 @@ class sampledIsoSurfaceCell
// Recreated for every isoSurface
//- Time at last call, also track it surface needs an update
//- Time at last call, also track if surface needs an update
mutable label prevTimeIndex_;
//- For every triangle the original cell in mesh
@ -179,13 +181,13 @@ public:
//- Points of surface
virtual const pointField& points() const
{
return MeshStorage::points();
return Mesh::points();
}
//- Faces of surface
virtual const faceList& faces() const
{
return MeshStorage::surfFaces();
return Mesh::surfFaces();
}
//- Per-face zone/region information
@ -197,19 +199,19 @@ public:
//- Face area magnitudes
virtual const vectorField& Sf() const
{
return MeshStorage::Sf();
return Mesh::Sf();
}
//- Face area magnitudes
virtual const scalarField& magSf() const
{
return MeshStorage::magSf();
return Mesh::magSf();
}
//- Face centres
virtual const vectorField& Cf() const
{
return MeshStorage::Cf();
return Mesh::Cf();
}
@ -279,7 +281,7 @@ public:
) const;
//- Write
virtual void print(Ostream&) const;
virtual void print(Ostream& os) const;
};

View File

@ -111,7 +111,8 @@ bool Foam::sampledIsoSurfaceTopo::updateGeometry() const
auto tpointFld = volPointInterpolation::New(fvm).interpolate(cellFld);
//- Direct from cell field and point field. Gives bad continuity.
Mesh& mySurface = const_cast<sampledIsoSurfaceTopo&>(*this);
isoSurfaceTopo surf
(
fvm,
@ -121,8 +122,6 @@ bool Foam::sampledIsoSurfaceTopo::updateGeometry() const
filter_
);
MeshedSurface<face>& mySurface = const_cast<sampledIsoSurfaceTopo&>(*this);
mySurface.transfer(static_cast<meshedSurface&>(surf));
meshCells_ = std::move(surf.meshCells());
@ -147,7 +146,7 @@ bool Foam::sampledIsoSurfaceTopo::updateGeometry() const
<< " isoField : " << isoField_ << nl
<< " isoValue : " << isoVal_ << nl
<< " points : " << points().size() << nl
<< " faces : " << MeshStorage::size() << nl
<< " faces : " << Mesh::size() << nl
<< " cut cells : " << meshCells_.size() << endl;
}
@ -165,7 +164,7 @@ Foam::sampledIsoSurfaceTopo::sampledIsoSurfaceTopo
)
:
sampledSurface(name, mesh, dict),
MeshStorage(),
Mesh(),
isoField_(dict.get<word>("isoField")),
isoVal_(dict.get<scalar>("isoValue")),
filter_

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,24 +28,23 @@ Class
Foam::sampledIsoSurfaceTopo
Description
A sampledSurface defined by a surface of iso value.
To be used in sampleSurfaces / functionObjects. Recalculates iso surface
only if time changes.
This is often embedded as part of a sampled surfaces function object.
A sampledSurface defined by a surface of iso value using a
\em topo algorithm.
It only recalculates the iso-surface if time changes.
To be used in sampleSurfaces / functionObjects.
Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type isoSurfaceTopo;
isoField p;
isoValue 0.0;
isoField T;
isoValue 373;
}
}
);
\endverbatim
Where the sub-entries comprise:
@ -55,7 +54,7 @@ Usage
isoField | field name for obtaining iso-surface | yes |
isoValue | value of iso-surface | yes |
regularise | filter faces (bool or enum) | no | true
triangulate | triangulate faces (if regularise) | no | false
triangulate | triangulate faces (requires regularise) | no | false
\endtable
Note
@ -63,6 +62,7 @@ Note
SourceFiles
sampledIsoSurfaceTopo.C
sampledIsoSurfaceTopoTemplates.C
\*---------------------------------------------------------------------------*/
@ -86,12 +86,13 @@ namespace Foam
class sampledIsoSurfaceTopo
:
public sampledSurface,
public MeshedSurface<face>
public meshedSurface
{
// Private typedefs for convenience
typedef MeshedSurface<face> MeshStorage;
typedef meshedSurface Mesh;
// Private data
// Private Data
//- Field to get isoSurface of
const word isoField_;
@ -175,7 +176,7 @@ public:
//- Points of surface
virtual const pointField& points() const
{
return MeshStorage::points();
return Mesh::points();
}
//- Faces of surface
@ -193,19 +194,19 @@ public:
//- Face area magnitudes
virtual const vectorField& Sf() const
{
return MeshStorage::Sf();
return Mesh::Sf();
}
//- Face area magnitudes
virtual const scalarField& magSf() const
{
return MeshStorage::magSf();
return Mesh::magSf();
}
//- Face centres
virtual const vectorField& Cf() const
{
return MeshStorage::Cf();
return Mesh::Cf();
}
@ -275,7 +276,7 @@ public:
) const;
//- Write
virtual void print(Ostream&) const;
virtual void print(Ostream& os) const;
};

View File

@ -37,7 +37,7 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type cuttingPlane;
@ -47,7 +47,7 @@ Usage
...
}
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -36,13 +36,13 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type faceZones;
zones (zone1 "sides.*");
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -69,25 +69,6 @@ namespace Foam
sampledTriSurfaceMesh
);
//- Private class for finding nearest
// Comprising:
// - global index
// - sqr(distance)
typedef Tuple2<scalar, label> nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first() < x.first())
{
x = y;
}
}
};
} // End namespace Foam
@ -170,6 +151,8 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher)
// Does approximation by looking at the face centres only
const pointField& fc = surface_.faceCentres();
// sqr(distance), global index
typedef Tuple2<scalar, label> nearInfo;
List<nearInfo> nearest(fc.size(), nearInfo(Foam::sqr(GREAT), labelMax));
if (sampleSource_ == samplingSource::cells)
@ -244,7 +227,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher)
// See which processor has the nearest. Mark and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pstream::listCombineGather(nearest, nearestEqOp());
Pstream::listCombineGather(nearest, minFirstEqOp<scalar>{});
Pstream::listCombineScatter(nearest);
labelList cellOrFaceLabels(fc.size(), -1);

View File

@ -36,13 +36,13 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type patch;
patches (inlet "outlet.*");
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -41,7 +41,7 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type patchInternalField;
@ -49,7 +49,7 @@ Usage
offsetMode normal;
distance 0.05;
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -37,7 +37,7 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type plane;
@ -47,7 +47,7 @@ Usage
...
}
}
);
}
\endverbatim
Where the sub-entries comprise:

View File

@ -27,12 +27,12 @@ License
\*---------------------------------------------------------------------------*/
#include "sampledThresholdCellFaces.H"
#include "thresholdCellFaces.H"
#include "dictionary.H"
#include "volFields.H"
#include "volPointInterpolation.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "thresholdCellFaces.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,6 +48,7 @@ namespace Foam
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::sampledThresholdCellFaces::updateGeometry() const
@ -106,6 +107,7 @@ bool Foam::sampledThresholdCellFaces::updateGeometry() const
const volScalarField& cellFld =
(fieldReadPtr ? *fieldReadPtr : *cellFldPtr);
Mesh& mySurface = const_cast<sampledThresholdCellFaces&>(*this);
thresholdCellFaces surf
(
@ -116,10 +118,7 @@ bool Foam::sampledThresholdCellFaces::updateGeometry() const
triangulate_
);
const_cast<sampledThresholdCellFaces&>
(
*this
).MeshedSurface<face>::transfer(surf);
mySurface.transfer(static_cast<Mesh&>(surf));
meshCells_.transfer(surf.meshCells());
// Clear derived data

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,14 +37,14 @@ Usage
Example of function object partial specification:
\verbatim
surfaces
(
{
surface1
{
type thresholdCellFaces;
field rho;
lowerLimit 0.1;
}
);
}
\endverbatim
Where the sub-entries comprise:
@ -73,6 +73,7 @@ SourceFiles
#include "sampledSurface.H"
#include "MeshedSurface.H"
#include "MeshedSurfacesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -86,12 +87,13 @@ namespace Foam
class sampledThresholdCellFaces
:
public sampledSurface,
public MeshedSurface<face>
public meshedSurface
{
//- Private typedefs for convenience
typedef MeshedSurface<face> MeshStorage;
// Private typedef for convenience
typedef meshedSurface Mesh;
// Private data
// Private Data
//- Threshold field
const word fieldName_;
@ -173,13 +175,13 @@ public:
//- Points of surface
virtual const pointField& points() const
{
return MeshStorage::points();
return Mesh::points();
}
//- Faces of surface
virtual const faceList& faces() const
{
return MeshStorage::surfFaces();
return Mesh::surfFaces();
}
//- Per-face zone/region information
@ -191,19 +193,19 @@ public:
//- Face area vectors (normals)
virtual const vectorField& Sf() const
{
return MeshStorage::Sf();
return Mesh::Sf();
}
//- Face area magnitudes
virtual const scalarField& magSf() const
{
return MeshStorage::magSf();
return Mesh::magSf();
}
//- Face centres
virtual const vectorField& Cf() const
{
return MeshStorage::Cf();
return Mesh::Cf();
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -89,7 +89,7 @@ void Foam::cuttingPlane::performCut
const plane& pln = *this;
const pointField& pts = mesh.points();
MeshStorage::clear();
Mesh::clear();
meshCells_.clear();
// Pre-populate with restriction
@ -153,7 +153,7 @@ void Foam::cuttingPlane::operator=(const cuttingPlane& rhs)
return; // Self-assignment is a no-op
}
static_cast<MeshStorage&>(*this) = rhs;
static_cast<Mesh&>(*this) = rhs;
static_cast<plane&>(*this) = rhs;
meshCells_ = rhs.meshCells();
}

View File

@ -98,7 +98,7 @@ void Foam::cuttingSurface::performCut
{
const fvMesh& fvm = static_cast<const fvMesh&>(mesh);
MeshStorage::clear();
Mesh::clear();
meshCells_.clear();
// Pre-populate with restriction
@ -170,8 +170,8 @@ void Foam::cuttingSurface::performCut
void Foam::cuttingSurface::print(Ostream& os) const
{
os << " surface:" << surfaceName()
<< " faces:" << MeshStorage::surfFaces().size()
<< " points:" << MeshStorage::points().size();
<< " faces:" << Mesh::surfFaces().size()
<< " points:" << Mesh::points().size();
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,12 +35,6 @@ int Foam::cuttingSurfaceBase::debug
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cuttingSurfaceBase::cuttingSurfaceBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cuttingSurfaceBase::performCut
@ -80,7 +74,7 @@ void Foam::cuttingSurfaceBase::remapFaces(const labelUList& faceMap)
{
if (!faceMap.empty())
{
MeshStorage::remapFaces(faceMap);
Mesh::remapFaces(faceMap);
List<label> remappedCells(faceMap.size());
forAll(faceMap, facei)
@ -101,7 +95,7 @@ void Foam::cuttingSurfaceBase::operator=(const cuttingSurfaceBase& rhs)
return; // Self-assignment is a no-op
}
static_cast<MeshStorage&>(*this) = rhs;
static_cast<Mesh&>(*this) = rhs;
meshCells_ = rhs.meshCells();
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,13 +44,14 @@ SourceFiles
#include "bitSet.H"
#include "faceList.H"
#include "MeshedSurface.H"
#include "MeshedSurfacesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
// Forward Declarations
class primitiveMesh;
/*---------------------------------------------------------------------------*\
@ -59,12 +60,12 @@ class primitiveMesh;
class cuttingSurfaceBase
:
public MeshedSurface<face>
public meshedSurface
{
protected:
//- Typedef for convenience
typedef MeshedSurface<face> MeshStorage;
typedef meshedSurface Mesh;
// Protected Data
@ -183,8 +184,8 @@ public:
// Constructors
//- Construct null
cuttingSurfaceBase();
//- Default construct
cuttingSurfaceBase() = default;
//- Destructors

View File

@ -1378,11 +1378,8 @@ Foam::isoSurface::isoSurface
Pout<< "isoSurface:" << nl
<< " isoField : " << cellValues.name() << nl
<< " cell min/max : "
<< min(cellValues.primitiveField()) << " / "
<< max(cellValues.primitiveField()) << nl
<< " point min/max : "
<< min(pVals_) << " / "
<< max(pVals_) << nl
<< minMax(cellValues.primitiveField()) << nl
<< " point min/max : " << minMax(pVals_) << nl
<< " isoValue : " << iso << nl
<< " filter : " << Switch(regularise_) << nl
<< " mergeTol : " << mergeTol << nl
@ -1754,9 +1751,9 @@ Foam::isoSurface::isoSurface
tmpsurf.clearOut();
MeshStorage updated(std::move(pts), std::move(faces), surfZoneList());
Mesh updated(std::move(pts), std::move(faces), surfZoneList());
this->MeshStorage::transfer(updated);
this->Mesh::transfer(updated);
}
}

View File

@ -59,7 +59,7 @@ class isoSurfaceBase
protected:
// Protected typedefs for convenience
typedef meshedSurface MeshStorage;
typedef meshedSurface Mesh;
// Protected Data

View File

@ -1335,13 +1335,9 @@ Foam::isoSurfaceCell::isoSurfaceCell
{
if (debug)
{
Pout<< "isoSurfaceCell::"
<< " cell min/max : "
<< min(cVals_) << " / "
<< max(cVals_) << nl
<< " point min/max : "
<< min(pVals_) << " / "
<< max(pVals_) << nl
Pout<< "isoSurfaceCell:" << nl
<< " cell min/max : " << minMax(cVals_) << nl
<< " point min/max : " << minMax(pVals_) << nl
<< " isoValue : " << iso << nl
<< " filter : " << Switch(regularise) << nl
<< " mergeTol : " << mergeTol << nl
@ -1638,9 +1634,9 @@ Foam::isoSurfaceCell::isoSurfaceCell
tmpsurf.clearOut();
MeshStorage updated(std::move(pts), std::move(faces), surfZoneList());
Mesh updated(std::move(pts), std::move(faces), surfZoneList());
this->MeshStorage::transfer(updated);
this->Mesh::transfer(updated);
}
}

View File

@ -29,6 +29,7 @@ License
#include "isoSurfaceTopo.H"
#include "isoSurface.H"
#include "polyMesh.H"
#include "volFields.H"
#include "tetMatcher.H"
#include "tetPointRef.H"
#include "DynamicField.H"
@ -217,7 +218,7 @@ Foam::label Foam::isoSurfaceTopo::calcCutTypes
if (debug)
{
Pout<< "isoSurfaceCell : candidate cut cells "
Pout<< "isoSurfaceTopo : candidate cut cells "
<< nCutCells << " / " << mesh_.nCells() << endl;
}
return nCutCells;
@ -513,7 +514,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x0E)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-2], verts[sz-1]);
}
}
@ -556,7 +557,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x0D)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-2], verts[sz-1]);
}
}
@ -565,7 +566,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
case 0x03:
case 0x0C:
{
label p0p2
const label p0p2
(
generatePoint
(
@ -575,7 +576,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
pointToVerts, pointToFace, pointFromDiag, vertsToPoint
)
);
label p1p3
const label p1p3
(
generatePoint
(
@ -614,7 +615,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x0C)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-5], verts[sz-4]);
Swap(verts[sz-2], verts[sz-1]);
}
@ -658,7 +659,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x0B)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-2], verts[sz-1]);
}
}
@ -667,7 +668,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
case 0x05:
case 0x0A:
{
label p0p1
const label p0p1
(
generatePoint
(
@ -677,7 +678,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
pointToVerts, pointToFace, pointFromDiag, vertsToPoint
)
);
label p2p3
const label p2p3
(
generatePoint
(
@ -716,7 +717,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x0A)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-5], verts[sz-4]);
Swap(verts[sz-2], verts[sz-1]);
}
@ -726,7 +727,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
case 0x06:
case 0x09:
{
label p0p1
const label p0p1
(
generatePoint
(
@ -736,7 +737,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
pointToVerts, pointToFace, pointFromDiag, vertsToPoint
)
);
label p2p3
const label p2p3
(
generatePoint
(
@ -775,7 +776,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
if (triIndex == 0x09)
{
// Flip normals
label sz = verts.size();
const label sz = verts.size();
Swap(verts[sz-5], verts[sz-4]);
Swap(verts[sz-2], verts[sz-1]);
}
@ -956,7 +957,7 @@ void Foam::isoSurfaceTopo::generateTriPoints
label fp = f.fcIndex(fp0);
for (label i = 2; i < f.size(); ++i)
{
label nextFp = f.fcIndex(fp);
const label nextFp = f.fcIndex(fp);
FixedList<bool, 6> edgeIsDiag(false);
@ -1104,10 +1105,10 @@ void Foam::isoSurfaceTopo::triangulateOutside
}
Foam::MeshedSurface<Foam::face> Foam::isoSurfaceTopo::removeInsidePoints
Foam::meshedSurface Foam::isoSurfaceTopo::removeInsidePoints
(
const bool filterDiag,
const MeshStorage& s,
const Mesh& s,
const boolList& pointFromDiag,
const labelList& pointToFace,
const labelList& start, // Per cell the starting triangle
@ -1173,7 +1174,7 @@ Foam::MeshedSurface<Foam::face> Foam::isoSurfaceTopo::removeInsidePoints
}
MeshStorage cpSurface
Mesh cpSurface
(
std::move(compactPoints),
std::move(compactFaces),
@ -1205,15 +1206,11 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
{
if (debug)
{
Pout<< "isoSurfaceTopo::"
<< " cell min/max : "
<< min(cVals_) << " / "
<< max(cVals_) << nl
<< " point min/max : "
<< min(pVals_) << " / "
<< max(pVals_) << nl
Pout<< "isoSurfaceTopo:" << nl
<< " cell min/max : " << minMax(cVals_) << nl
<< " point min/max : " << minMax(pVals_) << nl
<< " isoValue : " << iso << nl
<< " filter : " << isoSurfaceTopo::filterNames[filter]
<< " filter : " << isoSurfaceBase::filterNames[filter]
<< nl
<< " mesh span : " << mesh.bounds().mag() << nl
<< " ignoreCells : " << ignoreCells_.count()
@ -1324,14 +1321,14 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
surfZoneList allZones(one{}, surfZone("allFaces", allTris.size()));
MeshStorage::clear();
MeshStorage updated
Mesh::clear();
Mesh updated
(
std::move(allPoints),
std::move(allTris),
std::move(allZones)
);
MeshStorage::transfer(updated);
Mesh::transfer(updated);
// Now:
// - generated faces and points are assigned to *this
@ -1354,7 +1351,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
// face diagonals)
DynamicList<label> pointCompactMap(size()); // Back to original point
DynamicList<label> compactCellIDs(size()); // Per tri the cell
MeshStorage::operator=
Mesh::operator=
(
removeInsidePoints
(
@ -1444,7 +1441,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
const labelList& mp = meshPoints();
const labelListList& edgeFaces = MeshStorage::edgeFaces();
const labelListList& edgeFaces = Mesh::edgeFaces();
forAll(edgeFaces, edgei)
{
@ -1492,16 +1489,16 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
labelList pointMap;
labelList faceMap;
MeshStorage filteredSurf
Mesh filteredSurf
(
MeshStorage::subsetMesh
Mesh::subsetMesh
(
faceSelection,
pointMap,
faceMap
)
);
MeshStorage::transfer(filteredSurf);
Mesh::transfer(filteredSurf);
pointToVerts_ = UIndirectList<edge>(pointToVerts_, pointMap)();
pointToFace_ = UIndirectList<label>(pointToFace_, pointMap)();

View File

@ -171,10 +171,10 @@ class isoSurfaceTopo
DynamicList<label>& compactCellIDs
) const;
MeshStorage removeInsidePoints
Mesh removeInsidePoints
(
const bool filterDiag,
const MeshStorage& s,
const Mesh& s,
const boolList& pointFromDiag,
const labelList& pointToFace,
const labelList& start, // Per cell:starting tri

View File

@ -27,10 +27,8 @@ License
\*---------------------------------------------------------------------------*/
#include "thresholdCellFaces.H"
#include "polyMesh.H"
#include "DynamicList.H"
#include "emptyPolyPatch.H"
#include "processorPolyPatch.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,12 +40,14 @@ SourceFiles
#define thresholdCellFaces_H
#include "MeshedSurface.H"
#include "MeshedSurfacesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class polyMesh;
/*---------------------------------------------------------------------------*\
@ -54,10 +56,13 @@ class polyMesh;
class thresholdCellFaces
:
public MeshedSurface<face>
public meshedSurface
{
//- Private typedefs for convenience
typedef MeshedSurface<face> MeshStorage;
// Private typedefs for convenience
typedef meshedSurface Mesh;
// Private Data
//- Reference to mesh
const polyMesh& mesh_;
@ -108,7 +113,6 @@ public:
{
return meshCells_;
}
};

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -81,14 +81,14 @@ functions
turbulenceProperties:L
);
surfaces
(
{
inlet
{
type patch;
patches (inlet);
interpolate false;
}
);
}
}
}