OpenFOAM logo
Open Source CFD Toolkit

STLtriangleI.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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 //- Construct null
00037 inline STLtriangle::STLtriangle()
00038 {}
00039 
00040 
00041 //- Construct from components
00042 inline STLtriangle::STLtriangle
00043 (
00044     const STLpoint& normal,
00045     const STLpoint& a,
00046     const STLpoint& b,
00047     const STLpoint& c,
00048     short region
00049 )
00050 :
00051     normal_(normal),
00052     a_(a),
00053     b_(b),
00054     c_(c),
00055     region_(region)
00056 {}
00057 
00058 
00059 //- Construct from istream (binary)
00060 inline STLtriangle::STLtriangle(istream& is)
00061 {
00062     read(is);
00063 }
00064 
00065 
00066 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00067 
00068 inline const STLpoint& STLtriangle::a() const
00069 {
00070     return a_;
00071 }
00072 
00073 inline const STLpoint& STLtriangle::b() const
00074 {
00075     return b_;
00076 }
00077 
00078 inline const STLpoint& STLtriangle::c() const
00079 {
00080     return c_;
00081 }
00082 
00083 inline short STLtriangle::region() const
00084 {
00085     return region_;
00086 }
00087 
00088 
00089 inline void STLtriangle::read(istream& is)
00090 {
00091     is.read(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
00092     is.read(reinterpret_cast<char*>(&region_), 2);
00093 }
00094 
00095 
00096 inline void STLtriangle::write(ostream& os)
00097 {
00098     os.write(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
00099     os.write(reinterpret_cast<char*>(&region_), 2);
00100 }
00101 
00102 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
00103 
00104 inline Ostream& operator<<(Ostream& os, const STLtriangle& stlt)
00105 {
00106     os  << stlt.normal_ << token::SPACE
00107         << stlt.a_ << token::SPACE
00108         << stlt.b_ << token::SPACE
00109         << stlt.c_ << token::SPACE
00110         << stlt.region_;
00111 
00112     return os;
00113 }
00114 
00115 
00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00117 
00118 } // End namespace Foam
00119 
00120 // ************************************************************************* //
For further information go to www.openfoam.org