Ultra-lightweight wrapper for PETSc Vec with Eigen mapping. Loads only the data and maps it using externally provided cell IDs. For now it considers only tensors which are stored in a flatten array.
More...
#include <tensor.hpp>
|
| | 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.
|
| | Tensor (const Tensor &)=delete |
| Tensor & | operator= (const Tensor &)=delete |
| template<int Dim> |
| LocalMap< Dim > | getEigenMap (PetscInt local_index) const |
| | Get the tensor for a specific local cell id throw an Eigen Map.
|
| template<int Dim, typename IndexT> |
| auto | getEvaluation (IndexT local_index) const |
| | Get the evaluated tensor for a specific local cell id.
|
| | ~Tensor () |
|
| Vec | m_vec_data |
| | Store the complete flat tensor in a PETsc vector.
|
| const PetscScalar * | m_raw_ptr = nullptr |
| | Pointer to the PETSc data. Used to avoid multiple redefinition.
|
Ultra-lightweight wrapper for PETSc Vec with Eigen mapping. Loads only the data and maps it using externally provided cell IDs. For now it considers only tensors which are stored in a flatten array.
TODO: general form of tensor (N, Ni,Nj).
◆ LocalMap
Initial value:
Eigen::Map<const Eigen::Matrix<double, Dim, Dim, Eigen::RowMajor>>
◆ Tensor() [1/2]
| vulpes::la::Tensor::Tensor |
( |
const std::string & | filename, |
|
|
const std::string & | dataset_name ) |
|
inlineexplicit |
Construct a Tensor by loading data from HDF5. The class can manage only cell constant tensors.
- Parameters
-
| filename | Path to the .h5 file. |
| dataset_name | Internal HDF5 path (e.g., "/DTI/vector_0"). |
- Note
- The tensor must be stored in a flatten way and the values must be stored using the cell id order. The starting location in the flatten version of the tensor inside the file for cell id \( i \) is given by \(i * Dim * Dim \).
◆ Tensor() [2/2]
| vulpes::la::Tensor::Tensor |
( |
const Tensor & | | ) |
|
|
delete |
◆ ~Tensor()
| vulpes::la::Tensor::~Tensor |
( |
| ) |
|
|
inline |
◆ getEigenMap()
template<int Dim>
| LocalMap< Dim > vulpes::la::Tensor::getEigenMap |
( |
PetscInt | local_index | ) |
const |
|
inline |
Get the tensor for a specific local cell id throw an Eigen Map.
- Template Parameters
-
| Dim | Spatial dimension (2 or 3). |
- Parameters
-
| local_index | The local index of the cell (from 0 to n_local_cells - 1). |
- Returns
- An Eigen::Map pointing to the cell's tensor.
◆ getEvaluation()
template<int Dim, typename IndexT>
| auto vulpes::la::Tensor::getEvaluation |
( |
IndexT | local_index | ) |
const |
|
inline |
Get the evaluated tensor for a specific local cell id.
- Template Parameters
-
| Dim | Spatial dimension (2 or 3). |
| IndexT | Type of the index (automatically converted to PetscInt). |
- Parameters
-
| local_index | The local index of the cell. |
- Returns
- The evaluated Eigen matrix as a dense matrix.
◆ operator=()
◆ m_raw_ptr
| const PetscScalar* vulpes::la::Tensor::m_raw_ptr = nullptr |
|
mutableprivate |
Pointer to the PETSc data. Used to avoid multiple redefinition.
◆ m_vec_data
| Vec vulpes::la::Tensor::m_vec_data |
|
private |
Store the complete flat tensor in a PETsc vector.
The documentation for this class was generated from the following file: