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

geometricSurfacePatch.C

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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "geometricSurfacePatch.H"
00027 #include <OpenFOAM/dictionary.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00035 
00036 defineTypeNameAndDebug(geometricSurfacePatch, 0);
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 // Construct null
00041 geometricSurfacePatch::geometricSurfacePatch()
00042 :
00043     geometricType_("empty"),
00044     name_("patch"),
00045     index_(0)
00046 {}
00047 
00048 
00049 // Construct from components
00050 geometricSurfacePatch::geometricSurfacePatch
00051 (
00052     const word& geometricType,
00053     const word& name,
00054     const label index
00055 )
00056 :
00057     geometricType_(geometricType),
00058     name_(name),
00059     index_(index)
00060 
00061 {
00062     if (geometricType_.empty())
00063     {
00064         geometricType_ = "empty";
00065     }
00066 }
00067 
00068 
00069 // Construct from Istream
00070 geometricSurfacePatch::geometricSurfacePatch(Istream& is, const label index)
00071 :
00072     geometricType_(is),
00073     name_(is),
00074     index_(index)
00075 {
00076     if (geometricType_.empty())
00077     {
00078         geometricType_ = "empty";
00079     }
00080 }
00081 
00082 
00083 // Construct from dictionary
00084 geometricSurfacePatch::geometricSurfacePatch
00085 (
00086     const word& name,
00087     const dictionary& dict,
00088     const label index
00089 )
00090 :
00091     geometricType_(dict.lookup("geometricType")),
00092     name_(name),
00093     index_(index)
00094 {
00095     if (geometricType_.empty())
00096     {
00097         geometricType_ = "empty";
00098     }
00099 }
00100 
00101 
00102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00103 
00104 // Write
00105 void geometricSurfacePatch::write(Ostream& os) const
00106 {
00107     os  << nl << name_
00108         << nl << geometricType_;
00109 }
00110 
00111 
00112 void geometricSurfacePatch::writeDict(Ostream& os) const
00113 {
00114     os  << "    geometricType " << geometricType_ << ';' << nl;
00115 }
00116 
00117 
00118 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00119 
00120 bool Foam::geometricSurfacePatch::operator!=(const geometricSurfacePatch& p)
00121     const
00122 {
00123     return !(*this == p);
00124 }
00125 
00126 
00127 bool Foam::geometricSurfacePatch::operator==(const geometricSurfacePatch& p)
00128     const
00129 {
00130     return
00131     (
00132         (geometricType() == p.geometricType())
00133      && (name() == p.name())
00134     );
00135 }
00136 
00137 
00138 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00139 
00140 Istream& operator>>(Istream& is, geometricSurfacePatch& gp)
00141 {
00142     is >> gp.name_ >> gp.geometricType_;
00143 
00144     return is;
00145 }
00146 
00147 
00148 Ostream& operator<<(Ostream& os, const geometricSurfacePatch& gp)
00149 {
00150     gp.write(os);
00151     os.check
00152     (
00153         "Ostream& operator<<(Ostream& f, const geometricSurfacePatch& gp)"
00154     );
00155     return os;
00156 }
00157 
00158 
00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00160 
00161 } // End namespace Foam
00162 
00163 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines