mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-16 02:48:23 +01:00
refactor: Use assert instead of custom throw for invalid argument in TugUtils.hpp
This commit is contained in:
parent
16fbefa9ed
commit
9aafb3e184
@ -1,9 +1,6 @@
|
|||||||
#ifndef TUGUTILS_H_
|
#pragma once
|
||||||
#define TUGUTILS_H_
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <cassert>
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#define throw_invalid_argument(msg) \
|
#define throw_invalid_argument(msg) \
|
||||||
throw std::invalid_argument(std::string(__FILE__) + ":" + \
|
throw std::invalid_argument(std::string(__FILE__) + ":" + \
|
||||||
@ -24,6 +21,8 @@
|
|||||||
duration.count(); \
|
duration.count(); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define tug_assert(expr, msg) assert((expr) && msg)
|
||||||
|
|
||||||
// calculates arithmetic or harmonic mean of alpha between two cells
|
// calculates arithmetic or harmonic mean of alpha between two cells
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr T calcAlphaIntercell(T alpha1, T alpha2, bool useHarmonic = true) {
|
constexpr T calcAlphaIntercell(T alpha1, T alpha2, bool useHarmonic = true) {
|
||||||
@ -38,4 +37,3 @@ constexpr T calcAlphaIntercell(T alpha1, T alpha2, bool useHarmonic = true) {
|
|||||||
return 0.5 * (alpha1 + alpha2);
|
return 0.5 * (alpha1 + alpha2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // TUGUTILS_H_
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user