16 #if !defined(KRATOS_CSR_CONVERSION_UTILITIES_H_INCLUDED)
17 #define KRATOS_CSR_CONVERSION_UTILITIES_H_INCLUDED
22 #include <amgcl/backend/builtin.hpp>
23 #include <amgcl/adapter/zero_copy.hpp>
24 #include <span/span.hpp>
43 template<
class TDataType,
class TIndexType >
53 pAmgcl->ncols = rA.
size2();
54 pAmgcl->own_data =
false;
61 template<
class TDataType,
class TIndexType >
63 typename amgcl::backend::builtin<TDataType>::matrix& rA
66 auto pAconverted = Kratos::make_unique<CsrMatrix<TDataType, TIndexType>>();
68 if(rA.own_data ==
false){
69 pAconverted->SetIsOwnerOfData(
false);
73 pAconverted->SetIsOwnerOfData(
true);
76 pAconverted->SetRowSize(rA.nrows);
77 pAconverted->SetColSize(rA.ncols);
78 pAconverted->AssignIndex1Data((TIndexType*)(rA.ptr), rA.nrows+1);
79 pAconverted->AssignIndex2Data((TIndexType*)(rA.col), rA.nnz);
80 pAconverted->AssignValueData((TDataType*)(rA.val), rA.nnz);
85 template<
class TDataType,
class TIndexType >
90 const auto pAamgcl = ConvertToAmgcl<TDataType,TIndexType>(rA);
92 const auto pAamgcl_transpose = amgcl::backend::transpose(*pAamgcl);
94 return ConvertToCsrMatrix<TDataType,TIndexType>(*pAamgcl_transpose);
Definition: amgcl_csr_conversion_utilities.h:36
static CsrMatrix< TDataType, TIndexType >::Pointer Transpose(CsrMatrix< TDataType, TIndexType > &rA)
Definition: amgcl_csr_conversion_utilities.h:86
static Kratos::shared_ptr< typename amgcl::backend::builtin< TDataType >::matrix > ConvertToAmgcl(const CsrMatrix< TDataType, TIndexType > &rA)
Definition: amgcl_csr_conversion_utilities.h:44
static CsrMatrix< TDataType, TIndexType >::UniquePointer ConvertToCsrMatrix(typename amgcl::backend::builtin< TDataType >::matrix &rA)
Definition: amgcl_csr_conversion_utilities.h:62
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: csr_matrix.h:60
Kratos::span< TDataType > & value_data()
Definition: csr_matrix.h:273
IndexType size1() const
Definition: csr_matrix.h:240
IndexType size2() const
Definition: csr_matrix.h:245
Kratos::span< IndexType > & index2_data()
Definition: csr_matrix.h:269
Kratos::span< IndexType > & index1_data()
Definition: csr_matrix.h:265
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27