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 * * * * * * * * * * * * * //
30
31inline bool Foam::blockEdge::valid() const noexcept
32{
33 return (start_ != end_ && start_ >= 0 && end_ >= 0);
34}
35
36
37inline Foam::label Foam::blockEdge::start() const noexcept
38{
39 return start_;
40}
41
42
43inline Foam::label Foam::blockEdge::end() const noexcept
44{
45 return end_;
46}
47
48
50{
51 return points_[start_];
52}
53
54
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
75
76inline int Foam::blockEdge::compare(const blockEdge& e) const
77{
78 return Foam::blockEdge::compare(e.start(), e.end());
79}
80
81
82inline int Foam::blockEdge::compare(const edge& e) const
83{
84 return Foam::blockEdge::compare(e.start(), e.end());
85}
86
87
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// ************************************************************************* //
iterator end() noexcept
Return an iterator to end traversing the UList.
Definition: UListI.H:350
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
Definition: blockEdge.H:64
point linearPosition(const scalar lambda) const
The point position in the straight line.
Definition: blockEdgeI.H:88
const point & lastPoint() const
The location of the last point.
Definition: blockEdgeI.H:55
bool valid() const noexcept
True if first/last indices are unique and non-negative.
Definition: blockEdgeI.H:31
const label end_
Index of the last point.
Definition: blockEdge.H:76
label end() const noexcept
Index of end (last) point.
Definition: blockEdgeI.H:43
label start() const noexcept
Index of start (first) point.
Definition: blockEdgeI.H:37
const label start_
Index of the first point.
Definition: blockEdge.H:73
int compare(const blockEdge &e) const
Compare the given start/end points with this block edge.
Definition: blockEdgeI.H:76
const point & firstPoint() const
The location of the first point.
Definition: blockEdgeI.H:49
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
#define InfoInFunction
Report an information message using Foam::Info.
const direction noexcept
Definition: Scalar.H:223
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
volScalarField & e
Definition: createFields.H:11
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)