mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide ModifiableMeshedSurface class
- A special purpose MeshedSurface that exposes the stored values for direct modification. - Its usage should be restricted to special cases where the surface needs modifications as an atomic operation.
This commit is contained in:
@ -41,6 +41,9 @@ Usage
|
|||||||
- \par -orient
|
- \par -orient
|
||||||
Check face orientation on the input surface
|
Check face orientation on the input surface
|
||||||
|
|
||||||
|
- \par -testModify
|
||||||
|
Test modification mechanism
|
||||||
|
|
||||||
- \par -scale \<scale\>
|
- \par -scale \<scale\>
|
||||||
Specify a scaling factor for writing the files
|
Specify a scaling factor for writing the files
|
||||||
|
|
||||||
@ -65,6 +68,7 @@ Note
|
|||||||
#include "PackedBoolList.H"
|
#include "PackedBoolList.H"
|
||||||
|
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
|
#include "ModifiableMeshedSurface.H"
|
||||||
#include "UnsortedMeshedSurfaces.H"
|
#include "UnsortedMeshedSurfaces.H"
|
||||||
|
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
@ -93,6 +97,13 @@ int main(int argc, char *argv[])
|
|||||||
"orient",
|
"orient",
|
||||||
"check surface orientation"
|
"check surface orientation"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"testModify",
|
||||||
|
"Test modification mechanism (MeshedSurface)"
|
||||||
|
);
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"surfMesh",
|
"surfMesh",
|
||||||
@ -389,6 +400,34 @@ int main(int argc, char *argv[])
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("testModify"))
|
||||||
|
{
|
||||||
|
Info<< "Use ModifiableMeshedSurface to shift (1, 0, 0)" << endl;
|
||||||
|
Info<< "original" << nl;
|
||||||
|
surf.writeStats(Info);
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
|
ModifiableMeshedSurface<face> tsurf(surf.xfer());
|
||||||
|
// ModifiableMeshedSurface<face> tsurf;
|
||||||
|
// tsurf.reset(surf.xfer());
|
||||||
|
|
||||||
|
Info<< "in-progress" << nl;
|
||||||
|
surf.writeStats(Info);
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
|
tsurf.storedPoints() += vector(1, 0, 0);
|
||||||
|
|
||||||
|
surf.transfer(tsurf);
|
||||||
|
|
||||||
|
Info<< "updated" << nl;
|
||||||
|
surf.writeStats(Info);
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
|
Info<< "modifier" << nl;
|
||||||
|
tsurf.writeStats(Info);
|
||||||
|
Info<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "writing " << exportName;
|
Info<< "writing " << exportName;
|
||||||
if (scaleFactor <= 0)
|
if (scaleFactor <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
110
src/surfMesh/ModifiableMeshedSurface/ModifiableMeshedSurface.H
Normal file
110
src/surfMesh/ModifiableMeshedSurface/ModifiableMeshedSurface.H
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ModifiableMeshedSurface
|
||||||
|
|
||||||
|
Description
|
||||||
|
A special purpose MeshedSurface that exposes the stored values
|
||||||
|
for direct modification.
|
||||||
|
|
||||||
|
Its usage should be restricted to special cases where the surface
|
||||||
|
needs modifications as an atomic operation.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ModifiableMeshedSurface_H
|
||||||
|
#define ModifiableMeshedSurface_H
|
||||||
|
|
||||||
|
#include "MeshedSurface.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ModifiableMeshedSurface Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
class ModifiableMeshedSurface
|
||||||
|
:
|
||||||
|
public MeshedSurface<Face>
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
ModifiableMeshedSurface(const ModifiableMeshedSurface<Face>&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ModifiableMeshedSurface<Face>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null, use reset/transfer to adjust contents
|
||||||
|
ModifiableMeshedSurface()
|
||||||
|
:
|
||||||
|
MeshedSurface<Face>()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct by transferring the contents from a MeshedSurface
|
||||||
|
explicit ModifiableMeshedSurface
|
||||||
|
(
|
||||||
|
const Xfer<MeshedSurface<Face>>& surf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
MeshedSurface<Face>(surf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ModifiableMeshedSurface()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
// Expose protected methods
|
||||||
|
using MeshedSurface<Face>::storedFaces;
|
||||||
|
using MeshedSurface<Face>::storedPoints;
|
||||||
|
using MeshedSurface<Face>::storedZones;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user