24#ifndef VULPES_LA_TENSOR_HPP_
25#define VULPES_LA_TENSOR_HPP_
29#include <petscviewerhdf5.h>
54 std::is_same_v<double, PetscScalar>,
55 "Tensor requires PetscScalar to be double");
60 Eigen::Map<const Eigen::Matrix<double, Dim, Dim, Eigen::RowMajor>>;
72 explicit Tensor(
const std::string& filename,
const std::string& dataset_name)
76 PetscObjectSetName((PetscObject)
m_vec_data, dataset_name.c_str()));
80 PETSC_COMM_WORLD, filename.c_str(), FILE_MODE_READ, &viewer));
100 const PetscInt components_per_cell = Dim * Dim;
115 template <
int Dim,
typename IndexT>
auto getEvaluation(IndexT local_index) const
Get the evaluated tensor for a specific local cell id.
Definition tensor.hpp:116
Vec m_vec_data
Store the complete flat tensor in a PETsc vector.
Definition tensor.hpp:131
Tensor(const Tensor &)=delete
const PetscScalar * m_raw_ptr
Pointer to the PETSc data. Used to avoid multiple redefinition.
Definition tensor.hpp:133
~Tensor()
Definition tensor.hpp:120
Tensor(const std::string &filename, const std::string &dataset_name)
Construct a Tensor by loading data from HDF5. The class can manage only cell constant tensors.
Definition tensor.hpp:72
Eigen::Map< const Eigen::Matrix< double, Dim, Dim, Eigen::RowMajor > > LocalMap
Definition tensor.hpp:59
Tensor & operator=(const Tensor &)=delete
LocalMap< Dim > getEigenMap(PetscInt local_index) const
Get the tensor for a specific local cell id throw an Eigen Map.
Definition tensor.hpp:99
Definition boomer_amg.hpp:27
Definition cell_manager.hpp:38
#define PetscCallAbortWorld(...)
Definition petsc_utils.hpp:32