added surfaceMeshImport, surfaceMeshExport

This commit is contained in:
Mark Olesen
2009-02-05 00:08:24 +01:00
parent a43df3bddd
commit a4d0094e48
17 changed files with 758 additions and 92 deletions

View File

@ -102,8 +102,8 @@ int main(int argc, char *argv[])
if if
( (
!meshedSurface::canRead(importName, true) !MeshedSurface<face>::canRead(importName, true)
|| !meshedSurface::canWriteType(exportName.ext(), true) || !MeshedSurface<face>::canWriteType(exportName.ext(), true)
) )
{ {
return 1; return 1;

View File

@ -0,0 +1,3 @@
surfaceMeshExport.C
EXE = $(FOAM_APPBIN)/surfaceMeshExport

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = -lmeshTools -lsurfMesh

View File

@ -0,0 +1,277 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
surfaceMeshExport
Description
Export from surfMesh to various third-party surface formats with
optional scaling or transformations (rotate/translate) on a
coordinateSystem.
Usage
- surfaceMeshExport outputFile [OPTION]
@param -clean \n
Perform some surface checking/cleanup on the input surface.
@param -name \<name\> \n
Specify an alternative surface name when writing.
@param -scaleIn \<scale\> \n
Specify a scaling factor when reading files.
@param -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
@param -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
@param -from \<coordinateSystem\> \n
Specify a coordinate System when reading files.
@param -to \<coordinateSystem\> \n
Specify a coordinate System when writing files.
Note
The filename extensions are used to determine the file format type.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "MeshedSurfaces.H"
#include "coordinateSystems.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("outputFile");
argList::validOptions.insert("name", "name");
argList::validOptions.insert("clean", "scale");
argList::validOptions.insert("scaleIn", "scale");
argList::validOptions.insert("scaleOut", "scale");
argList::validOptions.insert("dict", "coordinateSystemsDict");
argList::validOptions.insert("from", "sourceCoordinateSystem");
argList::validOptions.insert("to", "targetCoordinateSystem");
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
const stringList& params = args.additionalArgs();
fileName exportName(params[0]);
word importName("default");
// check that writing is supported
if (!MeshedSurface<face>::canWriteType(exportName.ext(), true))
{
return 1;
}
if (args.options().found("name"))
{
importName = args.options()["name"];
}
// get the coordinate transformations
autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to"))
{
autoPtr<IOobject> ioPtr;
if (args.options().found("dict"))
{
fileName dictPath(args.options()["dict"]);
ioPtr.set
(
new IOobject
(
(
dictPath.isDir()
? dictPath/coordinateSystems::typeName
: dictPath
),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
else
{
ioPtr.set
(
new IOobject
(
coordinateSystems::typeName,
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
if (!ioPtr->headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open coordinateSystems file\n "
<< ioPtr->objectPath() << nl
<< exit(FatalError);
}
coordinateSystems csLst(ioPtr());
if (args.options().found("from"))
{
const word csName(args.options()["from"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -from " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
fromCsys.reset(new coordinateSystem(csLst[csId]));
}
if (args.options().found("to"))
{
const word csName(args.options()["to"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -to " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
toCsys.reset(new coordinateSystem(csLst[csId]));
}
// maybe fix this later
if (fromCsys.valid() && toCsys.valid())
{
FatalErrorIn(args.executable())
<< "Only allowed '-from' or '-to' option at the moment."
<< exit(FatalError);
}
}
surfMesh smesh
(
IOobject
(
importName,
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
Info<< "read surfMesh:\n " << smesh.objectPath() << endl;
// Simply copy for now, but really should have a separate write method
MeshedSurface<face> surf(smesh);
if (args.options().found("clean"))
{
surf.cleanup(true);
}
scalar scaleIn = 0;
scalar scaleOut = 0;
if (args.options().found("scaleIn"))
{
IStringStream(args.options()["scaleIn"])() >> scaleIn;
}
if (args.options().found("scaleOut"))
{
IStringStream(args.options()["scaleOut"])() >> scaleOut;
}
if (scaleIn > 0)
{
Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn);
}
if (fromCsys.valid())
{
Info<< " -from " << fromCsys().name() << endl;
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
surf.movePoints(tpf());
}
if (toCsys.valid())
{
Info<< " -to " << toCsys().name() << endl;
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
surf.movePoints(tpf());
}
if (scaleOut > 0)
{
Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut);
}
surf.writeStats(Info);
Info<< endl;
Info<< "writing " << exportName << endl;
surf.write(exportName);
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
surfaceMeshImport.C
EXE = $(FOAM_APPBIN)/surfaceMeshImport

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = -lmeshTools -lsurfMesh

View File

@ -0,0 +1,271 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
surfaceMeshImport
Description
Import from various third-party surface formats into surfMesh
with optional scaling or transformations (rotate/translate)
on a coordinateSystem.
Usage
- surfaceMeshImport inputFile [OPTION]
@param -clean \n
Perform some surface checking/cleanup on the input surface.
@param -name \<name\> \n
Specify an alternative surface name when writing.
@param -scaleIn \<scale\> \n
Specify a scaling factor when reading files.
@param -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
@param -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
@param -from \<coordinateSystem\> \n
Specify a coordinate System when reading files.
@param -to \<coordinateSystem\> \n
Specify a coordinate System when writing files.
Note
The filename extensions are used to determine the file format type.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "MeshedSurfaces.H"
#include "coordinateSystems.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("inputFile");
argList::validOptions.insert("name", "name");
argList::validOptions.insert("clean", "scale");
argList::validOptions.insert("scaleIn", "scale");
argList::validOptions.insert("scaleOut", "scale");
argList::validOptions.insert("dict", "coordinateSystemsDict");
argList::validOptions.insert("from", "sourceCoordinateSystem");
argList::validOptions.insert("to", "targetCoordinateSystem");
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
const stringList& params = args.additionalArgs();
fileName importName(params[0]);
word exportName("default");
// check that reading is supported
if (!MeshedSurface<face>::canRead(importName, true))
{
return 1;
}
if (args.options().found("name"))
{
exportName = args.options()["name"];
}
// get the coordinate transformations
autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to"))
{
autoPtr<IOobject> ioPtr;
if (args.options().found("dict"))
{
fileName dictPath(args.options()["dict"]);
ioPtr.set
(
new IOobject
(
(
dictPath.isDir()
? dictPath/coordinateSystems::typeName
: dictPath
),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
else
{
ioPtr.set
(
new IOobject
(
coordinateSystems::typeName,
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
if (!ioPtr->headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open coordinateSystems file\n "
<< ioPtr->objectPath() << nl
<< exit(FatalError);
}
coordinateSystems csLst(ioPtr());
if (args.options().found("from"))
{
const word csName(args.options()["from"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -from " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
fromCsys.reset(new coordinateSystem(csLst[csId]));
}
if (args.options().found("to"))
{
const word csName(args.options()["to"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -to " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
toCsys.reset(new coordinateSystem(csLst[csId]));
}
// maybe fix this later
if (fromCsys.valid() && toCsys.valid())
{
FatalErrorIn(args.executable())
<< "Only allowed '-from' or '-to' option at the moment."
<< exit(FatalError);
}
}
MeshedSurface<face> surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
}
scalar scaleIn = 0;
scalar scaleOut = 0;
if (args.options().found("scaleIn"))
{
IStringStream(args.options()["scaleIn"])() >> scaleIn;
}
if (args.options().found("scaleOut"))
{
IStringStream(args.options()["scaleOut"])() >> scaleOut;
}
if (scaleIn > 0)
{
Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn);
}
if (fromCsys.valid())
{
Info<< " -from " << fromCsys().name() << endl;
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
surf.movePoints(tpf());
}
if (toCsys.valid())
{
Info<< " -to " << toCsys().name() << endl;
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
surf.movePoints(tpf());
}
if (scaleOut > 0)
{
Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut);
}
surfMesh smesh
(
IOobject
(
exportName,
runTime.constant(),
runTime
),
surf.xfer()
);
Info<< "writing surfMesh:\n " << smesh.objectPath() << endl;
smesh.write();
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -532,10 +532,35 @@ void Foam::BasicMeshedSurface<Face>::remapFaces(const UList<label>&)
template<class Face> template<class Face>
void Foam::BasicMeshedSurface<Face>::writeStats(Ostream& os) const void Foam::BasicMeshedSurface<Face>::writeStats(Ostream& os) const
{ {
os << "points : " << this->points().size() << nl os << "points : " << this->points().size() << nl;
<< (this->isTri() ? "triangles : " : "faces : ") if (this->isTri())
<< this->size() << nl {
<< "boundingBox : " << boundBox(this->points()) << endl; os << "triangles : " << this->size() << nl;
}
else
{
label nTri = 0;
label nQuad = 0;
forAll(*this, i)
{
const label n = this->operator[](i).size();
if (n == 3)
{
nTri++;
}
else if (n == 4)
{
nQuad++;
}
}
os << "faces : " << this->size()
<< " (tri:" << nTri << " quad:" << nQuad
<< " poly:" << (this->size() - nTri - nQuad ) << ")" << nl;
}
os << "boundingBox : " << boundBox(this->points()) << endl;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //

View File

@ -2,6 +2,7 @@ surfZone/surfZone/surfZone.C
surfZone/surfZone/surfZoneIOList.C surfZone/surfZone/surfZoneIOList.C
surfZone/surfZoneIdentifier/surfZoneIdentifier.C surfZone/surfZoneIdentifier/surfZoneIdentifier.C
MeshedSurface/MeshedSurfaceCore.C
MeshedSurface/MeshedSurfaces.C MeshedSurface/MeshedSurfaces.C
UnsortedMeshedSurface/UnsortedMeshedSurfaces.C UnsortedMeshedSurface/UnsortedMeshedSurfaces.C

View File

@ -225,13 +225,13 @@ Foam::MeshedSurface<Face>::MeshedSurface
mesh.points() mesh.points()
); );
// use global/local points // use global/local points:
const pointField& bPoints = const pointField& bPoints =
( (
useGlobalPoints ? mesh.points() : allBoundary.localPoints() useGlobalPoints ? mesh.points() : allBoundary.localPoints()
); );
// global or local face addressing // global/local face addressing:
const List<Face>& bFaces = const List<Face>& bFaces =
( (
useGlobalPoints ? allBoundary : allBoundary.localFaces() useGlobalPoints ? allBoundary : allBoundary.localFaces()
@ -242,22 +242,29 @@ Foam::MeshedSurface<Face>::MeshedSurface
surfZoneList newZones(bPatches.size()); surfZoneList newZones(bPatches.size());
label startFaceI = 0; label startFaceI = 0;
label nZone = 0;
forAll(bPatches, patchI) forAll(bPatches, patchI)
{ {
const polyPatch& p = bPatches[patchI]; const polyPatch& p = bPatches[patchI];
newZones[patchI] = surfZone if (p.size())
( {
p.name(), newZones[nZone] = surfZone
p.size(), (
startFaceI, p.name(),
patchI p.size(),
); startFaceI,
nZone
);
startFaceI += p.size(); nZone++;
startFaceI += p.size();
}
} }
// must create with the same face type as the polyBoundaryMesh newZones.setSize(nZone);
// same face type as the polyBoundaryMesh
MeshedSurface<face> surf MeshedSurface<face> surf
( (
xferCopy(bPoints), xferCopy(bPoints),
@ -265,42 +272,14 @@ Foam::MeshedSurface<Face>::MeshedSurface
xferMove(newZones) xferMove(newZones)
); );
this->transcribe(surf);
// must triangulate?
if (this->isTri())
{
surf.triangulate();
this->storedPoints().transfer(surf.storedPoints());
// transcribe from face -> triFace
List<face>& origFaces = surf.storedFaces();
List<triFace> newFaces(origFaces.size());
forAll(origFaces, faceI)
{
newFaces[faceI] = Face
(
static_cast<const UList<label>&>(origFaces[faceI])
);
}
origFaces.clear();
this->storedFaces().transfer(newFaces);
zones_.transfer(surf.zones_);
}
else
{
this->transfer(surf);
}
} }
template<class Face> template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface Foam::MeshedSurface<Face>::MeshedSurface(const surfMesh& mesh)
(
const surfMesh& mesh
)
{ {
// must create with the same face type as surfMesh // same face type as surfMesh
MeshedSurface<face> surf MeshedSurface<face> surf
( (
xferCopy(mesh.points()), xferCopy(mesh.points()),
@ -308,31 +287,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
xferCopy(mesh.surfZones()) xferCopy(mesh.surfZones())
); );
// must triangulate? this->transcribe(surf);
if (this->isTri())
{
surf.triangulate();
this->storedPoints().transfer(surf.storedPoints());
// transcribe from face -> triFace
List<face>& origFaces = surf.storedFaces();
List<triFace> newFaces(origFaces.size());
forAll(origFaces, faceI)
{
newFaces[faceI] = Face
(
static_cast<const UList<label>&>(origFaces[faceI])
);
}
origFaces.clear();
this->storedFaces().transfer(newFaces);
zones_.transfer(surf.zones_);
}
else
{
this->transfer(surf);
}
} }
@ -426,6 +381,9 @@ Foam::MeshedSurface<Face>::~MeshedSurface()
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Face> template<class Face>
void Foam::MeshedSurface<Face>::oneZone(const word& name) void Foam::MeshedSurface<Face>::oneZone(const word& name)
{ {
@ -447,7 +405,7 @@ void Foam::MeshedSurface<Face>::oneZone(const word& name)
zones_[0] = surfZone zones_[0] = surfZone
( (
zoneName, zoneName,
size(), // zone size this->size(), // zone size
0, // zone start 0, // zone start
0 // zone index 0 // zone index
); );
@ -584,8 +542,6 @@ void Foam::MeshedSurface<Face>::remapFaces
} }
} }
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -67,7 +67,7 @@ class polyBoundaryMesh;
class surfMesh; class surfMesh;
template<class Face> template<class Face>
Ostream& operator<<(Ostream&, const MeshedSurface<Face>&); Ostream& operator<<(Ostream&, const MeshedSurface<Face>&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class MeshedSurface Declaration Class MeshedSurface Declaration
@ -79,7 +79,14 @@ class MeshedSurface
public BasicMeshedSurface<Face>, public BasicMeshedSurface<Face>,
public fileFormats::surfaceFormatsCore public fileFormats::surfaceFormatsCore
{ {
friend class UnsortedMeshedSurface<Face>; // friends despite different faces
template<class Face2>
friend class MeshedSurface;
// friends despite different faces
template<class Face2>
friend class UnsortedMeshedSurface;
friend class surfMesh; friend class surfMesh;
private: private:
@ -99,6 +106,9 @@ private:
//- Read OpenFOAM Surface format //- Read OpenFOAM Surface format
bool read(Istream&); bool read(Istream&);
//- Transfer points/zones and transcribe face -> triFace
void transcribe(MeshedSurface<face>&);
protected: protected:
// Protected Member functions // Protected Member functions

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "MeshedSurface.H"
#include "UnsortedMeshedSurface.H"
#include "IFstream.H"
#include "OFstream.H"
#include "Time.H"
#include "ListOps.H"
#include "polyBoundaryMesh.H"
#include "polyMesh.H"
#include "surfMesh.H"
#include "primitivePatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
namespace Foam
{
// specialization: from face -> triFace
template<>
void Foam::MeshedSurface<triFace>::transcribe(MeshedSurface<face>& surf)
{
// first triangulate
surf.triangulate();
this->storedPoints().transfer(surf.storedPoints());
zones_.transfer(surf.zones_);
// transcribe from face -> triFace
List<face>& origFaces = surf.storedFaces();
List<triFace> newFaces(origFaces.size());
forAll(origFaces, faceI)
{
newFaces[faceI] = triFace
(
static_cast<const UList<label>&>(origFaces[faceI])
);
}
surf.clear();
this->storedFaces().transfer(newFaces);
}
// specialization: from face -> face
template<>
void Foam::MeshedSurface<face>::transcribe(MeshedSurface<face>& surf)
{
this->transfer(surf);
}
} // end of namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -299,6 +299,8 @@ Foam::UnsortedMeshedSurface<Face>::~UnsortedMeshedSurface()
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Face> template<class Face>

View File

@ -83,6 +83,14 @@ class UnsortedMeshedSurface
public BasicMeshedSurface<Face>, public BasicMeshedSurface<Face>,
public fileFormats::surfaceFormatsCore public fileFormats::surfaceFormatsCore
{ {
// friends despite different faces
template<class Face2>
friend class MeshedSurface;
// friends despite different faces
template<class Face2>
friend class UnsortedMeshedSurface;
friend class MeshedSurface<Face>; friend class MeshedSurface<Face>;
private: private:

View File

@ -35,7 +35,6 @@ Description
defineTypeNameAndDebug(Foam::surfZone, 0); defineTypeNameAndDebug(Foam::surfZone, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfZone::surfZone() Foam::surfZone::surfZone()
@ -137,9 +136,9 @@ bool Foam::surfZone::operator==(const surfZone& rhs) const
{ {
return return
( (
(geometricType() == rhs.geometricType()) size() == rhs.size()
&& (size() == rhs.size()) && start() == rhs.start()
&& (start() == rhs.start()) && geometricType() == rhs.geometricType()
); );
} }

View File

@ -50,7 +50,6 @@ Foam::surfZoneIOList::surfZoneIOList
{ {
surfZoneList& zones = *this; surfZoneList& zones = *this;
// read polyPatchList
Istream& is = readStream(typeName); Istream& is = readStream(typeName);
PtrList<entry> dictEntries(is); PtrList<entry> dictEntries(is);
@ -82,9 +81,8 @@ Foam::surfZoneIOList::surfZoneIOList
{ {
FatalErrorIn(functionName) FatalErrorIn(functionName)
<< "surfZones are not ordered. Start of zone " << zoneI << "surfZones are not ordered. Start of zone " << zoneI
<< " does not correspond to sum of preceding zones." << " does not correspond to sum of preceding zones." << nl
<< endl << "while reading " << io.objectPath() << endl
<< "while reading " << io.objectPath()
<< exit(FatalError); << exit(FatalError);
} }
@ -98,7 +96,7 @@ Foam::surfZoneIOList::surfZoneIOList
} }
} }
// Construct from IOObject
Foam::surfZoneIOList::surfZoneIOList Foam::surfZoneIOList::surfZoneIOList
( (
const IOobject& io, const IOobject& io,
@ -110,6 +108,17 @@ Foam::surfZoneIOList::surfZoneIOList
{} {}
Foam::surfZoneIOList::surfZoneIOList
(
const IOobject& io,
const Xfer<surfZoneList>& zones
)
:
surfZoneList(zones),
regIOobject(io)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfZoneIOList::~surfZoneIOList() Foam::surfZoneIOList::~surfZoneIOList()
@ -122,7 +131,7 @@ Foam::surfZoneIOList::~surfZoneIOList()
// writeData member function required by regIOobject // writeData member function required by regIOobject
bool Foam::surfZoneIOList::writeData(Ostream& os) const bool Foam::surfZoneIOList::writeData(Ostream& os) const
{ {
os << *this; os << *this;
return os.good(); return os.good();
} }
@ -131,14 +140,14 @@ bool Foam::surfZoneIOList::writeData(Ostream& os) const
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIOList& L) Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIOList& L)
{ {
os << L.size() << nl << token::BEGIN_LIST; os << L.size() << nl << token::BEGIN_LIST << incrIndent << nl;
forAll(L, i) forAll(L, i)
{ {
L[i].writeDict(os); L[i].writeDict(os);
} }
os << token::END_LIST; os << decrIndent << token::END_LIST;
return os; return os;
} }

View File

@ -72,7 +72,7 @@ class surfZoneIOList
public: public:
//- Runtime type information //- Runtime type information
TypeName("surfZoneIOList"); TypeName("surfZoneList");
// Constructors // Constructors
@ -80,9 +80,12 @@ public:
//- Construct from IOobject //- Construct from IOobject
explicit surfZoneIOList(const IOobject&); explicit surfZoneIOList(const IOobject&);
//- Construct from IOobject //- Construct from IOobject and surfZoneList
surfZoneIOList(const IOobject&, const surfZoneList&); surfZoneIOList(const IOobject&, const surfZoneList&);
//- Construct from IOobject and surfZoneList
surfZoneIOList(const IOobject&, const Xfer<surfZoneList>&);
// Destructor // Destructor
~surfZoneIOList(); ~surfZoneIOList();