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

boundaryPatch.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 "boundaryPatch.H"
00028 #include "dictionary.H"
00029 #include "Ostream.H"
00030 
00031 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00032 
00033 Foam::boundaryPatch::boundaryPatch
00034 (
00035     const word& name,
00036     const label index,
00037     const label size,
00038     const label start,
00039     const word& physicalType
00040 )
00041 :
00042     patchIdentifier(name, index, physicalType),
00043     size_(size),
00044     start_(start)
00045 {}
00046 
00047 
00048 Foam::boundaryPatch::boundaryPatch
00049 (
00050     const word& name,
00051     const dictionary& dict,
00052     const label index
00053 )
00054 :
00055     patchIdentifier(name, dict, index),
00056     size_(readLabel(dict.lookup("nFaces"))),
00057     start_(readLabel(dict.lookup("startFace")))
00058 {}
00059 
00060 
00061 Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p)
00062 :
00063     patchIdentifier(p.name(), p.index(), p.physicalType()),
00064     size_(p.size()),
00065     start_(p.start())
00066 {}
00067 
00068 
00069 Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
00070 :
00071     patchIdentifier(p.name(), index, p.physicalType()),
00072     size_(p.size()),
00073     start_(p.start())
00074 {}
00075 
00076 
00077 Foam::autoPtr<Foam::boundaryPatch> Foam::boundaryPatch::clone() const
00078 {
00079     return autoPtr<boundaryPatch>(new boundaryPatch(*this));
00080 }
00081 
00082 
00083 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00084 
00085 Foam::boundaryPatch::~boundaryPatch()
00086 {}
00087 
00088 
00089 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00090 
00091 void Foam::boundaryPatch::write(Ostream& os) const
00092 {
00093     patchIdentifier::write(os);
00094     os.writeKeyword("nFaces") << size_ << token::END_STATEMENT << nl;
00095     os.writeKeyword("startFace") << start_ << token::END_STATEMENT << nl;
00096 }
00097 
00098 
00099 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00100 
00101 Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
00102 {
00103     p.write(os);
00104     os.check("Ostream& operator<<(Ostream& f, const boundaryPatch&)");
00105     return os;
00106 }
00107 
00108 
00109 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd