DEFEATURE: remove deprecated/obsolete sample/store onto surfMesh

- was a stop-gap measure until field/registry storage on
  polySurface was introduced (FEB-2019)
This commit is contained in:
Mark Olesen
2022-02-10 16:31:57 +01:00
parent 1be63cd378
commit cbc86d6a88
7 changed files with 24 additions and 197 deletions

View File

@ -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.

View File

@ -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<class Type, class GeoMeshType>
bool storeSurfMeshField
(
const word& fieldName,
const dimensionSet& dims,
const Field<Type>& values,
word lookupName = ""
) const;
//- Move/store sampled Face field onto surfMesh (if it exists)
template<class Type, class GeoMeshType>
bool storeSurfMeshField
(
const word& fieldName,
const dimensionSet& dims,
Field<Type>&& values,
word lookupName = ""
) const;
// Sample (faces)
//- Sample volume field onto surface faces

View File

@ -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<surfMesh>(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);
}
// ************************************************************************* //

View File

@ -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<class Type, class GeoMeshType>
bool Foam::sampledSurface::storeSurfMeshField
(
const word& fieldName,
const dimensionSet& dims,
const Field<Type>& values,
word lookupName
) const
{
surfMesh* surfptr = this->getSurfMesh(lookupName);
if (surfptr)
{
surfptr->storeField<Type, GeoMeshType>
(
fieldName, dims, values
);
}
return surfptr;
}
template<class Type, class GeoMeshType>
bool Foam::sampledSurface::storeSurfMeshField
(
const word& fieldName,
const dimensionSet& dims,
Field<Type>&& values,
word lookupName
) const
{
surfMesh* surfptr = this->getSurfMesh(lookupName);
if (surfptr)
{
surfptr->storeField<Type, GeoMeshType>
(
fieldName, dims, std::move(values)
);
}
return surfptr;
}
// ************************************************************************* //

View File

@ -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;
}

View File

@ -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<sampledSurface>& surfaces() const
const PtrList<sampledSurface>& surfaces() const noexcept
{
return *this;
}
//- Return the surfaces
PtrList<sampledSurface>& surfaces()
PtrList<sampledSurface>& surfaces() noexcept
{
return *this;
}
@ -247,19 +246,11 @@ class sampledSurfaces
//- Sample and store/write a specific volume field
template<class Type>
void performAction
(
const GeometricField<Type, fvPatchField, volMesh>& fld,
unsigned request
);
void performAction(const VolumeField<Type>& fld, unsigned request);
//- Sample and store/write a specific surface field
template<class Type>
void performAction
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
unsigned request
);
void performAction(const SurfaceField<Type>& 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;
};

View File

@ -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<class Type>
void Foam::sampledSurfaces::performAction
(
const GeometricField<Type, fvPatchField, volMesh>& fld,
const VolumeField<Type>& fld,
unsigned request
)
{
@ -139,15 +136,6 @@ void Foam::sampledSurfaces::performAction
writeSurface<Type>(writers_[surfi], values, fieldName);
}
if ((request & actions_[surfi]) & ACTION_SURF_MESH)
{
// Face fields only!
s.storeSurfMeshField<Type, surfGeoMesh>
(
fieldName, dims, values
);
}
if ((request & actions_[surfi]) & ACTION_STORE)
{
if (s.isPointData())
@ -172,7 +160,7 @@ void Foam::sampledSurfaces::performAction
template<class Type>
void Foam::sampledSurfaces::performAction
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
const SurfaceField<Type>& fld,
unsigned request
)
{
@ -197,14 +185,6 @@ void Foam::sampledSurfaces::performAction
writeSurface<Type>(writers_[surfi], values, fieldName);
}
if ((request & actions_[surfi]) & ACTION_SURF_MESH)
{
s.storeSurfMeshField<Type, surfGeoMesh>
(
fieldName, dims, values
);
}
if ((request & actions_[surfi]) & ACTION_STORE)
{
storeRegistryField<Type, polySurfaceGeoMesh>