-
Notifications
You must be signed in to change notification settings - Fork 17
/
grid_output.cpp
64 lines (50 loc) · 1.46 KB
/
grid_output.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2019 AUTHORS
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "octotiger/defs.hpp"
#include "octotiger/grid.hpp"
#include "octotiger/options.hpp"
#include "octotiger/physcon.hpp"
#include "octotiger/radiation/rad_grid.hpp"
#include <hpx/include/lcos.hpp>
#include <silo.h>
#include <atomic>
#include <cmath>
#include <fstream>
#include <iosfwd>
#include <thread>
// TODO (daissgr) Use this mutex or the one in hpx directly? (conflixing declaration here)
// namespace hpx {
// using mutex = hpx::lcos::local::spinlock;
// }
std::vector<std::vector<real>>& TLS_V();
#include <unordered_map>
inline bool float_eq(xpoint_type a, xpoint_type b) {
constexpr static xpoint_type eps = 0.00000011920928955078125; // std::pow(xpoint_type(2), -23);
// const xpoint_type eps = std::pow(xpoint_type(2), -23);
return std::abs(a - b) < eps;
}
bool grid::xpoint_eq(const xpoint& a, const xpoint& b) {
bool rc = true;
for (integer d = 0; d != NDIM; ++d) {
if (!float_eq(a[d], b[d])) {
rc = false;
break;
}
}
return rc;
}
bool grid::node_point::operator==(const node_point& other) const {
return xpoint_eq(other.pt, pt);
}
bool grid::node_point::operator<(const node_point& other) const {
bool rc = false;
for (integer d = 0; d != NDIM; ++d) {
if (!float_eq(pt[d], other.pt[d])) {
rc = (pt[d] < other.pt[d]);
break;
}
}
return rc;
}