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

faceMesh.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::faceMesh
00027 
00028 Description
00029     Storage for surface mesh i.e. points and faces.
00030 
00031 SourceFiles
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef faceMesh_H
00036 #define faceMesh_H
00037 
00038 #include "PrimitivePatch.H"
00039 #include "faceList.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class faceMesh Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 class faceMesh
00051 :
00052     public PrimitivePatch<face, List, pointField>
00053 {
00054     // Private member functions
00055 
00056         PrimitivePatch<face, List, pointField> read(Istream& is)
00057         {
00058             pointField points(is);
00059             faceList faces(is);
00060             return PrimitivePatch<face, Foam::List, pointField>(faces, points);
00061         }
00062 
00063 
00064 public:
00065 
00066     // Constructors
00067 
00068         //- Construct from components
00069         faceMesh(const faceList& faces, const pointField& points)
00070         :
00071             PrimitivePatch<face, Foam::List, pointField>(faces, points)
00072         {}
00073 
00074         //- Construct from Istream
00075         faceMesh(Istream& is)
00076         :
00077             PrimitivePatch<face, Foam::List, pointField>(read(is))
00078         {}
00079 
00080 
00081     // Member Functions
00082 
00083         void flip()
00084         {
00085             forAll(*this, i)
00086             {
00087                 face& f = operator[](i);
00088                 f = f.reverseFace();
00089             }
00090             clearOut();
00091         }
00092 
00093     // IOstream Operators
00094 
00095         friend Ostream& operator<<(Ostream& os, const faceMesh& fm)
00096         {
00097             return os
00098                 << fm.points()
00099                 << token::NL
00100                 << static_cast<PrimitivePatch<face, Foam::List, pointField> >
00101                    (fm);
00102         }
00103 };
00104 
00105 
00106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00107 
00108 } // End namespace Foam
00109 
00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00111 
00112 #endif
00113 
00114 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd