diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C index 6e9c8342bc..26dc2073ff 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index 014d93a162..95ab72c7bd 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,7 +75,6 @@ SourceFiles #define sampledSurface_H #include "polySurface.H" -#include "surfMesh.H" #include "typeInfo.H" #include "runTimeSelectionTables.H" #include "autoPtr.H" @@ -404,44 +403,6 @@ public: ) const; - // Specialized surfMesh storage (optional) - - //- Get surface from registry if available. - // \param lookupName Optional lookup name, use surface name if empty - // \return surface or nullptr - surfMesh* getSurfMesh(word lookupName = "") const; - - //- Copy surface into registry. - // \param lookupName Optional lookup name, use surface name if empty - // \return surface or nullptr it surface should not be stored - surfMesh* storeSurfMesh(word lookupName = "") const; - - //- Remove surface from registry. - // \param lookupName Optional lookup name, use surface name if empty - // \return True if surface existed and was removed - bool removeSurfMesh(word lookupName = "") const; - - //- Copy/store sampled Face field onto surfMesh (if it exists) - template - bool storeSurfMeshField - ( - const word& fieldName, - const dimensionSet& dims, - const Field& values, - word lookupName = "" - ) const; - - //- Move/store sampled Face field onto surfMesh (if it exists) - template - bool storeSurfMeshField - ( - const word& fieldName, - const dimensionSet& dims, - Field&& values, - word lookupName = "" - ) const; - - // Sample (faces) //- Sample volume field onto surface faces diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C index 4bb0eaecff..17de846f1f 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,7 +26,6 @@ License \*---------------------------------------------------------------------------*/ #include "sampledSurface.H" -#include "fvMesh.H" #include "MeshedSurface.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -61,7 +60,7 @@ Foam::polySurface* Foam::sampledSurface::storeRegistrySurface if (!surfptr) { - // Construct null and add to registry (owned by registry) + // Default construct and add to registry (owned by registry) surfptr = new polySurface(lookupName, obr, true); } @@ -82,45 +81,4 @@ bool Foam::sampledSurface::removeRegistrySurface } -Foam::surfMesh* Foam::sampledSurface::getSurfMesh(word lookupName) const -{ - if (lookupName.empty()) - { - lookupName = this->name(); - } - - return mesh().getObjectPtr(lookupName); -} - - -Foam::surfMesh* Foam::sampledSurface::storeSurfMesh(word lookupName) const -{ - if (lookupName.empty()) - { - lookupName = this->name(); - } - - surfMesh* surfptr = getSurfMesh(); - - if (!surfptr) - { - // Construct null and add owned by registry - surfptr = new surfMesh(lookupName, mesh()); - - surfptr->store(); // Add to registry - owned by registry - } - - surfptr->copySurface(*this); // Copy in geometry (removes old fields) - - return surfptr; -} - - -bool Foam::sampledSurface::removeSurfMesh(word lookupName) const -{ - surfMesh* surfptr = getSurfMesh(lookupName); - return mesh().checkOut(surfptr); -} - - // ************************************************************************* // diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C index f283b7eea9..add566ddae 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -225,50 +225,4 @@ bool Foam::sampledSurface::storeRegistryField } -template -bool Foam::sampledSurface::storeSurfMeshField -( - const word& fieldName, - const dimensionSet& dims, - const Field& values, - word lookupName -) const -{ - surfMesh* surfptr = this->getSurfMesh(lookupName); - - if (surfptr) - { - surfptr->storeField - ( - fieldName, dims, values - ); - } - - return surfptr; -} - - -template -bool Foam::sampledSurface::storeSurfMeshField -( - const word& fieldName, - const dimensionSet& dims, - Field&& values, - word lookupName -) const -{ - surfMesh* surfptr = this->getSurfMesh(lookupName); - - if (surfptr) - { - surfptr->storeField - ( - fieldName, dims, std::move(values) - ); - } - - return surfptr; -} - - // ************************************************************************* // diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index b35d2752bd..aab748c4e5 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -275,7 +275,7 @@ Foam::sampledSurfaces::sampledSurfaces // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::sampledSurfaces::verbose(const bool on) +bool Foam::sampledSurfaces::verbose(const bool on) noexcept { bool old(verbose_); verbose_ = on; @@ -353,10 +353,6 @@ bool Foam::sampledSurfaces::read(const dictionary& dict) { actions_[surfi] |= ACTION_STORE; } - if (surfDict.getOrDefault("surfMeshStore", false)) - { - actions_[surfi] |= ACTION_SURF_MESH; - } // Define surface writer, but do NOT yet attach a surface writers_.set @@ -419,10 +415,6 @@ bool Foam::sampledSurfaces::read(const dictionary& dict) { actions_[surfi] |= ACTION_STORE; } - if (surfDict.getOrDefault("surfMeshStore", false)) - { - actions_[surfi] |= ACTION_SURF_MESH; - } // Define surface writer, but do NOT yet attach a surface writers_.set @@ -473,10 +465,6 @@ bool Foam::sampledSurfaces::read(const dictionary& dict) Info<< ", store on registry (" << IOobject::groupName(name(), s.name()) << ')'; } - if (actions_[surfi] & ACTION_SURF_MESH) - { - Info<< ", store as surfMesh (DEPRECATED)"; - } Info<< nl; Info<< " "; s.print(Info, 0); @@ -533,11 +521,6 @@ bool Foam::sampledSurfaces::performAction(unsigned request) { storeRegistrySurface(s); } - - if ((request & actions_[surfi]) & ACTION_SURF_MESH) - { - s.storeSurfMesh(); - } } } @@ -765,17 +748,17 @@ bool Foam::sampledSurfaces::update() } -Foam::scalar Foam::sampledSurfaces::mergeTol() +Foam::scalar Foam::sampledSurfaces::mergeTol() noexcept { return mergeTol_; } -Foam::scalar Foam::sampledSurfaces::mergeTol(const scalar tol) +Foam::scalar Foam::sampledSurfaces::mergeTol(const scalar tol) noexcept { - const scalar prev(mergeTol_); + const scalar old(mergeTol_); mergeTol_ = tol; - return prev; + return old; } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index f412825778..ce4e00c99b 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -112,7 +112,6 @@ Description store | Store surface/fields on registry | no | surfaceFormat | output surface format | no | formatOptions | dictionary of format options | no | - surfMeshStore | Store surface/fields as surfMesh (transitional) | no | \endtable Note @@ -121,11 +120,12 @@ Note SourceFiles sampledSurfaces.C + sampledSurfacesTemplates.C \*---------------------------------------------------------------------------*/ -#ifndef sampledSurfaces_H -#define sampledSurfaces_H +#ifndef Foam_sampledSurfaces_H +#define Foam_sampledSurfaces_H #include "fvMeshFunctionObject.H" #include "sampledSurface.H" @@ -162,7 +162,6 @@ class sampledSurfaces ACTION_NONE = 0, ACTION_WRITE = 0x1, ACTION_STORE = 0x2, - ACTION_SURF_MESH = 0x4, ACTION_ALL = 0xF }; @@ -209,13 +208,13 @@ class sampledSurfaces // Private Member Functions //- Return the surfaces - const PtrList& surfaces() const + const PtrList& surfaces() const noexcept { return *this; } //- Return the surfaces - PtrList& surfaces() + PtrList& surfaces() noexcept { return *this; } @@ -247,19 +246,11 @@ class sampledSurfaces //- Sample and store/write a specific volume field template - void performAction - ( - const GeometricField& fld, - unsigned request - ); + void performAction(const VolumeField& fld, unsigned request); //- Sample and store/write a specific surface field template - void performAction - ( - const GeometricField& fld, - unsigned request - ); + void performAction(const SurfaceField& fld, unsigned request); //- Sample and write all applicable sampled fields // Only uses IOobjectList when loadFromFiles_ is active @@ -352,7 +343,7 @@ public: //- Enable/disable verbose output // \return old value - bool verbose(const bool on); + bool verbose(const bool on) noexcept; //- Read the sampledSurfaces dictionary virtual bool read(const dictionary& dict); @@ -373,10 +364,10 @@ public: virtual void readUpdate(const polyMesh::readUpdateState state); //- Get merge tolerance - static scalar mergeTol(); + static scalar mergeTol() noexcept; //- Set merge tolerance and return old value - static scalar mergeTol(const scalar tol); + static scalar mergeTol(const scalar tol) noexcept; }; diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index bca73a8c87..2bb6cb3018 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,10 +29,7 @@ License #include "sampledSurfaces.H" #include "volFields.H" #include "surfaceFields.H" -#include "polySurface.H" #include "polySurfaceFields.H" -#include "surfMesh.H" -#include "surfGeoMesh.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -81,7 +78,7 @@ bool Foam::sampledSurfaces::storeRegistryField template void Foam::sampledSurfaces::performAction ( - const GeometricField& fld, + const VolumeField& fld, unsigned request ) { @@ -139,15 +136,6 @@ void Foam::sampledSurfaces::performAction writeSurface(writers_[surfi], values, fieldName); } - if ((request & actions_[surfi]) & ACTION_SURF_MESH) - { - // Face fields only! - s.storeSurfMeshField - ( - fieldName, dims, values - ); - } - if ((request & actions_[surfi]) & ACTION_STORE) { if (s.isPointData()) @@ -172,7 +160,7 @@ void Foam::sampledSurfaces::performAction template void Foam::sampledSurfaces::performAction ( - const GeometricField& fld, + const SurfaceField& fld, unsigned request ) { @@ -197,14 +185,6 @@ void Foam::sampledSurfaces::performAction writeSurface(writers_[surfi], values, fieldName); } - if ((request & actions_[surfi]) & ACTION_SURF_MESH) - { - s.storeSurfMeshField - ( - fieldName, dims, values - ); - } - if ((request & actions_[surfi]) & ACTION_STORE) { storeRegistryField