Loading...
Searching...
No Matches
blockEdgeI.H
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) 2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31inline bool Foam::blockEdge::good() const noexcept
32{
33 return (start_ != end_ && start_ >= 0 && end_ >= 0);
34}
35
37inline Foam::label Foam::blockEdge::start() const noexcept
38{
39 return start_;
40}
41
43inline Foam::label Foam::blockEdge::end() const noexcept
44{
45 return end_;
46}
47
49inline const Foam::point& Foam::blockEdge::firstPoint() const
50{
51 return points_[start_];
52}
53
55inline const Foam::point& Foam::blockEdge::lastPoint() const
56{
57 return points_[end_];
58}
59
60
61inline int Foam::blockEdge::compare(const label start, const label end) const
62{
63 if (start_ == start && end_ == end)
64 {
65 return 1;
66 }
67 else if (start_ == end && end_ == start)
68 {
69 return -1;
70 }
71
72 return 0;
73}
74
76inline int Foam::blockEdge::compare(const blockEdge& e) const
77{
78 return Foam::blockEdge::compare(e.start(), e.end());
79}
80
82inline int Foam::blockEdge::compare(const edge& e) const
83{
84 return Foam::blockEdge::compare(e.start(), e.end());
85}
86
87
88inline Foam::point Foam::blockEdge::linearPosition(const scalar lambda) const
89{
90 #ifdef FULLDEBUG
91 if (lambda < -SMALL || lambda > 1 + SMALL)
92 {
94 << "Limit parameter to [0-1] range: " << lambda << nl;
95 }
96 #endif
97
98 if (lambda < SMALL)
99 {
100 return firstPoint();
101 }
102 else if (lambda >= 1 - SMALL)
103 {
104 return lastPoint();
105 }
106
107 return firstPoint() + lambda * (lastPoint() - firstPoint());
108}
109
110
111// ************************************************************************* //
const pointField & points_
The referenced point field.
Definition blockEdge.H:69
blockEdge(const pointField &points, const label from, const label to)
Construct from components.
Definition blockEdge.H:106
point linearPosition(const scalar lambda) const
The point position in the straight line.
Definition blockEdgeI.H:81
bool good() const noexcept
True if first/last indices are unique and non-negative.
Definition blockEdgeI.H:24
const point & lastPoint() const
The location of the last point.
Definition blockEdgeI.H:48
const label end_
Index of the last point.
Definition blockEdge.H:79
label end() const noexcept
Index of end (last) point.
Definition blockEdgeI.H:36
label start() const noexcept
Index of start (first) point.
Definition blockEdgeI.H:30
const label start_
Index of the first point.
Definition blockEdge.H:74
int compare(const blockEdge &e) const
Compare the given start/end points with this block edge.
Definition blockEdgeI.H:69
const point & firstPoint() const
The location of the first point.
Definition blockEdgeI.H:42
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Definition edge.H:62
#define InfoInFunction
Report an information message using Foam::Info.
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
volScalarField & e
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)