Tensorium
Loading...
Searching...
No Matches
BSSNTildeChristoffel.hpp
Go to the documentation of this file.
1
10#pragma once
11
12#include "../../Core/Tensor.hpp"
13#include "../../Core/Vector.hpp"
14#include <cassert>
15#include <cstddef>
16#include <stdexcept>
17
18namespace tensorium_RG {
38template <typename T> class TildeGamma {
39 public:
57 static void compute(const tensorium::Tensor<T, 2> &gamma_tilde_inv,
58 const tensorium::Tensor<T, 3> &christoffel,
59 tensorium::Vector<T> &tildeGamma) {
60 if (gamma_tilde_inv.shape() != std::array<size_t, 2>{3, 3})
61 throw std::invalid_argument("gamma_tilde_inv must be 3x3");
62 if (christoffel.shape() != std::array<size_t, 3>{3, 3, 3})
63 throw std::invalid_argument("christoffel must be 3x3x3");
64
65 tildeGamma.resize(3);
66 for (size_t i = 0; i < 3; ++i) {
67 T sum = 0.0;
68 for (size_t j = 0; j < 3; ++j) {
69 for (size_t k = 0; k < 3; ++k) {
70 sum += gamma_tilde_inv(j, k) * christoffel(i, j, k);
71 }
72 }
73 tildeGamma[i] = sum;
74 }
75 }
76};
77} // namespace tensorium_RG
Multi-dimensional tensor class with fixed rank and SIMD support.
Definition Tensor.hpp:25
void resize(const std::array< size_t, Rank > &dims)
Resize 2D tensor.
Definition Tensor.hpp:70
std::array< size_t, Rank > shape() const
Definition Tensor.hpp:62
Computes the contracted conformal Christoffel vector .
Definition BSSNTildeChristoffel.hpp:38
static void compute(const tensorium::Tensor< T, 2 > &gamma_tilde_inv, const tensorium::Tensor< T, 3 > &christoffel, tensorium::Vector< T > &tildeGamma)
Computes .
Definition BSSNTildeChristoffel.hpp:57
Definition BSSNAtildeTensor.hpp:10