fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / surfMesh / surfaceFormats / stl / STLsurfaceFormat.H
blob206e4f608642d70cda355d7522c9784502bbdeca
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::fileFormats::STLsurfaceFormat
28 Description
29     Provide a means of reading/writing STL files (ASCII and binary).
31 Note
32     For efficiency, the zones are sorted before creating the faces.
33     The class is thus derived from MeshedSurface.
35 SourceFiles
36     STLsurfaceFormat.C
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
53 namespace fileFormats
56 /*---------------------------------------------------------------------------*\
57                      Class STLsurfaceFormat Declaration
58 \*---------------------------------------------------------------------------*/
60 template<class Face>
61 class STLsurfaceFormat
63     public MeshedSurface<Face>
65     // Private Member Functions
67         //- Write Face (ASCII)
68         static inline void writeShell
69         (
70             Ostream&,
71             const pointField&,
72             const Face&
73         );
75         //- Write Face (BINARY)
76         static inline void writeShell
77         (
78             ostream&,
79             const pointField&,
80             const Face&,
81             const label zoneI
82         );
84         //- Disallow default bitwise copy construct
85         STLsurfaceFormat(const STLsurfaceFormat<Face>&);
87         //- Disallow default bitwise assignment
88         void operator=(const STLsurfaceFormat<Face>&);
91 public:
93     // Constructors
95         //- Construct from file name
96         STLsurfaceFormat(const fileName&);
99     // Selectors
101         //- Read file and return surface
102         static autoPtr<MeshedSurface<Face> > New(const fileName& name)
103         {
104             return autoPtr<MeshedSurface<Face> >
105             (
106                 new STLsurfaceFormat<Face>(name)
107             );
108         }
111     //- Destructor
112     virtual ~STLsurfaceFormat()
113     {}
116     // Member Functions
118         //- Write surface mesh components by proxy (as ASCII)
119         static void writeAscii
120         (
121             const fileName&,
122             const MeshedSurfaceProxy<Face>&
123         );
125         //- Write surface mesh components by proxy (as BINARY)
126         static void writeBinary
127         (
128             const fileName&,
129             const MeshedSurfaceProxy<Face>&
130         );
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
138         (
139             const fileName&,
140             const UnsortedMeshedSurface<Face>&
141         );
143         //- Write UnsortedMeshedSurface (as BINARY) unsorted by zone
144         static void writeBinary
145         (
146             const fileName&,
147             const UnsortedMeshedSurface<Face>&
148         );
150         //- Write UnsortedMeshedSurface
151         //  as ASCII or BINARY, depending on the extension
152         static void write(const fileName&, const UnsortedMeshedSurface<Face>&);
154         //- Read from file
155         virtual bool read(const fileName&);
157         //- Write object
158         virtual void write(const fileName& name) const
159         {
160             write(name, MeshedSurfaceProxy<Face>(*this));
161         }
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace fileFormats
168 } // End namespace Foam
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 #ifdef NoRepository
173 #   include "STLsurfaceFormat.C"
174 #endif
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #endif
180 // ************************************************************************* //