initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / mesh / generation / blockMesh / curvedEdges / curvedEdge.C
blobe9959073ca0b4f75a107107995141133f86c4c36
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 Description
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 \*---------------------------------------------------------------------------*/
32 #include "error.H"
34 #include "curvedEdge.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 namespace Foam
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;
56     if (!constructed)
57     {
58         curvedEdge::IstreamConstructorTablePtr_
59             = new HashTable<curvedEdge::IstreamConstructorPtr_>;
61         constructed = true;
62     }
66 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
68 // Construct from components
69 curvedEdge::curvedEdge
71     const pointField& points,
72     const label start,
73     const label end
76     points_(points),
77     start_(start),
78     end_(end)
82 // Construct from Istream
83 curvedEdge::curvedEdge(const pointField& points, Istream& is)
85     points_(points),
86     start_(readLabel(is)),
87     end_(readLabel(is))
91 // Copy construct
92 curvedEdge::curvedEdge(const curvedEdge& c)
94     points_(c.points_),
95     start_(c.start_),
96     end_(c.end_)
100 //- Clone function
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)
111     if (debug)
112     {
113         Info<< "curvedEdge::New(const pointField&, Istream&) : "
114             << "constructing curvedEdge"
115             << endl;
116     }
118     word curvedEdgeType(is);
120     HashTable<IstreamConstructorPtr_>::iterator curvedEdgeConstructorIter =
121         IstreamConstructorTablePtr_->find(curvedEdgeType);
123     if (curvedEdgeConstructorIter == IstreamConstructorTablePtr_->end())
124     {
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);
130     }
132     return autoPtr<curvedEdge>(curvedEdgeConstructorIter()(points, is));
136 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
138 //- Return the complete knotList by adding the start and end points to the
139 //  given list
140 pointField knotlist
142     const pointField& points,
143     const label start,
144     const label end,
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++)
154     {
155         tmp[i] = otherknots[i-1];
156     }
158     tmp[listsize-1] = points[end];
160     return tmp;
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;
176     return os;
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 } // End namespace Foam
185 // ************************************************************************* //