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

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-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 Description
00026     library functions that will define a curvedEdge in space
00027     parameterised for 0<lambda<1 from the beginning
00028     point to the end point.
00029 
00030 \*---------------------------------------------------------------------------*/
00031 
00032 #include "error.H"
00033 
00034 #include "curvedEdge.H"
00035 
00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00037 
00038 namespace Foam
00039 {
00040 
00041 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00042 
00043 defineTypeNameAndDebug(curvedEdge, 0);
00044 defineRunTimeSelectionTable(curvedEdge, Istream);
00045 
00046 
00047 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00048 
00049 // Construct from components
00050 curvedEdge::curvedEdge
00051 (
00052     const pointField& points,
00053     const label start,
00054     const label end
00055 )
00056 :
00057     points_(points),
00058     start_(start),
00059     end_(end)
00060 {}
00061 
00062 
00063 // Construct from Istream
00064 curvedEdge::curvedEdge(const pointField& points, Istream& is)
00065 :
00066     points_(points),
00067     start_(readLabel(is)),
00068     end_(readLabel(is))
00069 {}
00070 
00071 
00072 // Copy construct
00073 curvedEdge::curvedEdge(const curvedEdge& c)
00074 :
00075     points_(c.points_),
00076     start_(c.start_),
00077     end_(c.end_)
00078 {}
00079 
00080 
00081 //- Clone function
00082 autoPtr<curvedEdge> curvedEdge::clone() const
00083 {
00084     notImplemented("curvedEdge::clone() const");
00085     return autoPtr<curvedEdge>(NULL);
00086 }
00087 
00088 
00089 //- New function which constructs and returns pointer to a curvedEdge
00090 autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
00091 {
00092     if (debug)
00093     {
00094         Info<< "curvedEdge::New(const pointField&, Istream&) : "
00095             << "constructing curvedEdge"
00096             << endl;
00097     }
00098 
00099     word curvedEdgeType(is);
00100 
00101     IstreamConstructorTable::iterator cstrIter =
00102         IstreamConstructorTablePtr_
00103             ->find(curvedEdgeType);
00104 
00105     if (cstrIter == IstreamConstructorTablePtr_->end())
00106     {
00107         FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
00108             << "Unknown curvedEdge type " << curvedEdgeType << endl << endl
00109             << "Valid curvedEdge types are" << endl
00110             << IstreamConstructorTablePtr_->toc()
00111             << abort(FatalError);
00112     }
00113 
00114     return autoPtr<curvedEdge>(cstrIter()(points, is));
00115 }
00116 
00117 
00118 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00119 
00120 //- Return the complete knotList by adding the start and end points to the
00121 //  given list
00122 pointField knotlist
00123 (
00124     const pointField& points,
00125     const label start,
00126     const label end,
00127     const pointField& otherknots
00128 )
00129 {
00130     label listsize(otherknots.size() + 2);
00131     pointField tmp(listsize);
00132 
00133     tmp[0] = points[start];
00134 
00135     for (register label i=1; i<listsize-1; i++)
00136     {
00137         tmp[i] = otherknots[i-1];
00138     }
00139 
00140     tmp[listsize-1] = points[end];
00141 
00142     return tmp;
00143 }
00144 
00145 
00146 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00147 
00148 void curvedEdge::operator=(const curvedEdge&)
00149 {
00150     notImplemented("void curvedEdge::operator=(const curvedEdge&)");
00151 }
00152 
00153 
00154 Ostream& operator<<(Ostream& os, const curvedEdge& p)
00155 {
00156     os << p.start_ << tab << p.end_ << endl;
00157 
00158     return os;
00159 }
00160 
00161 
00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00163 
00164 } // End namespace Foam
00165 
00166 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd