OpenFOAM logo
Open Source CFD Toolkit

point2D.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 Class
00026     point2D
00027 
00028 Description
00029     2D point.
00030 
00031 SourceFiles
00032     point2DI.H
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef point2D_H
00037 #define point2D_H
00038 
00039 #include "error.H"
00040 #include "point.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 class Istream;
00048 class Ostream;
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class point2D Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class point2D
00055 {
00056     // Private data
00057 
00058         scalar X;
00059         scalar Y;
00060 
00061 public:
00062 
00063     // Constructors
00064 
00065         //- Construct as null
00066         point2D();
00067 
00068         //- Construct from components
00069         point2D(const scalar, const scalar);
00070 
00071         //- Construct from point (uses only x and y components)
00072         point2D(const point&);
00073 
00074         //- Construct from Istream
00075         point2D(Istream&);
00076 
00077 
00078     // Destructor
00079 
00080         ~point2D();
00081 
00082 
00083     // Member Functions
00084 
00085         // Access
00086 
00087             scalar x() const;
00088             scalar y() const;
00089 
00090 
00091     // Member Operators
00092 
00093         void operator=(const point2D&);
00094 
00095         void operator*=(const scalar&);
00096 
00097 
00098     // Friend Operators
00099 
00100         //- addition
00101         inline friend point2D operator+(const point2D&, const point2D&);
00102 
00103         //- subtraction
00104         inline friend point2D operator-(const point2D&, const point2D&);
00105 
00106         //- multiplication by a scalar
00107         inline friend point2D operator*(const scalar&, const point2D&);
00108 
00109         inline friend bool operator==(const point2D&, const point2D&);
00110         inline friend bool operator!=(const point2D&, const point2D&);
00111 
00112         //- distance between point2Ds
00113         inline friend scalar distance(const point2D&, const point2D&);
00114 
00115 
00116     // Ostream Operator
00117 
00118         inline friend Ostream& operator<<(Ostream&, const point2D&);
00119 };
00120 
00121 
00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00123 
00124 //- For the benefit of old compilers instantiating  ListIO.C
00125 inline Istream& operator>>(Istream& is, point2D&)
00126 {
00127     notImplemented("Istream& operator<<(Istream&, point2D&)");
00128     return is;
00129 }
00130 
00131 
00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00133 
00134 } // End namespace Foam
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 #include "point2DI.H"
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 #endif
00143 
00144 // ************************************************************************* //
For further information go to www.openfoam.org