OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

OBJsurfaceFormat.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::fileFormats::OBJsurfaceFormat
00027 
00028 Description
00029     Provide a means of reading/writing Alias/Wavefront OBJ format.
00030 
00031     Does not handle negative face indices.
00032 
00033 SourceFiles
00034     OBJsurfaceFormat.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef OBJsurfaceFormat_H
00039 #define OBJsurfaceFormat_H
00040 
00041 #include "MeshedSurface.H"
00042 #include "MeshedSurfaceProxy.H"
00043 #include "UnsortedMeshedSurface.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 namespace fileFormats
00050 {
00051 
00052 /*---------------------------------------------------------------------------*\
00053                       Class OBJsurfaceFormat Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 template<class Face>
00057 class OBJsurfaceFormat
00058 :
00059     public MeshedSurface<Face>
00060 {
00061     // Private Member Functions
00062 
00063         //- Disallow default bitwise copy construct
00064         OBJsurfaceFormat(const OBJsurfaceFormat<Face>&);
00065 
00066         //- Disallow default bitwise assignment
00067         void operator=(const OBJsurfaceFormat<Face>&);
00068 
00069 
00070 public:
00071 
00072     // Constructors
00073 
00074         //- Construct from file name
00075         OBJsurfaceFormat(const fileName&);
00076 
00077 
00078     // Selectors
00079 
00080         //- Read file and return surface
00081         static autoPtr<MeshedSurface<Face> > New(const fileName& name)
00082         {
00083             return autoPtr<MeshedSurface<Face> >
00084             (
00085                 new OBJsurfaceFormat<Face>(name)
00086             );
00087         }
00088 
00089 
00090     // Destructor
00091 
00092         virtual ~OBJsurfaceFormat()
00093         {}
00094 
00095 
00096     // Member Functions
00097 
00098         //- Write surface mesh components by proxy
00099         static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
00100 
00101         //- Read from file
00102         virtual bool read(const fileName&);
00103 
00104         //- Write object file
00105         virtual void write(const fileName& name) const
00106         {
00107             write(name, MeshedSurfaceProxy<Face>(*this));
00108         }
00109 };
00110 
00111 
00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00113 
00114 } // End namespace fileFormats
00115 } // End namespace Foam
00116 
00117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00118 
00119 #ifdef NoRepository
00120 #   include "OBJsurfaceFormat.C"
00121 #endif
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 #endif
00126 
00127 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd