Began porting the mapping system
This commit is contained in:
31
src/include/serif/utils/checks/finite.hpp
Normal file
31
src/include/serif/utils/checks/finite.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "mfem/linalg/vector.hpp"
|
||||
#include "mfem/linalg/densemat.hpp"
|
||||
|
||||
namespace serif::utils::checks {
|
||||
// If we have a new backend / new vector and matrix type in the future we can add new overloads
|
||||
inline bool is_finite(const mfem::Vector& vector) {
|
||||
for (int i = 0; i < vector.Size(); ++i) {
|
||||
if (!std::isfinite(vector(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool is_finite(const mfem::DenseMatrix& matrix) {
|
||||
for (int i = 0; i < matrix.Height(); ++i) {
|
||||
for (int j = 0; j < matrix.Width(); ++j) {
|
||||
if (!std::isfinite(matrix(i, j))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,18 @@ namespace serif::utils::errors {
|
||||
EOS_NONFINITE_RESULT,
|
||||
EOS_INVALID_THERMODYNAMIC_INPUT,
|
||||
|
||||
// Mapping Errors
|
||||
INVALID_DIMENSION = 400,
|
||||
NON_FINITE_MAPPING_INPUT,
|
||||
INVALID_REFERENCE_RADIUS,
|
||||
AT_COMPACTIFIED_INFINITY,
|
||||
OUTSIDE_REFERENCE_DOMAIN,
|
||||
NON_FINITE_MAPPING_RESULT,
|
||||
NON_POSITIVE_DETERMINATE,
|
||||
|
||||
IMPROPERLY_ORDERED_REFERENCE_RADII = 450,
|
||||
INVALID_COORDINATE_TOLERANCE,
|
||||
|
||||
// COMPILE TIME FAILURES (>1000)
|
||||
// Type Invariant Failures
|
||||
FAILED_TYPE_INVARIANT = 1000
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/utils/types/tensor/tensor.hpp"
|
||||
|
||||
namespace serif::utils::types::backend::mfem {
|
||||
|
||||
}
|
||||
31
src/include/serif/utils/types/tensor/tensor.hpp
Normal file
31
src/include/serif/utils/types/tensor/tensor.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
|
||||
namespace serif::utils::types {
|
||||
template <typename T>
|
||||
struct VectorBase {
|
||||
using Type = T;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct DenseMatrixBase {
|
||||
using Type = T;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct SparseMatrixBase{
|
||||
using Type = T;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t Rank>
|
||||
struct DenseTensorBase {
|
||||
using Type = T;
|
||||
static constexpr std::size_t rank = Rank;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t Rank>
|
||||
struct SparseTensorBase {
|
||||
using Type = T;
|
||||
static constexpr std::size_t rank = Rank;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace serif::utils::user_options {
|
||||
struct KelvinCompactificationOptions
|
||||
{
|
||||
double r_star_ref{1.0};
|
||||
double r_inf_ref{2.0};
|
||||
double coordinate_tolerance{1.0e-12};
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user