Commit e112eb50 authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent 52b6c49b
......@@ -41,6 +41,9 @@ Usage
- \par -orient
Check face orientation on the input surface
- \par -testModify
Test modification mechanism
- \par -scale \<scale\>
Specify a scaling factor for writing the files
......@@ -65,6 +68,7 @@ Note
#include "PackedBoolList.H"
#include "MeshedSurfaces.H"
#include "ModifiableMeshedSurface.H"
#include "UnsortedMeshedSurfaces.H"
#include "IStringStream.H"
......@@ -93,6 +97,13 @@ int main(int argc, char *argv[])
"orient",
"check surface orientation"
);
argList::addBoolOption
(
"testModify",
"Test modification mechanism (MeshedSurface)"
);
argList::addBoolOption
(
"surfMesh",
......@@ -389,6 +400,34 @@ int main(int argc, char *argv[])
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;
if (scaleFactor <= 0)
{
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment