diff --git a/applications/test/faces/Make/files b/applications/test/faces/Make/files
new file mode 100644
index 0000000000..8418bb2b93
--- /dev/null
+++ b/applications/test/faces/Make/files
@@ -0,0 +1,3 @@
+Test-faces.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-faces
diff --git a/applications/test/faces/Make/options b/applications/test/faces/Make/options
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/triSurface/tools/hashSignedLabel/hashSignedLabel.H b/applications/test/faces/Test-faces.C
similarity index 55%
rename from src/triSurface/tools/hashSignedLabel/hashSignedLabel.H
rename to applications/test/faces/Test-faces.C
index 992a820290..823f33e3e1 100644
--- a/src/triSurface/tools/hashSignedLabel/hashSignedLabel.H
+++ b/applications/test/faces/Test-faces.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -21,47 +21,64 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Class
- Foam::hashSignedLabel
+Application
+ Test-faces
Description
- hash for signed integers (Hash\ only works for unsigned ints)
+ Simple tests for various faces
\*---------------------------------------------------------------------------*/
-#ifndef HashSignedLabel_H
-#define HashSignedLabel_H
+#include "argList.H"
+#include "labelledTri.H"
-#include "List.H"
-#include "word.H"
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
- Class hashSignedLabel Declaration
-\*---------------------------------------------------------------------------*/
-
-class hashSignedLabel
-{
-
-public:
-
- hashSignedLabel()
- {}
-
-
- label operator()(const label key, const label tableSize) const
- {
- return mag(key)%tableSize;
- }
-};
-
-} // End namespace Foam
+using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+ face f1{ 1, 2, 3, 4 };
+ Info<< "face:" << f1 << nl;
+
+ triFace t1{ 1, 2, 3 };
+ Info<< "triFace:" << t1 << nl;
+
+ f1 = t1;
+ Info<< "face:" << f1 << nl;
+
+ f1 = t1.triFaceFace();
+ Info<< "face:" << f1 << nl;
+
+ // expect these to fail
+ FatalError.throwExceptions();
+ try
+ {
+ labelledTri l1{ 1, 2, 3, 10, 24 };
+ Info<< "labelled:" << l1 << nl;
+ }
+ catch (Foam::error& err)
+ {
+ WarningInFunction
+ << "Caught FatalError " << err << nl << endl;
+ }
+ FatalError.dontThrowExceptions();
+
+ labelledTri l2{ 1, 2, 3 };
+ Info<< "labelled:" << l2 << nl;
+
+ labelledTri l3{ 1, 2, 3, 10 };
+ Info<< "labelled:" << l3 << nl;
+
+ t1.flip();
+ l3.flip();
+
+ Info<< "flip:" << t1 << nl;
+ Info<< "flip:" << l3 << nl;
+
+ return 0;
+}
-#endif
// ************************************************************************* //
-
diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
index edb8527698..bc7d50f495 100644
--- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
+++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
@@ -41,6 +41,9 @@ Usage
- \par -orient
Check face orientation on the input surface
+ - \par -testModify
+ Test modification mechanism
+
- \par -scale \
Specify a scaling factor for writing the files
@@ -65,6 +68,7 @@ Note
#include "PackedBoolList.H"
#include "MeshedSurfaces.H"
+#include "ModifiableMeshedSurface.H"
#include "UnsortedMeshedSurfaces.H"
#include "IStringStream.H"
@@ -93,6 +97,13 @@ int main(int argc, char *argv[])
"orient",
"check surface orientation"
);
+
+ argList::addBoolOption
+ (
+ "testModify",
+ "Test modification mechanism (MeshedSurface)"
+ );
+
argList::addBoolOption
(
"surfMesh",
@@ -389,6 +400,34 @@ int main(int argc, char *argv[])
Info<< endl;
}
+ if (args.optionFound("testModify"))
+ {
+ Info<< "Use ModifiableMeshedSurface to shift (1, 0, 0)" << endl;
+ Info<< "original" << nl;
+ surf.writeStats(Info);
+ Info<< endl;
+
+ ModifiableMeshedSurface tsurf(surf.xfer());
+ // ModifiableMeshedSurface tsurf;
+ // tsurf.reset(surf.xfer());
+
+ Info<< "in-progress" << nl;
+ surf.writeStats(Info);
+ Info<< endl;
+
+ tsurf.storedPoints() += vector(1, 0, 0);
+
+ surf.transfer(tsurf);
+
+ Info<< "updated" << nl;
+ surf.writeStats(Info);
+ Info<< endl;
+
+ Info<< "modifier" << nl;
+ tsurf.writeStats(Info);
+ Info<< endl;
+ }
+
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
diff --git a/etc/controlDict b/etc/controlDict
index 9726a8b1ae..1334cc1bb1 100644
--- a/etc/controlDict
+++ b/etc/controlDict
@@ -794,7 +794,6 @@ DebugSwitches
surfaceIntersection 0;
surfaceNormalFixedValue 0;
surfacePatch 0;
- surfacePatchIOList 0;
surfaceScalarField 0;
surfaceScalarField::Internal 0;
surfaceSlipDisplacement 0;
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index 8b6be8d895..a1650b7ee3 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -418,6 +418,7 @@ $(cellShape)/cellShapeIOList.C
meshes/Identifiers/patch/patchIdentifier.C
meshes/Identifiers/patch/coupleGroupIdentifier.C
+meshes/Identifiers/surface/surfZoneIdentifier.C
meshes/MeshObject/meshObject.C
diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
similarity index 90%
rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C
rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
index 0495598657..88c3f2d788 100644
--- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C
+++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
@@ -97,14 +97,11 @@ Foam::surfZoneIdentifier::~surfZoneIdentifier()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
void Foam::surfZoneIdentifier::write(Ostream& os) const
{
if (geometricType_.size())
{
- os.writeKeyword("geometricType")
- << geometricType_
- << token::END_STATEMENT << nl;
+ os.writeEntry("geometricType", geometricType_);
}
}
@@ -112,7 +109,6 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// needed for list output
-
bool Foam::surfZoneIdentifier::operator!=
(
const surfZoneIdentifier& rhs
@@ -129,8 +125,9 @@ bool Foam::surfZoneIdentifier::operator==
{
return
(
- name() == rhs.name()
- && geometricType() == rhs.geometricType()
+ (index() == rhs.index())
+ && (name() == rhs.name())
+ && (geometricType() == rhs.geometricType())
);
}
@@ -139,8 +136,7 @@ bool Foam::surfZoneIdentifier::operator==
Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
{
- is >> obj.name_
- >> obj.geometricType_;
+ is >> obj.name_ >> obj.geometricType_;
return is;
}
@@ -148,7 +144,8 @@ Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
{
- os << obj.name_ << ' ' << obj.geometricType_;
+ // newlines to separate, since that is what triSurface currently expects
+ os << nl << obj.name_ << nl << obj.geometricType_;
os.check("Ostream& operator<<(Ostream&, const surfZoneIdentifier&)");
return os;
diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
similarity index 98%
rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H
rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
index 3f6a1b9a77..ff75b56afa 100644
--- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H
+++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
@@ -40,7 +40,6 @@ SourceFiles
#include "word.H"
#include "label.H"
-#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -56,7 +55,7 @@ Istream& operator>>(Istream&, surfZoneIdentifier&);
Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
/*---------------------------------------------------------------------------*\
- Class surfZoneIdentifier Declaration
+ Class surfZoneIdentifier Declaration
\*---------------------------------------------------------------------------*/
class surfZoneIdentifier
diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifierList.H b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifierList.H
similarity index 100%
rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifierList.H
rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifierList.H
diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H
index 0504145ade..62ae47b3d0 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/face.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/face.H
@@ -155,8 +155,8 @@ public:
//- Construct from list of labels
explicit inline face(const labelUList&);
- //- Construct from list of labels
- explicit inline face(const labelList&);
+ //- Construct from an initializer list of labels
+ explicit inline face(std::initializer_list);
//- Construct by transferring the parameter contents
explicit inline face(const Xfer&);
diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceI.H b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
index 7dfc9ef7ea..0dc5e035a6 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/faceI.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
@@ -57,7 +57,7 @@ inline Foam::face::face(const labelUList& lst)
{}
-inline Foam::face::face(const labelList& lst)
+inline Foam::face::face(std::initializer_list lst)
:
labelList(lst)
{}
@@ -79,7 +79,7 @@ inline Foam::face::face(Istream& is)
inline Foam::pointField Foam::face::points(const pointField& meshPoints) const
{
- // There are as many points as there labels for them
+ // There are as many points as there are labels for them
pointField p(size());
// For each point in list, set it to the point in 'pnts' addressed
diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceListFwd.H b/src/OpenFOAM/meshes/meshShapes/face/faceListFwd.H
index d268b0ccbc..0caf8a454a 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/faceListFwd.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/faceListFwd.H
@@ -43,8 +43,6 @@ namespace Foam
typedef List faceList;
typedef SubList faceSubList;
typedef List faceListList;
- // same as faceUList:
- typedef UList unallocFaceList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/triSurface/tools/labelledTri/labelledTri.H b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
similarity index 81%
rename from src/triSurface/tools/labelledTri/labelledTri.H
rename to src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
index a0fd5a90dd..f9feafa610 100644
--- a/src/triSurface/tools/labelledTri/labelledTri.H
+++ b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -64,29 +64,44 @@ class labelledTri
label region_;
+ // Private Member Functions
+
+ //- Assign from a list of 3 or 4 labels.
+ // Default region is 0.
+ inline void assign(const labelUList&);
+
public:
// Constructors
- //- Construct null
+ //- Construct null with invalid point labels and region (-1).
inline labelledTri();
- //- Construct from triFace and a region label
+ //- Construct from triFace and region label.
+ // Default region is 0 if not specified.
inline labelledTri
(
const triFace&,
- const label region
+ const label region = 0
);
- //- Construct from three point labels and a region label
+ //- Construct from three point labels and a region label.
+ // Default region is 0 if not specified.
inline labelledTri
(
const label a,
const label b,
const label c,
- const label region
+ const label region = 0
);
+ //- Construct from a list of 3 or 4 labels.
+ // Default region is 0.
+ explicit inline labelledTri(const labelUList&);
+
+ //- Construct from an initializer list of 3 or 4 labels.
+ explicit inline labelledTri(std::initializer_list);
+
//- Construct from Istream
inline labelledTri(Istream&);
@@ -102,17 +117,6 @@ public:
inline label& region();
- // Check
-
- // Edit
-
- // Write
-
-
- // Friend Functions
-
- // Friend Operators
-
// IOstream Operators
inline friend Istream& operator>>(Istream&, labelledTri&);
diff --git a/src/triSurface/tools/labelledTri/labelledTriI.H b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
similarity index 79%
rename from src/triSurface/tools/labelledTri/labelledTriI.H
rename to src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
index 0d86d6cee9..0e0c72af77 100644
--- a/src/triSurface/tools/labelledTri/labelledTriI.H
+++ b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -25,10 +25,34 @@ License
#include "IOstreams.H"
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+inline void Foam::labelledTri::assign(const labelUList& lst)
+{
+ const label sz = lst.size();
+
+ // checkSize
+ if (sz < 3 || sz > 4)
+ {
+ FatalErrorInFunction
+ << "size " << sz << " != (3 or 4)"
+ << abort(FatalError);
+ }
+
+ for (label i=0; i<3; ++i)
+ {
+ operator[](i) = lst[i];
+ }
+
+ region_ = (sz > 3 ? lst[3] : 0);
+}
+
+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::labelledTri::labelledTri()
:
+ triFace(),
region_(-1)
{}
@@ -57,6 +81,24 @@ inline Foam::labelledTri::labelledTri
{}
+inline Foam::labelledTri::labelledTri(const labelUList& lst)
+:
+ triFace(),
+ region_(0)
+{
+ assign(lst);
+}
+
+
+inline Foam::labelledTri::labelledTri(std::initializer_list initLst)
+:
+ triFace(),
+ region_(0)
+{
+ assign(labelList(initLst));
+}
+
+
inline Foam::labelledTri::labelledTri(Istream& is)
{
operator>>(is, *this);
diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
index 2e7a730228..0b2d5170ad 100644
--- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
+++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
@@ -75,7 +75,7 @@ public:
// Constructors
- //- Construct null
+ //- Construct null with invalid point labels (-1)
inline triFace();
//- Construct from three point labels
@@ -86,9 +86,12 @@ public:
const label c
);
- //- Construct from a list of labels
+ //- Construct from a list of 3 labels.
explicit inline triFace(const labelUList&);
+ //- Construct from an initializer list of 3 labels
+ explicit inline triFace(std::initializer_list);
+
//- Construct from Istream
inline triFace(Istream&);
diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H
index b956780df4..8d8bcaba99 100644
--- a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H
+++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H
@@ -62,6 +62,8 @@ inline int Foam::triFace::compare(const triFace& a, const triFace& b)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::triFace::triFace()
+:
+ FixedList(-1)
{}
@@ -84,6 +86,12 @@ inline Foam::triFace::triFace(const labelUList& lst)
{}
+inline Foam::triFace::triFace(std::initializer_list lst)
+:
+ FixedList(lst)
+{}
+
+
inline Foam::triFace::triFace(Istream& is)
:
FixedList(is)
diff --git a/src/fileFormats/Make/files b/src/fileFormats/Make/files
index 8919e3392d..87fd35ee22 100644
--- a/src/fileFormats/Make/files
+++ b/src/fileFormats/Make/files
@@ -10,6 +10,9 @@ ensight/type/ensightPTraits.C
nas/NASCore.C
fire/FIRECore.C
starcd/STARCDCore.C
+stl/STLCore.C
+stl/STLReader.C
+stl/STLReaderASCII.L
vtk/foamVtkCore.C
vtk/format/foamVtkAppendBase64Formatter.C
diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C b/src/fileFormats/stl/STLCore.C
similarity index 51%
rename from src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C
rename to src/fileFormats/stl/STLCore.C
index 022b6df5a9..a38d3a3cdf 100644
--- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.C
+++ b/src/fileFormats/stl/STLCore.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -23,36 +23,75 @@ License
\*---------------------------------------------------------------------------*/
-#include "STLsurfaceFormatCore.H"
+#include "STLCore.H"
#include "gzstream.h"
#include "OSspecific.H"
-#include "Map.H"
#include "IFstream.H"
-#include "Ostream.H"
-#undef DEBUG_STLBINARY
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+//! \cond fileScope
-// check binary by getting the header and number of facets
+// The number of bytes in the STL binary header
+static const unsigned STLHeaderSize = 80;
+
+//! \endcond
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::fileFormats::STLCore::STLCore()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::fileFormats::STLCore::isBinaryName
+(
+ const fileName& filename,
+ const STLFormat& format
+)
+{
+ return (format == DETECT ? (filename.ext() == "stlb") : format == BINARY);
+}
+
+
+// Check binary by getting the header and number of facets
// this seems to work better than the old token-based method
// - some programs (eg, pro-STAR) have 'solid' as the first word in
// the binary header.
// - using wordToken can cause an abort if non-word (binary) content
// is detected ... this is not exactly what we want.
-int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
+int Foam::fileFormats::STLCore::detectBinaryHeader
(
const fileName& filename
)
{
- off_t dataFileSize = Foam::fileSize(filename);
+ bool compressed = false;
+ autoPtr streamPtr
+ (
+ new ifstream(filename.c_str(), std::ios::binary)
+ );
- IFstream str(filename, IOstream::BINARY);
- istream& is = str().stdStream();
+ // If the file is compressed, decompress it before further checking.
+ if (!streamPtr->good() && isFile(filename + ".gz", false))
+ {
+ compressed = true;
+ streamPtr.reset(new igzstream((filename + ".gz").c_str()));
+ }
+ istream& is = streamPtr();
+
+ if (!is.good())
+ {
+ FatalErrorInFunction
+ << "Cannot read file " << filename
+ << " or file " << filename + ".gz"
+ << exit(FatalError);
+ }
// Read the STL header
- char header[headerSize];
- is.read(header, headerSize);
+ char header[STLHeaderSize];
+ is.read(header, STLHeaderSize);
// Check that stream is OK, if not this may be an ASCII file
if (!is.good())
@@ -60,7 +99,7 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
return 0;
}
- // Read the number of triangles in the STl file
+ // Read the number of triangles in the STL file
// (note: read as int so we can check whether >2^31)
int nTris;
is.read(reinterpret_cast(&nTris), sizeof(unsigned int));
@@ -74,33 +113,73 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
(
!is
|| nTris < 0
- || nTris < (dataFileSize - headerSize)/50
- || nTris > (dataFileSize - headerSize)/25
)
{
return 0;
}
+ else if (!compressed)
+ {
+ const off_t dataFileSize = Foam::fileSize(filename);
+
+ if
+ (
+ nTris < int(dataFileSize - STLHeaderSize)/50
+ || nTris > int(dataFileSize - STLHeaderSize)/25
+ )
+ {
+ return 0;
+ }
+ }
// looks like it might be BINARY, return number of triangles
return nTris;
}
-bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
+Foam::autoPtr
+Foam::fileFormats::STLCore::readBinaryHeader
(
- istream& is,
- const off_t dataFileSize
+ const fileName& filename,
+ label& nTrisEstimated
)
{
- sorted_ = true;
+ bool bad = false;
+ bool compressed = false;
+ nTrisEstimated = 0;
+
+ autoPtr streamPtr
+ (
+ new ifstream(filename.c_str(), std::ios::binary)
+ );
+
+ // If the file is compressed, decompress it before reading.
+ if (!streamPtr->good() && isFile(filename + ".gz", false))
+ {
+ compressed = true;
+ streamPtr.reset(new igzstream((filename + ".gz").c_str()));
+ }
+ istream& is = streamPtr();
+
+ if (!is.good())
+ {
+ streamPtr.clear();
+
+ FatalErrorInFunction
+ << "Cannot read file " << filename
+ << " or file " << filename + ".gz"
+ << exit(FatalError);
+ }
+
// Read the STL header
- char header[headerSize];
- is.read(header, headerSize);
+ char header[STLHeaderSize];
+ is.read(header, STLHeaderSize);
// Check that stream is OK, if not this may be an ASCII file
if (!is.good())
{
+ streamPtr.clear();
+
FatalErrorInFunction
<< "problem reading header, perhaps file is not binary "
<< exit(FatalError);
@@ -116,156 +195,56 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
//
// Also compare the file size with that expected from the number of tris
// If the comparison is not sensible then it may be an ASCII file
- if
- (
- !is
- || nTris < 0
- || nTris < int(dataFileSize - headerSize)/50
- || nTris > int(dataFileSize - headerSize)/25
- )
+ if (!is || nTris < 0)
{
+ bad = true;
+ }
+ else if (!compressed)
+ {
+ const off_t dataFileSize = Foam::fileSize(filename);
+
+ if
+ (
+ nTris < int(dataFileSize - STLHeaderSize)/50
+ || nTris > int(dataFileSize - STLHeaderSize)/25
+ )
+ {
+ bad = true;
+ }
+ }
+
+ if (bad)
+ {
+ streamPtr.clear();
+
FatalErrorInFunction
<< "problem reading number of triangles, perhaps file is not binary"
<< exit(FatalError);
}
-#ifdef DEBUG_STLBINARY
- Info<< "# " << nTris << " facets" << endl;
- label prevZone = -1;
-#endif
-
- points_.setSize(3*nTris);
- zoneIds_.setSize(nTris);
-
- Map lookup;
- DynamicList dynSizes;
-
- label ptI = 0;
- label zoneI = -1;
- forAll(zoneIds_, facei)
- {
- // Read an STL triangle
- STLtriangle stlTri(is);
-
- // transcribe the vertices of the STL triangle -> points
- points_[ptI++] = stlTri.a();
- points_[ptI++] = stlTri.b();
- points_[ptI++] = stlTri.c();
-
- // interprete stl attribute as a zone
- const label origId = stlTri.attrib();
-
- Map::const_iterator fnd = lookup.find(origId);
- if (fnd != lookup.end())
- {
- if (zoneI != fnd())
- {
- // group appeared out of order
- sorted_ = false;
- }
- zoneI = fnd();
- }
- else
- {
- zoneI = dynSizes.size();
- lookup.insert(origId, zoneI);
- dynSizes.append(0);
- }
-
- zoneIds_[facei] = zoneI;
- dynSizes[zoneI]++;
-
-#ifdef DEBUG_STLBINARY
- if (prevZone != zoneI)
- {
- if (prevZone != -1)
- {
- Info<< "endsolid zone" << prevZone << nl;
- }
- prevZone = zoneI;
-
- Info<< "solid zone" << prevZone << nl;
- }
-
- Info<< " facet normal " << stlTri.normal() << nl
- << " outer loop" << nl
- << " vertex " << stlTri.a() << nl
- << " vertex " << stlTri.b() << nl
- << " vertex " << stlTri.c() << nl
- << " outer loop" << nl
- << " endfacet" << endl;
-#endif
- }
-
- names_.clear();
- sizes_.transfer(dynSizes);
-
- return true;
+ nTrisEstimated = nTris;
+ return streamPtr;
}
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-Foam::fileFormats::STLsurfaceFormatCore::STLsurfaceFormatCore
-(
- const fileName& filename
-)
-:
- sorted_(true),
- points_(0),
- zoneIds_(0),
- names_(0),
- sizes_(0)
-{
- off_t dataFileSize = Foam::fileSize(filename);
-
- // auto-detect ascii/binary
- if (detectBINARY(filename))
- {
- readBINARY
- (
- IFstream(filename, IOstream::BINARY)().stdStream(),
- dataFileSize
- );
- }
- else
- {
- readASCII
- (
- IFstream(filename)().stdStream(),
- dataFileSize
- );
- }
-}
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-Foam::fileFormats::STLsurfaceFormatCore::~STLsurfaceFormatCore()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-void Foam::fileFormats::STLsurfaceFormatCore::writeHeaderBINARY
+void Foam::fileFormats::STLCore::writeBinaryHeader
(
ostream& os,
unsigned int nTris
)
{
// STL header with extra information about nTris
- char header[headerSize];
+ char header[STLHeaderSize];
sprintf(header, "STL binary file %u facets", nTris);
// avoid trailing junk
- for (size_t i = strlen(header); i < headerSize; ++i)
+ for (size_t i = strlen(header); i < STLHeaderSize; ++i)
{
header[i] = 0;
}
- os.write(header, headerSize);
+ os.write(header, STLHeaderSize);
os.write(reinterpret_cast(&nTris), sizeof(unsigned int));
-
}
diff --git a/src/fileFormats/stl/STLCore.H b/src/fileFormats/stl/STLCore.H
new file mode 100644
index 0000000000..548cfabde2
--- /dev/null
+++ b/src/fileFormats/stl/STLCore.H
@@ -0,0 +1,115 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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 .
+
+Class
+ Foam::fileFormats::STLCore
+
+Description
+ Core routines used when reading/writing STL files.
+
+SourceFiles
+ STLCore.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef STLCore_H
+#define STLCore_H
+
+#include "STLpoint.H"
+#include "STLtriangle.H"
+#include "autoPtr.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace fileFormats
+{
+
+/*---------------------------------------------------------------------------*\
+ Class fileFormats::STLCore Declaration
+\*---------------------------------------------------------------------------*/
+
+class STLCore
+{
+public:
+
+ // Public data types
+
+ //- Enumeration for the format of data in the stream
+ enum STLFormat
+ {
+ ASCII, //!< ASCII
+ BINARY, //!< BINARY
+ DETECT //!< Detect based on (input) content or (output) extension
+ };
+
+
+protected:
+
+ // Protected Member Functions
+
+ //- Detect 'stlb' extension as binary
+ static bool isBinaryName
+ (
+ const fileName& filename,
+ const STLFormat& format
+ );
+
+
+ //- Check contents to detect if the file is a binary STL.
+ // Return the estimated number of triangles or 0 on error.
+ static int detectBinaryHeader(const fileName&);
+
+
+ //- Read STL binary file header.
+ // Return the opened file stream and estimated number of triangles.
+ // The stream is invalid and number of triangles is 0 on error.
+ static autoPtr readBinaryHeader
+ (
+ const fileName& filename,
+ label& nTrisEstimated
+ );
+
+ //- Write STL binary file and number of triangles to stream
+ static void writeBinaryHeader(ostream&, unsigned int);
+
+
+ // Constructors
+
+ //- Construct null
+ STLCore();
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace fileFormats
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/fileFormats/stl/STLReader.C b/src/fileFormats/stl/STLReader.C
new file mode 100644
index 0000000000..c507b02673
--- /dev/null
+++ b/src/fileFormats/stl/STLReader.C
@@ -0,0 +1,188 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "STLReader.H"
+#include "Map.H"
+#include "IFstream.H"
+
+#undef DEBUG_STLBINARY
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+bool Foam::fileFormats::STLReader::readBINARY
+(
+ const fileName& filename
+)
+{
+ sorted_ = true;
+
+ label nTris = 0;
+ autoPtr streamPtr = readBinaryHeader(filename, nTris);
+
+ if (!streamPtr.valid())
+ {
+ FatalErrorInFunction
+ << "Error reading file " << filename
+ << " or file " << filename + ".gz"
+ << exit(FatalError);
+ }
+
+ istream& is = streamPtr();
+
+#ifdef DEBUG_STLBINARY
+ Info<< "# " << nTris << " facets" << endl;
+ label prevZone = -1;
+#endif
+
+ points_.setSize(3*nTris);
+ zoneIds_.setSize(nTris);
+
+ Map lookup;
+ DynamicList dynSizes;
+
+ label ptI = 0;
+ label zoneI = -1;
+ forAll(zoneIds_, facei)
+ {
+ // Read STL triangle
+ STLtriangle stlTri(is);
+
+ // transcribe the vertices of the STL triangle -> points
+ points_[ptI++] = stlTri.a();
+ points_[ptI++] = stlTri.b();
+ points_[ptI++] = stlTri.c();
+
+ // interpret STL attribute as a zone
+ const label origId = stlTri.attrib();
+
+ Map::const_iterator fnd = lookup.find(origId);
+ if (fnd != lookup.end())
+ {
+ if (zoneI != fnd())
+ {
+ // group appeared out of order
+ sorted_ = false;
+ }
+ zoneI = fnd();
+ }
+ else
+ {
+ zoneI = dynSizes.size();
+ lookup.insert(origId, zoneI);
+ dynSizes.append(0);
+ }
+
+ zoneIds_[facei] = zoneI;
+ dynSizes[zoneI]++;
+
+#ifdef DEBUG_STLBINARY
+ if (prevZone != zoneI)
+ {
+ if (prevZone != -1)
+ {
+ Info<< "endsolid zone" << prevZone << nl;
+ }
+ prevZone = zoneI;
+
+ Info<< "solid zone" << prevZone << nl;
+ }
+
+ stlTri.print(Info);
+#endif
+ }
+
+#ifdef DEBUG_STLBINARY
+ if (prevZone != -1)
+ {
+ Info<< "endsolid zone" << prevZone << nl;
+ }
+#endif
+
+ names_.clear();
+ sizes_.transfer(dynSizes);
+
+ return true;
+}
+
+
+bool Foam::fileFormats::STLReader::readFile
+(
+ const fileName& filename,
+ const STLFormat& format
+)
+{
+ if (format == DETECT ? detectBinaryHeader(filename) : format == BINARY)
+ {
+ return readBINARY(filename);
+ }
+ else
+ {
+ return readASCII(filename);
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::fileFormats::STLReader::STLReader
+(
+ const fileName& filename
+)
+:
+ sorted_(true),
+ points_(),
+ zoneIds_(),
+ names_(),
+ sizes_()
+{
+ // Auto-detect ASCII/BINARY format
+ readFile(filename, STLCore::DETECT);
+}
+
+
+Foam::fileFormats::STLReader::STLReader
+(
+ const fileName& filename,
+ const STLFormat& format
+)
+:
+ sorted_(true),
+ points_(),
+ zoneIds_(),
+ names_(),
+ sizes_()
+{
+ // Manually specified ASCII/BINARY format
+ readFile(filename, format);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::fileFormats::STLReader::~STLReader()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.H b/src/fileFormats/stl/STLReader.H
similarity index 78%
rename from src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.H
rename to src/fileFormats/stl/STLReader.H
index a5aba97cfd..db985181d0 100644
--- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatCore.H
+++ b/src/fileFormats/stl/STLReader.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -22,22 +22,22 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::fileFormats::STLsurfaceFormatCore
+ Foam::fileFormats::STLReader
Description
Internal class used by the STLsurfaceFormat
SourceFiles
- STLsurfaceFormatCore.C
+ STLReader.C
STLsurfaceFormatASCII.L
\*---------------------------------------------------------------------------*/
-#ifndef STLsurfaceFormatCore_H
-#define STLsurfaceFormatCore_H
+#ifndef STLReader_H
+#define STLReader_H
-#include "STLtriangle.H"
-#include "triFace.H"
+#include "STLCore.H"
+#include "labelledTri.H"
#include "IFstream.H"
#include "Ostream.H"
@@ -49,10 +49,12 @@ namespace fileFormats
{
/*---------------------------------------------------------------------------*\
- Class STLsurfaceFormatCore Declaration
+ Class fileFormats::STLReader Declaration
\*---------------------------------------------------------------------------*/
-class STLsurfaceFormatCore
+class STLReader
+:
+ public STLCore
{
// Private Data
@@ -73,44 +75,37 @@ class STLsurfaceFormatCore
// Private Member Functions
- //- Disallow default bitwise copy construct
- STLsurfaceFormatCore(const STLsurfaceFormatCore&);
-
- //- Disallow default bitwise assignment
- void operator=(const STLsurfaceFormatCore&);
-
- //- Determine the file type
- static int detectBINARY(const fileName&);
-
//- Read ASCII
- bool readASCII(istream&, const off_t);
+ bool readASCII(const fileName&);
//- Read BINARY
- bool readBINARY(istream&, const off_t);
+ bool readBINARY(const fileName&);
+
+ //- Read ASCII or BINARY
+ bool readFile(const fileName&, const STLFormat&);
+
+
+ //- Disallow default bitwise copy construct
+ STLReader(const STLReader&) = delete;
+
+ //- Disallow default bitwise assignment
+ void operator=(const STLReader&) = delete;
public:
- // Static Data
-
- //- The number of bytes in the STL binary header
- static const unsigned int headerSize = 80;
-
-
- // Static Member Functions
-
- //- Write "STL binary file" and number of triangles to stream
- static void writeHeaderBINARY(ostream&, unsigned int);
-
-
// Constructors
//- Read from file, filling in the information
- STLsurfaceFormatCore(const fileName&);
+ STLReader(const fileName&);
+
+ //- Read from file, filling in the information.
+ // Manually selected choice of ascii/binary/detect.
+ STLReader(const fileName&, const STLFormat&);
//- Destructor
- ~STLsurfaceFormatCore();
+ ~STLReader();
// Member Functions
diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L b/src/fileFormats/stl/STLReaderASCII.L
similarity index 93%
rename from src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L
rename to src/fileFormats/stl/STLReaderASCII.L
index a3f9e47a6c..515a1be90d 100644
--- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L
+++ b/src/fileFormats/stl/STLReaderASCII.L
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -31,7 +31,8 @@ License
------ local definitions
\* ------------------------------------------------------------------------ */
-#include "STLsurfaceFormatCore.H"
+#include "STLReader.H"
+#include "OSspecific.H"
using namespace Foam;
@@ -97,32 +98,32 @@ public:
// Access
//- Do all the solid groups appear in order
- bool sorted() const
+ inline bool sorted() const
{
return sorted_;
}
//- A list of points corresponding to a pointField
- DynamicList& points()
+ inline DynamicList& points()
{
return points_;
}
//- A list of facet IDs (group IDs)
// corresponds to the number of triangles
- DynamicList& facets()
+ inline DynamicList& facets()
{
return facets_;
}
//- Names
- DynamicList& names()
+ inline DynamicList& names()
{
return names_;
}
//- Sizes
- DynamicList& sizes()
+ inline DynamicList& sizes()
{
return sizes_;
}
@@ -390,20 +391,27 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
//
// member function
//
-bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
+bool Foam::fileFormats::STLReader::readASCII
(
- istream& is,
- const off_t dataFileSize
+ const fileName& filename
)
{
+ IFstream is(filename);
+ if (!is)
+ {
+ FatalErrorInFunction
+ << "file " << filename << " not found"
+ << exit(FatalError);
+ }
+
// Create the lexer with the approximate number of vertices in the STL
// from the file size
- STLASCIILexer lexer(&is, dataFileSize/400);
+ STLASCIILexer lexer(&(is.stdStream()), Foam::fileSize(filename)/400);
while (lexer.lex() != 0) {}
sorted_ = lexer.sorted();
- // transfer to normal lists
+ // Transfer to normal lists
points_.transfer(lexer.points());
zoneIds_.transfer(lexer.facets());
names_.transfer(lexer.names());
@@ -413,5 +421,5 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
}
/* ------------------------------------------------------------------------ *\
- ------ End of STLfileFormatASCII.L
+ ------ End of STLReaderASCII.L
\* ------------------------------------------------------------------------ */
diff --git a/src/surfMesh/surfaceFormats/stl/STLpoint.H b/src/fileFormats/stl/STLpoint.H
similarity index 91%
rename from src/surfMesh/surfaceFormats/stl/STLpoint.H
rename to src/fileFormats/stl/STLpoint.H
index 157e832ba5..c9862eaf94 100644
--- a/src/surfMesh/surfaceFormats/stl/STLpoint.H
+++ b/src/fileFormats/stl/STLpoint.H
@@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
- \\/ M anipulation |
+ \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -27,14 +27,13 @@ Class
Description
A vertex point representation for STL files.
-SourceFiles
-
\*---------------------------------------------------------------------------*/
#ifndef STLpoint_H
#define STLpoint_H
#include "point.H"
+#include "floatVector.H"
#include "Istream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -80,11 +79,13 @@ public:
// Member Operators
- //- Conversion to point
+ #ifdef WM_DP
+ //- Conversion to double-precision point
inline operator point() const
{
return point(x(), y(), z());
}
+ #endif
};
diff --git a/src/surfMesh/surfaceFormats/stl/STLtriangle.H b/src/fileFormats/stl/STLtriangle.H
similarity index 80%
rename from src/surfMesh/surfaceFormats/stl/STLtriangle.H
rename to src/fileFormats/stl/STLtriangle.H
index 17783047f2..a80f5498c5 100644
--- a/src/surfMesh/surfaceFormats/stl/STLtriangle.H
+++ b/src/fileFormats/stl/STLtriangle.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -45,12 +45,9 @@ namespace Foam
{
// Forward declaration of friend functions and operators
-
class STLtriangle;
-
Ostream& operator<<(Ostream&, const STLtriangle&);
-
/*---------------------------------------------------------------------------*\
Class STLtriangle Declaration
\*---------------------------------------------------------------------------*/
@@ -62,7 +59,7 @@ class STLtriangle
//- Attribute is 16-bit
typedef unsigned short STLattrib;
- //- The face normal, many programs write zore or other junk
+ //- The face normal, many programs write zero or other junk
STLpoint normal_;
//- The three points defining the triangle
@@ -113,7 +110,30 @@ public:
// Write
//- Write to ostream (binary)
- inline void write(ostream&);
+ inline void write(ostream&) const;
+
+ //- Write to Ostream (ASCII)
+ inline Ostream& print(Ostream& os) const;
+
+
+ //- Write components to Ostream (ASCII)
+ inline static void write
+ (
+ Ostream& os,
+ const vector& norm,
+ const point& pt0,
+ const point& pt1,
+ const point& pt2
+ );
+
+ //- Write components to Ostream (ASCII), calculating the normal
+ inline static void write
+ (
+ Ostream& os,
+ const point& pt0,
+ const point& pt1,
+ const point& pt2
+ );
// Ostream operator
diff --git a/src/surfMesh/surfaceFormats/stl/STLtriangleI.H b/src/fileFormats/stl/STLtriangleI.H
similarity index 61%
rename from src/surfMesh/surfaceFormats/stl/STLtriangleI.H
rename to src/fileFormats/stl/STLtriangleI.H
index c6d17f4a83..85e02be3d4 100644
--- a/src/surfMesh/surfaceFormats/stl/STLtriangleI.H
+++ b/src/fileFormats/stl/STLtriangleI.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/
+#include "triPointRef.H"
+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::STLtriangle::STLtriangle()
@@ -91,10 +93,61 @@ inline void Foam::STLtriangle::read(istream& is)
}
-inline void Foam::STLtriangle::write(ostream& os)
+inline void Foam::STLtriangle::write(ostream& os) const
{
- os.write(reinterpret_cast(this), 4*sizeof(STLpoint));
- os.write(reinterpret_cast(&attrib_), sizeof(STLattrib));
+ os.write(reinterpret_cast(this), 4*sizeof(STLpoint));
+ os.write(reinterpret_cast(&attrib_), sizeof(STLattrib));
+}
+
+
+inline Foam::Ostream& Foam::STLtriangle::print(Ostream& os) const
+{
+ os << " facet normal "
+ << normal_.x() << ' ' << normal_.y() << ' ' << normal_.z() << nl
+ << " outer loop" << nl
+ << " vertex " << a_.x() << ' ' << a_.y() << ' ' << a_.z() << nl
+ << " vertex " << b_.x() << ' ' << b_.y() << ' ' << b_.z() << nl
+ << " vertex " << c_.x() << ' ' << c_.y() << ' ' << c_.z() << nl
+ << " endloop" << nl
+ << " endfacet" << nl;
+
+ return os;
+}
+
+
+inline void Foam::STLtriangle::write
+(
+ Ostream& os,
+ const vector& norm,
+ const point& pt0,
+ const point& pt1,
+ const point& pt2
+)
+{
+ os << " facet normal "
+ << norm.x() << ' ' << norm.y() << ' ' << norm.z() << nl
+ << " outer loop" << nl
+ << " vertex " << pt0.x() << ' ' << pt0.y() << ' ' << pt0.z() << nl
+ << " vertex " << pt1.x() << ' ' << pt1.y() << ' ' << pt1.z() << nl
+ << " vertex " << pt2.x() << ' ' << pt2.y() << ' ' << pt2.z() << nl
+ << " endloop" << nl
+ << " endfacet" << nl;
+}
+
+
+inline void Foam::STLtriangle::write
+(
+ Ostream& os,
+ const point& pt0,
+ const point& pt1,
+ const point& pt2
+)
+{
+ // calculate the normal ourselves
+ vector norm = triPointRef(pt0, pt1, pt2).normal();
+ norm /= mag(norm) + VSMALL;
+
+ write(os, norm, pt0, pt1, pt2);
}
diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index c187a63d80..d6dd0ec9f2 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -149,6 +149,7 @@ momentOfInertia/momentOfInertia.C
surfaceSets/surfaceSets.C
+triSurface/faceTriangulation/faceTriangulation.C
triSurface/orientedSurface/orientedSurface.C
triSurface/surfaceLocation/surfaceLocation.C
diff --git a/src/triSurface/tools/labelPair/labelPairLookup.H b/src/meshTools/triSurface/containers/labelPairLookup.H
similarity index 100%
rename from src/triSurface/tools/labelPair/labelPairLookup.H
rename to src/meshTools/triSurface/containers/labelPairLookup.H
diff --git a/src/triSurface/faceTriangulation/faceTriangulation.C b/src/meshTools/triSurface/faceTriangulation/faceTriangulation.C
similarity index 100%
rename from src/triSurface/faceTriangulation/faceTriangulation.C
rename to src/meshTools/triSurface/faceTriangulation/faceTriangulation.C
diff --git a/src/triSurface/faceTriangulation/faceTriangulation.H b/src/meshTools/triSurface/faceTriangulation/faceTriangulation.H
similarity index 100%
rename from src/triSurface/faceTriangulation/faceTriangulation.H
rename to src/meshTools/triSurface/faceTriangulation/faceTriangulation.H
diff --git a/src/surfMesh/Make/files b/src/surfMesh/Make/files
index 7b23b07ac6..e0a2b486e4 100644
--- a/src/surfMesh/Make/files
+++ b/src/surfMesh/Make/files
@@ -1,6 +1,5 @@
surfZone/surfZone/surfZone.C
surfZone/surfZone/surfZoneIOList.C
-surfZone/surfZoneIdentifier/surfZoneIdentifier.C
MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C
@@ -8,7 +7,7 @@ MeshedSurface/MeshedSurfaceCore.C
MeshedSurface/MeshedSurfaces.C
UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
-MeshedSurfaceProxy/MeshedSurfaceProxyCore.C
+MeshedSurfaceProxy/MeshedSurfaceProxys.C
mergedSurf/mergedSurf.C
@@ -33,9 +32,7 @@ $(surfaceFormats)/off/OFFsurfaceFormatRunTime.C
$(surfaceFormats)/smesh/SMESHsurfaceFormatRunTime.C
$(surfaceFormats)/starcd/STARCDsurfaceFormatCore.C
$(surfaceFormats)/starcd/STARCDsurfaceFormatRunTime.C
-$(surfaceFormats)/stl/STLsurfaceFormatCore.C
$(surfaceFormats)/stl/STLsurfaceFormatRunTime.C
-$(surfaceFormats)/stl/STLsurfaceFormatASCII.L
$(surfaceFormats)/tri/TRIsurfaceFormatCore.C
$(surfaceFormats)/tri/TRIsurfaceFormatRunTime.C
$(surfaceFormats)/vtk/VTKsurfaceFormatCore.C
diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C
index 0bc6e4921c..a51428f8b4 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurface.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurface.C
@@ -532,6 +532,16 @@ void Foam::MeshedSurface::scalePoints(const scalar scaleFactor)
}
+template
+void Foam::MeshedSurface::reset
+(
+ const Xfer>& surf
+)
+{
+ transfer(surf());
+}
+
+
template
void Foam::MeshedSurface::reset
(
@@ -837,6 +847,61 @@ bool Foam::MeshedSurface::checkFaces
}
+template
+Foam::label Foam::MeshedSurface::nTriangles() const
+{
+ return nTriangles
+ (
+ const_cast&>(List::null())
+ );
+}
+
+
+template
+Foam::label Foam::MeshedSurface::nTriangles
+(
+ List& faceMap
+) const
+{
+ label nTri = 0;
+ const List& faceLst = surfFaces();
+
+ // Count triangles needed
+ forAll(faceLst, facei)
+ {
+ nTri += faceLst[facei].nTriangles();
+ }
+
+ // Nothing to do
+ if (nTri <= faceLst.size())
+ {
+ if (notNull(faceMap))
+ {
+ faceMap.clear();
+ }
+ }
+ else if (notNull(faceMap))
+ {
+ // face map requested
+ faceMap.setSize(nTri);
+
+ nTri = 0;
+ forAll(faceLst, facei)
+ {
+ label n = faceLst[facei].nTriangles();
+ while (n-- > 0)
+ {
+ faceMap[nTri++] = facei;
+ }
+ }
+
+ faceMap.setSize(nTri);
+ }
+
+ return nTri;
+}
+
+
template
Foam::label Foam::MeshedSurface::triangulate()
{
@@ -888,14 +953,11 @@ Foam::label Foam::MeshedSurface::triangulate
}
faceMap.setSize(nTri);
- // remember the number of *additional* faces
- nTri -= faceLst.size();
-
if (this->points().empty())
{
// triangulate without points
// simple face triangulation around f[0]
- label newFacei = 0;
+ nTri = 0;
forAll(faceLst, facei)
{
const Face& f = faceLst[facei];
@@ -904,9 +966,9 @@ Foam::label Foam::MeshedSurface::triangulate
{
label fp1 = f.fcIndex(fp);
- newFaces[newFacei] = triFace(f[0], f[fp], f[fp1]);
- faceMap[newFacei] = facei;
- newFacei++;
+ newFaces[nTri] = triFace(f[0], f[fp], f[fp1]);
+ faceMap[nTri] = facei;
+ nTri++;
}
}
}
@@ -915,7 +977,7 @@ Foam::label Foam::MeshedSurface::triangulate
// triangulate with points
List tmpTri(maxTri);
- label newFacei = 0;
+ nTri = 0;
forAll(faceLst, facei)
{
// 'face' not ''
@@ -925,16 +987,19 @@ Foam::label Foam::MeshedSurface::triangulate
f.triangles(this->points(), nTmp, tmpTri);
for (label triI = 0; triI < nTmp; triI++)
{
- newFaces[newFacei] = Face
+ newFaces[nTri] = Face
(
static_cast(tmpTri[triI])
);
- faceMap[newFacei] = facei;
- newFacei++;
+ faceMap[nTri] = facei;
+ nTri++;
}
}
}
+ // The number of *additional* faces
+ nTri -= faceLst.size();
+
faceLst.transfer(newFaces);
remapFaces(faceMap);
@@ -947,6 +1012,7 @@ Foam::label Foam::MeshedSurface::triangulate
// Topology can change because of renumbering
ParentType::clearOut();
+
return nTri;
}
@@ -1056,12 +1122,13 @@ void Foam::MeshedSurface::transfer
MeshedSurface& surf
)
{
- reset
- (
- xferMove(surf.storedPoints()),
- xferMove(surf.storedFaces()),
- xferMove(surf.storedZones())
- );
+ ParentType::clearOut();
+
+ this->storedPoints().transfer(surf.storedPoints());
+ this->storedFaces().transfer(surf.storedFaces());
+ this->storedZones().transfer(surf.storedZones());
+
+ surf.clear();
}
@@ -1109,12 +1176,43 @@ void Foam::MeshedSurface::transfer
template
-Foam::Xfer> Foam::MeshedSurface::xfer()
+Foam::Xfer>
+Foam::MeshedSurface::xfer()
{
return xferMove(*this);
}
+template
+Foam::Xfer>
+Foam::MeshedSurface::xferFaces()
+{
+ // Topology changed because of transfer
+ ParentType::clearOut();
+
+ return this->storedFaces().xfer();
+}
+
+
+template
+Foam::Xfer>
+Foam::MeshedSurface::xferPoints()
+{
+ // Topology changed because of transfer
+ ParentType::clearOut();
+
+ return this->storedPoints().xfer();
+}
+
+
+template
+Foam::Xfer
+Foam::MeshedSurface::xferZones()
+{
+ return this->storedZones().xfer();
+}
+
+
// Read from file, determine format from extension
template
bool Foam::MeshedSurface::read(const fileName& name)
diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H
index c30686f6b4..513a813597 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurface.H
+++ b/src/surfMesh/MeshedSurface/MeshedSurface.H
@@ -51,7 +51,7 @@ SourceFiles
#include "PatchTools.H"
#include "pointField.H"
#include "face.H"
-#include "triFace.H"
+#include "labelledTri.H"
#include "surfZoneList.H"
#include "surfaceFormatsCore.H"
@@ -134,7 +134,10 @@ protected:
// Protected Member functions
- //- Transfer points/zones and transcribe face -> triFace
+ //- Transfer points/zones from 'face' to other other shapes.
+ // Eg, transcribe face to triFace, or face -> labelledTri, including
+ // any addZonesToFaces adjustment.
+ // No general form, only specializations.
void transcribe(MeshedSurface&);
//- Basic sanity check on zones
@@ -386,6 +389,12 @@ public:
const bool cullEmpty=false
);
+ //- Propagate zone information on face regions.
+ // Normally a no-op, only used by the labelledTri specialization.
+ // Specializations return true, others return false.
+ bool addZonesToFaces();
+
+
//- Remove surface zones
virtual void removeZones();
@@ -396,6 +405,12 @@ public:
//- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar);
+ //- Reset by transferring contents of the argument and annul it
+ virtual void reset
+ (
+ const Xfer>&
+ );
+
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
@@ -428,7 +443,14 @@ public:
const bool verbose=false
);
- //- Triangulate in-place, returning the number of triangles added
+ //- Count number of triangles.
+ virtual label nTriangles() const;
+
+ //- Count number of triangles, returning a face map of original ids.
+ // The faceMap is zero-sized when no triangulation would be needed.
+ virtual label nTriangles(List& faceMap) const;
+
+ //- Triangulate in-place, returning the number of triangles added.
virtual label triangulate();
//- Triangulate in-place, returning the number of triangles added
@@ -436,7 +458,6 @@ public:
// The faceMap is zero-sized when no triangulation was done.
virtual label triangulate(List& faceMap);
-
//- Return new surface.
// Returns return pointMap, faceMap from subsetMeshMap
MeshedSurface subsetMesh
@@ -461,6 +482,15 @@ public:
//- Transfer contents to the Xfer container
Xfer> xfer();
+ //- Transfer stored faces to an Xfer container
+ Xfer> xferFaces();
+
+ //- Transfer stored points to an Xfer container
+ Xfer> xferPoints();
+
+ //- Transfer stored zones to an Xfer container
+ Xfer xferZones();
+
// Read
@@ -521,34 +551,11 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//- Specialization for holding triangulated information
+//- Specialization for labelledTri.
template<>
-inline bool MeshedSurface::isTri()
-{
- return true;
-}
+bool MeshedSurface::addZonesToFaces();
-//- Specialization for holding triangulated information
-template<>
-inline label MeshedSurface::triangulate()
-{
- return 0;
-}
-
-
-//- Specialization for holding triangulated information
-template<>
-inline label MeshedSurface::triangulate(List& faceMap)
-{
- if (notNull(faceMap))
- {
- faceMap.clear();
- }
-
- return 0;
-}
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -556,6 +563,8 @@ inline label MeshedSurface::triangulate(List& faceMap)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#include "MeshedSurfaceI.H"
+
#ifdef NoRepository
#include "MeshedSurface.C"
#endif
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C b/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
index 08851de627..8640b6e5ae 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -30,18 +30,34 @@ License
namespace Foam
{
- // specialization: from face -> triFace
+ // Transcribe 'face' to 'face' (ie, just transfer)
template<>
- void Foam::MeshedSurface::transcribe(MeshedSurface& surf)
+ void Foam::MeshedSurface::transcribe
+ (
+ MeshedSurface& surf
+ )
{
- // first triangulate
+ this->transfer(surf);
+ this->addZonesToFaces(); // currently a no-op
+ }
+
+ // Transcribe 'face' to 'triFace'
+ // Transfer points/zones and triangulate faces
+ template<>
+ void Foam::MeshedSurface::transcribe
+ (
+ MeshedSurface& surf
+ )
+ {
+ // First triangulate
+ // - slightly wasteful for space, but manages adjusts the zones too!
surf.triangulate();
this->storedPoints().transfer(surf.storedPoints());
this->storedZones().transfer(surf.storedZones());
// transcribe from face -> triFace
- List& origFaces = surf.storedFaces();
- List newFaces(origFaces.size());
+ const List& origFaces = surf.surfFaces();
+ List newFaces(origFaces.size());
forAll(origFaces, facei)
{
newFaces[facei] = triFace
@@ -52,18 +68,65 @@ namespace Foam
surf.clear();
this->storedFaces().transfer(newFaces);
+ this->addZonesToFaces(); // currently a no-op
}
- // specialization: from face -> face
+ // Transcribe 'face' to 'labelledTri'
+ // Transfer points/zones and triangulate faces
template<>
- void Foam::MeshedSurface::transcribe(MeshedSurface& surf)
+ void Foam::MeshedSurface::transcribe
+ (
+ MeshedSurface& surf
+ )
{
- this->transfer(surf);
+ // First triangulate
+ // - slightly wasteful for space, but manages adjusts the zones too!
+ surf.triangulate();
+ this->storedPoints().transfer(surf.storedPoints());
+ this->storedZones().transfer(surf.storedZones());
+
+ // transcribe from face -> triFace
+ const List& origFaces = surf.surfFaces();
+ List newFaces(origFaces.size());
+ forAll(origFaces, facei)
+ {
+ newFaces[facei] = triFace
+ (
+ static_cast(origFaces[facei])
+ );
+ }
+ surf.clear();
+
+ this->storedFaces().transfer(newFaces);
+ this->addZonesToFaces(); // for labelledTri
+ }
+
+
+ // Propagate zone information on face regions for labelledTri.
+ template<>
+ bool Foam::MeshedSurface::addZonesToFaces()
+ {
+ List& faceLst = this->storedFaces();
+ const surfZoneList& zones = this->surfZones();
+
+ forAll(zones, zoneI)
+ {
+ const surfZone& zone = zones[zoneI];
+
+ label faceI = zone.start();
+ forAll(zone, i)
+ {
+ faceLst[faceI++].region() = zoneI;
+ }
+ }
+
+ return true;
}
} // end of namespace Foam
+
// ************************************************************************* //
diff --git a/src/triSurface/tools/labelledTri/sortLabelledTri.C b/src/surfMesh/MeshedSurface/MeshedSurfaceI.H
similarity index 51%
rename from src/triSurface/tools/labelledTri/sortLabelledTri.C
rename to src/surfMesh/MeshedSurface/MeshedSurfaceI.H
index 8ee98169f4..a7415f7b4b 100644
--- a/src/triSurface/tools/labelledTri/sortLabelledTri.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceI.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -23,65 +23,76 @@ License
\*---------------------------------------------------------------------------*/
-#include "sortLabelledTri.H"
-#include "labelledTri.H"
-#include "triSurface.H"
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
-// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
-
-inline bool surfAndLabel::less::operator()
-(
- const surfAndLabel& one,
- const surfAndLabel& two
-) const
+// A triFace surface only handles triangulated faces
+template<>
+inline bool MeshedSurface::isTri()
{
- const triSurface& surf = *one.surfPtr_;
- return surf[one.index_].region() < surf[two.index_].region();
+ return true;
}
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-// Construct from components
-sortLabelledTri::sortLabelledTri(const triSurface& surf)
-:
- List(surf.size(), surfAndLabel(surf, -1))
+// A labelledTri surface only handles triangulated faces
+template<>
+inline bool MeshedSurface::isTri()
{
+ return true;
+}
- // Set the face label
- forAll(surf, facei)
+
+// Number of triangles for a triFace surface
+template<>
+inline label MeshedSurface::nTriangles() const
+{
+ return ParentType::size();
+}
+
+// Number of triangles for a labelledTri surface
+template<>
+inline label MeshedSurface::nTriangles() const
+{
+ return ParentType::size();
+}
+
+
+// Inplace triangulation of triFace surface = no-op
+template<>
+inline label MeshedSurface::triangulate()
+{
+ return 0;
+}
+
+// Inplace triangulation of labelledTri surface = no-op
+template<>
+inline label MeshedSurface::triangulate()
+{
+ return 0;
+}
+
+// Inplace triangulation of triFace surface (with face map) = no-op
+template<>
+inline label MeshedSurface::triangulate(List& faceMap)
+{
+ if (notNull(faceMap))
{
- operator[](facei).index_ = facei;
+ faceMap.clear();
}
-
- // Sort according to region number.
- sort(*this, surfAndLabel::less());
+ return 0;
}
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-void sortLabelledTri::indices(labelList& newIndices) const
+// Inplace triangulation of labelledTri surface (with face map) = no-op
+template<>
+inline label MeshedSurface::triangulate(List& faceMap)
{
- newIndices.setSize(size());
-
- forAll(newIndices, i)
+ if (notNull(faceMap))
{
- newIndices[i] = operator[](i).index_;
+ faceMap.clear();
}
-}
-
-
-labelList sortLabelledTri::indices() const
-{
- labelList newIndices(size());
- indices(newIndices);
- return newIndices;
+ return 0;
}
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceZones.C b/src/surfMesh/MeshedSurface/MeshedSurfaceZones.C
index 767d1e5b9c..5127467418 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaceZones.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceZones.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -131,7 +131,7 @@ void Foam::MeshedSurface::addZones
const bool cullEmpty
)
{
- label start = 0;
+ label start = 0;
label nZone = 0;
surfZoneList& zones = this->storedZones();
@@ -162,7 +162,7 @@ void Foam::MeshedSurface::addZones
const bool cullEmpty
)
{
- label start = 0;
+ label start = 0;
label nZone = 0;
surfZoneList& zones = this->storedZones();
@@ -186,6 +186,14 @@ void Foam::MeshedSurface::addZones
}
+template
+bool Foam::MeshedSurface::addZonesToFaces()
+{
+ // Normally a no-op, only the specializations are used.
+ return false;
+}
+
+
template
void Foam::MeshedSurface::removeZones()
{
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaces.C b/src/surfMesh/MeshedSurface/MeshedSurfaces.C
index 999c755c7e..8795a37e25 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaces.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaces.C
@@ -46,6 +46,7 @@ namespace Foam
makeSurface(MeshedSurface, face)
makeSurface(MeshedSurface, triFace)
+makeSurface(MeshedSurface, labelledTri)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H
index 190b081ce5..6c8aa07e2a 100644
--- a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H
+++ b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H
@@ -152,7 +152,7 @@ public:
//- Clear primitive data (points, faces and zones)
void clear();
- //- Reset primitive data (points, faces and zones)
+ //- Reset primitive data (faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
void resetFaces
(
diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C
index 1b1ad73ccf..d7c92fa620 100644
--- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C
+++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C
@@ -235,4 +235,41 @@ Foam::MeshedSurfaceProxy::~MeshedSurfaceProxy()
{}
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+
+namespace Foam
+{
+
+// Number of triangles for a triFace surface
+template<>
+inline label MeshedSurfaceProxy::nTriangles() const
+{
+ return this->size();
+}
+
+// Number of triangles for a labelledTri surface
+template<>
+inline label MeshedSurfaceProxy::nTriangles() const
+{
+ return this->size();
+}
+
+}
+
+
+template
+inline Foam::label Foam::MeshedSurfaceProxy::nTriangles() const
+{
+ label nTri = 0;
+ const List& faceLst = this->surfFaces();
+ forAll(faceLst, facei)
+ {
+ nTri += faceLst[facei].nTriangles();
+ }
+
+ return nTri;
+}
+
+
// ************************************************************************* //
diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
index 9dc548aba4..3bedc3f076 100644
--- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
+++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
@@ -30,7 +30,7 @@ Description
SourceFiles
MeshedSurfaceProxy.C
- MeshedSurfaceProxyCore.C
+ MeshedSurfaceProxys.C
\*---------------------------------------------------------------------------*/
@@ -38,8 +38,7 @@ SourceFiles
#define MeshedSurfaceProxy_H
#include "pointField.H"
-#include "face.H"
-#include "triFace.H"
+#include "labelledTri.H"
#include "surfZoneList.H"
#include "surfaceFormatsCore.H"
@@ -139,6 +138,12 @@ public:
// Access
+ //- The surface size is the number of faces
+ inline label size() const
+ {
+ return faces_.size();
+ }
+
//- Return const access to the points
inline const pointField& points() const
{
@@ -171,6 +176,10 @@ public:
return faceMap_.size() == faces_.size();
}
+ //- Count number of triangles.
+ inline label nTriangles() const;
+
+
// Write
//- Generic write routine. Chooses writer based on extension.
diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxyCore.C b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxys.C
similarity index 95%
rename from src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxyCore.C
rename to src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxys.C
index 76750a14d4..1fd0bfa7e4 100644
--- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxyCore.C
+++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxys.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -46,6 +46,7 @@ namespace Foam
makeSurface(MeshedSurfaceProxy, face)
makeSurface(MeshedSurfaceProxy, triFace)
+makeSurface(MeshedSurfaceProxy, labelledTri)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.H b/src/surfMesh/ModifiableMeshedSurface/ModifiableMeshedSurface.H
similarity index 51%
rename from src/triSurface/triSurface/surfacePatch/surfacePatchIOList.H
rename to src/surfMesh/ModifiableMeshedSurface/ModifiableMeshedSurface.H
index 5dca93d6f0..160198dff1 100644
--- a/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.H
+++ b/src/surfMesh/ModifiableMeshedSurface/ModifiableMeshedSurface.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -22,110 +22,83 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::surfacePatchIOList
+ Foam::ModifiableMeshedSurface
Description
- IOobject for a surfacePatchList
+ A special purpose MeshedSurface that exposes the stored values
+ for direct modification.
-SourceFiles
- surfacePatchIOList.C
+ Its usage should be restricted to special cases where the surface
+ needs modifications as an atomic operation.
\*---------------------------------------------------------------------------*/
-#ifndef surfacePatchIOList_H
-#define surfacePatchIOList_H
+#ifndef ModifiableMeshedSurface_H
+#define ModifiableMeshedSurface_H
-#include "surfacePatchList.H"
-#include "regIOobject.H"
-#include "faceList.H"
-#include "className.H"
+#include "MeshedSurface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
-// Forward declaration of friend functions and operators
-
-class surfacePatchIOList;
-
-Ostream& operator<<(Ostream&, const surfacePatchIOList&);
-
-
/*---------------------------------------------------------------------------*\
- Class surfacePatchIOList Declaration
+ Class ModifiableMeshedSurface Declaration
\*---------------------------------------------------------------------------*/
-class surfacePatchIOList
+template
+class ModifiableMeshedSurface
:
- public surfacePatchList,
- public regIOobject
+ public MeshedSurface
{
- // Private data
-
-
// Private Member Functions
//- Disallow default bitwise copy construct
- surfacePatchIOList(const surfacePatchIOList&);
+ ModifiableMeshedSurface(const ModifiableMeshedSurface&) = delete;
//- Disallow default bitwise assignment
- void operator=(const surfacePatchIOList&);
+ void operator=(const ModifiableMeshedSurface&) = delete;
public:
- //- Runtime type information
- TypeName("surfacePatchIOList");
-
-
- // Static data members
-
- //- Static data someStaticData
-
// Constructors
- //- Construct from IOobject
- explicit surfacePatchIOList(const IOobject& io);
+ //- Construct null, use reset/transfer to adjust contents
+ ModifiableMeshedSurface()
+ :
+ MeshedSurface()
+ {}
+
+
+ //- Construct by transferring the contents from a MeshedSurface
+ explicit ModifiableMeshedSurface
+ (
+ const Xfer>& surf
+ )
+ :
+ MeshedSurface(surf)
+ {}
- //- Construct from IOobject
- surfacePatchIOList(const IOobject& io, const surfacePatchList&);
//- Destructor
- ~surfacePatchIOList();
+ virtual ~ModifiableMeshedSurface()
+ {}
// Member Functions
- //- writeData member function required by regIOobject
- bool writeData(Ostream&) const;
+ // Edit
- //- Is object global
- virtual bool global() const
- {
- return true;
- }
- //- Return complete path + object name if the file exists
- // either in the case/processor or case otherwise null
- virtual fileName filePath() const
- {
- return globalFilePath();
- }
+ // Expose protected methods
+ using MeshedSurface::storedFaces;
+ using MeshedSurface::storedPoints;
+ using MeshedSurface::storedZones;
- // IOstream Operators
-
- friend Ostream& operator<<(Ostream&, const surfacePatchIOList&);
};
-//- Template function for obtaining global status
-template<>
-inline bool typeGlobal()
-{
- return true;
-}
-
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
index d427454e4a..e3975c6b8b 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
@@ -722,6 +722,14 @@ Foam::UnsortedMeshedSurface::xfer()
}
+template
+Foam::Xfer
+Foam::UnsortedMeshedSurface::xferZoneIds()
+{
+ return this->storedZoneIds().xfer();
+}
+
+
// Read from file, determine format from extension
template
bool Foam::UnsortedMeshedSurface::read(const fileName& name)
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
index 9be2e3151d..e038e92711 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
@@ -366,6 +366,9 @@ public:
//- Transfer contents to the Xfer container
Xfer> xfer();
+ //- Transfer stored zoneIds to an Xfer container
+ Xfer xferZoneIds();
+
// Read
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaces.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
index 400cafb148..69c4991748 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -46,6 +46,7 @@ namespace Foam
makeSurface(UnsortedMeshedSurface, face)
makeSurface(UnsortedMeshedSurface, triFace)
+makeSurface(UnsortedMeshedSurface, labelledTri)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/surfMesh/surfMesh/surfMesh.C b/src/surfMesh/surfMesh/surfMesh.C
index 1cc3ddcba4..c7eef6b72b 100644
--- a/src/surfMesh/surfMesh/surfMesh.C
+++ b/src/surfMesh/surfMesh/surfMesh.C
@@ -260,7 +260,28 @@ void Foam::surfMesh::resetPrimitives
)
{
// Clear addressing.
- MeshReference::clearGeom();
+ clearOut();
+
+ Allocator::reset(points, faces, zones);
+ this->updateRefs();
+
+ if (validate)
+ {
+ checkZones();
+ }
+}
+
+
+void Foam::surfMesh::resetPrimitives
+(
+ const Xfer>& points,
+ const Xfer& faces,
+ const Xfer& zones,
+ const bool validate
+)
+{
+ // Clear addressing.
+ clearOut();
Allocator::reset(points, faces, zones);
this->updateRefs();
@@ -278,7 +299,7 @@ void Foam::surfMesh::transfer
)
{
// Clear addressing.
- MeshReference::clearGeom();
+ clearOut();
this->storedIOPoints().transfer(surf.storedPoints());
this->storedIOFaces().transfer(surf.storedFaces());
@@ -288,7 +309,8 @@ void Foam::surfMesh::transfer
}
-Foam::Xfer> Foam::surfMesh::xfer()
+Foam::Xfer>
+Foam::surfMesh::xfer()
{
Xfer> xf;
@@ -300,7 +322,7 @@ Foam::Xfer> Foam::surfMesh::xfer()
this->updateRefs();
// Clear addressing.
- MeshReference::clearGeom();
+ clearOut();
return xf;
}
diff --git a/src/surfMesh/surfMesh/surfMesh.H b/src/surfMesh/surfMesh/surfMesh.H
index f936d3f46d..64e7c0239a 100644
--- a/src/surfMesh/surfMesh/surfMesh.H
+++ b/src/surfMesh/surfMesh/surfMesh.H
@@ -277,6 +277,15 @@ public:
const bool validate = true
);
+ //- Reset mesh primitive data.
+ void resetPrimitives
+ (
+ const Xfer>& points,
+ const Xfer& faces,
+ const Xfer& zones,
+ const bool validate = true
+ );
+
//- Transfer the contents of the argument and annul the argument
void transfer(MeshedSurface&);
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
index c88b4ed5b0..0c60b22ede 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
@@ -24,10 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "AC3DsurfaceFormat.H"
-#include "clock.H"
#include "IStringStream.H"
-#include "tensor.H"
-#include "primitivePatch.H"
+#include "PrimitivePatch.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@@ -49,7 +47,6 @@ bool Foam::fileFormats::AC3DsurfaceFormat::read
const fileName& filename
)
{
- const bool mustTriangulate = this->isTri();
this->clear();
IFstream is(filename);
@@ -199,7 +196,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat::read
labelUList& f = static_cast(verts);
- if (mustTriangulate && f.size() > 3)
+ if (MeshedSurface::isTri() && f.size() > 3)
{
// simple face triangulation about f[0]
// points may be incomplete
@@ -248,11 +245,64 @@ bool Foam::fileFormats::AC3DsurfaceFormat::read
// add zones, culling empty ones
this->addZones(sizes, names, true);
+ this->addZonesToFaces(); // for labelledTri
this->stitchFaces(SMALL);
+
return true;
}
+namespace Foam
+{
+// file-scope writing of a patch of faces
+template
+<
+ class Face,
+ template class FaceList,
+ class PointField,
+ class PointType
+>
+static void writeZone
+(
+ Ostream& os,
+ const PrimitivePatch& patch,
+ const word& name,
+ const label zoneI
+)
+{
+ // An isolated surface region (patch).
+ os << "OBJECT poly" << nl
+ << "name \"" << name << "\"" << nl;
+
+ os << "numvert " << patch.nPoints() << nl;
+
+ forAll(patch.localPoints(), pti)
+ {
+ const point& pt = patch.localPoints()[pti];
+
+ os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
+ }
+
+ os << "numsurf " << patch.size() << nl;
+
+ forAll(patch.localFaces(), facei)
+ {
+ const Face& f = patch.localFaces()[facei];
+
+ os << "SURF 0x20" << nl // polygon
+ << "mat " << zoneI << nl
+ << "refs " << f.size() << nl;
+
+ forAll(f, fp)
+ {
+ os << f[fp] << " 0 0" << nl;
+ }
+ }
+
+ os << "kids 0" << endl;
+}
+}
+
template
void Foam::fileFormats::AC3DsurfaceFormat::write
(
@@ -272,14 +322,6 @@ void Foam::fileFormats::AC3DsurfaceFormat::write
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
- if (useFaceMap)
- {
- FatalErrorInFunction
- << "output with faceMap is not supported " << filename
- << exit(FatalError);
- }
-
-
OFstream os(filename);
if (!os.good())
{
@@ -290,52 +332,42 @@ void Foam::fileFormats::AC3DsurfaceFormat::write
writeHeader(os, zones);
+ if (zones.size() == 1)
+ {
+ PrimitivePatch patch
+ (
+ faceLst, pointLst
+ );
+
+ writeZone(os, patch, zones[0].name(), 0);
+ return;
+ }
+
forAll(zones, zoneI)
{
const surfZone& zone = zones[zoneI];
- os << "OBJECT poly" << nl
- << "name \"" << zone.name() << "\"\n";
-
- // Temporary PrimitivePatch to calculate compact points & faces
- // use 'UList' to avoid allocations!
- PrimitivePatch patch
- (
- SubList
+ if (useFaceMap)
+ {
+ SubList zoneMap(surf.faceMap(), zone.size(), zone.start());
+ PrimitivePatch patch
(
- faceLst,
- zone.size(),
- zone.start()
- ),
- pointLst
- );
+ UIndirectList(faceLst, zoneMap),
+ pointLst
+ );
- os << "numvert " << patch.nPoints() << endl;
-
- forAll(patch.localPoints(), ptI)
- {
- const point& pt = patch.localPoints()[ptI];
-
- os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
+ writeZone(os, patch, zone.name(), zoneI);
}
-
- os << "numsurf " << patch.localFaces().size() << endl;
-
- forAll(patch.localFaces(), localFacei)
+ else
{
- const Face& f = patch.localFaces()[localFacei];
+ PrimitivePatch patch
+ (
+ SubList(faceLst, zone.size(), zone.start()),
+ pointLst
+ );
- os << "SURF 0x20" << nl // polygon
- << "mat " << zoneI << nl
- << "refs " << f.size() << nl;
-
- forAll(f, fp)
- {
- os << f[fp] << " 0 0" << nl;
- }
+ writeZone(os, patch, zone.name(), zoneI);
}
-
- os << "kids 0" << endl;
}
}
@@ -347,81 +379,44 @@ void Foam::fileFormats::AC3DsurfaceFormat::write
const UnsortedMeshedSurface& surf
)
{
+ OFstream os(filename);
+ if (!os.good())
+ {
+ FatalErrorInFunction
+ << "Cannot open file for writing " << filename
+ << exit(FatalError);
+ }
+
labelList faceMap;
List zoneLst = surf.sortedZones(faceMap);
if (zoneLst.size() <= 1)
{
- write
+ const List& zones =
(
- filename,
- MeshedSurfaceProxy
- (
- surf.points(),
- surf.surfFaces(),
- zoneLst
- )
+ zoneLst.size()
+ ? zoneLst
+ : surfaceFormatsCore::oneZone(surf.surfFaces())
);
+
+ writeHeader(os, zones);
+ writeZone(os, surf, zones[0].name(), 0);
+ return;
}
- else
+
+ writeHeader(os, zoneLst);
+ forAll(zoneLst, zoneI)
{
- OFstream os(filename);
- if (!os.good())
- {
- FatalErrorInFunction
- << "Cannot open file for writing " << filename
- << exit(FatalError);
- }
+ const surfZone& zone = zoneLst[zoneI];
- writeHeader(os, zoneLst);
+ SubList zoneMap(faceMap, zone.size(), zone.start());
+ PrimitivePatch patch
+ (
+ UIndirectList(surf.surfFaces(), zoneMap),
+ surf.points()
+ );
- label faceIndex = 0;
- forAll(zoneLst, zoneI)
- {
- const surfZone& zone = zoneLst[zoneI];
-
- os << "OBJECT poly" << nl
- << "name \"" << zone.name() << "\"\n";
-
- // Create zone with only zone faces included for ease of addressing
- labelHashSet include(surf.size());
-
- forAll(zone, localFacei)
- {
- const label facei = faceMap[faceIndex++];
- include.insert(facei);
- }
-
- UnsortedMeshedSurface subm = surf.subsetMesh(include);
-
- // Now we have isolated surface for this patch alone. Write it.
- os << "numvert " << subm.nPoints() << endl;
-
- forAll(subm.localPoints(), ptI)
- {
- const point& pt = subm.localPoints()[ptI];
-
- os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
- }
-
- os << "numsurf " << subm.localFaces().size() << endl;
-
- forAll(subm.localFaces(), localFacei)
- {
- const Face& f = subm.localFaces()[localFacei];
-
- os << "SURF 0x20" << nl // polygon
- << "mat " << zoneI << nl
- << "refs " << f.size() << nl;
-
- forAll(f, fp)
- {
- os << f[fp] << " 0 0" << nl;
- }
- }
-
- os << "kids 0" << endl;
- }
+ writeZone(os, patch, zone.name(), zoneI);
}
}
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.H b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.H
index 8d626099c3..177c2deb41 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -67,10 +67,10 @@ class AC3DsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- AC3DsurfaceFormat(const AC3DsurfaceFormat&);
+ AC3DsurfaceFormat(const AC3DsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const AC3DsurfaceFormat&);
+ void operator=(const AC3DsurfaceFormat&) = delete;
public:
@@ -101,10 +101,18 @@ public:
// Member Functions
//- Write surface mesh components by proxy
- static void write(const fileName&, const MeshedSurfaceProxy&);
+ static void write
+ (
+ const fileName&,
+ const MeshedSurfaceProxy&
+ );
//- Write UnsortedMeshedSurface, the output is always sorted by zones.
- static void write(const fileName&, const UnsortedMeshedSurface&);
+ static void write
+ (
+ const fileName&,
+ const UnsortedMeshedSurface&
+ );
//- Read from file
virtual bool read(const fileName&);
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatRunTime.C
index 89e4f5eb63..9c2846efee 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,6 +52,14 @@ addNamedTemplatedToRunTimeSelectionTable
fileExtension,
ac
);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ MeshedSurface,
+ AC3DsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ ac
+);
// write MeshedSurfaceProxy
addNamedTemplatedToMemberFunctionSelectionTable
@@ -72,6 +80,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
ac
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ AC3DsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ ac
+);
// write UnsortedMeshedSurface
@@ -93,6 +110,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
ac
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ UnsortedMeshedSurface,
+ AC3DsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ ac
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormatRunTime.C
index a4b00b40f0..d4fd924b7b 100644
--- a/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/fire/FLMAsurfaceFormatRunTime.C
@@ -54,6 +54,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
flma
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ FLMAsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ flma
+);
// write MeshedSurfaceProxy (comnpressed versions of above)
@@ -75,6 +84,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
flmaz
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ FLMAZsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ flmaz
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
index 069c0b9db2..731b2e1b96 100644
--- a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
@@ -203,6 +203,7 @@ bool Foam::fileFormats::GTSsurfaceFormat::read
}
this->storedZoneToc().transfer(newZones);
+ this->addZonesToFaces(); // for labelledTri
return true;
}
diff --git a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.H b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.H
index 7a0175d0d2..c39c005af5 100644
--- a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -60,10 +60,10 @@ class GTSsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- GTSsurfaceFormat(const GTSsurfaceFormat&);
+ GTSsurfaceFormat(const GTSsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const GTSsurfaceFormat&);
+ void operator=(const GTSsurfaceFormat&) = delete;
public:
@@ -94,10 +94,18 @@ public:
// Member Functions
//- Write MeshedSurface
- static void write(const fileName&, const MeshedSurface&);
+ static void write
+ (
+ const fileName&,
+ const MeshedSurface&
+ );
//- Write UnsortedMeshedSurface, the output remains unsorted
- static void write(const fileName&, const UnsortedMeshedSurface&);
+ static void write
+ (
+ const fileName&,
+ const UnsortedMeshedSurface&
+ );
//- Read from file
virtual bool read(const fileName&);
diff --git a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormatRunTime.C
index 03fc0569ab..35a6e95ba8 100644
--- a/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/gts/GTSsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,6 +52,14 @@ addNamedTemplatedToRunTimeSelectionTable
fileExtension,
gts
);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ UnsortedMeshedSurface,
+ GTSsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ gts
+);
// write MeshedSurface
addNamedTemplatedToMemberFunctionSelectionTable
@@ -72,6 +80,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
gts
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurface,
+ GTSsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ gts
+);
// write UnsortedMeshedSurface
addNamedTemplatedToMemberFunctionSelectionTable
@@ -92,6 +109,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
gts
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ UnsortedMeshedSurface,
+ GTSsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ gts
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
index 2a7ea0ebc7..d7b932ec48 100644
--- a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C
@@ -47,7 +47,6 @@ bool Foam::fileFormats::NASsurfaceFormat::read
const fileName& filename
)
{
- const bool mustTriangulate = this->isTri();
this->clear();
IFstream is(filename);
@@ -253,7 +252,7 @@ bool Foam::fileFormats::NASsurfaceFormat::read
}
- if (mustTriangulate)
+ if (MeshedSurface::isTri())
{
dynFaces.append(triFace(f[0], f[1], f[2]));
dynFaces.append(triFace(f[0], f[2], f[3]));
@@ -374,9 +373,8 @@ bool Foam::fileFormats::NASsurfaceFormat::read
}
this->sortFacesAndStore(dynFaces.xfer(), dynZones.xfer(), sorted);
-
- // add zones, culling empty ones
- this->addZones(dynSizes, names, true);
+ this->addZones(dynSizes, names, true); // add zones, cull empty ones
+ this->addZonesToFaces(); // for labelledTri
return true;
}
diff --git a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.H b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.H
index 65f22eecf7..d6b0ed0852 100644
--- a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -68,10 +68,10 @@ class NASsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- NASsurfaceFormat(const NASsurfaceFormat&);
+ NASsurfaceFormat(const NASsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const NASsurfaceFormat&);
+ void operator=(const NASsurfaceFormat&) = delete;
public:
diff --git a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormatRunTime.C
index 4fca5cc1b6..572a9aa982 100644
--- a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -35,7 +35,7 @@ namespace Foam
namespace fileFormats
{
-// read MeshedSurface - .bdf (Bulk Data Format)
+// read MeshedSurface - .bdf (Bulk Data Format) and nas (Nastran)
addNamedTemplatedToRunTimeSelectionTable
(
MeshedSurface,
@@ -53,7 +53,6 @@ addNamedTemplatedToRunTimeSelectionTable
nas
);
-// read MeshedSurface - .nas (Nastran)
addNamedTemplatedToRunTimeSelectionTable
(
MeshedSurface,
@@ -71,6 +70,23 @@ addNamedTemplatedToRunTimeSelectionTable
nas
);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ MeshedSurface,
+ NASsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ bdf
+);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ MeshedSurface,
+ NASsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ nas
+);
+
}
}
diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
index 2107d02a5f..04274c775a 100644
--- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.C
@@ -51,7 +51,6 @@ bool Foam::fileFormats::OBJsurfaceFormat::read
const fileName& filename
)
{
- const bool mustTriangulate = this->isTri();
this->clear();
IFstream is(filename);
@@ -173,7 +172,7 @@ bool Foam::fileFormats::OBJsurfaceFormat::read
labelUList& f = static_cast(dynVertices);
- if (mustTriangulate && f.size() > 3)
+ if (MeshedSurface::isTri() && f.size() > 3)
{
// simple face triangulation about f[0]
// points may be incomplete
@@ -200,9 +199,9 @@ bool Foam::fileFormats::OBJsurfaceFormat::read
this->storedPoints().transfer(dynPoints);
this->sortFacesAndStore(dynFaces.xfer(), dynZones.xfer(), sorted);
+ this->addZones(dynSizes, dynNames, true); // add zones, cull empty ones
+ this->addZonesToFaces(); // for labelledTri
- // add zones, culling empty ones
- this->addZones(dynSizes, dynNames, true);
return true;
}
diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.H b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.H
index 7162078175..dc47207037 100644
--- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -60,10 +60,10 @@ class OBJsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- OBJsurfaceFormat(const OBJsurfaceFormat&);
+ OBJsurfaceFormat(const OBJsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const OBJsurfaceFormat&);
+ void operator=(const OBJsurfaceFormat&) = delete;
public:
@@ -94,7 +94,11 @@ public:
// Member Functions
//- Write surface mesh components by proxy
- static void write(const fileName&, const MeshedSurfaceProxy&);
+ static void write
+ (
+ const fileName&,
+ const MeshedSurfaceProxy&
+ );
//- Read from file
virtual bool read(const fileName&);
diff --git a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormatRunTime.C
index a0d7ab518a..ff8b7ee1e5 100644
--- a/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/obj/OBJsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,6 +52,14 @@ addNamedTemplatedToRunTimeSelectionTable
fileExtension,
obj
);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ MeshedSurface,
+ OBJsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ obj
+);
// write MeshedSurfaceProxy
addNamedTemplatedToMemberFunctionSelectionTable
@@ -72,6 +80,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
obj
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ OBJsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ obj
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
index b4cb06a81f..fd869a0c50 100644
--- a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.C
@@ -50,7 +50,6 @@ bool Foam::fileFormats::OFFsurfaceFormat::read
const fileName& filename
)
{
- const bool mustTriangulate = this->isTri();
this->clear();
IFstream is(filename);
@@ -116,7 +115,7 @@ bool Foam::fileFormats::OFFsurfaceFormat::read
labelUList& f = static_cast(verts);
- if (mustTriangulate && f.size() > 3)
+ if (MeshedSurface::isTri() && f.size() > 3)
{
// simple face triangulation about f[0]
// cannot use face::triangulation (points may be incomplete)
diff --git a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.H b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.H
index 0fc6bdf6c6..654da0c93e 100644
--- a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -68,10 +68,10 @@ class OFFsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- OFFsurfaceFormat(const OFFsurfaceFormat&);
+ OFFsurfaceFormat(const OFFsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const OFFsurfaceFormat&);
+ void operator=(const OFFsurfaceFormat&) = delete;
public:
@@ -102,7 +102,11 @@ public:
// Member Functions
//- Write surface mesh components by proxy
- static void write(const fileName&, const MeshedSurfaceProxy&);
+ static void write
+ (
+ const fileName&,
+ const MeshedSurfaceProxy&
+ );
//- Read from file
virtual bool read(const fileName&);
diff --git a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormatRunTime.C
index f3177520f8..6b355ecfe3 100644
--- a/src/surfMesh/surfaceFormats/off/OFFsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/off/OFFsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,6 +52,14 @@ addNamedTemplatedToRunTimeSelectionTable
fileExtension,
off
);
+addNamedTemplatedToRunTimeSelectionTable
+(
+ MeshedSurface,
+ OFFsurfaceFormat,
+ labelledTri,
+ fileExtension,
+ off
+);
// write MeshedSurfaceProxy
addNamedTemplatedToMemberFunctionSelectionTable
@@ -72,7 +80,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
off
);
-
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ OFFsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ off
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C
index e8e7ed21cc..01640aa5ec 100644
--- a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.C
@@ -25,9 +25,7 @@ License
#include "SMESHsurfaceFormat.H"
#include "clock.H"
-#include "IFstream.H"
#include "OFstream.H"
-#include "Ostream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@@ -58,7 +56,6 @@ void Foam::fileFormats::SMESHsurfaceFormat::write
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
-
OFstream os(filename);
if (!os.good())
{
diff --git a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.H b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.H
index 94fd8e1df0..0a4e315f3e 100644
--- a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.H
+++ b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -64,10 +64,10 @@ class SMESHsurfaceFormat
// Private Member Functions
//- Disallow default bitwise copy construct
- SMESHsurfaceFormat(const SMESHsurfaceFormat&);
+ SMESHsurfaceFormat(const SMESHsurfaceFormat&) = delete;
//- Disallow default bitwise assignment
- void operator=(const SMESHsurfaceFormat&);
+ void operator=(const SMESHsurfaceFormat&) = delete;
public:
@@ -86,7 +86,11 @@ public:
// Member Functions
//- Write surface mesh components by proxy
- static void write(const fileName&, const MeshedSurfaceProxy&);
+ static void write
+ (
+ const fileName&,
+ const MeshedSurfaceProxy&
+ );
//- Write object
virtual void write(const fileName& name) const
diff --git a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormatRunTime.C b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormatRunTime.C
index 34db152c9f..2bb1dae786 100644
--- a/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormatRunTime.C
+++ b/src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormatRunTime.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -54,6 +54,15 @@ addNamedTemplatedToMemberFunctionSelectionTable
fileExtension,
smesh
);
+addNamedTemplatedToMemberFunctionSelectionTable
+(
+ MeshedSurfaceProxy,
+ SMESHsurfaceFormat,
+ labelledTri,
+ write,
+ fileExtension,
+ smesh
+);
}
}
diff --git a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
index 219448967c..7240ee7824 100644
--- a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
@@ -79,7 +79,6 @@ bool Foam::fileFormats::STARCDsurfaceFormat::read
const fileName& filename
)
{
- const bool mustTriangulate = this->isTri();
this->clear();
fileName baseName = filename.lessExt();
@@ -194,24 +193,19 @@ bool Foam::fileFormats::STARCDsurfaceFormat::read
}
SubList