OpenFOAM logo
Open Source CFD Toolkit

labelledTriI.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-2005 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 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "IOstreams.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00037 
00038 //- Construct null
00039 inline labelledTri::labelledTri()
00040 :
00041     region_(-1)
00042 {}
00043 
00044 
00045 //- Construct from components
00046 inline labelledTri::labelledTri
00047 (
00048     const label A,
00049     const label B,
00050     const label C,
00051     const label region
00052 )
00053 :
00054     triFace(A, B, C),
00055     region_(region)
00056 {}
00057 
00058 
00059 inline labelledTri::labelledTri(Istream& is)
00060 {
00061     // Read beginning of labelledTri point pair
00062     is.readBegin("labelledTri");
00063 
00064     is >> static_cast<triFace&>(*this) >> region_;
00065 
00066     // Read end of labelledTri point pair
00067     is.readEnd("labelledTri");
00068 
00069     // Check state of Istream
00070     is.check("labelledTri::labelledTri(Istream& is)");
00071 }
00072 
00073 
00074 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00075 
00076 inline label labelledTri::region() const
00077 {
00078     return region_;
00079 }
00080 
00081 inline label& labelledTri::region()
00082 {
00083     return region_;
00084 }
00085 
00086 
00087 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
00088 
00089 inline Istream& operator>>(Istream& is, labelledTri& t)
00090 {
00091     // Read beginning of labelledTri point pair
00092     is.readBegin("labelledTri");
00093 
00094     is  >> static_cast<triFace&>(t) >> t.region_;
00095 
00096     // Read end of labelledTri point pair
00097     is.readEnd("labelledTri");
00098 
00099     // Check state of Ostream
00100     is.check("Istream& operator>>(Istream&, labelledTri&)");
00101 
00102     return is;
00103 }
00104 
00105 
00106 inline Ostream& operator<<(Ostream& os, const labelledTri& t)
00107 {
00108     os  << token::BEGIN_LIST
00109         << static_cast<const triFace&>(t) << token::SPACE << t.region_
00110         << token::END_LIST;
00111 
00112     return os;
00113 }
00114 
00115 
00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00117 
00118 } // End namespace Foam
00119 
00120 // ************************************************************************* //
For further information go to www.openfoam.org