diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 2cde386cea..7c2727ce53 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -33,7 +33,6 @@ surface/isoSurface/isoSurfaceBase.C surface/isoSurface/isoSurfaceCell.C surface/isoSurface/isoSurfaceTopo.C surface/thresholdCellFaces/thresholdCellFaces.C -surface/triSurfaceMesh/discreteSurface.C sampledSurface/sampledNone/sampledNone.C sampledSurface/sampledPatch/sampledPatch.C @@ -52,9 +51,6 @@ sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshNormal.C sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C -/* Proof-of-concept: */ -/* sampledSurface/triSurfaceMesh/sampledDiscreteSurface.C */ - readers = sampledSurface/readers $(readers)/surfaceReader.C diff --git a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.C b/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.C deleted file mode 100644 index ca6d87d15a..0000000000 --- a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.C +++ /dev/null @@ -1,236 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "sampledDiscreteSurface.H" -#include "meshSearch.H" -#include "Tuple2.H" -#include "globalIndex.H" -#include "treeDataCell.H" -#include "treeDataFace.H" -#include "meshTools.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(sampledDiscreteSurface, 0); - addToRunTimeSelectionTable - ( - sampledSurface, - sampledDiscreteSurface, - word - ); -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::sampledDiscreteSurface::sampledDiscreteSurface -( - const word& name, - const polyMesh& mesh, - const word& surfaceName, - const discreteSurface::samplingSource sampleSource -) -: - sampledSurface(name, mesh), - SurfaceSource(mesh, surfaceName, sampleSource) -{} - - -Foam::sampledDiscreteSurface::sampledDiscreteSurface -( - const word& name, - const polyMesh& mesh, - const dictionary& dict -) -: - sampledSurface(name, mesh, dict), - SurfaceSource(mesh, dict) -{} - - -Foam::sampledDiscreteSurface::sampledDiscreteSurface -( - const word& name, - const polyMesh& mesh, - const triSurface& surface, - const word& sampleSourceName -) -: - sampledSurface(name, mesh), - SurfaceSource(name, mesh, surface, sampleSourceName) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::sampledDiscreteSurface::~sampledDiscreteSurface() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::sampledDiscreteSurface::needsUpdate() const -{ - return SurfaceSource::needsUpdate(); -} - - -bool Foam::sampledDiscreteSurface::expire() -{ - if (SurfaceSource::expire()) - { - // merged information etc - sampledSurface::clearGeom(); - - return true; - } - - return false; -} - - -bool Foam::sampledDiscreteSurface::update() -{ - return SurfaceSource::update(); -} - - -bool Foam::sampledDiscreteSurface::update(const treeBoundBox& bb) -{ - return SurfaceSource::update(bb); -} - - -bool Foam::sampledDiscreteSurface::sampleAndStore -( - const objectRegistry& store, - const word& fieldName -) const -{ - return SurfaceSource::sampleAndStore(store, fieldName); -} - - -Foam::tmp Foam::sampledDiscreteSurface::sample -( - const interpolation& sampler -) const -{ - return SurfaceSource::sampleOnFaces(sampler); -} - - -Foam::tmp Foam::sampledDiscreteSurface::sample -( - const interpolation& sampler -) const -{ - return SurfaceSource::sampleOnFaces(sampler); -} - -Foam::tmp Foam::sampledDiscreteSurface::sample -( - const interpolation& sampler -) const -{ - return SurfaceSource::sampleOnFaces(sampler); -} - - -Foam::tmp Foam::sampledDiscreteSurface::sample -( - const interpolation& sampler -) const -{ - return SurfaceSource::sampleOnFaces(sampler); -} - - -Foam::tmp Foam::sampledDiscreteSurface::sample -( - const interpolation& sampler -) const -{ - return SurfaceSource::sampleOnFaces(sampler); -} - - -Foam::tmp Foam::sampledDiscreteSurface::interpolate -( - const interpolation& interpolator -) const -{ - return SurfaceSource::sampleOnPoints(interpolator); -} - - -Foam::tmp Foam::sampledDiscreteSurface::interpolate -( - const interpolation& interpolator -) const -{ - return SurfaceSource::sampleOnPoints(interpolator); -} - -Foam::tmp Foam::sampledDiscreteSurface::interpolate -( - const interpolation& interpolator -) const -{ - return SurfaceSource::sampleOnPoints(interpolator); -} - - -Foam::tmp Foam::sampledDiscreteSurface::interpolate -( - const interpolation& interpolator -) const -{ - return SurfaceSource::sampleOnPoints(interpolator); -} - - -Foam::tmp Foam::sampledDiscreteSurface::interpolate -( - const interpolation& interpolator -) const -{ - return SurfaceSource::sampleOnPoints(interpolator); -} - - -void Foam::sampledDiscreteSurface::print(Ostream& os) const -{ - os << "sampledDiscreteSurface: " << name() << " :"; - SurfaceSource::print(os); -} - - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H b/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H deleted file mode 100644 index adb28da795..0000000000 --- a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurface.H +++ /dev/null @@ -1,294 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. -------------------------------------------------------------------------------- -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 . - -Class - Foam::sampledDiscreteSurface - -Description - A sampledSurface from a triSurfaceMesh. - It samples on the points/triangles of a triSurfaceMesh. - -See Also - discreteSurface, sampledSurface - -SourceFiles - sampledDiscreteSurface.C - sampledDiscreteSurfaceTemplates.C - -\*---------------------------------------------------------------------------*/ - -#ifndef sampledDiscreteSurface_H -#define sampledDiscreteSurface_H - -#include "sampledSurface.H" -#include "discreteSurface.H" -#include "triSurfaceMesh.H" -#include "MeshedSurface.H" -#include "MeshedSurfacesFwd.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class sampledDiscreteSurface; - -/*---------------------------------------------------------------------------*\ - Class sampledDiscreteSurface Declaration -\*---------------------------------------------------------------------------*/ - -class sampledDiscreteSurface -: - public sampledSurface, - public discreteSurface -{ - //- Private typedefs for convenience - typedef discreteSurface MeshStorage; - typedef discreteSurface SurfaceSource; - - - // Private Member Functions - - //- Sample volume field onto surface faces - template - tmp> sampleOnFaces - ( - const interpolation& sampler - ) const; - - //- Interpolate volume field onto surface points - template - tmp> sampleOnPoints - ( - const interpolation& interpolator - ) const; - - -public: - - //- Runtime type information - TypeName("sampledDiscreteSurface"); - - - // Constructors - - //- Construct from components - sampledDiscreteSurface - ( - const word& name, - const polyMesh& mesh, - const word& surfaceName, - const discreteSurface::samplingSource sampleSource - ); - - //- Construct from dictionary - sampledDiscreteSurface - ( - const word& name, - const polyMesh& mesh, - const dictionary& dict - ); - - //- Construct from triSurface - sampledDiscreteSurface - ( - const word& name, - const polyMesh& mesh, - const triSurface& surface, - const word& sampleSourceName - ); - - - //- Destructor - virtual ~sampledDiscreteSurface(); - - - // Member Functions - - //- Does the surface need an update? - virtual bool needsUpdate() const; - - //- Mark the surface as needing an update. - // May also free up unneeded data. - // Return false if surface was already marked as expired. - virtual bool expire(); - - //- Update the surface as required. - // Do nothing (and return false) if no update was needed - virtual bool update(); - - //- Update the surface using a bound box to limit the searching. - // For direct use, i.e. not through sample. - // Do nothing (and return false) if no update was needed - bool update(const treeBoundBox&); - - //- Points of surface - virtual const pointField& points() const - { - return MeshStorage::points(); - } - - //- Faces of surface - virtual const faceList& faces() const - { - return MeshStorage::surfFaces(); - } - - //- Per-face zone/region information - virtual const labelList& zoneIds() const - { - return MeshStorage::zoneIds(); - } - - //- Face area vectors - virtual const vectorField& Sf() const - { - return MeshStorage::Sf(); - } - - //- Face area magnitudes - virtual const scalarField& magSf() const - { - return MeshStorage::magSf(); - } - - //- Face centres - virtual const vectorField& Cf() const - { - return MeshStorage::Cf(); - } - - //- If element ids/order of the original surface are kept - virtual bool hasFaceIds() const - { - return MeshStorage::hasFaceIds(); - } - - //- List of element ids/order of the original surface, - // when keepIds is active. - virtual const labelList& originalIds() const - { - return MeshStorage::originalIds(); - } - - //- Sample the volume field onto surface, - // store it (temporarily) onto the given registry - virtual bool sampleAndStore - ( - const objectRegistry& store, - const word& fieldName - ) const; - - - // Sample - - //- Sample volume field onto surface faces - virtual tmp sample - ( - const interpolation& sampler - ) const; - - //- Sample volume field onto surface faces - virtual tmp sample - ( - const interpolation& sampler - ) const; - - //- Sample volume field onto surface faces - virtual tmp sample - ( - const interpolation& sampler - ) const; - - //- Sample volume field onto surface faces - virtual tmp sample - ( - const interpolation& sampler - ) const; - - //- Sample volume field onto surface faces - virtual tmp sample - ( - const interpolation& sampler - ) const; - - - // Interpolate - - //- Interpolate volume field onto surface points - virtual tmp interpolate - ( - const interpolation& interpolator - ) const; - - //- Interpolate volume field onto surface points - virtual tmp interpolate - ( - const interpolation& interpolator - ) const; - - //- Interpolate volume field onto surface points - virtual tmp interpolate - ( - const interpolation& interpolator - ) const; - - //- Interpolate volume field onto surface points - virtual tmp interpolate - ( - const interpolation& interpolator - ) const; - - //- Interpolate volume field onto surface points - virtual tmp interpolate - ( - const interpolation& interpolator - ) const; - - - // Output - - //- Write - virtual void print(Ostream& os) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// #ifdef NoRepository -// #include "sampledDiscreteSurfaceTemplates.C" -// #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurfaceTemplates.C b/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurfaceTemplates.C deleted file mode 100644 index 2d4ff8f9dd..0000000000 --- a/src/sampling/sampledSurface/triSurfaceMesh/sampledDiscreteSurfaceTemplates.C +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "sampledDiscreteSurface.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// ************************************************************************* // diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.C b/src/sampling/surface/triSurfaceMesh/discreteSurface.C deleted file mode 100644 index 700899d419..0000000000 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.C +++ /dev/null @@ -1,866 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "discreteSurface.H" -#include "meshSearch.H" -#include "Tuple2.H" -#include "globalIndex.H" -#include "treeDataCell.H" -#include "treeDataFace.H" -#include "meshTools.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const Foam::Enum -< - Foam::discreteSurface::samplingSource -> -Foam::discreteSurface::samplingSourceNames_ -({ - { samplingSource::cells, "cells" }, - { samplingSource::insideCells, "insideCells" }, - { samplingSource::boundaryFaces, "boundaryFaces" }, -}); - - -namespace Foam -{ - defineTypeNameAndDebug(discreteSurface, 0); - - //- 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; - } - } - }; -} - - -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - -void Foam::discreteSurface::setZoneMap -( - const surfZoneList& zoneLst, - labelList& zoneIds -) -{ - label sz = 0; - for (const surfZone& zn : zoneLst) - { - sz += zn.size(); - } - - zoneIds.setSize(sz); - forAll(zoneLst, zonei) - { - const surfZone& zn = zoneLst[zonei]; - - // Assign sub-zone Ids - SubList