Debian Codegraph @

src/atlas/interpolation/method/Intersect.h

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #pragma once
12
13 #include <iosfwd>
14
15 namespace atlas {
16 namespace interpolation {
17 namespace method {
18
19 //----------------------------------------------------------------------------------------------------------------------
20
21 /// Intersection data structure
22
23 struct Intersect {
24 double u;
25 double v;
26 double t;
27
28 Intersect();
29
30 operator bool() const { return success_; }
31
32 Intersect& success() {
33 success_ = true;
34 return *this;
35 }
36 Intersect& fail() {
37 success_ = false;
38 return *this;
39 }
40
41 void print(std::ostream& s) const;
42
43 friend std::ostream& operator<<(std::ostream& s, const Intersect& p) {
44 p.print(s);
45 return s;
46 }
47
48 private:
49 bool success_;
50 };
51
52 //----------------------------------------------------------------------------------------------------------------------
53
54 } // namespace method
55 } // namespace interpolation
56 } // namespace atlas