OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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