1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::fileFormats::STLsurfaceFormat
29 Provide a means of reading/writing STL files (ASCII and binary).
32 For efficiency, the zones are sorted before creating the faces.
33 The class is thus derived from MeshedSurface.
37 STLsurfaceFormatASCII.L
39 \*---------------------------------------------------------------------------*/
41 #ifndef STLsurfaceFormat_H
42 #define STLsurfaceFormat_H
44 #include "STLsurfaceFormatCore.H"
45 #include "MeshedSurface.H"
46 #include "MeshedSurfaceProxy.H"
47 #include "UnsortedMeshedSurface.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 /*---------------------------------------------------------------------------*\
57 Class STLsurfaceFormat Declaration
58 \*---------------------------------------------------------------------------*/
61 class STLsurfaceFormat
63 public MeshedSurface<Face>
65 // Private Member Functions
67 //- Write Face (ASCII)
68 static inline void writeShell
75 //- Write Face (BINARY)
76 static inline void writeShell
84 //- Disallow default bitwise copy construct
85 STLsurfaceFormat(const STLsurfaceFormat<Face>&);
87 //- Disallow default bitwise assignment
88 void operator=(const STLsurfaceFormat<Face>&);
95 //- Construct from file name
96 STLsurfaceFormat(const fileName&);
101 //- Read file and return surface
102 static autoPtr<MeshedSurface<Face> > New(const fileName& name)
104 return autoPtr<MeshedSurface<Face> >
106 new STLsurfaceFormat<Face>(name)
112 virtual ~STLsurfaceFormat()
118 //- Write surface mesh components by proxy (as ASCII)
119 static void writeAscii
122 const MeshedSurfaceProxy<Face>&
125 //- Write surface mesh components by proxy (as BINARY)
126 static void writeBinary
129 const MeshedSurfaceProxy<Face>&
132 //- Write surface mesh components by proxy
133 // as ASCII or BINARY, depending on the extension
134 static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
136 //- Write UnsortedMeshedSurface (as ASCII) sorted by zone
137 static void writeAscii
140 const UnsortedMeshedSurface<Face>&
143 //- Write UnsortedMeshedSurface (as BINARY) unsorted by zone
144 static void writeBinary
147 const UnsortedMeshedSurface<Face>&
150 //- Write UnsortedMeshedSurface
151 // as ASCII or BINARY, depending on the extension
152 static void write(const fileName&, const UnsortedMeshedSurface<Face>&);
155 virtual bool read(const fileName&);
158 virtual void write(const fileName& name) const
160 write(name, MeshedSurfaceProxy<Face>(*this));
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace fileFormats
168 } // End namespace Foam
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 # include "STLsurfaceFormat.C"
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 // ************************************************************************* //