initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / generation / blockMesh / curvedEdges / curvedEdge.C
blob6a2d41a83e31af8d938cfb8bc1a4bccdffd532b7
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 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);
44 defineRunTimeSelectionTable(curvedEdge, Istream);
47 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
49 // Construct from components
50 curvedEdge::curvedEdge
52     const pointField& points,
53     const label start,
54     const label end
57     points_(points),
58     start_(start),
59     end_(end)
63 // Construct from Istream
64 curvedEdge::curvedEdge(const pointField& points, Istream& is)
66     points_(points),
67     start_(readLabel(is)),
68     end_(readLabel(is))
72 // Copy construct
73 curvedEdge::curvedEdge(const curvedEdge& c)
75     points_(c.points_),
76     start_(c.start_),
77     end_(c.end_)
81 //- Clone function
82 autoPtr<curvedEdge> curvedEdge::clone() const
84     notImplemented("curvedEdge::clone() const");
85     return autoPtr<curvedEdge>(NULL);
89 //- New function which constructs and returns pointer to a curvedEdge
90 autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
92     if (debug)
93     {
94         Info<< "curvedEdge::New(const pointField&, Istream&) : "
95             << "constructing curvedEdge"
96             << endl;
97     }
99     word curvedEdgeType(is);
101     IstreamConstructorTable::iterator cstrIter =
102         IstreamConstructorTablePtr_
103             ->find(curvedEdgeType);
105     if (cstrIter == IstreamConstructorTablePtr_->end())
106     {
107         FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
108             << "Unknown curvedEdge type " << curvedEdgeType << endl << endl
109             << "Valid curvedEdge types are" << endl
110             << IstreamConstructorTablePtr_->toc()
111             << abort(FatalError);
112     }
114     return autoPtr<curvedEdge>(cstrIter()(points, is));
118 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
120 //- Return the complete knotList by adding the start and end points to the
121 //  given list
122 pointField knotlist
124     const pointField& points,
125     const label start,
126     const label end,
127     const pointField& otherknots
130     label listsize(otherknots.size() + 2);
131     pointField tmp(listsize);
133     tmp[0] = points[start];
135     for (register label i=1; i<listsize-1; i++)
136     {
137         tmp[i] = otherknots[i-1];
138     }
140     tmp[listsize-1] = points[end];
142     return tmp;
146 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
148 void curvedEdge::operator=(const curvedEdge&)
150     notImplemented("void curvedEdge::operator=(const curvedEdge&)");
154 Ostream& operator<<(Ostream& os, const curvedEdge& p)
156     os << p.start_ << tab << p.end_ << endl;
158     return os;
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 } // End namespace Foam
166 // ************************************************************************* //