1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 library functions that will define a curvedEdge in space
27 parameterised for 0<lambda<1 from the beginning
28 point to the end point.
30 \*---------------------------------------------------------------------------*/
34 #include "curvedEdge.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(curvedEdge, 0);
45 // Define the constructor function hash tables
46 HashTable<curvedEdge::IstreamConstructorPtr_>*
47 curvedEdge::IstreamConstructorTablePtr_;
50 // Hash table Constructor called from the table add functions.
52 void curvedEdge::constructTables()
54 static bool constructed = false;
58 curvedEdge::IstreamConstructorTablePtr_
59 = new HashTable<curvedEdge::IstreamConstructorPtr_>;
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
68 // Construct from components
69 curvedEdge::curvedEdge
71 const pointField& points,
82 // Construct from Istream
83 curvedEdge::curvedEdge(const pointField& points, Istream& is)
86 start_(readLabel(is)),
92 curvedEdge::curvedEdge(const curvedEdge& c)
101 autoPtr<curvedEdge> curvedEdge::clone() const
103 notImplemented("curvedEdge::clone() const");
104 return autoPtr<curvedEdge>(NULL);
108 //- New function which constructs and returns pointer to a curvedEdge
109 autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
113 Info<< "curvedEdge::New(const pointField&, Istream&) : "
114 << "constructing curvedEdge"
118 word curvedEdgeType(is);
120 HashTable<IstreamConstructorPtr_>::iterator curvedEdgeConstructorIter =
121 IstreamConstructorTablePtr_->find(curvedEdgeType);
123 if (curvedEdgeConstructorIter == IstreamConstructorTablePtr_->end())
125 FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
126 << "Unknown curvedEdge type " << curvedEdgeType << endl << endl
127 << "Valid curvedEdge types are" << endl
128 << IstreamConstructorTablePtr_->toc()
129 << abort(FatalError);
132 return autoPtr<curvedEdge>(curvedEdgeConstructorIter()(points, is));
136 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
138 //- Return the complete knotList by adding the start and end points to the
142 const pointField& points,
145 const pointField& otherknots
148 label listsize(otherknots.size() + 2);
149 pointField tmp(listsize);
151 tmp[0] = points[start];
153 for (register label i=1; i<listsize-1; i++)
155 tmp[i] = otherknots[i-1];
158 tmp[listsize-1] = points[end];
164 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
166 void curvedEdge::operator=(const curvedEdge&)
168 notImplemented("void curvedEdge::operator=(const curvedEdge&)");
172 Ostream& operator<<(Ostream& os, const curvedEdge& p)
174 os << p.start_ << tab << p.end_ << endl;
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 } // End namespace Foam
185 // ************************************************************************* //