From: kronbichler Date: Tue, 2 Aug 2011 08:55:36 +0000 (+0000) Subject: Make transpose of matrix in Trilinos matmatmult work. Still not correct result. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1322e1c7577d12d146b85e388d99a1f49671969b;p=dealii-svn.git Make transpose of matrix in Trilinos matmatmult work. Still not correct result. git-svn-id: https://svn.dealii.org/trunk@23986 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index a3aa7be34b..83c0579d2f 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -1015,10 +1015,15 @@ namespace TrilinosWrappers // transposed matrix, let ML know it ML_Comm* comm; ML_Comm_Create(&comm); +#ifdef ML_MPI + const Epetra_MpiComm *epcomm = dynamic_cast(&(inputleft.trilinos_matrix().Comm())); + // Get the MPI communicator, as it may not be MPI_COMM_W0RLD, and update the ML comm object + if (epcomm) ML_Comm_Set_UsrComm(comm,epcomm->Comm()); +#endif ML_Operator *A_ = ML_Operator_Create(comm); - ML_Operator *Anotrans_ = ML_Operator_Create(comm); ML_Operator *B_ = ML_Operator_Create(comm); ML_Operator *C_ = ML_Operator_Create(comm); + SparseMatrix transposed_mat; if (transpose_left == false) ML_Operator_WrapEpetraCrsMatrix @@ -1026,12 +1031,42 @@ namespace TrilinosWrappers false); else { + // create transposed matrix + SparsityPattern sparsity_transposed (inputleft.domain_partitioner(), + inputleft.range_partitioner()); + Assert (inputleft.domain_partitioner().LinearMap() == true, + ExcMessage("Matrix must be partitioned contiguously between procs.")); + for (unsigned int i=0; i= 0, ExcInternalError()); + const unsigned int GID = inputleft.row_partitioner().GID(i); + for (int j=0; j= 0, ExcInternalError()); + const unsigned int GID = inputleft.row_partitioner().GID(i); + for (int j=0; j(&inputleft.trilinos_matrix()), - Anotrans_,false); - ML_Operator_Transpose_byrow(Anotrans_,A_); + (const_cast(&transposed_mat.trilinos_matrix()), + A_,false); } - ML_Operator_WrapEpetraCrsMatrix(mod_B.get(),B_,false); // We implement the multiplication by @@ -1106,7 +1141,6 @@ namespace TrilinosWrappers // destroy allocated memory delete C_mat; ML_Operator_Destroy (&A_); - ML_Operator_Destroy (&Anotrans_); ML_Operator_Destroy (&B_); ML_Operator_Destroy (&C_); ML_Comm_Destroy (&comm);