KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
amgcl_distributed_csr_spmm_utilities.h
Go to the documentation of this file.
1 
2 // | / |
3 // ' / __| _` | __| _ \ __|
4 // . \ | ( | | ( |\__ \.
5 // _|\_\_| \__,_|\__|\___/ ____/
6 // Multi-Physics
7 //
8 // License: BSD License
9 // Kratos default license: kratos/license.txt
10 //
11 // Main authors: Riccardo Rossi
12 //
13 //
14 
15 #if !defined(KRATOS_CSR_SPMM_UTILITIES_H_INCLUDED)
16 #define KRATOS_CSR_SPMM_UTILITIES_H_INCLUDED
17 
18 // System includes
19 
20 // External includes
21 #include <amgcl/backend/builtin.hpp>
22 #include <amgcl/adapter/zero_copy.hpp>
23 
24 // Project includes
25 #include "containers/csr_matrix.h"
27 
28 namespace Kratos
29 {
30 
35 {
36 
37 public:
38 
42  template< class TDataType=double, class TIndexType=std::size_t >
46  )
47  {
48  bool move_to_backend=false;
49 
50  auto Aoffdiag_global_index2 = rA.GetOffDiagonalIndex2DataInGlobalNumbering();
51 
52  auto pAamgcl = AmgclDistributedCSRConversionUtilities::ConvertToAmgcl<double,IndexType>
53  (rA,Aoffdiag_global_index2,move_to_backend);
54 
55  auto Boffdiag_global_index2 = rB.GetOffDiagonalIndex2DataInGlobalNumbering();
56  auto pBamgcl = AmgclDistributedCSRConversionUtilities::ConvertToAmgcl<double,IndexType>
57  (rB,Boffdiag_global_index2,move_to_backend);
58 
59  auto Camgcl = product(*pAamgcl, *pBamgcl);
60 
61  sort_rows(*Camgcl);
62 
63  return AmgclDistributedCSRConversionUtilities::ConvertToCsrMatrix<TDataType,IndexType>(*Camgcl, rA.GetComm());
64  }
65 
66 
67 
68 };
69 
70 }
71 
72 #endif // KRATOS_CSR_SPMM_UTILITIES_H_INCLUDED
Definition: amgcl_distributed_csr_spmm_utilities.h:35
static DistributedCsrMatrix< TDataType, TIndexType >::Pointer SparseMultiply(const DistributedCsrMatrix< TDataType, TIndexType > &rA, const DistributedCsrMatrix< TDataType, TIndexType > &rB)
Definition: amgcl_distributed_csr_spmm_utilities.h:43
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: distributed_csr_matrix.h:58
const DataCommunicator & GetComm() const
Definition: distributed_csr_matrix.h:329
DenseVector< TIndexType > GetOffDiagonalIndex2DataInGlobalNumbering() const
Definition: distributed_csr_matrix.h:431
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21