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

curvedEdge.H

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 Class
00026     Foam::curvedEdge
00027 
00028 Description
00029     curvedEdges : library functions that will define a curvedEdge in space
00030     parameterised for 0<lambda<1 from the beginning point to the end point.
00031     This file contains the abstract base class curvedEdge.
00032 
00033 SourceFiles
00034     curvedEdge.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef curvedEdges_H
00039 #define curvedEdges_H
00040 
00041 #include "pointField.H"
00042 #include "typeInfo.H"
00043 #include "HashTable.H"
00044 #include "autoPtr.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class curvedEdge Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class curvedEdge
00056 {
00057 protected:
00058 
00059     // Protected data
00060 
00061         const pointField& points_;
00062         const label start_, end_;
00063 
00064 public:
00065 
00066     //- Runtime type information
00067     TypeName("curvedEdge");
00068 
00069 
00070     // Declare run-time constructor selection tables
00071 
00072         declareRunTimeSelectionTable
00073         (
00074             autoPtr,
00075             curvedEdge,
00076             Istream,
00077             (
00078                 const pointField& points,
00079                 Istream& is
00080             ),
00081             (points, is)
00082         );
00083 
00084 
00085     // Constructors
00086 
00087         //- Construct from components
00088         curvedEdge
00089         (
00090             const pointField& points,
00091             const label start,
00092             const label end
00093         );
00094 
00095         //- Construct from Istream setting pointsList
00096         curvedEdge(const pointField&, Istream&);
00097 
00098         //- Copy construct
00099         curvedEdge(const curvedEdge&);
00100 
00101         //- Clone function
00102         virtual autoPtr<curvedEdge> clone() const;
00103 
00104         //- New function which constructs and returns pointer to a curvedEdge
00105         static autoPtr<curvedEdge> New(const pointField&, Istream&);
00106 
00107 
00108     // Destructor
00109 
00110         virtual ~curvedEdge(){}
00111 
00112 
00113     // Member Functions
00114 
00115         //- Return label of start point
00116         label start() const
00117         {
00118             return start_;
00119         }
00120 
00121         //- Return label of end point
00122         label end() const
00123         {
00124             return end_;
00125         }
00126 
00127         //- Compare the given start and end points with those of this curve
00128         bool compare(const label start, const label end) const
00129         {
00130             return
00131             (
00132                 (start_ == start && end_ == end)
00133              || (start_ == end && end_ == start)
00134             );
00135         }
00136 
00137         //- Return the position of a point on the curve given by
00138         //  the parameter 0 <= lambda <= 1
00139         virtual vector position(const scalar) const = 0;
00140 
00141         //- Return the length of the curve
00142         virtual scalar length() const = 0;
00143 
00144     // Member operators
00145 
00146         void operator=(const curvedEdge&);
00147 
00148     // Ostream operator
00149 
00150         friend Ostream& operator<<(Ostream&, const curvedEdge&);
00151 };
00152 
00153 
00154 //- Return the complete knotList by adding the start and end points to the
00155 //  given list
00156 pointField knotlist
00157 (
00158     const pointField& points,
00159     const label start,
00160     const label end,
00161     const pointField& otherknots
00162 );
00163 
00164 
00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00166 
00167 } // End namespace Foam
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 #endif
00172 
00173 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd