FreeFOAM The Cross-Platform CFD Toolkit
curvedEdge.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include <OpenFOAM/error.H>
27 #include "curvedEdge.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34  defineTypeNameAndDebug(curvedEdge, 0);
35  defineRunTimeSelectionTable(curvedEdge, Istream);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
43  const pointField& points,
44  const label start,
45  const label end
46 )
47 :
48  points_(points),
49  start_(start),
50  end_(end)
51 {}
52 
53 
55 :
56  points_(points),
57  start_(readLabel(is)),
58  end_(readLabel(is))
59 {}
60 
61 
62 Foam::curvedEdge::curvedEdge(const curvedEdge& c)
63 :
64  points_(c.points_),
65  start_(c.start_),
66  end_(c.end_)
67 {}
68 
69 
71 {
72  notImplemented("curvedEdge::clone() const");
73  return autoPtr<curvedEdge>(NULL);
74 }
75 
76 
78 (
79  const pointField& points,
80  Istream& is
81 )
82 {
83  if (debug)
84  {
85  Info<< "curvedEdge::New(const pointField&, Istream&) : "
86  << "constructing curvedEdge"
87  << endl;
88  }
89 
90  word edgeType(is);
91 
92  IstreamConstructorTable::iterator cstrIter =
93  IstreamConstructorTablePtr_->find(edgeType);
94 
95  if (cstrIter == IstreamConstructorTablePtr_->end())
96  {
97  FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
98  << "Unknown curvedEdge type " << edgeType << endl << endl
99  << "Valid curvedEdge types are" << endl
100  << IstreamConstructorTablePtr_->toc()
101  << abort(FatalError);
102  }
103 
104  return autoPtr<curvedEdge>(cstrIter()(points, is));
105 }
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
111 (
112  const pointField& points,
113  const label start,
114  const label end,
115  const pointField& otherKnots
116 )
117 {
118  pointField allKnots(otherKnots.size() + 2);
119 
120  // start/end knots
121  allKnots[0] = points[start];
122  allKnots[otherKnots.size() + 1] = points[end];
123 
124  // intermediate knots
125  forAll(otherKnots, knotI)
126  {
127  allKnots[knotI+1] = otherKnots[knotI];
128  }
129 
130  return allKnots;
131 }
132 
133 
134 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
135 
136 void Foam::curvedEdge::operator=(const curvedEdge&)
137 {
138  notImplemented("void curvedEdge::operator=(const curvedEdge&)");
139 }
140 
141 
142 Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p)
143 {
144  os << p.start_ << tab << p.end_ << endl;
145 
146  return os;
147 }
148 
149 
150 // ************************ vim: set sw=4 sts=4 et: ************************ //