1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::fileFormats::STLsurfaceFormat
28 Provide a means of reading/writing STL files (ASCII and binary).
31 For efficiency, the zones are sorted before creating the faces.
32 The class is thus derived from MeshedSurface.
36 STLsurfaceFormatASCII.L
38 \*---------------------------------------------------------------------------*/
40 #ifndef STLsurfaceFormat_H
41 #define STLsurfaceFormat_H
43 #include "STLsurfaceFormatCore.H"
44 #include "MeshedSurface.H"
45 #include "MeshedSurfaceProxy.H"
46 #include "UnsortedMeshedSurface.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class STLsurfaceFormat Declaration
57 \*---------------------------------------------------------------------------*/
60 class STLsurfaceFormat
62 public MeshedSurface<Face>
64 // Private Member Functions
66 //- Write Face (ASCII)
67 static inline void writeShell
74 //- Write Face (BINARY)
75 static inline void writeShell
83 //- Disallow default bitwise copy construct
84 STLsurfaceFormat(const STLsurfaceFormat<Face>&);
86 //- Disallow default bitwise assignment
87 void operator=(const STLsurfaceFormat<Face>&);
94 //- Construct from file name
95 STLsurfaceFormat(const fileName&);
100 //- Read file and return surface
101 static autoPtr<MeshedSurface<Face> > New(const fileName& name)
103 return autoPtr<MeshedSurface<Face> >
105 new STLsurfaceFormat<Face>(name)
111 virtual ~STLsurfaceFormat()
117 //- Write surface mesh components by proxy (as ASCII)
118 static void writeAscii
121 const MeshedSurfaceProxy<Face>&
124 //- Write surface mesh components by proxy (as BINARY)
125 static void writeBinary
128 const MeshedSurfaceProxy<Face>&
131 //- Write surface mesh components by proxy
132 // as ASCII or BINARY, depending on the extension
133 static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
135 //- Write UnsortedMeshedSurface (as ASCII) sorted by zone
136 static void writeAscii
139 const UnsortedMeshedSurface<Face>&
142 //- Write UnsortedMeshedSurface (as BINARY) unsorted by zone
143 static void writeBinary
146 const UnsortedMeshedSurface<Face>&
149 //- Write UnsortedMeshedSurface
150 // as ASCII or BINARY, depending on the extension
151 static void write(const fileName&, const UnsortedMeshedSurface<Face>&);
154 virtual bool read(const fileName&);
157 virtual void write(const fileName& name) const
159 write(name, MeshedSurfaceProxy<Face>(*this));
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 } // End namespace fileFormats
167 } // End namespace Foam
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 # include "STLsurfaceFormat.C"
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //