From 61dd6aa70104dd1903f8155249541d3456f36e8f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 2 Dec 2020 10:01:48 +0100 Subject: [PATCH] ENH: code consistency in sampling TUT: dictionary form of surfaces instead of list --- .../distanceSurface/sampledDistanceSurface.H | 4 +- .../isoSurface/sampledIsoSurface.C | 37 +++++++--- .../isoSurface/sampledIsoSurface.H | 39 +++++------ .../isoSurface/sampledIsoSurfaceCell.C | 69 ++++++++----------- .../isoSurface/sampledIsoSurfaceCell.H | 56 +++++++-------- .../isoSurface/sampledIsoSurfaceTopo.C | 9 ++- .../isoSurface/sampledIsoSurfaceTopo.H | 41 +++++------ .../sampledCuttingPlane/sampledCuttingPlane.H | 4 +- .../sampledFaceZone/sampledFaceZone.H | 4 +- .../sampledMeshedSurface.C | 23 +------ .../sampledPatch/sampledPatch.H | 4 +- .../sampledPatchInternalField.H | 4 +- .../sampledPlane/sampledPlane.H | 4 +- .../sampledThresholdCellFaces.C | 9 ++- .../sampledThresholdCellFaces.H | 26 +++---- src/sampling/surface/cutting/cuttingPlane.C | 6 +- src/sampling/surface/cutting/cuttingSurface.C | 6 +- .../surface/cutting/cuttingSurfaceBase.C | 12 +--- .../surface/cutting/cuttingSurfaceBase.H | 13 ++-- src/sampling/surface/isoSurface/isoSurface.C | 11 ++- .../surface/isoSurface/isoSurfaceBase.H | 2 +- .../surface/isoSurface/isoSurfaceCell.C | 14 ++-- .../surface/isoSurface/isoSurfaceTopo.C | 63 ++++++++--------- .../surface/isoSurface/isoSurfaceTopo.H | 4 +- .../thresholdCellFaces/thresholdCellFaces.C | 2 - .../thresholdCellFaces/thresholdCellFaces.H | 14 ++-- .../initChannel/system/controlDict | 6 +- 27 files changed, 230 insertions(+), 256 deletions(-) diff --git a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H index 2f6ae8214c..56f84ca8bf 100644 --- a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H @@ -36,12 +36,12 @@ Usage Example of function object partial specification: \verbatim surfaces - ( + { surface1 { type distanceSurface; } - ); + } \endverbatim Where the sub-entries comprise: diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C index 76b8d181c4..ba2c157ee7 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C @@ -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::sampledIsoSurface::sample +Foam::tmp +Foam::sampledIsoSurface::sample ( const interpolation& sampler ) const @@ -528,7 +536,8 @@ Foam::tmp Foam::sampledIsoSurface::sample } -Foam::tmp Foam::sampledIsoSurface::sample +Foam::tmp +Foam::sampledIsoSurface::sample ( const interpolation& sampler ) const @@ -537,7 +546,8 @@ Foam::tmp Foam::sampledIsoSurface::sample } -Foam::tmp Foam::sampledIsoSurface::sample +Foam::tmp +Foam::sampledIsoSurface::sample ( const interpolation& sampler ) const @@ -546,7 +556,8 @@ Foam::tmp Foam::sampledIsoSurface::sample } -Foam::tmp Foam::sampledIsoSurface::sample +Foam::tmp +Foam::sampledIsoSurface::sample ( const interpolation& sampler ) const @@ -555,7 +566,8 @@ Foam::tmp Foam::sampledIsoSurface::sample } -Foam::tmp Foam::sampledIsoSurface::sample +Foam::tmp +Foam::sampledIsoSurface::sample ( const interpolation& sampler ) const @@ -564,7 +576,8 @@ Foam::tmp Foam::sampledIsoSurface::sample } -Foam::tmp Foam::sampledIsoSurface::interpolate +Foam::tmp +Foam::sampledIsoSurface::interpolate ( const interpolation& interpolator ) const @@ -573,7 +586,8 @@ Foam::tmp Foam::sampledIsoSurface::interpolate } -Foam::tmp Foam::sampledIsoSurface::interpolate +Foam::tmp +Foam::sampledIsoSurface::interpolate ( const interpolation& interpolator ) const @@ -581,7 +595,8 @@ Foam::tmp Foam::sampledIsoSurface::interpolate return sampleOnPoints(interpolator); } -Foam::tmp Foam::sampledIsoSurface::interpolate +Foam::tmp +Foam::sampledIsoSurface::interpolate ( const interpolation& interpolator ) const @@ -590,7 +605,8 @@ Foam::tmp Foam::sampledIsoSurface::interpolate } -Foam::tmp Foam::sampledIsoSurface::interpolate +Foam::tmp +Foam::sampledIsoSurface::interpolate ( const interpolation& interpolator ) const @@ -599,7 +615,8 @@ Foam::tmp Foam::sampledIsoSurface::interpolate } -Foam::tmp Foam::sampledIsoSurface::interpolate +Foam::tmp +Foam::sampledIsoSurface::interpolate ( const interpolation& interpolator ) const diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index 6e29b61c62..c67ddc987f 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -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 \*---------------------------------------------------------------------------*/ @@ -80,14 +81,14 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class sampledIsoSurface Declaration + Class sampledIsoSurface Declaration \*---------------------------------------------------------------------------*/ 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; }; diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C index a5fe5b56f0..af2643fc5b 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C @@ -111,10 +111,15 @@ bool Foam::sampledIsoSurfaceCell::updateGeometry() const auto tpointFld = volPointInterpolation::New(fvm).interpolate(cellFld); + // Non-averaged? Use reference + tmp tcellValues(cellFld.primitiveField()); + if (average_) { - //- From point field and interpolated cell. - scalarField cellAvg(fvm.nCells(), Zero); + // From point field and interpolated cell. + tcellValues = tmp::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, - tpointFld().primitiveField(), - isoVal_, - filter_, - bounds_ - ); - - const_cast - ( - *this - ).transfer(static_cast(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 - ( - *this - ).transfer(static_cast(surf)); - meshCells_.transfer(surf.meshCells()); } + isoSurfaceCell surf + ( + fvm, + tcellValues(), + tpointFld().primitiveField(), + isoVal_, + filter_, + bounds_, + 1e-6 // mergeTol + ); + + // Replace current geomety + const_cast + ( + *this + ).transfer(static_cast(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("isoField")), isoVal_(dict.get("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 diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index 8e5bf322b2..a6c6e032ac 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -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 | - 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 | + Property | Description | Required | Default + type | isoSurfaceCell | yes | + isoField | field name for obtaining iso-surface | yes | + isoValue | value of iso-surface | 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; }; diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.C index a9ce4fba01..1f77bc2710 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.C @@ -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(*this); + isoSurfaceTopo surf ( fvm, @@ -121,8 +122,6 @@ bool Foam::sampledIsoSurfaceTopo::updateGeometry() const filter_ ); - MeshedSurface& mySurface = const_cast(*this); - mySurface.transfer(static_cast(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("isoField")), isoVal_(dict.get("isoValue")), filter_ diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H index 5f75e631d1..a6cbea9e7a 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTopo.H @@ -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; + type isoSurfaceTopo; + 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 + public meshedSurface { // Private typedefs for convenience - typedef MeshedSurface 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; }; diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index 41997ddafd..f470645a51 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -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: diff --git a/src/sampling/sampledSurface/sampledFaceZone/sampledFaceZone.H b/src/sampling/sampledSurface/sampledFaceZone/sampledFaceZone.H index 69b648385e..fa65d777a2 100644 --- a/src/sampling/sampledSurface/sampledFaceZone/sampledFaceZone.H +++ b/src/sampling/sampledSurface/sampledFaceZone/sampledFaceZone.H @@ -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: diff --git a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C index 2eed7d3d43..892f89f327 100644 --- a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C +++ b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C @@ -69,25 +69,6 @@ namespace Foam sampledTriSurfaceMesh ); - //- Private class for finding nearest - // Comprising: - // - global index - // - sqr(distance) - typedef Tuple2 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 nearInfo; List 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{}); Pstream::listCombineScatter(nearest); labelList cellOrFaceLabels(fc.size(), -1); diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index 2d47876496..2e6cd48680 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -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: diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H index f2b6b363bc..884efce23b 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H @@ -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: diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index b746f6c631..ee3ce97240 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -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: diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C index bdf7861580..bf728543aa 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C @@ -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(*this); thresholdCellFaces surf ( @@ -116,10 +118,7 @@ bool Foam::sampledThresholdCellFaces::updateGeometry() const triangulate_ ); - const_cast - ( - *this - ).MeshedSurface::transfer(surf); + mySurface.transfer(static_cast(surf)); meshCells_.transfer(surf.meshCells()); // Clear derived data diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H index 0f2d5f5ded..c4c105709a 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H @@ -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 + public meshedSurface { - //- Private typedefs for convenience - typedef MeshedSurface 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(); } diff --git a/src/sampling/surface/cutting/cuttingPlane.C b/src/sampling/surface/cutting/cuttingPlane.C index 15a773ae52..cd651431bd 100644 --- a/src/sampling/surface/cutting/cuttingPlane.C +++ b/src/sampling/surface/cutting/cuttingPlane.C @@ -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(*this) = rhs; + static_cast(*this) = rhs; static_cast(*this) = rhs; meshCells_ = rhs.meshCells(); } diff --git a/src/sampling/surface/cutting/cuttingSurface.C b/src/sampling/surface/cutting/cuttingSurface.C index 80dba908c7..936b5654f4 100644 --- a/src/sampling/surface/cutting/cuttingSurface.C +++ b/src/sampling/surface/cutting/cuttingSurface.C @@ -98,7 +98,7 @@ void Foam::cuttingSurface::performCut { const fvMesh& fvm = static_cast(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(); } diff --git a/src/sampling/surface/cutting/cuttingSurfaceBase.C b/src/sampling/surface/cutting/cuttingSurfaceBase.C index a207e3ae36..e0f6593fba 100644 --- a/src/sampling/surface/cutting/cuttingSurfaceBase.C +++ b/src/sampling/surface/cutting/cuttingSurfaceBase.C @@ -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