diff --git a/src/mesh/MeshNodeBoundaryUtils.cpp b/src/mesh/MeshNodeBoundaryUtils.cpp index d6a0e31cd9a671530216b9dce15747e07f06c9b4..39715d33d2f80da11dc9b11d1433320305fe2715 100644 --- a/src/mesh/MeshNodeBoundaryUtils.cpp +++ b/src/mesh/MeshNodeBoundaryUtils.cpp @@ -17,7 +17,7 @@ getBounds(const Mesh<2>& mesh, const RefNodeList& ref_node_list) R2& xmax = bounds[1]; xmin = R2{std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; - xmax = R2{-std::numeric_limits<double>::max(), -std::numeric_limits<double>::max()}; + xmax = R2{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest()}; auto update_xmin = [](const R2& x, R2& x_min) { if ((x[0] < x_min[0]) or ((x[0] == x_min[0]) and (x[1] < x_min[1]))) { @@ -118,12 +118,12 @@ getBounds(const Mesh<3>& mesh, const RefNodeList& ref_node_list) ymin = R3{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; zmin = R3{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; - xmax = - -R3{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; - ymax = - -R3{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; - zmax = - -R3{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}; + xmax = R3{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), + std::numeric_limits<double>::lowest()}; + ymax = R3{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), + std::numeric_limits<double>::lowest()}; + zmax = R3{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), + std::numeric_limits<double>::lowest()}; const NodeValue<const R3>& xr = mesh.xr(); diff --git a/src/output/WriterBase.hpp b/src/output/WriterBase.hpp index 1964068a0222bfb35304d30afab2861f3cb97383..c07c20c711e827ae566635ca82c9456bbda853ac 100644 --- a/src/output/WriterBase.hpp +++ b/src/output/WriterBase.hpp @@ -61,7 +61,7 @@ class WriterBase : public IWriter if (m_saved_times.size() > 0) { return m_saved_times[m_saved_times.size() - 1]; } else { - return -std::numeric_limits<double>::max(); + return std::numeric_limits<double>::lowest(); } } @@ -77,7 +77,8 @@ class WriterBase : public IWriter PeriodManager(const PeriodManager&) = default; PeriodManager(PeriodManager&&) = default; - PeriodManager(double time_period) : m_time_period{time_period}, m_next_time{-std::numeric_limits<double>::max()} {} + PeriodManager(double time_period) : m_time_period{time_period}, m_next_time{std::numeric_limits<double>::lowest()} + {} }; protected: diff --git a/src/utils/SmallArray.hpp b/src/utils/SmallArray.hpp index 9e0782f1c0adb0b9bfa4bcf25bcaa8977a3800d4..81d70a848187216e82cf80c5208f96cb64e05dfa 100644 --- a/src/utils/SmallArray.hpp +++ b/src/utils/SmallArray.hpp @@ -25,12 +25,14 @@ class [[nodiscard]] SmallArray friend SmallArray<std::add_const_t<DataType>>; public: - PUGS_INLINE size_t size() const noexcept + PUGS_INLINE size_t + size() const noexcept { return m_size; } - friend PUGS_INLINE SmallArray<std::remove_const_t<DataType>> copy(const SmallArray<DataType>& source) + friend PUGS_INLINE SmallArray<std::remove_const_t<DataType>> + copy(const SmallArray<DataType>& source) { SmallArray<std::remove_const_t<DataType>> image(source.m_size); std::copy(source.m_values.get(), source.m_values.get() + source.m_size, image.m_values.get()); @@ -38,28 +40,31 @@ class [[nodiscard]] SmallArray return image; } - friend PUGS_INLINE void copy_to(const SmallArray<DataType>& source, - const SmallArray<std::remove_const_t<DataType>>& destination) + friend PUGS_INLINE void + copy_to(const SmallArray<DataType>& source, const SmallArray<std::remove_const_t<DataType>>& destination) { Assert(source.size() == destination.size()); std::copy(source.m_values.get(), source.m_values.get() + source.m_size, destination.m_values.get()); } - PUGS_INLINE DataType& operator[](index_type i) const noexcept(NO_ASSERT) + PUGS_INLINE DataType& + operator[](index_type i) const noexcept(NO_ASSERT) { Assert(i < m_size); return m_values[i]; } PUGS_INLINE - void fill(const DataType& data) const + void + fill(const DataType& data) const { static_assert(not std::is_const_v<DataType>, "Cannot modify SmallArray of const"); std::fill(m_values.get(), m_values.get() + m_size, data); } template <typename DataType2> - PUGS_INLINE SmallArray& operator=(const SmallArray<DataType2>& array) noexcept + PUGS_INLINE SmallArray& + operator=(const SmallArray<DataType2>& array) noexcept { // ensures that DataType is the same as source DataType2 static_assert(std::is_same<std::remove_const_t<DataType>, std::remove_const_t<DataType2>>(), @@ -99,7 +104,8 @@ class [[nodiscard]] SmallArray #endif // NDEBUG } - friend std::ostream& operator<<(std::ostream& os, const SmallArray& x) + friend std::ostream& + operator<<(std::ostream& os, const SmallArray& x) { if (x.size() > 0) { os << 0 << ':' << NaNHelper(x[0]); @@ -117,13 +123,14 @@ class [[nodiscard]] SmallArray SmallArray(const SmallArray&) = default; template <typename DataType2> - PUGS_INLINE SmallArray(const SmallArray<DataType2>& array) noexcept + PUGS_INLINE + SmallArray(const SmallArray<DataType2>& array) noexcept { this->operator=(array); } PUGS_INLINE - SmallArray(SmallArray &&) = default; + SmallArray(SmallArray&&) = default; PUGS_INLINE ~SmallArray() = default; @@ -172,7 +179,7 @@ max(const SmallArray<DataType>& array) using data_type = std::remove_const_t<DataType>; using index_type = typename SmallArray<DataType>::index_type; - data_type max_value = -std::numeric_limits<data_type>::max(); + data_type max_value = std::numeric_limits<data_type>::lowest(); for (index_type i = 0; i < array.size(); ++i) { if (array[i] > max_value) { max_value = array[i];