Changeset 14678
- Timestamp:
- 04/19/13 16:57:07 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/DataSet.h
r14570 r14678 4 4 #include <vector> 5 5 #include "../classes/objects/Object.h" 6 #include "../toolkits/toolkits.h"7 6 #include "../EnumDefinitions/EnumDefinitions.h" 8 7 -
issm/trunk-jpl/src/c/Makefile.am
r14656 r14678 53 53 ./classes/IoModel.h\ 54 54 ./classes/IoModel.cpp\ 55 ./classes/objects/Bucket.h\ 55 56 ./classes/objects/Node.h\ 56 57 ./classes/objects/Node.cpp\ -
issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h
r14647 r14678 17 17 #include "../../../include/include.h" 18 18 #include "../../../shared/Exceptions/exceptions.h" 19 #include "../../../shared/Alloc/alloc.h" 20 #include "../../../shared/MemOps/xMemCpy.h" 19 21 #include "../../../io/io.h" 20 22 #include "../../../EnumDefinitions/EnumDefinitions.h" -
issm/trunk-jpl/src/c/classes/objects/objects.h
r13534 r14678 17 17 #include "./IndependentObject.h" 18 18 #include "./Segment.h" 19 #include "./Bucket.h" 19 20 20 21 /*Constraints: */ -
issm/trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h
r14671 r14678 22 22 #include "../../shared/Alloc/alloc.h" 23 23 #include "../../include/macros.h" 24 #include "../../Container/DataSet.h" 25 #include "../../classes/IssmComm.h" 26 #include "../../classes/objects/Bucket.h" 24 27 #include <math.h> 25 28 … … 38 41 public: 39 42 40 int M,N; 43 int M,N; //global size 44 int m; //local number of rows 41 45 doubletype* matrix; /*here, doubletype is either IssmDouble or IssmPDouble*/ 46 DataSet* buckets; /*here, we store buckets of values that we will Assemble into a global matrix.*/ 42 47 43 48 /*IssmMpiDenseMat constructors, destructors*/ 44 49 /*FUNCTION IssmMpiDenseMat(){{{*/ 45 50 IssmMpiDenseMat(){ 46 _error_("not supported yet!"); 51 this->M=0; 52 this->N=0; 53 this->m=0; 54 this->matrix=NULL; 55 this->buckets=new DataSet(); 47 56 } 48 57 /*}}}*/ 49 58 /*FUNCTION IssmMpiDenseMat(int M,int N){{{*/ 50 IssmMpiDenseMat(int pM,int pN){51 _error_("not supported yet!");59 IssmMpiDenseMat(int Min,int Nin){ 60 this->Init(Min,Nin); 52 61 } 53 62 /*}}}*/ 54 63 /*FUNCTION IssmMpiDenseMat(int M,int N, doubletype sparsity){{{*/ 55 64 IssmMpiDenseMat(int pM,int pN, doubletype sparsity){ 56 _error_("not supported yet!"); 65 /*no sparsity involved here, we are fully dense, so just use the previous constructor: */ 66 this->Init(pM,pN); 57 67 } 58 68 /*}}}*/ 59 69 /*FUNCTION IssmMpiDenseMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz){{{*/ 60 70 IssmMpiDenseMat(int m,int n,int pM,int pN,int* d_nnz,int* o_nnz){ 61 _error_("not supported yet!"); 71 /*not needed, we are fully dense!: */ 72 this->Init(pM,pN); 62 73 } 63 74 /*}}}*/ 64 75 /*FUNCTION IssmMpiDenseMat(doubletype* serial_mat,int M,int N,doubletype sparsity){{{*/ 65 IssmMpiDenseMat(doubletype* serial_mat,int pM,int pN,doubletype sparsity){ 66 _error_("not supported yet!"); 76 IssmMpiDenseMat(doubletype* serial_mat,int Min,int Nin,doubletype sparsity){ 77 78 /*Here, we assume that the serial_mat is local to the local cpu, and that it has 79 * the correct size (m rows by N colums), n determined by DetermineLocalSize: */ 80 this->buckets=new DataSet(); 81 this->M=Min; 82 this->N=Nin; 83 this->m=DetermineLocalSize(this->M,IssmComm::GetComm()); 84 85 this->matrix=NULL; 86 if(m*N){ 87 this->matrix=xNewZeroInit<doubletype>(m*N); 88 xMemCpy<doubletype>(this->matrix,serial_mat,m*N); 89 } 67 90 } 68 91 /*}}}*/ 69 92 /*FUNCTION IssmMpiDenseMat(int M,int N, int connectivity, int numberofdofspernode){{{*/ 70 93 IssmMpiDenseMat(int pM,int pN, int connectivity,int numberofdofspernode){ 71 _error_("not supported yet!"); 94 /*not needed, we are fully dense!: */ 95 this->Init(pM,pN); 72 96 } 73 97 /*}}}*/ 74 98 /*FUNCTION ~IssmMpiDenseMat(){{{*/ 75 99 ~IssmMpiDenseMat(){ 76 _error_("not supported yet!"); 100 xDelete<doubletype>(this->matrix); 101 M=0; 102 N=0; 103 m=0; 104 delete this->buckets; 105 } 106 /*}}}*/ 107 /*FUNCTION IssmMpiDenseMat::Init(int Min,int Nin){{{*/ 108 void Init(int Min,int Nin){ 109 110 this->buckets=new DataSet(); 111 112 this->M=Min; 113 this->N=Nin; 114 115 /*Figure out local number of rows: */ 116 this->m=DetermineLocalSize(this->M,IssmComm::GetComm()); 117 118 /*Initialize pointer: */ 119 this->matrix=NULL; 120 121 /*Allocate: */ 122 if (m*N)this->matrix=xNewZeroInit<doubletype>(this->m*N); 77 123 } 78 124 /*}}}*/ … … 81 127 /*FUNCTION Echo{{{*/ 82 128 void Echo(void){ 83 _error_("not supported yet!"); 129 130 int my_rank; 131 int i,j,k; 132 133 /*Do a synchronized dump across all the rows: */ 134 my_rank=IssmComm::GetRank(); 135 for(i=0;i<IssmComm::GetSize();i++){ 136 if (my_rank==i){ 137 printf("cpu %i #rows: %i\n",i,this->m); 138 for (j=0;j<this->m;j++){ 139 printf("row %i ",j); 140 for (k=0;k<this->N;k++){ 141 printf("%g ",this->matrix[j*this->N+k]); 142 } 143 } 144 } 145 MPI_Barrier(IssmComm::GetComm()); 146 } 147 84 148 } 85 149 /*}}}*/ … … 120 184 /*}}}*/ 121 185 /*FUNCTION SetValues{{{*/ 122 void SetValues(int m,int* idxm,int n,int* idxn,doubletype* values,InsMode mode){ 123 _error_("not supported yet!"); 186 void SetValues(int min,int* idxm,int nin,int* idxn,doubletype* values,InsMode mode){ 187 188 /*we need to store all the values we collect here in order to Assemble later. 189 * Indeed, the values we are collecting here most of the time will not belong 190 * to us, but to another part of the matrix on another cpu: */ 191 _assert_(buckets); 192 193 buckets->AddObject(new Bucket<doubletype>(min,idxm,nin,idxn,values,mode)); 194 124 195 } 125 196 /*}}}*/ 126 197 /*FUNCTION Convert{{{*/ 127 198 void Convert(MatrixType type){ 128 _error_("not supported yet!");199 /*do nothing: */ 129 200 } 130 201 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.