Guest User

Untitled

a guest
Jul 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #include <list>
  2. #include <string>
  3. #include <math.h>
  4.  
  5. #include "Epetra_ConfigDefs.h"
  6. #ifdef HAVE_MPI
  7. #include "mpi.h"
  8. #include "Epetra_MpiComm.h"
  9. #else
  10. #include "Epetra_SerialComm.h"
  11. #endif
  12. #include "Epetra_Map.h"
  13. #include "Epetra_BlockMap.h"
  14. #include "Epetra_FEVbrMatrix.h"
  15.  
  16. #include <EpetraExt_MatrixMatrix.h>
  17.  
  18. using namespace std;
  19.  
  20. int main(int argc, char *argv[])
  21. {
  22.  
  23. #ifdef HAVE_MPI
  24. MPI_Init(&argc, &argv);
  25. Epetra_MpiComm Comm(MPI_COMM_WORLD);
  26. #else
  27. Epetra_SerialComm Comm;
  28. #endif
  29.  
  30. int NSIDE = 1;
  31. int NPIX ;
  32. int NSTOKES = 3;
  33.  
  34. int NumElements;
  35. NumElements = 11;
  36.  
  37. NPIX = 12. * NSIDE * NSIDE +1; //total pixel size, each pixel is an element which contains 3 floats which are IQU
  38. Epetra_BlockMap PixMap(NPIX,NSTOKES,0,Comm);
  39.  
  40. int * PixMyGlobalElements = PixMap.MyGlobalElements();
  41.  
  42. cout << PixMap << endl;
  43.  
  44. Epetra_FEVbrMatrix invM(Copy, PixMap, 1);
  45.  
  46. int BlockIndices[1];
  47. BlockIndices[0] = 2;
  48. Epetra_SerialDenseMatrix *Prow;
  49. int RowDim, NumBlockEntries;
  50. int err;
  51. Epetra_SerialDenseMatrix Mpp(NSTOKES, NSTOKES);
  52. Mpp[0][0] = 1.;
  53. cout << Mpp << endl;
  54.  
  55. int debugPID = 1;
  56.  
  57. int NumHits = 2*Comm.MyPID() + 5;
  58. for( int i=0 ; i<NumHits; ++i ) { //loop on local pointing
  59.  
  60. invM.BeginSumIntoGlobalValues(BlockIndices[0], 1, BlockIndices);
  61.  
  62. err = invM.SubmitBlockEntry(Mpp.A(), Mpp.LDA(), NSTOKES, NSTOKES); //FIXME check order
  63. if (err != 0) {
  64. cout << "PID:" << Comm.MyPID() << "Error in inserting values in M, error code:" << err << endl;
  65. }
  66.  
  67. err = invM.EndSubmitEntries();
  68. if (err != 0) {
  69. cout << "PID:" << Comm.MyPID() << " LocalRow[i]:" << i << " Error in ending submit entries in M, error code:" << err << endl;
  70. }
  71.  
  72. }
  73. invM.GlobalAssemble();
  74.  
  75. cout << invM << endl;
  76.  
  77. #ifdef HAVE_MPI
  78. MPI_Finalize();
  79. #endif
  80.  
  81. return(0);
  82.  
  83. };
Add Comment
Please, Sign In to add comment