triIntersectLocation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2022 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 Description
25  Class to encapsulate the topology of a point within a triangle intersection
26 
27 SourceFiles
28  triIntersectLocationI.H
29  triIntersectLocationIO.C
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef triIntersectLocation_H
34 #define triIntersectLocation_H
35 
36 #include "labelPair.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 // Forward declaration of classes
44 class Ostream;
45 
46 namespace triIntersect
47 {
48 
49 // Forward declaration of friend functions and operators
50 class location;
51 bool operator==(const location& a, const location& b);
52 bool operator!=(const location& a, const location& b);
53 Ostream& operator<<(Ostream&, const location&);
54 
55 /*---------------------------------------------------------------------------*\
56  Class location Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class location
60 :
61  private labelPair
62 {
63  private:
64 
65  // Private Static Member Functions
66 
67  //- Return the null index
68  inline static label noi();
69 
70 
71  // Private Constructors
72 
73  //- Construct from a source index and a target index
74  inline location(const label srci, const label tgti);
75 
76 
77  public:
78 
79  // Static Member Functions
80 
81  //- Construct a source point location
82  inline static location srcPoint(const label srcPi);
83 
84  //- Construct a target point location
85  inline static location tgtPoint(const label tgtPi);
86 
87  //- Construct a source and target point location
88  inline static location srcTgtPoint
89  (
90  const label srcPi,
91  const label tgtPi
92  );
93 
94  //- Construct an intersection location between a source and a
95  // target edge
96  inline static location intersection
97  (
98  const label srcEi,
99  const label tgtEi
100  );
101 
102 
103  // Constructors
104 
105  //- Construct null
106  inline location();
107 
108 
109  // Member Functions
110 
111  //- Return whether the location is null
112  inline bool isNull() const;
113 
114  //- Return whether the location is a source point
115  inline bool isSrcPoint() const;
116 
117  //- Return whether the location is a target point
118  inline bool isTgtPoint() const;
119 
120  //- Return whether the location is a source point and not a target
121  // point
122  inline bool isSrcNotTgtPoint() const;
123 
124  //- Return whether the location is a target point and not a source
125  // point
126  inline bool isTgtNotSrcPoint() const;
127 
128  //- Return whether the location is a source point and a target point
129  inline bool isSrcAndTgtPoint() const;
130 
131  //- Return whether the location is an intersection
132  inline bool isIntersection() const;
133 
134  //- Return the source point index
135  inline label srcPointi() const;
136 
137  //- Return the target point index
138  inline label tgtPointi() const;
139 
140  //- Return the source edge index
141  inline label srcEdgei() const;
142 
143  //- Return the target edge index
144  inline label tgtEdgei() const;
145 
146 
147  // Friend Operators
148 
149  //- Test if locations are the same
150  inline friend bool operator==(const location& a, const location& b);
151 
152  //- Test if locations are not the same
153  inline friend bool operator!=(const location& a, const location& b);
154 
155 
156  // IOstream Operators
157 
158  //- Output the location to a stream
159  friend Ostream& operator<<(Ostream& os, const location& l);
160 };
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace triIntersect
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 template<>
169 inline bool contiguous<triIntersect::location>()
170 {
171  return true;
172 }
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #include "triIntersectLocationI.H"
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
friend bool operator==(const location &a, const location &b)
Test if locations are the same.
bool isTgtNotSrcPoint() const
Return whether the location is a target point and not a source.
bool isIntersection() const
Return whether the location is an intersection.
bool isSrcPoint() const
Return whether the location is a source point.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
Definition: createFields.H:27
static location tgtPoint(const label tgtPi)
Construct a target point location.
friend bool operator!=(const location &a, const location &b)
Test if locations are not the same.
Ostream & operator<<(Ostream &os, const FixedList< FixedList< Type, 3 >, 3 > &l)
Print 3x3 FixedListLists on one line.
Definition: triIntersect.C:66
static location srcPoint(const label srcPi)
Construct a source point location.
bool isSrcNotTgtPoint() const
Return whether the location is a source point and not a target.
static location srcTgtPoint(const label srcPi, const label tgtPi)
Construct a source and target point location.
bool isTgtPoint() const
Return whether the location is a target point.
label tgtPointi() const
Return the target point index.
label srcPointi() const
Return the source point index.
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
bool operator==(const location &a, const location &b)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool operator!=(const location &a, const location &b)
bool isSrcAndTgtPoint() const
Return whether the location is a source point and a target point.
static location intersection(const label srcEi, const label tgtEi)
Construct an intersection location between a source and a.
friend Ostream & operator<<(Ostream &os, const location &l)
Output the location to a stream.
bool isNull() const
Return whether the location is null.
label tgtEdgei() const
Return the target edge index.
label srcEdgei() const
Return the source edge index.
Namespace for OpenFOAM.