12#ifndef __PETSc_SparseArray_HPP
13#define __PETSc_SparseArray_HPP
15#include "Gedim_Macro.hpp"
28template <
typename PETSc_ArrayType = Vec,
typename PETSc_SparseArrayType = Mat>
29class PETSc_SparseArray final :
public ISparseArray
33 SparseArrayTypes _matrixType;
38 _matrixType = SparseArrayTypes::None;
71 void SetSize(
const unsigned int &
numRows,
const unsigned int &
numCols,
const SparseArrayTypes &
type = SparseArrayTypes::None);
73 inline SparseArrayTypes Type()
const
83 void Triplet(
const unsigned int &i,
const unsigned int &j,
const double &value);
85 void Triplets(
const std::vector<unsigned int> &i,
const std::vector<unsigned int> &j,
const std::vector<double> &values);
89 inline ISparseArray &
operator+=(
const ISparseArray &A)
94 inline ISparseArray &
operator-=(
const ISparseArray &A)
110 unsigned int rows()
const;
111 unsigned int cols()
const;
115 throw std::runtime_error(
"unimplemented method");
118 void ToBinaryFile(
const std::string &,
const bool &)
const
120 throw std::runtime_error(
"unimplemented method");
123 inline double Norm()
const
132 throw std::runtime_error(
"unimplemented method");
135 unsigned int NonZeros()
const;
std::ostream & Print(std::ostream &output) const
Print the array.
Definition Eigen_Array.hpp:135
double Norm() const
Definition Eigen_Array.hpp:193
Eigen_ArrayType & Cast(IArray &v)
Definition Eigen_Array.hpp:51
void SetSize(const unsigned int &numCols)
Set the size the Array. Resize a Array for Eigen application.
Definition Eigen_Array.hpp:66
IArray & operator+=(const IArray &v)
Definition Eigen_Array.hpp:140
IArray & operator-=(const IArray &v)
Definition Eigen_Array.hpp:145
void Destroy()
Definition Eigen_Array.hpp:63
void ToBinaryFile(const std::string &filePath, const unsigned int &dataSizeToWrite=0, const unsigned int &dataStartingPositionToWrite=0, const bool &append=false) const
Write array to binary file.
Definition Eigen_Array.cpp:111
void Create()
Matrix create call. Last call to complete the matrix structure.
Definition Eigen_Array.hpp:60
IArray & operator*=(const double &c)
Definition Eigen_Array.hpp:150
Eigen_Array()
Definition Eigen_Array.hpp:28
IArray & operator/=(const double &c)
Definition Eigen_Array.hpp:155
Eigen_Array< Eigen_ArrayType, Eigen_SparseArrayType > & operator=(Eigen_ArrayType &&vector)
Definition Eigen_Array.hpp:182
ConditionNumberAlgorithm
Definition ISparseArray.hpp:37
Definition Eigen_Array.cpp:22