Directory: | ./ |
---|---|
File: | Geometry/point.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 22 | 29 | 75.9% |
Branches: | 3 | 6 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: J-F. Gerbeau | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Geometry/point.hpp" | ||
21 | #include "Core/felisce_error.hpp" | ||
22 | |||
23 | namespace felisce | ||
24 | { | ||
25 | 11336 | const std::array<double, 3>& Point::getCoor() const | |
26 | { | ||
27 | 11336 | return m_coor; | |
28 | } | ||
29 | |||
30 | /***********************************************************************************/ | ||
31 | /***********************************************************************************/ | ||
32 | |||
33 | 6011274 | std::array<double, 3>& Point::getCoor() | |
34 | { | ||
35 | 6011274 | return m_coor; | |
36 | } | ||
37 | |||
38 | /***********************************************************************************/ | ||
39 | /***********************************************************************************/ | ||
40 | |||
41 | 17888 | void Point::getCoor(std::vector<double>& coord) | |
42 | { | ||
43 |
2/2✓ Branch 1 taken 37216 times.
✓ Branch 2 taken 17888 times.
|
55104 | for(std::size_t i = 0; i < coord.size(); ++i) |
44 | 37216 | coord[i] = m_coor[i]; | |
45 | 17888 | } | |
46 | |||
47 | /***********************************************************************************/ | ||
48 | /***********************************************************************************/ | ||
49 | |||
50 | 1 | void Point::setCoor(const std::vector<double>& coord) | |
51 | { | ||
52 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if ( coord.size() != 3 ) { |
53 | ✗ | FEL_ERROR("expecting 3 coordinates") | |
54 | } | ||
55 | 1 | m_coor[0] = coord[0]; | |
56 | 1 | m_coor[1] = coord[1]; | |
57 | 1 | m_coor[2] = coord[2]; | |
58 | 1 | } | |
59 | |||
60 | /***********************************************************************************/ | ||
61 | /***********************************************************************************/ | ||
62 | |||
63 | 1 | void Point::setCoor(const std::array<double, 3>& coord) | |
64 | { | ||
65 | 1 | m_coor = coord; | |
66 | 1 | } | |
67 | |||
68 | /***********************************************************************************/ | ||
69 | /***********************************************************************************/ | ||
70 | |||
71 | 1 | void Point::setCoor(const double* coord) | |
72 | { | ||
73 | 1 | m_coor[0] = coord[0]; | |
74 | 1 | m_coor[1] = coord[1]; | |
75 | 1 | m_coor[2] = coord[2]; | |
76 | 1 | } | |
77 | |||
78 | /***********************************************************************************/ | ||
79 | /***********************************************************************************/ | ||
80 | |||
81 | ✗ | void Point::print( | |
82 | const std::size_t verbose, | ||
83 | std::ostream& outstr | ||
84 | ) const | ||
85 | { | ||
86 | ✗ | if(verbose) { | |
87 | ✗ | outstr << "[" << m_coor[0] << ", " << m_coor[1] << ", " << m_coor[2] << "] " | |
88 | ✗ | << "\n"; | |
89 | } | ||
90 | } | ||
91 | |||
92 | /***********************************************************************************/ | ||
93 | /***********************************************************************************/ | ||
94 | |||
95 | ✗ | void Point::printWithTab(std::ostream& outstr) const | |
96 | { | ||
97 | ✗ | outstr <<m_coor[0] << '\t' << m_coor[1] << '\t' << m_coor[2]; | |
98 | } | ||
99 | |||
100 | } | ||
101 |