FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025 
00026 \*---------------------------------------------------------------------------*/
00027 
00028 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 
00033 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00034 
00035 //- Construct null
00036 inline STLtriangle::STLtriangle()
00037 {}
00038 
00039 
00040 //- Construct from components
00041 inline STLtriangle::STLtriangle
00042 (
00043     const STLpoint& normal,
00044     const STLpoint& a,
00045     const STLpoint& b,
00046     const STLpoint& c,
00047     unsigned short region
00048 )
00049 :
00050     normal_(normal),
00051     a_(a),
00052     b_(b),
00053     c_(c),
00054     region_(region)
00055 {}
00056 
00057 
00058 //- Construct from istream (binary)
00059 inline STLtriangle::STLtriangle(istream& is)
00060 {
00061     read(is);
00062 }
00063 
00064 
00065 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00066 
00067 inline const STLpoint& STLtriangle::a() const
00068 {
00069     return a_;
00070 }
00071 
00072 inline const STLpoint& STLtriangle::b() const
00073 {
00074     return b_;
00075 }
00076 
00077 inline const STLpoint& STLtriangle::c() const
00078 {
00079     return c_;
00080 }
00081 
00082 inline unsigned short STLtriangle::region() const
00083 {
00084     return region_;
00085 }
00086 
00087 
00088 inline void STLtriangle::read(istream& is)
00089 {
00090     is.read(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
00091     is.read(reinterpret_cast<char*>(&region_), 2);
00092 }
00093 
00094 
00095 inline void STLtriangle::write(ostream& os)
00096 {
00097     os.write(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
00098     os.write(reinterpret_cast<char*>(&region_), 2);
00099 }
00100 
00101 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
00102 
00103 inline Ostream& operator<<(Ostream& os, const STLtriangle& stlt)
00104 {
00105     os  << stlt.normal_ << token::SPACE
00106         << stlt.a_ << token::SPACE
00107         << stlt.b_ << token::SPACE
00108         << stlt.c_ << token::SPACE
00109         << stlt.region_;
00110 
00111     return os;
00112 }
00113 
00114 
00115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00116 
00117 } // End namespace Foam
00118 
00119 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines