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

curvedEdge.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 <OpenFOAM/error.H>
00027 #include "curvedEdge.H"
00028 
00029 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034     defineTypeNameAndDebug(curvedEdge, 0);
00035     defineRunTimeSelectionTable(curvedEdge, Istream);
00036 }
00037 
00038 
00039 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00040 
00041 Foam::curvedEdge::curvedEdge
00042 (
00043     const pointField& points,
00044     const label start,
00045     const label end
00046 )
00047 :
00048     points_(points),
00049     start_(start),
00050     end_(end)
00051 {}
00052 
00053 
00054 Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is)
00055 :
00056     points_(points),
00057     start_(readLabel(is)),
00058     end_(readLabel(is))
00059 {}
00060 
00061 
00062 Foam::curvedEdge::curvedEdge(const curvedEdge& c)
00063 :
00064     points_(c.points_),
00065     start_(c.start_),
00066     end_(c.end_)
00067 {}
00068 
00069 
00070 Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::clone() const
00071 {
00072     notImplemented("curvedEdge::clone() const");
00073     return autoPtr<curvedEdge>(NULL);
00074 }
00075 
00076 
00077 Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
00078 (
00079     const pointField& points,
00080     Istream& is
00081 )
00082 {
00083     if (debug)
00084     {
00085         Info<< "curvedEdge::New(const pointField&, Istream&) : "
00086             << "constructing curvedEdge"
00087             << endl;
00088     }
00089 
00090     word edgeType(is);
00091 
00092     IstreamConstructorTable::iterator cstrIter =
00093         IstreamConstructorTablePtr_->find(edgeType);
00094 
00095     if (cstrIter == IstreamConstructorTablePtr_->end())
00096     {
00097         FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
00098             << "Unknown curvedEdge type " << edgeType << endl << endl
00099             << "Valid curvedEdge types are" << endl
00100             << IstreamConstructorTablePtr_->toc()
00101             << abort(FatalError);
00102     }
00103 
00104     return autoPtr<curvedEdge>(cstrIter()(points, is));
00105 }
00106 
00107 
00108 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00109 
00110 Foam::pointField Foam::curvedEdge::appendEndPoints
00111 (
00112     const pointField& points,
00113     const label start,
00114     const label end,
00115     const pointField& otherKnots
00116 )
00117 {
00118     pointField allKnots(otherKnots.size() + 2);
00119 
00120     // start/end knots
00121     allKnots[0] = points[start];
00122     allKnots[otherKnots.size() + 1] = points[end];
00123 
00124     // intermediate knots
00125     forAll(otherKnots, knotI)
00126     {
00127         allKnots[knotI+1] = otherKnots[knotI];
00128     }
00129 
00130     return allKnots;
00131 }
00132 
00133 
00134 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00135 
00136 void Foam::curvedEdge::operator=(const curvedEdge&)
00137 {
00138     notImplemented("void curvedEdge::operator=(const curvedEdge&)");
00139 }
00140 
00141 
00142 Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p)
00143 {
00144     os << p.start_ << tab << p.end_ << endl;
00145 
00146     return os;
00147 }
00148 
00149 
00150 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines