hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
misc.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// Copyright (c) 2026, rcana-project
4// Copyright (c) 2026, Liam Pohlmann
5//
6// Portions of this file are derived from rcana-project and starling.
7
8#ifndef HUMMINGBIRD_UTILS_MISC_H_
9#define HUMMINGBIRD_UTILS_MISC_H_
10
11#include "utils/constants.h"
12
13namespace hummingbird {
14/**
15 * @brief Tests if two double-type numbers are equal using the TOLERANCE
16 * value. Taken from https://github.com/starling
17 *
18 * @param first First number to compare
19 * @param second Second number to compare
20 * @param tolerance Tolerance for the absolute difference between the first and
21 * second values
22 * @return true
23 * @return false
24 */
25bool DoubleEqual(const double first, const double second,
26 const double tolerance = TOLERANCE);
27
28/**
29 * @brief Compute the relative error between two values
30 *
31 * @param new_val New value
32 * @param old_val Old value
33 * @return double
34 */
35double RelativeError(const double new_val, const double old_val);
36} // namespace hummingbird
37
38#endif // HUMMINGBIRD_UTILS_MISC_H_
bool DoubleEqual(const double first, const double second, const double tolerance=TOLERANCE)
Tests if two double-type numbers are equal using the TOLERANCE value. Taken from https://github....
Definition misc.cc:9
double RelativeError(const double new_val, const double old_val)
Compute the relative error between two values.
Definition misc.cc:15
constexpr double TOLERANCE
General tolerance value for double comparisons.
Definition constants.h:10