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
29 curvedEdges : library functions that will define a curvedEdge in space
30 parameterised for 0<lambda<1 from the beginning point to the end point.
31 This file contains the abstract base class curvedEdge.
36 \*---------------------------------------------------------------------------*/
41 #include "pointField.H"
43 #include "HashTable.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class curvedEdge Declaration
53 \*---------------------------------------------------------------------------*/
61 const pointField& points_;
62 const label start_, end_;
66 // Constructor Hash tables
68 //- Construct from Istream function pointer type
69 typedef autoPtr<curvedEdge> (*IstreamConstructorPtr_)
70 (const pointField&, Istream&);
72 //- Construct from Istream function pointer table pointer
73 static HashTable<IstreamConstructorPtr_>*
74 IstreamConstructorTablePtr_;
77 // Hash table constructor classes and functions
79 //- Hash table Constructor.
80 // Must be called from the table add functions below.
81 static void constructTables();
84 //- Class to add constructor from Istream to Hash table
85 template<class curvedEdgeType>
86 class addIstreamConstructorToTable
90 static autoPtr<curvedEdge> New
92 const pointField& points,
96 return autoPtr<curvedEdge>(new curvedEdgeType(points, is));
99 addIstreamConstructorToTable()
101 curvedEdge::constructTables();
103 curvedEdge::IstreamConstructorTablePtr_
104 ->insert(curvedEdgeType::typeName, New);
109 //- Runtime type information
110 TypeName("curvedEdge");
115 //- Construct from components
118 const pointField& points,
123 //- Construct from Istream setting pointsList
124 curvedEdge(const pointField&, Istream&);
127 curvedEdge(const curvedEdge&);
130 virtual autoPtr<curvedEdge> clone() const;
132 //- New function which constructs and returns pointer to a curvedEdge
133 static autoPtr<curvedEdge> New(const pointField&, Istream&);
138 virtual ~curvedEdge(){}
143 //- Return label of start point
149 //- Return label of end point
155 //- Compare the given start and end points with those of this curve
156 bool compare(const label start, const label end) const
160 (start_ == start && end_ == end)
161 || (start_ == end && end_ == start)
165 //- Return the position of a point on the curve given by
166 // the parameter 0 <= lambda <= 1
167 virtual vector position(const scalar) const = 0;
169 //- Return the length of the curve
170 virtual scalar length() const = 0;
174 void operator=(const curvedEdge&);
178 friend Ostream& operator<<(Ostream&, const curvedEdge&);
182 //- Return the complete knotList by adding the start and end points to the
186 const pointField& points,
189 const pointField& otherknots
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 // ************************************************************************* //