![]() |
|
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 "Ostream.H" 00030 00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00032 00033 namespace Foam 00034 { 00035 00036 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 00037 00038 //- Construct null 00039 inline STLpoint::STLpoint() 00040 {} 00041 00042 00043 //- Construct from components 00044 inline STLpoint::STLpoint(float x, float y, float z) 00045 : 00046 x_(x), y_(y), z_(z) 00047 {} 00048 00049 00050 //- Construct from point 00051 inline STLpoint::STLpoint(const point& pt) 00052 : 00053 x_(float(pt.x())), y_(float(pt.y())), z_(float(pt.z())) 00054 {} 00055 00056 00057 //- Construct from istream 00058 inline STLpoint::STLpoint(Istream& is) 00059 { 00060 is >> *this; 00061 } 00062 00063 00064 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00065 00066 inline float STLpoint::x() const 00067 { 00068 return x_; 00069 } 00070 00071 inline float STLpoint::y() const 00072 { 00073 return y_; 00074 } 00075 00076 inline float STLpoint::z() const 00077 { 00078 return z_; 00079 } 00080 00081 00082 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // 00083 00084 inline STLpoint::operator point() const 00085 { 00086 return point(x_, y_, z_); 00087 } 00088 00089 00090 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // 00091 00092 inline Istream& operator>>(Istream& is, STLpoint& stlp) 00093 { 00094 stlp.x_ = readScalar(is); 00095 stlp.y_ = readScalar(is); 00096 stlp.z_ = readScalar(is); 00097 00098 return is; 00099 } 00100 00101 00102 inline Ostream& operator<<(Ostream& os, const STLpoint& stlp) 00103 { 00104 os << stlp.x_ << token::SPACE 00105 << stlp.y_ << token::SPACE 00106 << stlp.z_; 00107 00108 return os; 00109 } 00110 00111 00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00113 00114 } // End namespace Foam 00115 00116 // ************************************************************************* //