initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / generation / extrudeMesh / faceMesh.H
blobc8e1075f52e5f31ceba4f8930ad6be4dbab9158e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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::faceMesh
28 Description
29     Storage for surface mesh i.e. points and faces.
31 SourceFiles
33 \*---------------------------------------------------------------------------*/
35 #ifndef faceMesh_H
36 #define faceMesh_H
38 #include "PrimitivePatch.H"
39 #include "faceList.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                            Class faceMesh Declaration
48 \*---------------------------------------------------------------------------*/
50 class faceMesh
52     public PrimitivePatch<face, List, pointField>
54     // Private member functions
56         PrimitivePatch<face, List, pointField> read(Istream& is)
57         {
58             pointField points(is);
59             faceList faces(is);
60             return PrimitivePatch<face, Foam::List, pointField>(faces, points);
61         }
64 public:
66     // Constructors
68         //- Construct from components
69         faceMesh(const faceList& faces, const pointField& points)
70         :
71             PrimitivePatch<face, Foam::List, pointField>(faces, points)
72         {}
74         //- Construct from Istream
75         faceMesh(Istream& is)
76         :
77             PrimitivePatch<face, Foam::List, pointField>(read(is))
78         {}
81     // Member Functions
83         void flip()
84         {
85             forAll(*this, i)
86             {
87                 face& f = operator[](i);
88                 f = f.reverseFace();
89             }
90             clearOut();
91         }
93     // IOstream Operators
95         friend Ostream& operator<<(Ostream& os, const faceMesh& fm)
96         {
97             return os
98                 << fm.points()
99                 << token::NL
100                 << static_cast<PrimitivePatch<face, Foam::List, pointField> >
101                    (fm);
102         }
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 } // End namespace Foam
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 #endif
114 // ************************************************************************* //