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

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