mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add stream operators for MeshedSurface, UnsortedMeshedSurface
- add corrsponding testing into surfaceMeshConvertTesting too
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,6 +66,9 @@ Note
|
|||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "UnsortedMeshedSurfaces.H"
|
#include "UnsortedMeshedSurfaces.H"
|
||||||
|
|
||||||
|
#include "IStringStream.H"
|
||||||
|
#include "OStringStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -84,11 +87,33 @@ int main(int argc, char *argv[])
|
|||||||
argList::validArgs.append("outputFile");
|
argList::validArgs.append("outputFile");
|
||||||
|
|
||||||
argList::addBoolOption("clean");
|
argList::addBoolOption("clean");
|
||||||
argList::addBoolOption("orient");
|
argList::addBoolOption
|
||||||
argList::addBoolOption("surfMesh");
|
(
|
||||||
|
"orient",
|
||||||
|
"check surface orientation"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"surfMesh",
|
||||||
|
"test surfMesh output"
|
||||||
|
);
|
||||||
argList::addBoolOption("triSurface");
|
argList::addBoolOption("triSurface");
|
||||||
argList::addBoolOption("unsorted");
|
argList::addBoolOption
|
||||||
argList::addBoolOption("triFace");
|
(
|
||||||
|
"unsorted",
|
||||||
|
"use UnsortedMeshedSurface instead of MeshedSurface, "
|
||||||
|
"or unsorted output (with -triSurface option)"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"triFace",
|
||||||
|
"use triFace instead of face"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"stdout",
|
||||||
|
"ignore output filename and write to stdout"
|
||||||
|
);
|
||||||
|
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
@ -99,10 +124,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
const bool optStdout = args.optionFound("stdout");
|
||||||
const scalar scaleFactor = args.optionLookupOrDefault("scale", 0.0);
|
const scalar scaleFactor = args.optionLookupOrDefault("scale", 0.0);
|
||||||
|
|
||||||
const fileName importName = args[1];
|
const fileName importName = args[1];
|
||||||
const fileName exportName = args[2];
|
const fileName exportName = optStdout ? "-stdout" : args[2];
|
||||||
|
|
||||||
if (importName == exportName)
|
if (importName == exportName)
|
||||||
{
|
{
|
||||||
@ -114,7 +140,11 @@ int main(int argc, char *argv[])
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
!MeshedSurface<face>::canRead(importName, true)
|
!MeshedSurface<face>::canRead(importName, true)
|
||||||
|| !MeshedSurface<face>::canWriteType(exportName.ext(), true)
|
||
|
||||||
|
(
|
||||||
|
!optStdout
|
||||||
|
&& !MeshedSurface<face>::canWriteType(exportName.ext(), true)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -128,6 +158,19 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
// check: output to ostream, construct from istream
|
||||||
|
{
|
||||||
|
OStringStream os;
|
||||||
|
os << surf;
|
||||||
|
IStringStream is(os.str());
|
||||||
|
|
||||||
|
triSurface surf2(is);
|
||||||
|
|
||||||
|
// is.rewind();
|
||||||
|
// is >> surf2; // FAIL: uses List<labelledTri> base class
|
||||||
|
// surf2.read(is); // FAIL: private method
|
||||||
|
}
|
||||||
|
|
||||||
if (args.optionFound("orient"))
|
if (args.optionFound("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
@ -156,8 +199,15 @@ int main(int argc, char *argv[])
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write sorted by region
|
if (optStdout)
|
||||||
surf.write(exportName, true);
|
{
|
||||||
|
Info<< surf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// normally write sorted (looks nicer)
|
||||||
|
surf.write(exportName, !args.optionFound("unsorted"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (args.optionFound("unsorted"))
|
else if (args.optionFound("unsorted"))
|
||||||
{
|
{
|
||||||
@ -167,6 +217,23 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
// check: output to ostream, construct from istream
|
||||||
|
{
|
||||||
|
OStringStream os;
|
||||||
|
os << surf;
|
||||||
|
IStringStream is(os.str());
|
||||||
|
|
||||||
|
// both work:
|
||||||
|
UnsortedMeshedSurface<face> surf2(is);
|
||||||
|
|
||||||
|
// OR
|
||||||
|
// is.rewind();
|
||||||
|
// UnsortedMeshedSurface<face> surf2;
|
||||||
|
// is >> surf2;
|
||||||
|
|
||||||
|
// surf2.read(is); // FAIL: private method
|
||||||
|
}
|
||||||
|
|
||||||
if (args.optionFound("orient"))
|
if (args.optionFound("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
@ -194,9 +261,16 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
surf.write(exportName);
|
|
||||||
|
if (optStdout)
|
||||||
|
{
|
||||||
|
Info<< surf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
surf.write(exportName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
else if (args.optionFound("triFace"))
|
else if (args.optionFound("triFace"))
|
||||||
{
|
{
|
||||||
MeshedSurface<triFace> surf(importName);
|
MeshedSurface<triFace> surf(importName);
|
||||||
@ -205,6 +279,23 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
// check: output to ostream, construct from istream
|
||||||
|
{
|
||||||
|
OStringStream os;
|
||||||
|
os << surf;
|
||||||
|
IStringStream is(os.str());
|
||||||
|
|
||||||
|
// both work:
|
||||||
|
MeshedSurface<face> surf2(is);
|
||||||
|
|
||||||
|
// OR
|
||||||
|
// is.rewind();
|
||||||
|
// MeshedSurface<face> surf2;
|
||||||
|
// is >> surf2;
|
||||||
|
|
||||||
|
// surf2.read(is); // FAIL: private method
|
||||||
|
}
|
||||||
|
|
||||||
if (args.optionFound("orient"))
|
if (args.optionFound("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
@ -232,9 +323,16 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
surf.write(exportName);
|
|
||||||
|
if (optStdout)
|
||||||
|
{
|
||||||
|
Info<< surf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
surf.write(exportName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MeshedSurface<face> surf(importName);
|
MeshedSurface<face> surf(importName);
|
||||||
@ -243,6 +341,23 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
// check: output to ostream, construct from istream
|
||||||
|
{
|
||||||
|
OStringStream os;
|
||||||
|
os << surf;
|
||||||
|
IStringStream is(os.str());
|
||||||
|
|
||||||
|
// both work:
|
||||||
|
MeshedSurface<face> surf2(is);
|
||||||
|
|
||||||
|
// OR
|
||||||
|
// is.rewind();
|
||||||
|
// MeshedSurface<face> surf2;
|
||||||
|
// is >> surf2;
|
||||||
|
|
||||||
|
// surf2.read(is); // FAIL: private method
|
||||||
|
}
|
||||||
|
|
||||||
if (args.optionFound("orient"))
|
if (args.optionFound("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
@ -258,7 +373,6 @@ int main(int argc, char *argv[])
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Info<< "writing " << exportName;
|
Info<< "writing " << exportName;
|
||||||
if (scaleFactor <= 0)
|
if (scaleFactor <= 0)
|
||||||
{
|
{
|
||||||
@ -271,7 +385,15 @@ int main(int argc, char *argv[])
|
|||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
surf.write(exportName);
|
|
||||||
|
if (optStdout)
|
||||||
|
{
|
||||||
|
Info<< surf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
surf.write(exportName);
|
||||||
|
}
|
||||||
|
|
||||||
if (args.optionFound("surfMesh"))
|
if (args.optionFound("surfMesh"))
|
||||||
{
|
{
|
||||||
@ -287,7 +409,6 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
||||||
Info<< "runTime.timeName() = " << runTime.timeName() << endl;
|
Info<< "runTime.timeName() = " << runTime.timeName() << endl;
|
||||||
|
|
||||||
|
|
||||||
Info<< "write MeshedSurface 'yetAnother' via proxy as surfMesh"
|
Info<< "write MeshedSurface 'yetAnother' via proxy as surfMesh"
|
||||||
<< endl;
|
<< endl;
|
||||||
surf.write
|
surf.write
|
||||||
@ -312,14 +433,11 @@ int main(int argc, char *argv[])
|
|||||||
MeshedSurface<face> surfIn2(runTime, "foobar");
|
MeshedSurface<face> surfIn2(runTime, "foobar");
|
||||||
|
|
||||||
Info<<"surfIn2 = " << surfIn2.size() << endl;
|
Info<<"surfIn2 = " << surfIn2.size() << endl;
|
||||||
|
|
||||||
Info<< "surfIn = " << surfIn.size() << endl;
|
Info<< "surfIn = " << surfIn.size() << endl;
|
||||||
|
|
||||||
|
|
||||||
Info<< "writing surfMesh as obj = oldSurfIn.obj" << endl;
|
Info<< "writing surfMesh as obj = oldSurfIn.obj" << endl;
|
||||||
surfIn.write("oldSurfIn.obj");
|
surfIn.write("oldSurfIn.obj");
|
||||||
|
|
||||||
|
|
||||||
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
||||||
|
|
||||||
surfMesh surfOut
|
surfMesh surfOut
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -343,7 +343,10 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::MeshedSurface<Face>::MeshedSurface(const fileName& name)
|
Foam::MeshedSurface<Face>::MeshedSurface
|
||||||
|
(
|
||||||
|
const fileName& name
|
||||||
|
)
|
||||||
:
|
:
|
||||||
ParentType(List<Face>(), pointField())
|
ParentType(List<Face>(), pointField())
|
||||||
{
|
{
|
||||||
@ -351,6 +354,19 @@ Foam::MeshedSurface<Face>::MeshedSurface(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::MeshedSurface<Face>::MeshedSurface
|
||||||
|
(
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ParentType(List<Face>(), pointField()),
|
||||||
|
zones_()
|
||||||
|
{
|
||||||
|
read(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::MeshedSurface<Face>::MeshedSurface
|
Foam::MeshedSurface<Face>::MeshedSurface
|
||||||
(
|
(
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -69,11 +69,18 @@ namespace Foam
|
|||||||
class Time;
|
class Time;
|
||||||
class surfMesh;
|
class surfMesh;
|
||||||
class polyBoundaryMesh;
|
class polyBoundaryMesh;
|
||||||
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
template<class Face> class MeshedSurface;
|
template<class Face> class MeshedSurface;
|
||||||
template<class Face> class MeshedSurfaceProxy;
|
template<class Face> class MeshedSurfaceProxy;
|
||||||
template<class Face> class UnsortedMeshedSurface;
|
template<class Face> class UnsortedMeshedSurface;
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Istream& operator>>(Istream&, MeshedSurface<Face>&);
|
||||||
|
template<class Face>
|
||||||
|
Ostream& operator<<(Ostream&, const MeshedSurface<Face>&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class MeshedSurface Declaration
|
Class MeshedSurface Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -84,7 +91,7 @@ class MeshedSurface
|
|||||||
public PrimitivePatch<Face, ::Foam::List, pointField, point>,
|
public PrimitivePatch<Face, ::Foam::List, pointField, point>,
|
||||||
public fileFormats::surfaceFormatsCore
|
public fileFormats::surfaceFormatsCore
|
||||||
{
|
{
|
||||||
// friends - despite different face representationsx
|
// friends - despite different face representations
|
||||||
template<class Face2> friend class MeshedSurface;
|
template<class Face2> friend class MeshedSurface;
|
||||||
template<class Face2> friend class UnsortedMeshedSurface;
|
template<class Face2> friend class UnsortedMeshedSurface;
|
||||||
friend class surfMesh;
|
friend class surfMesh;
|
||||||
@ -114,6 +121,15 @@ private:
|
|||||||
List<surfZone> zones_;
|
List<surfZone> zones_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member functions
|
||||||
|
|
||||||
|
//- Read/construct from Istream
|
||||||
|
Istream& read(Istream&);
|
||||||
|
|
||||||
|
//- Write to Ostream
|
||||||
|
Ostream& write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Member functions
|
// Protected Member functions
|
||||||
@ -133,7 +149,7 @@ protected:
|
|||||||
//- Non-const access to the faces
|
//- Non-const access to the faces
|
||||||
List<Face>& storedFaces()
|
List<Face>& storedFaces()
|
||||||
{
|
{
|
||||||
return static_cast<List<Face> &>(*this);
|
return static_cast<List<Face>&>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Non-const access to the zones
|
//- Non-const access to the zones
|
||||||
@ -234,8 +250,15 @@ public:
|
|||||||
//- Construct from file name (uses extension to determine type)
|
//- Construct from file name (uses extension to determine type)
|
||||||
MeshedSurface(const fileName&, const word& ext);
|
MeshedSurface(const fileName&, const word& ext);
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
MeshedSurface(Istream&);
|
||||||
|
|
||||||
//- Construct from database
|
//- Construct from database
|
||||||
MeshedSurface(const Time&, const word& surfName="");
|
MeshedSurface
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection table
|
// Declare run-time constructor selection table
|
||||||
@ -285,7 +308,11 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Write to file
|
//- Write to file
|
||||||
static void write(const fileName&, const MeshedSurface<Face>&);
|
static void write
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -301,7 +328,7 @@ public:
|
|||||||
//- Return const access to the faces
|
//- Return const access to the faces
|
||||||
inline const List<Face>& faces() const
|
inline const List<Face>& faces() const
|
||||||
{
|
{
|
||||||
return static_cast<const List<Face> &>(*this);
|
return static_cast<const List<Face>&>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Const access to the surface zones.
|
//- Const access to the surface zones.
|
||||||
@ -353,7 +380,7 @@ public:
|
|||||||
// Note, optimized to avoid overwriting data (with Xfer::null)
|
// Note, optimized to avoid overwriting data (with Xfer::null)
|
||||||
virtual void reset
|
virtual void reset
|
||||||
(
|
(
|
||||||
const Xfer<pointField >& points,
|
const Xfer<pointField>& points,
|
||||||
const Xfer<List<Face>>& faces,
|
const Xfer<List<Face>>& faces,
|
||||||
const Xfer<surfZoneList>& zones
|
const Xfer<surfZoneList>& zones
|
||||||
);
|
);
|
||||||
@ -364,7 +391,7 @@ public:
|
|||||||
(
|
(
|
||||||
const Xfer<List<point>>& points,
|
const Xfer<List<point>>& points,
|
||||||
const Xfer<List<Face>>& faces,
|
const Xfer<List<Face>>& faces,
|
||||||
const Xfer<surfZoneList >& zones
|
const Xfer<surfZoneList>& zones
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Remove invalid faces
|
//- Remove invalid faces
|
||||||
@ -435,7 +462,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Write to database
|
//- Write to database
|
||||||
void write(const Time&, const word& surfName="") const;
|
void write
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
@ -444,6 +475,25 @@ public:
|
|||||||
|
|
||||||
//- Conversion operator to MeshedSurfaceProxy
|
//- Conversion operator to MeshedSurfaceProxy
|
||||||
operator MeshedSurfaceProxy<Face>() const;
|
operator MeshedSurfaceProxy<Face>() const;
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
//- Read MeshedSurface from Istream.
|
||||||
|
friend Istream& operator>> <Face>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write MeshedSurface to Ostream.
|
||||||
|
friend Ostream& operator<< <Face>
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const MeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,12 +66,4 @@ namespace Foam
|
|||||||
} // end of namespace Foam
|
} // end of namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,10 +25,35 @@ License
|
|||||||
|
|
||||||
#include "MeshedSurface.H"
|
#include "MeshedSurface.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
|
#include "Istream.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Istream& Foam::MeshedSurface<Face>::read(Istream& is)
|
||||||
|
{
|
||||||
|
is >> this->storedZones()
|
||||||
|
>> this->storedPoints()
|
||||||
|
>> this->storedFaces();
|
||||||
|
|
||||||
|
is.check("MeshedSurface::read(Istream&)");
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Ostream& Foam::MeshedSurface<Face>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << this->surfZones()
|
||||||
|
<< this->points()
|
||||||
|
<< this->faces();
|
||||||
|
|
||||||
|
os.check("MeshedSurface::write(Ostream&) const");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
||||||
{
|
{
|
||||||
@ -64,4 +89,28 @@ void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Istream& Foam::operator>>
|
||||||
|
(
|
||||||
|
Foam::Istream& is,
|
||||||
|
Foam::MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return surf.read(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Foam::Ostream& os,
|
||||||
|
const Foam::MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return surf.write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -128,7 +128,11 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Write to file
|
//- Write to file
|
||||||
static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
|
static void write
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const MeshedSurfaceProxy<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -176,7 +180,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Write to database
|
//- Write to database
|
||||||
virtual void write(const Time&, const word& surfName = "") const;
|
virtual void write
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -263,7 +263,10 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
|||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(const fileName& name)
|
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||||
|
(
|
||||||
|
const fileName& name
|
||||||
|
)
|
||||||
:
|
:
|
||||||
ParentType()
|
ParentType()
|
||||||
{
|
{
|
||||||
@ -271,6 +274,20 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||||
|
(
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ParentType(),
|
||||||
|
zoneIds_(),
|
||||||
|
zoneToc_()
|
||||||
|
{
|
||||||
|
read(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
||||||
(
|
(
|
||||||
@ -422,6 +439,30 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Istream& Foam::UnsortedMeshedSurface<Face>::read(Istream& is)
|
||||||
|
{
|
||||||
|
is >> this->storedZoneIds()
|
||||||
|
>> this->storedPoints()
|
||||||
|
>> this->storedFaces();
|
||||||
|
|
||||||
|
is.check("UnsortedMeshedSurface::read(Istream&)");
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Ostream& Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << this->zoneIds()
|
||||||
|
<< this->points()
|
||||||
|
<< this->faces();
|
||||||
|
|
||||||
|
os.check("UnsortedMeshedSurface::write(Ostream&) const");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::UnsortedMeshedSurface<Face>::setSize(const label s)
|
void Foam::UnsortedMeshedSurface<Face>::setSize(const label s)
|
||||||
{
|
{
|
||||||
@ -759,6 +800,30 @@ Foam::MeshedSurfaceProxy<Face>() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Istream& Foam::operator>>
|
||||||
|
(
|
||||||
|
Foam::Istream& is,
|
||||||
|
Foam::UnsortedMeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return surf.read(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Foam::Ostream& os,
|
||||||
|
const Foam::UnsortedMeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return surf.write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "UnsortedMeshedSurfaceNew.C"
|
#include "UnsortedMeshedSurfaceNew.C"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,12 +62,18 @@ namespace Foam
|
|||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class Time;
|
class Time;
|
||||||
class IFstream;
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
template<class Face> class MeshedSurface;
|
template<class Face> class MeshedSurface;
|
||||||
template<class Face> class MeshedSurfaceProxy;
|
template<class Face> class MeshedSurfaceProxy;
|
||||||
template<class Face> class UnsortedMeshedSurface;
|
template<class Face> class UnsortedMeshedSurface;
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
Istream& operator>>(Istream&, UnsortedMeshedSurface<Face>&);
|
||||||
|
template<class Face>
|
||||||
|
Ostream& operator<<(Ostream&, const UnsortedMeshedSurface<Face>&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class UnsortedMeshedSurface Declaration
|
Class UnsortedMeshedSurface Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -77,7 +83,7 @@ class UnsortedMeshedSurface
|
|||||||
:
|
:
|
||||||
public MeshedSurface<Face>
|
public MeshedSurface<Face>
|
||||||
{
|
{
|
||||||
// friends - despite different face representationsx
|
// friends - despite different face representations
|
||||||
template<class Face2> friend class MeshedSurface;
|
template<class Face2> friend class MeshedSurface;
|
||||||
template<class Face2> friend class UnsortedMeshedSurface;
|
template<class Face2> friend class UnsortedMeshedSurface;
|
||||||
friend class surfMesh;
|
friend class surfMesh;
|
||||||
@ -104,11 +110,16 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disable resize with value
|
//- Disable resize with value
|
||||||
void resize(const label, const Face&);
|
void resize(const label, const Face&) = delete;
|
||||||
|
|
||||||
//- Disable setSize with value
|
//- Disable setSize with value
|
||||||
void setSize(const label, const Face&);
|
void setSize(const label, const Face&) = delete;
|
||||||
|
|
||||||
|
//- Read/construct from Istream
|
||||||
|
Istream& read(Istream&);
|
||||||
|
|
||||||
|
//- Write to Ostream
|
||||||
|
Ostream& write(Ostream&) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -199,8 +210,15 @@ public:
|
|||||||
//- Construct from file name (uses extension to determine type)
|
//- Construct from file name (uses extension to determine type)
|
||||||
UnsortedMeshedSurface(const fileName&, const word&);
|
UnsortedMeshedSurface(const fileName&, const word&);
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
UnsortedMeshedSurface(Istream&);
|
||||||
|
|
||||||
//- Construct from objectRegistry and a named surface
|
//- Construct from objectRegistry and a named surface
|
||||||
UnsortedMeshedSurface(const Time&, const word& surfName="");
|
UnsortedMeshedSurface
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection table
|
// Declare run-time constructor selection table
|
||||||
@ -250,7 +268,11 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Write to file
|
//- Write to file
|
||||||
static void write(const fileName&, const UnsortedMeshedSurface<Face>&);
|
static void write
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const UnsortedMeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -363,7 +385,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Write to database
|
//- Write to database
|
||||||
void write(const Time&, const word& surfName="") const;
|
void write
|
||||||
|
(
|
||||||
|
const Time&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
@ -372,6 +398,24 @@ public:
|
|||||||
|
|
||||||
//- Conversion operator to MeshedSurfaceProxy
|
//- Conversion operator to MeshedSurfaceProxy
|
||||||
operator MeshedSurfaceProxy<Face>() const;
|
operator MeshedSurfaceProxy<Face>() const;
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
//- Read UnsortedMeshedSurface from Istream.
|
||||||
|
friend Istream& operator>> <Face>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
UnsortedMeshedSurface<Face>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write UnsortedMeshedSurface to Ostream.
|
||||||
|
friend Ostream& operator<< <Face>
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const UnsortedMeshedSurface<Face>&
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -98,10 +98,10 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow construct as copy
|
//- Disallow construct as copy
|
||||||
surfMesh(const surfMesh&);
|
surfMesh(const surfMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const surfMesh&);
|
void operator=(const surfMesh&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -155,7 +155,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject, with alternative surface name
|
//- Construct from IOobject, with alternative surface name
|
||||||
explicit surfMesh(const IOobject&, const word& surfName="");
|
explicit surfMesh
|
||||||
|
(
|
||||||
|
const IOobject&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct by transferring components (points, faces) without zones.
|
//- Construct by transferring components (points, faces) without zones.
|
||||||
// surfZones are added using addZones() member function
|
// surfZones are added using addZones() member function
|
||||||
@ -164,7 +168,7 @@ public:
|
|||||||
const IOobject&,
|
const IOobject&,
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>&,
|
||||||
const Xfer<faceList>&,
|
const Xfer<faceList>&,
|
||||||
const word& surfName=""
|
const word& surfName = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct copy/move from MeshedSurface
|
//- Construct copy/move from MeshedSurface
|
||||||
@ -172,7 +176,7 @@ public:
|
|||||||
(
|
(
|
||||||
const IOobject&,
|
const IOobject&,
|
||||||
const Xfer<MeshedSurface<face>>& surf,
|
const Xfer<MeshedSurface<face>>& surf,
|
||||||
const word& surfName=""
|
const word& surfName = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,10 +54,10 @@ class surfaceRegistry
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
surfaceRegistry(const surfaceRegistry&);
|
surfaceRegistry(const surfaceRegistry&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const surfaceRegistry&);
|
void operator=(const surfaceRegistry&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -75,7 +75,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for the given objectRegistry and named surface
|
//- Construct for the given objectRegistry and named surface
|
||||||
surfaceRegistry(const objectRegistry&, const word& surfName = "");
|
surfaceRegistry
|
||||||
|
(
|
||||||
|
const objectRegistry&,
|
||||||
|
const word& surfName = word::null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
Reference in New Issue
Block a user