lineEdge.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "lineEdge.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace blockEdges
37 {
38  defineTypeNameAndDebug(lineEdge, 0);
39  addToRunTimeSelectionTable(blockEdge, lineEdge, Istream);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const pointField& points,
49  const label start,
50  const label end
51 )
52 :
53  blockEdge(points, start, end)
54 {}
55 
56 
58 (
59  const dictionary& dict,
60  const label index,
61  const searchableSurfaces& geometry,
62  const pointField& points,
63  Istream& is
64 )
65 :
66  blockEdge(dict, index, points, is)
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
73 {
74  #ifdef FULLDEBUG
75  if (lambda < -SMALL || lambda > 1 + SMALL)
76  {
78  << "Limit parameter to [0-1] range: " << lambda << nl;
79  }
80  #endif
81 
82  if (lambda < SMALL)
83  {
84  return points_[start_];
85  }
86  else if (lambda >= 1 - SMALL)
87  {
88  return points_[end_];
89  }
90 
91  return points_[start_] + lambda * (points_[end_] - points_[start_]);
92 }
93 
94 
96 {
97  return mag(points_[end_] - points_[start_]);
98 }
99 
100 
101 // ************************************************************************* //
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:325
Foam::blockEdges::lineEdge::lineEdge
lineEdge(const pointField &points, const label start, const label end)
Construct from components.
Definition: lineEdge.C:47
Foam::blockEdge
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:62
Foam::blockEdges::defineTypeNameAndDebug
defineTypeNameAndDebug(arcEdge, 0)
Foam::Field< vector >
Foam::blockEdges::addToRunTimeSelectionTable
addToRunTimeSelectionTable(blockEdge, arcEdge, Istream)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::blockEdge::points_
const pointField & points_
The referenced point field.
Definition: blockEdge.H:69
Foam::blockEdge::start_
const label start_
Index of the start point.
Definition: blockEdge.H:72
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
lambda
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::blockEdge::end_
const label end_
Index of the end point.
Definition: blockEdge.H:75
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::Vector< scalar >
Foam::blockEdges::lineEdge::length
scalar length() const
The length of the curve.
Definition: lineEdge.C:95
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
points
const pointField & points
Definition: gmvOutputHeader.H:1
lineEdge.H
Foam::blockEdges::lineEdge::position
point position(const scalar) const
The point position corresponding to the curve parameter.
Definition: lineEdge.C:72