13 #if !defined(KRATOS_DISTRIBUTED_CSR_MATRIX_H_INCLUDED )
14 #define KRATOS_DISTRIBUTED_CSR_MATRIX_H_INCLUDED
56 template<
class TDataType=
double,
class TIndexType=std::
size_t>
86 mpRowNumbering = Kratos::make_unique< DistributedNumbering<TIndexType> >( rSparseGraph.
GetRowNumbering());
90 TIndexType tot_col_size = max_col_index+1;
93 if (tot_col_size == mpRowNumbering->Size()) {
94 mpColNumbering = Kratos::make_unique<DistributedNumbering<TIndexType>>(*mpComm, mpRowNumbering->GetCpuBounds());
96 mpColNumbering = Kratos::make_unique<DistributedNumbering<TIndexType>>(*mpComm, tot_col_size, mpComm->
Size());
99 mOffDiagonalLocalIds.clear();
103 const TIndexType nlocal_rows = local_graph.
Size();
105 TIndexType diag_nnz = 0, offdiag_nnz=0;
106 for(
const auto& entries : local_graph) {
107 for(
const auto& global_j : entries) {
112 mOffDiagonalLocalIds[global_j] = 0;
119 for(
auto& item : mOffDiagonalLocalIds)
122 mOffDiagonalGlobalIds.resize(mOffDiagonalLocalIds.size(),
false);
124 for(
auto& item : mOffDiagonalLocalIds) {
125 TIndexType global_i = item.first;
126 mOffDiagonalGlobalIds[
counter++] = global_i;
134 for(
unsigned int i=0;
i<nlocal_rows+1; ++
i)
139 for(
const auto& entries : local_graph) {
142 for(
auto global_j : entries) {
160 for(TIndexType
i = 0;
i<nlocal_rows; ++
i) {
164 if(row_end - row_begin > 0)
173 if(offdiag_nnz == 0) {
174 for(
unsigned int i=0;
i<nlocal_rows+1; ++
i)
179 for(
const auto& entries : local_graph) {
182 for(
auto global_j : entries) {
200 for(TIndexType
i = 0;
i<nlocal_rows; ++
i) {
203 if(row_end - row_begin > 0)
210 auto pimporter = Kratos::make_unique<DistributedVectorImporter<TDataType,TIndexType>>(
GetComm(),mOffDiagonalGlobalIds,
GetColNumbering());
211 mpVectorImporter.swap(pimporter);
216 mpComm(rOtherMatrix.mpComm),
221 mNonLocalData(rOtherMatrix.mNonLocalData),
222 mOffDiagonalLocalIds(rOtherMatrix.mOffDiagonalLocalIds),
223 mOffDiagonalGlobalIds(rOtherMatrix.mOffDiagonalGlobalIds),
224 mfem_assemble_colors(rOtherMatrix.mfem_assemble_colors),
225 mRecvCachedIJ(rOtherMatrix.mRecvCachedIJ),
226 mSendCachedIJ(rOtherMatrix.mSendCachedIJ),
229 ReconstructDirectAccessVectors();
234 :mpComm(rOtherMatrix.mpComm)
236 mpRowNumbering.swap(rOtherMatrix.pGetRowNumbering());
237 mpColNumbering.swap(rOtherMatrix.pGetColNumbering());
238 mpDiagonalBlock = std::move(rOtherMatrix.mpDiagonalBlock);
239 mpOffDiagonalBlock = std::move(rOtherMatrix.mpOffDiagonalBlock);
240 mNonLocalData = std::move(rOtherMatrix.mNonLocalData);
241 mSendCachedIJ = std::move(rOtherMatrix.mSendCachedIJ);
242 mRecvCachedIJ = std::move(rOtherMatrix.mRecvCachedIJ);
243 mOffDiagonalLocalIds = std::move(rOtherMatrix.mOffDiagonalLocalIds);
244 mOffDiagonalGlobalIds = std::move(rOtherMatrix.mOffDiagonalGlobalIds);
245 mfem_assemble_colors = std::move(rOtherMatrix.mfem_assemble_colors);
246 mpVectorImporter = std::move(rOtherMatrix.mpVectorImporter);
252 mpComm = rOtherMatrix.mpComm,
253 mpRowNumbering.swap(rOtherMatrix.pGetRowNumbering());
254 mpColNumbering.swap(rOtherMatrix.pGetColNumbering());
255 mpDiagonalBlock = std::move(rOtherMatrix.mpDiagonalBlock);
256 mpOffDiagonalBlock = std::move(rOtherMatrix.mpOffDiagonalBlock);
257 mNonLocalData = std::move(rOtherMatrix.mNonLocalData);
258 mSendCachedIJ = std::move(rOtherMatrix.mSendCachedIJ);
259 mRecvCachedIJ = std::move(rOtherMatrix.mRecvCachedIJ);
260 mOffDiagonalLocalIds = std::move(rOtherMatrix.mOffDiagonalLocalIds);
261 mOffDiagonalGlobalIds = std::move(rOtherMatrix.mOffDiagonalGlobalIds);
262 mfem_assemble_colors = std::move(rOtherMatrix.mfem_assemble_colors);
263 mpVectorImporter = std::move(rOtherMatrix.mpVectorImporter);
284 return *mpRowNumbering;
289 return *mpColNumbering;
295 return mpRowNumbering;
300 return mpColNumbering;
305 return mpVectorImporter;
341 return mpDiagonalBlock;
345 return mpOffDiagonalBlock;
350 return *mpDiagonalBlock;
354 return *mpOffDiagonalBlock;
359 return *mpDiagonalBlock;
363 return *mpOffDiagonalBlock;
368 return mOffDiagonalLocalIds;
373 return mOffDiagonalLocalIds;
378 return mOffDiagonalGlobalIds;
383 return mOffDiagonalGlobalIds;
388 auto it = mOffDiagonalLocalIds.find(GlobalJ);
389 KRATOS_DEBUG_ERROR_IF( it == mOffDiagonalLocalIds.end() ) <<
"GlobalJ is not in the nonlocal list" << std::endl;
395 return mOffDiagonalGlobalIds[LocalJ];
415 KRATOS_DEBUG_ERROR_IF(
GetRowNumbering().IsLocal(GlobalI) ) <<
" local row access for GlobalI,GlobalJ = " << GlobalI <<
" " << GlobalJ <<
" expected to be nonlocal" << std::endl;
416 auto it = mNonLocalData.find(std::make_pair(GlobalI,GlobalJ));
417 KRATOS_DEBUG_ERROR_IF(it == mNonLocalData.end()) <<
" entry GlobalI,GlobalJ = " << GlobalI <<
" " << GlobalJ <<
" not found in NonLocalData" << std::endl;
442 const TDataType DiagonalValue,
447 <<
" and free_dofs_vector size " << rFreeDofsVector.
LocalSize() << std::endl;
454 auto off_diag_free = mpVectorImporter->ImportData(rFreeDofsVector);
457 <<
" and free_dofs_vector size " << rFreeDofsVector.
LocalSize() << std::endl;
459 <<
" and free_dofs_vector size " << off_diag_free.size() << std::endl;
497 auto off_diag_x = mpVectorImporter->ImportData(
x);
505 const TDataType beta,
509 auto off_diag_x = mpVectorImporter->ImportData(
x);
525 if(pTransposeExporter ==
nullptr)
530 pTransposeExporter->Apply(
y,non_local_transpose_data);
532 return pTransposeExporter;
549 if(pTransposeExporter ==
nullptr)
554 pTransposeExporter->Apply(
y,non_local_transpose_data);
556 return pTransposeExporter;
563 TDataType sum_squared = std::pow(diag_norm,2) + std::pow(off_diag_norm,2);
564 sum_squared =
GetComm().SumAll(sum_squared);
565 return std::sqrt(sum_squared);
572 for(
auto& item : mNonLocalData)
581 std::vector<TDataType> send_data;
582 std::vector<TDataType> recv_data;
585 for(
auto color : mfem_assemble_colors) {
587 const auto& direct_senddata_access = mPointersToSendValues[
color];
588 const auto& direct_recvdata_access = mPointersToRecvValues[
color];
590 send_data.resize(direct_senddata_access.size());
591 recv_data.resize(direct_recvdata_access.size());
593 for(TIndexType
i=0;
i<send_data.size(); ++
i) {
594 send_data[
i] = *(direct_senddata_access[
i]);
597 rComm.SendRecv(send_data,
color, 0, recv_data,
color, 0);
599 for(TIndexType
i=0;
i<recv_data.size(); ++
i) {
600 *(direct_recvdata_access[
i]) += recv_data[
i];
606 template<
class TMatrixType,
class TIndexVectorType >
608 const TMatrixType& rMatrixInput,
609 const TIndexVectorType& EquationId
612 KRATOS_DEBUG_ERROR_IF(rMatrixInput.size1() != EquationId.size()) <<
"sizes of matrix and equation id do not match in Assemble" << std::endl;
613 KRATOS_DEBUG_ERROR_IF(rMatrixInput.size2() != EquationId.size()) <<
"sizes of matrix and equation id do not match in Assemble" << std::endl;
615 for(
unsigned int i=0;
i<EquationId.size(); ++
i) {
616 const TIndexType global_i = EquationId[
i];
618 for(
unsigned int j = 0;
j<EquationId.size(); ++
j) {
619 const TIndexType global_j = EquationId[
j];
624 for(
unsigned int j = 0;
j<EquationId.size(); ++
j) {
625 const TIndexType global_j = EquationId[
j];
633 void AssembleEntry(
const TDataType Value,
const TIndexType GlobalI,
const TIndexType GlobalJ)
644 template<
class TMatrixType,
class TIndexVectorType >
646 const TMatrixType& rMatrixInput,
647 const TIndexVectorType& RowEquationId,
648 const TIndexVectorType& ColEquationId
651 KRATOS_DEBUG_ERROR_IF(rMatrixInput.size1() != RowEquationId.size()) <<
"sizes of matrix and equation id do not match in Assemble" << std::endl;
652 KRATOS_DEBUG_ERROR_IF(rMatrixInput.size2() != ColEquationId.size()) <<
"sizes of matrix and equation id do not match in Assemble" << std::endl;
654 for(
unsigned int i=0;
i<RowEquationId.size(); ++
i) {
655 const TIndexType global_i = RowEquationId[
i];
658 for(
unsigned int j = 0;
j<ColEquationId.size(); ++
j) {
659 const TIndexType global_j = ColEquationId[
j];
664 for(
unsigned int j = 0;
j<ColEquationId.size(); ++
j) {
665 const TIndexType global_j = ColEquationId[
j];
680 for(TIndexType
k = row_begin;
k < row_end; ++
k) {
690 for(TIndexType
k = row_begin;
k < row_end; ++
k) {
703 std::vector<double> tmp_data;
713 tmp_data.push_back(
v);
723 tmp_data.push_back(mOffDiagonalGlobalIds[
j]);
724 tmp_data.push_back(
v);
728 auto collected_data =
GetComm().Gatherv(tmp_data,target_rank);
736 if(my_rank==target_rank){
739 for(
int i_proc=0; i_proc<num_processors; ++i_proc){
740 const auto&
data = collected_data[i_proc];
750 if(my_rank==target_rank){
751 p_csr_output = Kratos::make_shared<CsrMatrix<TDataType,TIndexType>>(*p_csr_graph);
753 for(
int i_proc=0; i_proc<num_processors; ++i_proc){
754 const auto&
data = collected_data[i_proc];
758 const double v =
data[
i+2];
796 std::stringstream buffer;
797 buffer <<
"DistributedCsrMatrix" ;
804 rOStream <<
"DistributedCsrMatrix" << std::endl;
810 rOStream <<
"--- Diagonal Block: ---" << std::endl;
814 rOStream <<
"index1_data : " << std::endl;
816 rOStream << item <<
",";
817 rOStream << std::endl;
818 rOStream <<
"index2_data in local numbering: " << std::endl;
820 rOStream << item <<
",";
821 rOStream << std::endl;
822 rOStream <<
"index2_data in global numbering: " << std::endl;
824 rOStream << item <<
",";
825 rOStream << std::endl;
826 rOStream <<
"value_data : " << std::endl;
828 rOStream << item <<
",";
829 rOStream << std::endl;
831 rOStream << std::endl;
832 rOStream <<
"--- OffDiagonal Block: ---" << std::endl;
836 rOStream <<
"index1_data : " << std::endl;
838 rOStream << item <<
",";
839 rOStream << std::endl;
840 rOStream <<
"index2_data in local numbering: " << std::endl;
842 rOStream << item <<
",";
843 rOStream << std::endl;
844 rOStream <<
"index2_data in global numbering: " << std::endl;
846 rOStream << item <<
",";
847 rOStream << std::endl;
848 rOStream <<
"value_data : " << std::endl;
850 rOStream << item <<
",";
851 rOStream << std::endl;
880 template<
class TVectorType >
882 TIndexType
l, TIndexType r, TIndexType
x)
885 int m =
l + (r -
l) / 2;
911 std::vector<int> send_list;
912 for(
unsigned int id = 0;
id<nonlocal_graphs.size(); ++id)
913 if( !nonlocal_graphs[
id].
IsEmpty())
914 send_list.push_back(
id);
919 for(
auto color : mfem_assemble_colors) {
921 const auto& send_graph = nonlocal_graphs[
color];
922 auto& direct_senddata_access = mPointersToSendValues[
color];
923 auto& send_ij = mSendCachedIJ[
color];
925 for(
auto row_it=send_graph.begin(); row_it!=send_graph.end(); ++row_it) {
926 const auto remote_local_I = row_it.GetRowIndex();
929 for(
auto J : *row_it) {
930 TDataType& value = mNonLocalData[std::make_pair(remote_global_I,
J)];
931 direct_senddata_access.push_back(&value);
932 send_ij.push_back(remote_global_I);
933 send_ij.push_back(
J);
939 auto& recv_ij = mRecvCachedIJ[
color];
941 auto& direct_recvdata_access = mPointersToRecvValues[
color];
943 for(TIndexType
k=0;
k<recv_ij.size();
k+=2) {
944 TIndexType I = recv_ij[
k];
945 TIndexType
J = recv_ij[
k+1];
947 direct_recvdata_access.push_back(&value);
983 typename BlockMatrixType::UniquePointer mpDiagonalBlock = Kratos::make_unique< BlockMatrixType >();
984 typename BlockMatrixType::UniquePointer mpOffDiagonalBlock = Kratos::make_unique< BlockMatrixType >();
988 std::map<TIndexType, TIndexType> mOffDiagonalLocalIds;
991 std::vector<int> mfem_assemble_colors;
992 std::unordered_map< unsigned int, std::vector<TIndexType> > mRecvCachedIJ;
993 std::unordered_map< unsigned int, std::vector<TIndexType> > mSendCachedIJ;
994 std::unordered_map< unsigned int, std::vector<TDataType*> > mPointersToRecvValues;
995 std::unordered_map< unsigned int, std::vector<TDataType*> > mPointersToSendValues;
997 std::unique_ptr<DistributedVectorImporter<TDataType,TIndexType>> mpVectorImporter;
1007 rSerializer.
save(
"RowNumbering",mpRowNumbering);
1008 rSerializer.
save(
"ColNumbering",mpColNumbering);
1009 rSerializer.
save(
"mpDiagonalBlock",mpDiagonalBlock);
1010 rSerializer.
save(
"mpOffDiagonalBlock",mpOffDiagonalBlock);
1011 rSerializer.
save(
"mNonLocalData",mNonLocalData);
1012 rSerializer.
save(
"mSendCachedIJ",mSendCachedIJ);
1013 rSerializer.
save(
"mRecvCachedIJ",mRecvCachedIJ);
1014 rSerializer.
save(
"mOffDiagonalLocalIds",mOffDiagonalLocalIds);
1015 rSerializer.
save(
"mfem_assemble_colors",mfem_assemble_colors);
1016 rSerializer.
save(
"mpVectorImporter",mpVectorImporter);
1023 std::string comm_name;
1024 rSerializer.
load(
"CommunicatorName",comm_name);
1026 rSerializer.
load(
"RowNumbering",mpRowNumbering);
1027 rSerializer.
load(
"ColNumbering",mpColNumbering);
1028 rSerializer.
load(
"mpDiagonalBlock",mpDiagonalBlock);
1029 rSerializer.
load(
"mpOffDiagonalBlock",mpOffDiagonalBlock);
1030 rSerializer.
load(
"mNonLocalData",mNonLocalData);
1031 rSerializer.
load(
"mSendCachedIJ",mSendCachedIJ);
1032 rSerializer.
load(
"mRecvCachedIJ",mRecvCachedIJ);
1033 rSerializer.
load(
"mOffDiagonalLocalIds",mOffDiagonalLocalIds);
1034 rSerializer.
load(
"mfem_assemble_colors",mfem_assemble_colors);
1035 rSerializer.
load(
"mpVectorImporter",mpVectorImporter);
1037 ReconstructDirectAccessVectors();
1044 void ReconstructDirectAccessVectors()
1047 for(
auto color : mfem_assemble_colors)
1051 const auto& send_ij = mSendCachedIJ[
color];
1052 const auto& recv_ij = mRecvCachedIJ[
color];
1054 auto& direct_senddata_access = mPointersToRecvValues[
color];
1055 for(TIndexType
i=0;
i<send_ij.size();
i+=2)
1057 TIndexType I = recv_ij[
i];
1058 TIndexType
J = recv_ij[
i+1];
1060 direct_senddata_access.push_back(&value);
1063 auto& direct_recvdata_access = mPointersToRecvValues[
color];
1064 for(TIndexType
k=0;
k<recv_ij.size();
k+=2)
1066 TIndexType I = recv_ij[
k];
1067 TIndexType
J = recv_ij[
k+1];
1069 direct_recvdata_access.push_back(&value);
1108 template<
class TDataType>
1116 template<
class TDataType>
1121 rOStream << std::endl;
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: csr_matrix.h:60
void BeginAssemble()
Definition: csr_matrix.h:542
void AssembleEntry(const TDataType Value, const IndexType GlobalI, const IndexType GlobalJ)
Definition: csr_matrix.h:634
void FinalizeAssemble()
Definition: csr_matrix.h:544
std::unordered_map< std::pair< IndexType, IndexType >, double, PairHasher< IndexType, IndexType >, PairComparor< IndexType, IndexType > > MatrixMapType
Definition: csr_matrix.h:69
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
virtual int Size() const
Get the parallel size of this DataCommunicator.
Definition: data_communicator.h:597
virtual int Rank() const
Get the parallel rank for this DataCommunicator.
Definition: data_communicator.h:587
This class implements "serial" CSR matrix, including capabilities for FEM assembly.
Definition: distributed_csr_matrix.h:58
TIndexType local_size1() const
Definition: distributed_csr_matrix.h:314
CsrMatrix< TDataType, TIndexType > & GetOffDiagonalBlock()
Definition: distributed_csr_matrix.h:352
int MpiIndexType
Definition: distributed_csr_matrix.h:63
const DistributedNumbering< TIndexType > & GetColNumbering() const
Definition: distributed_csr_matrix.h:287
TIndexType size2() const
Definition: distributed_csr_matrix.h:319
DistributedNumbering< TIndexType >::UniquePointer & pGetColNumbering()
Definition: distributed_csr_matrix.h:298
TIndexType IndexType
Definition: distributed_csr_matrix.h:62
DistributedCsrMatrix & operator=(DistributedCsrMatrix const &rOther)=delete
Assignment operator. TODO: decide if we do want to allow it.
TIndexType GetOffDiagonalBlockLocalId(TIndexType GlobalJ) const
Definition: distributed_csr_matrix.h:386
CsrMatrix< TDataType, TIndexType >::UniquePointer & pGetDiagonalBlock()
Definition: distributed_csr_matrix.h:339
DistributedCsrMatrix(const DistributedCsrMatrix &rOtherMatrix)
Definition: distributed_csr_matrix.h:214
std::map< TIndexType, TIndexType > & GetOffDiagonalLocalIds()
Definition: distributed_csr_matrix.h:371
DistributedVectorImporter< TDataType, TIndexType >::UniquePointer & pGetVectorImporter()
Definition: distributed_csr_matrix.h:303
DenseVector< TIndexType > & GetOffDiagonalGlobalIds()
Definition: distributed_csr_matrix.h:381
TIndexType local_nnz() const
Definition: distributed_csr_matrix.h:324
const CsrMatrix< TDataType, TIndexType > & GetDiagonalBlock() const
Definition: distributed_csr_matrix.h:357
const DistributedNumbering< TIndexType > & GetRowNumbering() const
Definition: distributed_csr_matrix.h:282
DistributedCsrMatrix()
Definition: distributed_csr_matrix.h:75
DistributedCsrMatrix(const DistributedSparseGraph< TIndexType > &rSparseGraph)
Definition: distributed_csr_matrix.h:82
DenseVector< TIndexType > GetDiagonalIndex2DataInGlobalNumbering() const
Definition: distributed_csr_matrix.h:421
void SpMV(const TDataType alpha, const DistributedSystemVector< TDataType, TIndexType > &x, const TDataType beta, DistributedSystemVector< TDataType, TIndexType > &y) const
Definition: distributed_csr_matrix.h:503
DistributedNumbering< TIndexType >::UniquePointer & pGetRowNumbering()
Definition: distributed_csr_matrix.h:293
DistributedCsrMatrix(const DataCommunicator &rComm)
Definition: distributed_csr_matrix.h:78
const CsrMatrix< TDataType, TIndexType > & GetOffDiagonalBlock() const
Definition: distributed_csr_matrix.h:361
const DataCommunicator & GetComm() const
Definition: distributed_csr_matrix.h:329
KRATOS_CLASS_POINTER_DEFINITION(DistributedCsrMatrix)
Pointer definition of DistributedCsrMatrix.
DistributedCsrMatrix & operator=(DistributedCsrMatrix &&rOtherMatrix)
Definition: distributed_csr_matrix.h:250
CsrMatrix< TDataType, TIndexType >::UniquePointer & pGetOffDiagonalBlock()
Definition: distributed_csr_matrix.h:343
std::string Info() const
Turn back information as a string.
Definition: distributed_csr_matrix.h:794
void ApplyHomogeneousDirichlet(const DistributedSystemVector< TDataType, TIndexType > &rFreeDofsVector, const TDataType DiagonalValue, DistributedSystemVector< TDataType, TIndexType > &rRHS)
Definition: distributed_csr_matrix.h:441
CsrMatrix< TDataType, TIndexType >::Pointer ToSerialCSR(MpiIndexType target_rank=0) const
Definition: distributed_csr_matrix.h:700
void PrepareNonLocalCommunications(const DistributedSparseGraph< TIndexType > &rSparseGraph)
Definition: distributed_csr_matrix.h:907
TDataType NormFrobenius() const
Definition: distributed_csr_matrix.h:559
void BeginAssemble()
Definition: distributed_csr_matrix.h:569
void FinalizeAssemble()
Definition: distributed_csr_matrix.h:576
DistributedVectorExporter< TIndexType > * TransposeSpMV(const DistributedSystemVector< TDataType, TIndexType > &x, DistributedSystemVector< TDataType, TIndexType > &y, DistributedVectorExporter< TIndexType > *pTransposeExporter=nullptr) const
Definition: distributed_csr_matrix.h:515
DenseVector< TIndexType > GetOffDiagonalIndex2DataInGlobalNumbering() const
Definition: distributed_csr_matrix.h:431
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: distributed_csr_matrix.h:802
CsrMatrix< TDataType, TIndexType > BlockMatrixType
Definition: distributed_csr_matrix.h:64
void SetValue(const TDataType value)
Definition: distributed_csr_matrix.h:308
const DenseVector< TIndexType > & GetOffDiagonalGlobalIds() const
Definition: distributed_csr_matrix.h:376
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: distributed_csr_matrix.h:808
void Clear()
Definition: distributed_csr_matrix.h:278
void AssembleEntry(const TDataType Value, const TIndexType GlobalI, const TIndexType GlobalJ)
Definition: distributed_csr_matrix.h:633
DistributedVectorExporter< TIndexType > * TransposeSpMV(TDataType alpha, const DistributedSystemVector< TDataType, TIndexType > &x, TDataType beta, DistributedSystemVector< TDataType, TIndexType > &y, DistributedVectorExporter< TIndexType > *pTransposeExporter=nullptr) const
Definition: distributed_csr_matrix.h:536
DistributedCsrMatrix(DistributedCsrMatrix< TDataType, TIndexType > &&rOtherMatrix)
Definition: distributed_csr_matrix.h:233
MatrixMapType ToMap() const
Definition: distributed_csr_matrix.h:674
TDataType & GetLocalDataByGlobalId(TIndexType GlobalI, TIndexType GlobalJ)
Definition: distributed_csr_matrix.h:398
TIndexType GetOffDiaGlobalId(TIndexType LocalJ) const
Definition: distributed_csr_matrix.h:393
void Assemble(const TMatrixType &rMatrixInput, const TIndexVectorType &RowEquationId, const TIndexVectorType &ColEquationId)
Definition: distributed_csr_matrix.h:645
CsrMatrix< TDataType, TIndexType > & GetDiagonalBlock()
Definition: distributed_csr_matrix.h:348
void Assemble(const TMatrixType &rMatrixInput, const TIndexVectorType &EquationId)
Definition: distributed_csr_matrix.h:607
TDataType & GetNonLocalCachedDataByGlobalId(TIndexType GlobalI, TIndexType GlobalJ)
Definition: distributed_csr_matrix.h:413
CsrMatrix< TDataType, TIndexType >::MatrixMapType MatrixMapType
Definition: distributed_csr_matrix.h:65
const DataCommunicator * pGetComm() const
Definition: distributed_csr_matrix.h:334
const std::map< TIndexType, TIndexType > & GetOffDiagonalLocalIds() const
Definition: distributed_csr_matrix.h:366
~DistributedCsrMatrix()
Destructor.
Definition: distributed_csr_matrix.h:266
void SpMV(const DistributedSystemVector< TDataType, TIndexType > &x, DistributedSystemVector< TDataType, TIndexType > &y) const
Definition: distributed_csr_matrix.h:493
TIndexType BinarySearch(const TVectorType &arr, TIndexType l, TIndexType r, TIndexType x)
Definition: distributed_csr_matrix.h:881
This function provides essential capabilities for mapping between local and global ids in a distribut...
Definition: distributed_numbering.h:56
Short class definition.
Definition: distributed_sparse_graph.h:68
const DenseVector< NonLocalGraphType > & GetNonLocalGraphs() const
Definition: distributed_sparse_graph.h:295
IndexType ComputeMaxGlobalColumnIndex() const
Definition: distributed_sparse_graph.h:146
const DistributedNumbering< IndexType > & GetRowNumbering() const
Definition: distributed_sparse_graph.h:111
const LocalGraphType & GetLocalGraph() const
Definition: distributed_sparse_graph.h:285
Provides a DistributedSystemVector which implements FEM assemble capabilities.
Definition: distributed_system_vector.h:61
IndexType LocalSize() const
Definition: distributed_system_vector.h:178
DenseVector< TDataType > & GetLocalData()
Definition: distributed_system_vector.h:182
Provides a DistributedVectorExporter which implements FEM assemble capabilities.
Definition: distributed_vector_exporter.h:54
Provides a DistributedVectorImporter which implements FEM assemble capabilities.
Definition: distributed_vector_importer.h:57
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
Definition: amatrix_interface.h:41
static std::vector< int > ComputeCommunicationScheduling(const std::vector< int > &rLocalDestinationIds, const DataCommunicator &rComm)
Definition: communication_coloring_utilities.cpp:56
static std::string RetrieveRegisteredName(const DataCommunicator &rComm)
Get the MPI Comm size, as given by the default DataCommunicator.
Definition: parallel_environment.cpp:235
static DataCommunicator & GetDataCommunicator(const std::string &rName)
Retrieve a registered DataCommunicator instance.
Definition: parallel_environment.cpp:26
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Short class definition.
Definition: sparse_contiguous_row_graph.h:65
void Finalize()
Definition: sparse_contiguous_row_graph.h:220
void AddEntry(const IndexType RowIndex, const IndexType ColIndex)
Definition: sparse_contiguous_row_graph.h:164
IndexType Size() const
Definition: sparse_contiguous_row_graph.h:141
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
void AtomicAdd(TDataType &target, const TDataType &value)
Definition: atomic_utilities.h:55
unique_ptr< C > make_unique(Args &&...args)
Definition: smart_pointers.h:45
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
color
Definition: all_t_win_vs_m_fixed_error.py:230
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
v
Definition: generate_convection_diffusion_explicit_element.py:114
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
data
Definition: mesh_to_mdpa_converter.py:59
def load(f)
Definition: ode_solve.py:307
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int m
Definition: run_marine_rain_substepping.py:8
int counter
Definition: script_THERMAL_CORRECT.py:218
J
Definition: sensitivityMatrix.py:58
x
Definition: sensitivityMatrix.py:49
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
def IsEmpty(_A)
Definition: custom_math.py:33