mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use faceTraits for managing differences between face representations
This commit is contained in:
@ -33,24 +33,17 @@ License
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "surfMesh.H"
|
#include "surfMesh.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Face>
|
|
||||||
inline bool Foam::MeshedSurface<Face>::isTri()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::MeshedSurface<Face>::readTypes()
|
Foam::wordHashSet Foam::MeshedSurface<Face>::readTypes()
|
||||||
{
|
{
|
||||||
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::wordHashSet Foam::MeshedSurface<Face>::writeTypes()
|
Foam::wordHashSet Foam::MeshedSurface<Face>::writeTypes()
|
||||||
{
|
{
|
||||||
@ -116,25 +109,34 @@ void Foam::MeshedSurface<Face>::write
|
|||||||
const fileName& name,
|
const fileName& name,
|
||||||
const MeshedSurface<Face>& surf
|
const MeshedSurface<Face>& surf
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
write(name, name.ext(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
void Foam::MeshedSurface<Face>::write
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const word& ext,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
InfoInFunction << "Writing to " << name << endl;
|
InfoInFunction << "Writing to " << name << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const word ext = name.ext();
|
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||||
|
|
||||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
if (!mfIter.found())
|
||||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
|
||||||
|
|
||||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
|
||||||
{
|
{
|
||||||
// No direct writer, delegate to proxy if possible
|
// No direct writer, delegate to proxy if possible
|
||||||
const wordHashSet& delegate = ProxyType::writeTypes();
|
const wordHashSet& delegate = ProxyType::writeTypes();
|
||||||
|
|
||||||
if (delegate.found(ext))
|
if (delegate.found(ext))
|
||||||
{
|
{
|
||||||
MeshedSurfaceProxy<Face>(surf).write(name);
|
MeshedSurfaceProxy<Face>(surf).write(name, ext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -850,6 +852,11 @@ bool Foam::MeshedSurface<Face>::checkFaces
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::label Foam::MeshedSurface<Face>::nTriangles() const
|
Foam::label Foam::MeshedSurface<Face>::nTriangles() const
|
||||||
{
|
{
|
||||||
|
if (faceTraits<Face>::isTri())
|
||||||
|
{
|
||||||
|
return ParentType::size();
|
||||||
|
}
|
||||||
|
|
||||||
return nTriangles
|
return nTriangles
|
||||||
(
|
(
|
||||||
const_cast<List<label>&>(List<label>::null())
|
const_cast<List<label>&>(List<label>::null())
|
||||||
@ -905,10 +912,18 @@ Foam::label Foam::MeshedSurface<Face>::nTriangles
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::label Foam::MeshedSurface<Face>::triangulate()
|
Foam::label Foam::MeshedSurface<Face>::triangulate()
|
||||||
{
|
{
|
||||||
return triangulate
|
if (faceTraits<Face>::isTri())
|
||||||
(
|
{
|
||||||
const_cast<List<label>&>(List<label>::null())
|
// Inplace triangulation of triFace/labelledTri surface = no-op
|
||||||
);
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return triangulate
|
||||||
|
(
|
||||||
|
const_cast<List<label>&>(List<label>::null())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -918,6 +933,17 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
|
|||||||
List<label>& faceMapOut
|
List<label>& faceMapOut
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (faceTraits<Face>::isTri())
|
||||||
|
{
|
||||||
|
// Inplace triangulation of triFace/labelledTri surface = no-op
|
||||||
|
if (notNull(faceMapOut))
|
||||||
|
{
|
||||||
|
faceMapOut.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
label nTri = 0;
|
label nTri = 0;
|
||||||
label maxTri = 0; // the maximum number of triangles for any single face
|
label maxTri = 0; // the maximum number of triangles for any single face
|
||||||
List<Face>& faceLst = this->storedFaces();
|
List<Face>& faceLst = this->storedFaces();
|
||||||
@ -966,7 +992,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
|
|||||||
{
|
{
|
||||||
label fp1 = f.fcIndex(fp);
|
label fp1 = f.fcIndex(fp);
|
||||||
|
|
||||||
newFaces[nTri] = triFace(f[0], f[fp], f[fp1]);
|
newFaces[nTri] = Face{f[0], f[fp], f[fp1]};
|
||||||
faceMap[nTri] = facei;
|
faceMap[nTri] = facei;
|
||||||
nTri++;
|
nTri++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,9 +186,6 @@ public:
|
|||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
//- Face storage only handles triangulated faces
|
|
||||||
inline static bool isTri();
|
|
||||||
|
|
||||||
//- Can we read this file format?
|
//- Can we read this file format?
|
||||||
static bool canRead(const fileName&, const bool verbose=false);
|
static bool canRead(const fileName&, const bool verbose=false);
|
||||||
|
|
||||||
@ -210,36 +207,36 @@ public:
|
|||||||
//- Construct by transferring components (points, faces, zones).
|
//- Construct by transferring components (points, faces, zones).
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face>>&,
|
const Xfer<List<Face>>& faceLst,
|
||||||
const Xfer<surfZoneList>&
|
const Xfer<surfZoneList>& zoneLst
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by transferring components (points, faces).
|
//- Construct by transferring components (points, faces).
|
||||||
// Use zone information if available
|
// Use zone information if available
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face>>&,
|
const Xfer<List<Face>>& faceLst,
|
||||||
const labelUList& zoneSizes = labelUList(),
|
const labelUList& zoneSizes = labelUList(),
|
||||||
const UList<word>& zoneNames = UList<word>()
|
const UList<word>& zoneNames = UList<word>()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
MeshedSurface(const MeshedSurface&);
|
MeshedSurface(const MeshedSurface& surf);
|
||||||
|
|
||||||
//- Construct from a UnsortedMeshedSurface
|
//- Construct from a UnsortedMeshedSurface
|
||||||
MeshedSurface(const UnsortedMeshedSurface<Face>&);
|
MeshedSurface(const UnsortedMeshedSurface<Face>& surf);
|
||||||
|
|
||||||
//- Construct from a boundary mesh with local points/faces
|
//- Construct from a boundary mesh with local points/faces
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const polyBoundaryMesh&,
|
const polyBoundaryMesh& bMesh,
|
||||||
const bool globalPoints=false
|
const bool globalPoints=false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from a surfMesh
|
//- Construct from a surfMesh
|
||||||
MeshedSurface(const surfMesh&);
|
MeshedSurface(const surfMesh& mesh);
|
||||||
|
|
||||||
//- Construct by transferring the contents from a UnsortedMeshedSurface
|
//- Construct by transferring the contents from a UnsortedMeshedSurface
|
||||||
MeshedSurface(const Xfer<UnsortedMeshedSurface<Face>>&);
|
MeshedSurface(const Xfer<UnsortedMeshedSurface<Face>>&);
|
||||||
@ -248,18 +245,18 @@ public:
|
|||||||
MeshedSurface(const Xfer<MeshedSurface<Face>>&);
|
MeshedSurface(const Xfer<MeshedSurface<Face>>&);
|
||||||
|
|
||||||
//- Construct from file name (uses extension to determine type)
|
//- Construct from file name (uses extension to determine type)
|
||||||
MeshedSurface(const fileName&);
|
MeshedSurface(const fileName& name);
|
||||||
|
|
||||||
//- 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& name, const word& ext);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
MeshedSurface(Istream&);
|
MeshedSurface(Istream& is);
|
||||||
|
|
||||||
//- Construct from database
|
//- Construct from database
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const Time&,
|
const Time& t,
|
||||||
const word& surfName = word::null
|
const word& surfName = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -283,7 +280,7 @@ public:
|
|||||||
//- Select constructed from filename (explicit extension)
|
//- Select constructed from filename (explicit extension)
|
||||||
static autoPtr<MeshedSurface> New
|
static autoPtr<MeshedSurface> New
|
||||||
(
|
(
|
||||||
const fileName&,
|
const fileName& name,
|
||||||
const word& ext
|
const word& ext
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -310,11 +307,19 @@ public:
|
|||||||
(name, surf)
|
(name, surf)
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write to file
|
//- Write to file, selecting writer based on its extension
|
||||||
static void write
|
static void write
|
||||||
(
|
(
|
||||||
const fileName&,
|
const fileName& name,
|
||||||
const MeshedSurface<Face>&
|
const MeshedSurface<Face>& surf
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write to file, selecting writer based on the given extension
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const word& ext,
|
||||||
|
const MeshedSurface<Face>& surf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -563,8 +568,6 @@ bool MeshedSurface<labelledTri>::addZonesToFaces();
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "MeshedSurfaceI.H"
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "MeshedSurface.C"
|
#include "MeshedSurface.C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Foam
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// First triangulate
|
// First triangulate
|
||||||
// - slightly wasteful for space, but manages adjusts the zones too!
|
// - slightly wasteful for space, but adjusts the zones too!
|
||||||
surf.triangulate();
|
surf.triangulate();
|
||||||
this->storedPoints().transfer(surf.storedPoints());
|
this->storedPoints().transfer(surf.storedPoints());
|
||||||
this->storedZones().transfer(surf.storedZones());
|
this->storedZones().transfer(surf.storedZones());
|
||||||
@ -81,12 +81,12 @@ namespace Foam
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// First triangulate
|
// First triangulate
|
||||||
// - slightly wasteful for space, but manages adjusts the zones too!
|
// - slightly wasteful for space, but adjusts the zones too!
|
||||||
surf.triangulate();
|
surf.triangulate();
|
||||||
this->storedPoints().transfer(surf.storedPoints());
|
this->storedPoints().transfer(surf.storedPoints());
|
||||||
this->storedZones().transfer(surf.storedZones());
|
this->storedZones().transfer(surf.storedZones());
|
||||||
|
|
||||||
// transcribe from face -> triFace
|
// transcribe from face -> labelledTri (via triFace)
|
||||||
const List<face>& origFaces = surf.surfFaces();
|
const List<face>& origFaces = surf.surfFaces();
|
||||||
List<labelledTri> newFaces(origFaces.size());
|
List<labelledTri> newFaces(origFaces.size());
|
||||||
forAll(origFaces, facei)
|
forAll(origFaces, facei)
|
||||||
|
|||||||
@ -1,103 +0,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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// A triFace surface only handles triangulated faces
|
|
||||||
template<>
|
|
||||||
inline bool MeshedSurface<triFace>::isTri()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A labelledTri surface only handles triangulated faces
|
|
||||||
template<>
|
|
||||||
inline bool MeshedSurface<labelledTri>::isTri()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Number of triangles for a triFace surface
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<triFace>::nTriangles() const
|
|
||||||
{
|
|
||||||
return ParentType::size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Number of triangles for a labelledTri surface
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<labelledTri>::nTriangles() const
|
|
||||||
{
|
|
||||||
return ParentType::size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Inplace triangulation of triFace surface = no-op
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<triFace>::triangulate()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inplace triangulation of labelledTri surface = no-op
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<labelledTri>::triangulate()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inplace triangulation of triFace surface (with face map) = no-op
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
|
|
||||||
{
|
|
||||||
if (notNull(faceMap))
|
|
||||||
{
|
|
||||||
faceMap.clear();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inplace triangulation of labelledTri surface (with face map) = no-op
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurface<labelledTri>::triangulate(List<label>& faceMap)
|
|
||||||
{
|
|
||||||
if (notNull(faceMap))
|
|
||||||
{
|
|
||||||
faceMap.clear();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "MeshedSurface.H"
|
#include "MeshedSurface.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ template<class Face>
|
|||||||
void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << "points : " << this->points().size() << nl;
|
os << "points : " << this->points().size() << nl;
|
||||||
if (MeshedSurface<Face>::isTri())
|
if (faceTraits<Face>::isTri())
|
||||||
{
|
{
|
||||||
os << "triangles : " << this->size() << nl;
|
os << "triangles : " << this->size() << nl;
|
||||||
}
|
}
|
||||||
@ -82,7 +83,7 @@ void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
|||||||
|
|
||||||
os << "faces : " << this->size()
|
os << "faces : " << this->size()
|
||||||
<< " (tri:" << nTri << " quad:" << nQuad
|
<< " (tri:" << nTri << " quad:" << nQuad
|
||||||
<< " poly:" << (this->size() - nTri - nQuad ) << ")" << nl;
|
<< " poly:" << (this->size() - nTri - nQuad) << ")" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "boundingBox : " << boundBox(this->points()) << endl;
|
os << "boundingBox : " << boundBox(this->points()) << endl;
|
||||||
|
|||||||
@ -38,10 +38,9 @@ Foam::MeshedSurface<Face>::New(const fileName& name, const word& ext)
|
|||||||
InfoInFunction << "Constructing MeshedSurface" << endl;
|
InfoInFunction << "Constructing MeshedSurface" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename fileExtensionConstructorTable::iterator cstrIter =
|
auto cstrIter = fileExtensionConstructorTablePtr_->find(ext);
|
||||||
fileExtensionConstructorTablePtr_->find(ext);
|
|
||||||
|
|
||||||
if (cstrIter == fileExtensionConstructorTablePtr_->end())
|
if (!cstrIter.found())
|
||||||
{
|
{
|
||||||
// No direct reader, delegate to friend if possible
|
// No direct reader, delegate to friend if possible
|
||||||
const wordHashSet& delegate = FriendType::readTypes();
|
const wordHashSet& delegate = FriendType::readTypes();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "surfMesh.H"
|
#include "surfMesh.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,18 +60,27 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
|||||||
const fileName& name,
|
const fileName& name,
|
||||||
const MeshedSurfaceProxy& surf
|
const MeshedSurfaceProxy& surf
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
write(name, name.ext(), surf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
void Foam::MeshedSurfaceProxy<Face>::write
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const word& ext,
|
||||||
|
const MeshedSurfaceProxy& surf
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
InfoInFunction << "Writing to " << name << endl;
|
InfoInFunction << "Writing to " << name << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const word ext = name.ext();
|
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||||
|
|
||||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
if (!mfIter.found())
|
||||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
|
||||||
|
|
||||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unknown file extension " << ext << nl << nl
|
<< "Unknown file extension " << ext << nl << nl
|
||||||
@ -237,38 +247,24 @@ Foam::MeshedSurfaceProxy<Face>::~MeshedSurfaceProxy()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Number of triangles for a triFace surface
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurfaceProxy<triFace>::nTriangles() const
|
|
||||||
{
|
|
||||||
return this->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Number of triangles for a labelledTri surface
|
|
||||||
template<>
|
|
||||||
inline label MeshedSurfaceProxy<labelledTri>::nTriangles() const
|
|
||||||
{
|
|
||||||
return this->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
inline Foam::label Foam::MeshedSurfaceProxy<Face>::nTriangles() const
|
inline Foam::label Foam::MeshedSurfaceProxy<Face>::nTriangles() const
|
||||||
{
|
{
|
||||||
label nTri = 0;
|
if (faceTraits<Face>::isTri())
|
||||||
const List<Face>& faceLst = this->surfFaces();
|
|
||||||
forAll(faceLst, facei)
|
|
||||||
{
|
{
|
||||||
nTri += faceLst[facei].nTriangles();
|
return this->size();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label nTri = 0;
|
||||||
|
const List<Face>& faceLst = this->surfFaces();
|
||||||
|
forAll(faceLst, facei)
|
||||||
|
{
|
||||||
|
nTri += faceLst[facei].nTriangles();
|
||||||
|
}
|
||||||
|
|
||||||
return nTri;
|
return nTri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -100,9 +100,9 @@ public:
|
|||||||
//- Construct from component references
|
//- Construct from component references
|
||||||
MeshedSurfaceProxy
|
MeshedSurfaceProxy
|
||||||
(
|
(
|
||||||
const pointField&,
|
const pointField& pointLst,
|
||||||
const List<Face>&,
|
const List<Face>& faceLst,
|
||||||
const List<surfZone>& = List<surfZone>(),
|
const List<surfZone>& zoneLst = List<surfZone>(),
|
||||||
const List<label>& faceMap = List<label>()
|
const List<label>& faceMap = List<label>()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -126,11 +126,19 @@ public:
|
|||||||
(name, surf)
|
(name, surf)
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write to file
|
//- Write to file, selected based on its extension
|
||||||
static void write
|
static void write
|
||||||
(
|
(
|
||||||
const fileName&,
|
const fileName& name,
|
||||||
const MeshedSurfaceProxy<Face>&
|
const MeshedSurfaceProxy& surf
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write to file, selected based on given extension
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const word& ext,
|
||||||
|
const MeshedSurfaceProxy& surf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -188,10 +196,16 @@ public:
|
|||||||
write(name, *this);
|
write(name, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Generic write routine. Chooses writer based on extension.
|
||||||
|
virtual void write(const fileName& name, const word& ext) const
|
||||||
|
{
|
||||||
|
write(name, ext, *this);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write to database
|
//- Write to database
|
||||||
virtual void write
|
virtual void write
|
||||||
(
|
(
|
||||||
const Time&,
|
const Time& t,
|
||||||
const word& surfName = word::null
|
const word& surfName = word::null
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -113,17 +113,16 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
|||||||
|
|
||||||
const word ext = name.ext();
|
const word ext = name.ext();
|
||||||
|
|
||||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
|
||||||
|
|
||||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
if (!mfIter.found())
|
||||||
{
|
{
|
||||||
// No direct writer, delegate to proxy if possible
|
// No direct writer, delegate to proxy if possible
|
||||||
const wordHashSet& delegate = ProxyType::writeTypes();
|
const wordHashSet& delegate = ProxyType::writeTypes();
|
||||||
|
|
||||||
if (delegate.found(ext))
|
if (delegate.found(ext))
|
||||||
{
|
{
|
||||||
MeshedSurfaceProxy<Face>(surf).write(name);
|
MeshedSurfaceProxy<Face>(surf).write(name, ext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,10 +37,9 @@ Foam::UnsortedMeshedSurface<Face>::New(const fileName& name, const word& ext)
|
|||||||
InfoInFunction << "Constructing UnsortedMeshedSurface" << endl;
|
InfoInFunction << "Constructing UnsortedMeshedSurface" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename fileExtensionConstructorTable::iterator cstrIter =
|
auto cstrIter = fileExtensionConstructorTablePtr_->find(ext);
|
||||||
fileExtensionConstructorTablePtr_->find(ext);
|
|
||||||
|
|
||||||
if (cstrIter == fileExtensionConstructorTablePtr_->end())
|
if (!cstrIter.found())
|
||||||
{
|
{
|
||||||
// No direct reader, delegate to parent if possible
|
// No direct reader, delegate to parent if possible
|
||||||
const wordHashSet& delegate = ParentType::readTypes();
|
const wordHashSet& delegate = ParentType::readTypes();
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "AC3DsurfaceFormat.H"
|
#include "AC3DsurfaceFormat.H"
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -194,9 +195,9 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
verts[vertI] = parse<int>(line) + vertexOffset;
|
verts[vertI] = parse<int>(line) + vertexOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelUList& f = static_cast<labelUList&>(verts);
|
const labelUList& f = static_cast<const labelUList&>(verts);
|
||||||
|
|
||||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||||
{
|
{
|
||||||
// simple face triangulation about f[0]
|
// simple face triangulation about f[0]
|
||||||
// points may be incomplete
|
// points may be incomplete
|
||||||
@ -204,7 +205,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
{
|
{
|
||||||
label fp2 = f.fcIndex(fp1);
|
label fp2 = f.fcIndex(fp1);
|
||||||
|
|
||||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||||
sizes[zoneI]++;
|
sizes[zoneI]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,8 +28,8 @@ License
|
|||||||
#include "clock.H"
|
#include "clock.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
#include "Ostream.H"
|
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
faceLst[facei] = triFace(e0Far, common01, e1Far);
|
faceLst[facei] = Face{e0Far, common01, e1Far};
|
||||||
zoneIds[facei] = zoneI;
|
zoneIds[facei] = zoneI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
// check if output triangulation would be required
|
// check if output triangulation would be required
|
||||||
// It is too annoying to triangulate on-the-fly
|
// It is too annoying to triangulate on-the-fly
|
||||||
// just issue a warning and get out
|
// just issue a warning and get out
|
||||||
if (!MeshedSurface<Face>::isTri())
|
if (!faceTraits<Face>::isTri())
|
||||||
{
|
{
|
||||||
label nNonTris = 0;
|
label nNonTris = 0;
|
||||||
forAll(faceLst, facei)
|
forAll(faceLst, facei)
|
||||||
@ -249,7 +249,6 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OFstream os(filename);
|
OFstream os(filename);
|
||||||
if (!os.good())
|
if (!os.good())
|
||||||
{
|
{
|
||||||
@ -331,7 +330,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
// check if output triangulation would be required
|
// check if output triangulation would be required
|
||||||
// It is too annoying to triangulate on-the-fly
|
// It is too annoying to triangulate on-the-fly
|
||||||
// just issue a warning and get out
|
// just issue a warning and get out
|
||||||
if (!MeshedSurface<Face>::isTri())
|
if (!faceTraits<Face>::isTri())
|
||||||
{
|
{
|
||||||
label nNonTris = 0;
|
label nNonTris = 0;
|
||||||
forAll(faceLst, facei)
|
forAll(faceLst, facei)
|
||||||
@ -351,7 +350,6 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OFstream os(filename);
|
OFstream os(filename);
|
||||||
if (!os.good())
|
if (!os.good())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "NASsurfaceFormat.H"
|
#include "NASsurfaceFormat.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -191,12 +192,10 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
if (cmd == "CTRIA3")
|
if (cmd == "CTRIA3")
|
||||||
{
|
{
|
||||||
triFace fTri;
|
|
||||||
|
|
||||||
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
||||||
fTri[0] = readLabel(IStringStream(line.substr(24,8))());
|
label a = readLabel(IStringStream(line.substr(24,8))());
|
||||||
fTri[1] = readLabel(IStringStream(line.substr(32,8))());
|
label b = readLabel(IStringStream(line.substr(32,8))());
|
||||||
fTri[2] = readLabel(IStringStream(line.substr(40,8))());
|
label c = readLabel(IStringStream(line.substr(40,8))());
|
||||||
|
|
||||||
// Convert groupID into zoneId
|
// Convert groupID into zoneId
|
||||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||||
@ -217,20 +216,17 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynFaces.append(fTri);
|
dynFaces.append(Face{a, b, c});
|
||||||
dynZones.append(zoneI);
|
dynZones.append(zoneI);
|
||||||
dynSizes[zoneI]++;
|
dynSizes[zoneI]++;
|
||||||
}
|
}
|
||||||
else if (cmd == "CQUAD4")
|
else if (cmd == "CQUAD4")
|
||||||
{
|
{
|
||||||
face fQuad(4);
|
|
||||||
labelUList& f = static_cast<labelUList&>(fQuad);
|
|
||||||
|
|
||||||
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
||||||
fQuad[0] = readLabel(IStringStream(line.substr(24,8))());
|
label a = readLabel(IStringStream(line.substr(24,8))());
|
||||||
fQuad[1] = readLabel(IStringStream(line.substr(32,8))());
|
label b = readLabel(IStringStream(line.substr(32,8))());
|
||||||
fQuad[2] = readLabel(IStringStream(line.substr(40,8))());
|
label c = readLabel(IStringStream(line.substr(40,8))());
|
||||||
fQuad[3] = readLabel(IStringStream(line.substr(48,8))());
|
label d = readLabel(IStringStream(line.substr(48,8))());
|
||||||
|
|
||||||
// Convert groupID into zoneId
|
// Convert groupID into zoneId
|
||||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||||
@ -251,18 +247,17 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (faceTraits<Face>::isTri())
|
||||||
if (MeshedSurface<Face>::isTri())
|
|
||||||
{
|
{
|
||||||
dynFaces.append(triFace(f[0], f[1], f[2]));
|
dynFaces.append(Face{a, b, c});
|
||||||
dynFaces.append(triFace(f[0], f[2], f[3]));
|
dynFaces.append(Face{c, d, a});
|
||||||
dynZones.append(zoneI);
|
dynZones.append(zoneI);
|
||||||
dynZones.append(zoneI);
|
dynZones.append(zoneI);
|
||||||
dynSizes[zoneI] += 2;
|
dynSizes[zoneI] += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynFaces.append(Face(f));
|
dynFaces.append(Face{a,b,c,d});
|
||||||
dynZones.append(zoneI);
|
dynZones.append(zoneI);
|
||||||
dynSizes[zoneI]++;
|
dynSizes[zoneI]++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,9 +27,9 @@ License
|
|||||||
#include "clock.H"
|
#include "clock.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
#include "Ostream.H"
|
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
labelUList& f = static_cast<labelUList&>(dynVertices);
|
labelUList& f = static_cast<labelUList&>(dynVertices);
|
||||||
|
|
||||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||||
{
|
{
|
||||||
// simple face triangulation about f[0]
|
// simple face triangulation about f[0]
|
||||||
// points may be incomplete
|
// points may be incomplete
|
||||||
@ -180,7 +180,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
{
|
{
|
||||||
label fp2 = f.fcIndex(fp1);
|
label fp2 = f.fcIndex(fp1);
|
||||||
|
|
||||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||||
dynZones.append(zoneI);
|
dynZones.append(zoneI);
|
||||||
dynSizes[zoneI]++;
|
dynSizes[zoneI]++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "clock.H"
|
#include "clock.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
#include "Ostream.H"
|
#include "faceTraits.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -113,9 +113,9 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
|||||||
lineStream >> verts[vertI];
|
lineStream >> verts[vertI];
|
||||||
}
|
}
|
||||||
|
|
||||||
labelUList& f = static_cast<labelUList&>(verts);
|
const labelUList& f = static_cast<const labelUList&>(verts);
|
||||||
|
|
||||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||||
{
|
{
|
||||||
// simple face triangulation about f[0]
|
// simple face triangulation about f[0]
|
||||||
// cannot use face::triangulation (points may be incomplete)
|
// cannot use face::triangulation (points may be incomplete)
|
||||||
@ -123,7 +123,7 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
|||||||
{
|
{
|
||||||
label fp2 = f.fcIndex(fp1);
|
label fp2 = f.fcIndex(fp1);
|
||||||
|
|
||||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "STARCDsurfaceFormat.H"
|
#include "STARCDsurfaceFormat.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
SubList<label> vertices(vertexLabels, vertexLabels.size());
|
SubList<label> vertices(vertexLabels, vertexLabels.size());
|
||||||
if (MeshedSurface<Face>::isTri() && nLabels > 3)
|
if (faceTraits<Face>::isTri() && nLabels > 3)
|
||||||
{
|
{
|
||||||
// face needs triangulation
|
// face needs triangulation
|
||||||
face f(vertices);
|
face f(vertices);
|
||||||
|
|||||||
@ -146,7 +146,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
forAll(faceLst, facei)
|
forAll(faceLst, facei)
|
||||||
{
|
{
|
||||||
const label startPt = 3*facei;
|
const label startPt = 3*facei;
|
||||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -160,7 +160,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
forAll(faceMap, facei)
|
forAll(faceMap, facei)
|
||||||
{
|
{
|
||||||
const label startPt = 3*faceMap[facei];
|
const label startPt = 3*faceMap[facei];
|
||||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zoneIds.clear();
|
zoneIds.clear();
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -97,7 +97,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
forAll(faceLst, facei)
|
forAll(faceLst, facei)
|
||||||
{
|
{
|
||||||
const label startPt = 3*facei;
|
const label startPt = 3*facei;
|
||||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -111,7 +111,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
forAll(faceMap, facei)
|
forAll(faceMap, facei)
|
||||||
{
|
{
|
||||||
const label startPt = 3*faceMap[facei];
|
const label startPt = 3*faceMap[facei];
|
||||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zoneIds.clear();
|
zoneIds.clear();
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2107 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "VTKsurfaceFormat.H"
|
#include "VTKsurfaceFormat.H"
|
||||||
#include "vtkUnstructuredReader.H"
|
#include "vtkUnstructuredReader.H"
|
||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
|
#include "faceTraits.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -150,7 +151,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
// Check if it needs triangulation
|
// Check if it needs triangulation
|
||||||
label nTri = 0;
|
label nTri = 0;
|
||||||
if (MeshedSurface<Face>::isTri())
|
if (faceTraits<Face>::isTri())
|
||||||
{
|
{
|
||||||
forAll(faces, facei)
|
forAll(faces, facei)
|
||||||
{
|
{
|
||||||
@ -172,7 +173,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
|||||||
{
|
{
|
||||||
label fp2 = f.fcIndex(fp1);
|
label fp2 = f.fcIndex(fp1);
|
||||||
|
|
||||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||||
dynZones.append(zones[facei]);
|
dynZones.append(zones[facei]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user