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) 2011-2016 OpenFOAM Foundation
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 "error.H"
27 #include "curvedEdge.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(curvedEdge, 0);
34  defineRunTimeSelectionTable(curvedEdge, Istream);
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 (
42  const pointField& points,
43  const label start,
44  const label end
45 )
46 :
47  points_(points),
48  start_(start),
49  end_(end)
50 {}
51 
52 
54 :
55  points_(points),
56  start_(readLabel(is)),
57  end_(readLabel(is))
58 {}
59 
60 
62 :
63  points_(c.points_),
64  start_(c.start_),
65  end_(c.end_)
66 {}
67 
68 
70 {
72  return autoPtr<curvedEdge>(NULL);
73 }
74 
75 
77 (
78  const pointField& points,
79  Istream& is
80 )
81 {
82  if (debug)
83  {
84  InfoInFunction << "Constructing curvedEdge" << endl;
85  }
86 
87  const word edgeType(is);
88 
89  IstreamConstructorTable::iterator cstrIter =
90  IstreamConstructorTablePtr_->find(edgeType);
91 
92  if (cstrIter == IstreamConstructorTablePtr_->end())
93  {
95  << "Unknown curvedEdge type "
96  << edgeType << nl << nl
97  << "Valid curvedEdge types are" << endl
98  << IstreamConstructorTablePtr_->sortedToc()
99  << abort(FatalError);
100  }
101 
102  return autoPtr<curvedEdge>(cstrIter()(points, is));
103 }
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
109 (
110  const pointField& points,
111  const label start,
112  const label end,
113  const pointField& otherKnots
114 )
115 {
116  pointField allKnots(otherKnots.size() + 2);
117 
118  // Start/end knots
119  allKnots[0] = points[start];
120  allKnots[otherKnots.size() + 1] = points[end];
121 
122  // Intermediate knots
123  forAll(otherKnots, knotI)
124  {
125  allKnots[knotI+1] = otherKnots[knotI];
126  }
127 
128  return allKnots;
129 }
130 
131 
132 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
133 
135 {
137 }
138 
139 
141 {
142  os << p.start_ << tab << p.end_ << endl;
143 
144  return os;
145 }
146 
147 
148 // ************************************************************************* //
static pointField appendEndPoints(const pointField &, const label start, const label end, const pointField &otherKnots)
Return a complete point field by appending the start/end points.
Definition: curvedEdge.C:109
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
curvedEdge(const pointField &points, const label start, const label end)
Construct from components.
Definition: curvedEdge.C:41
virtual autoPtr< curvedEdge > clone() const
Clone function.
Definition: curvedEdge.C:69
static const char tab
Definition: Ostream.H:261
error FatalError
const label start_
Definition: curvedEdge.H:67
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
const pointField & points_
Definition: curvedEdge.H:66
const label end_
Definition: curvedEdge.H:68
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
errorManip< error > abort(error &err)
Definition: errorManip.H:131
label readLabel(Istream &is)
Definition: label.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
label end() const
Return label of end point.
Definition: curvedEdgeI.H:34
static const char nl
Definition: Ostream.H:262
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
static autoPtr< curvedEdge > New(const pointField &, Istream &)
New function which constructs and returns pointer to a curvedEdge.
Definition: curvedEdge.C:77
void operator=(const curvedEdge &)
Definition: curvedEdge.C:134
const dimensionedScalar c
Speed of light in a vacuum.
Ostream & operator<<(Ostream &, const ensightPart &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Define a curved edge that is parameterized for 0<lambda<1 between the start and end point...
Definition: curvedEdge.H:60
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
Namespace for OpenFOAM.
label start() const
Return label of start point.
Definition: curvedEdgeI.H:28
#define InfoInFunction
Report an information message using Foam::Info.