new spline (Catmull-Rom)
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / generation / blockMesh / curvedEdges / curvedEdge.H
blobbd1ad3246ada4444ef88cd3dabdfd914d695c329
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::curvedEdge
28 Description
29     Define a curved edge that is parameterized for 0<lambda<1
30     between the start and end point.
32 SourceFiles
33     curvedEdge.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef curvedEdges_H
38 #define curvedEdges_H
40 #include "edge.H"
41 #include "pointField.H"
42 #include "typeInfo.H"
43 #include "HashTable.H"
44 #include "autoPtr.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                          Class curvedEdge Declaration
53 \*---------------------------------------------------------------------------*/
55 class curvedEdge
57 protected:
59     // Protected data
61         const pointField& points_;
62         const label start_;
63         const label end_;
65     // Protected Member Functions
67         //- Return a complete point field by appending the start/end points
68         //  to the given list
69         static pointField appendEndPoints
70         (
71             const pointField&,
72             const label start,
73             const label end,
74             const pointField& otherKnots
75         );
78 public:
80     //- Runtime type information
81     TypeName("curvedEdge");
83     // Declare run-time constructor selection tables
85         declareRunTimeSelectionTable
86         (
87             autoPtr,
88             curvedEdge,
89             Istream,
90             (
91                 const pointField& points,
92                 Istream& is
93             ),
94             (points, is)
95         );
98     // Constructors
100         //- Construct from components
101         curvedEdge
102         (
103             const pointField& points,
104             const label start,
105             const label end
106         );
108         //- Construct from Istream setting pointsList
109         curvedEdge(const pointField&, Istream&);
111         //- Copy construct
112         curvedEdge(const curvedEdge&);
114         //- Clone function
115         virtual autoPtr<curvedEdge> clone() const;
117         //- New function which constructs and returns pointer to a curvedEdge
118         static autoPtr<curvedEdge> New(const pointField&, Istream&);
121     // Destructor
123         virtual ~curvedEdge(){}
126     // Member Functions
128         //- Return label of start point
129         inline label start() const;
131         //- Return label of end point
132         inline label end() const;
134         //- Compare the given start and end points with this curve
135         //  -  0: different
136         //  - +1: identical
137         //  - -1: same edge, but different orientation
138         inline int compare(const curvedEdge&) const;
140         //- Compare the given start and end points with this curve
141         //  -  0: different
142         //  - +1: identical
143         //  - -1: same edge, but different orientation
144         inline int compare(const edge&) const;
146         //- Compare the given start and end points with this curve
147         //  -  0: different
148         //  - +1: identical
149         //  - -1: same edge, but different orientation
150         inline int compare(const label start, const label end) const;
152         //- Return the point position corresponding to the curve parameter
153         //  0 <= lambda <= 1
154         virtual point position(const scalar) const = 0;
156         //- Return the length of the curve
157         virtual scalar length() const = 0;
160     // Member operators
162         void operator=(const curvedEdge&);
164     // Ostream operator
166         friend Ostream& operator<<(Ostream&, const curvedEdge&);
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #include "curvedEdgeI.H"
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 #endif
182 // ************************************************************************* //