Changeset 2316
- Timestamp:
- 09/24/09 18:12:14 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 1 deleted
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Dofx/Dofx.cpp
r1 r2316 13 13 #include "../EnumDefinitions/EnumDefinitions.h" 14 14 15 int Dofx( Vec* ppartition, Vec* ptpartition,DataSet* elements,DataSet* nodes, DataSet* params) {15 int Dofx( DofVec** ppartition, DofVec** ptpartition,DataSet* elements,DataSet* nodes, DataSet* params) { 16 16 17 17 int noerr=1; … … 27 27 28 28 /*output: */ 29 Vec partition=NULL; 30 Vec tpartition=NULL; 29 DofVec* partition=NULL; 30 DofVec* tpartition=NULL; 31 32 /*Initialize dofvecs: */ 33 partition=new DofVec("partition"); 34 tpartition=new DofVec("tpartition"); 31 35 32 36 /*First, recover number of grids from parameters: */ … … 48 52 49 53 /*Now that dofs have been distributed, create partitioning vector and its transpose: */ 50 nodes->CreatePartitioningVector(&partition ,numberofnodes,numberofdofspernode);54 nodes->CreatePartitioningVector(&partition->vector,numberofnodes,numberofdofspernode); 51 55 52 56 /*Transpose partition into tpartition: */ 53 VecTranspose(&tpartition,partition); 54 57 VecTranspose(&tpartition->vector,partition->vector); 58 59 /*Now, setup numdof and numentries for dofvec: */ 60 partition->numdofs=1; 61 VecGetSize(partition->vector,&partition->numentries); 62 63 tpartition->numdofs=1; 64 VecGetSize(tpartition->vector,&tpartition->numentries); 65 55 66 /*Assign output pointers: */ 56 67 *ppartition=partition; -
issm/trunk/src/c/Dofx/Dofx.h
r1 r2316 9 9 10 10 /* local prototypes: */ 11 int Dofx( Vec* partition, Vec* ptpartition,DataSet* elements,DataSet* nodesin,DataSet* params);11 int Dofx( DofVec** partition, DofVec** ptpartition,DataSet* elements,DataSet* nodesin,DataSet* params); 12 12 13 13 #endif /* _DOFX_H */ -
issm/trunk/src/c/Makefile.am
r2313 r2316 171 171 ./io/WriteDataToDisk.cpp\ 172 172 ./io/SerialFetchData.cpp\ 173 ./io/SerialWriteData.cpp\174 173 ./io/ParallelFetchData.cpp\ 175 174 ./io/ParallelFetchInteger.cpp\ … … 469 468 ./io/WriteDataToDisk.cpp\ 470 469 ./io/SerialFetchData.cpp\ 471 ./io/SerialWriteData.cpp\472 470 ./io/ParallelFetchData.cpp\ 473 471 ./io/ParallelFetchInteger.cpp\ -
issm/trunk/src/c/SpcNodesx/SpcNodesx.cpp
r304 r2316 13 13 #include "../EnumDefinitions/EnumDefinitions.h" 14 14 15 int SpcNodesx( Vec* pyg, DataSet* nodes,DataSet* constraints){15 void SpcNodesx( DofVec** pyg, DataSet* nodes,DataSet* constraints){ 16 16 17 17 int i; 18 18 int numberofdofs; 19 int gsize; 19 20 20 21 /*output: */ 21 Vecyg=NULL;22 DofVec* yg=NULL; 22 23 23 24 /*First, recover number of dofs from nodes: */ … … 25 26 26 27 if(numberofdofs){ 28 29 /*Allocate dofvec: */ 30 yg=new DofVec("yg"); 31 yg->numdofs=numberofdofs; 32 27 33 /*Allocate yg: */ 28 yg =NewVec(numberofdofs);34 yg->vector=NewVec(numberofdofs); 29 35 30 36 /*Now, go through constraints, and update the nodes and the constraint vector at the same time: */ 31 constraints->SetupSpcs(nodes,yg); 37 constraints->SetupSpcs(nodes,yg->vector); 38 39 /*Specify numentries: */ 40 VecGetSize(yg->vector,&gsize); 41 yg->numentries=(int)gsize/yg->numdofs; 42 } 43 else{ 44 /*Allocate dofvec: */ 45 yg=new DofVec("yg"); 32 46 } 33 47 34 48 /*Assign output pointers: */ 35 49 *pyg=yg; 36 37 return 1;38 39 50 } -
issm/trunk/src/c/SpcNodesx/SpcNodesx.h
r1 r2316 10 10 11 11 /* local prototypes: */ 12 int SpcNodesx( Vec*yg, DataSet* nodesin,DataSet* constraints);12 void SpcNodesx( DofVec** pyg, DataSet* nodesin,DataSet* constraints); 13 13 14 14 #endif /* _SPCNODESX_H */ -
issm/trunk/src/c/io/WriteData.cpp
r1 r2316 19 19 20 20 #include <mex.h> 21 void WriteData(mxArray** pdataref,void* data,int M,int N,char* data_type,char* sub_data_type){ 21 22 23 /*Several prototypes for WriteData, according to type: */ 24 25 /*DataSet: */ 26 void WriteData(mxArray** pdataref,DataSet* dataset){ 27 28 mxArray* dataref=NULL; 29 char* marshalled_dataset=NULL; 30 int marshalled_dataset_size; 31 32 /*Write a dataset: */ 33 if(dataset){ 34 /* marshall the dataset: */ 35 marshalled_dataset=dataset->Marshall(); 36 marshalled_dataset_size=dataset->MarshallSize(); 37 38 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 39 mxSetM(dataref,(mwSize)(marshalled_dataset_size/sizeof(double))); 40 mxSetN(dataref,(mwSize)1); 41 mxSetPr(dataref,(double*)marshalled_dataset); 42 } 43 else{ 44 /* return empty matrix: */ 45 dataref=mxCreateDoubleMatrix(0,0,mxREAL); 46 } 47 *pdataref=dataref; 22 48 23 SerialWriteData(pdataref,data,M,N,data_type,sub_data_type);24 49 } 50 51 void WriteData(mxArray** pdataref,Mat matrix){ 52 53 mxArray* dataref=NULL; 54 55 if(matrix){ 56 57 /*call toolkit routine: */ 58 PetscMatrixToMatlabMatrix(&dataref,matrix); 59 } 60 else{ 61 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 62 } 63 64 *pdataref=dataref; 65 } 66 67 void WriteData(mxArray** pdataref,double* matrix, int M,int N){ 68 69 mxArray* dataref=NULL; 70 mxArray* tdataref=NULL; 71 72 if(matrix){ 73 74 /*data is a double* pointer. Copy into a matrix: */ 75 tdataref = mxCreateDoubleMatrix(0,0,mxREAL); 76 mxSetM(tdataref,(mwSize)N); 77 mxSetN(tdataref,(mwSize)M); 78 mxSetPr(tdataref,(double*)matrix); 79 80 //transpose 81 mexCallMATLAB(1,&dataref,1,&tdataref, "'"); 82 } 83 else{ 84 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 85 } 86 *pdataref=dataref; 87 } 88 89 90 void WriteData(mxArray** pdataref,Vec vector){ 91 92 mxArray* dataref=NULL; 93 94 if(vector){ 95 96 /*call toolkit routine: */ 97 PetscVectorToMatlabVector(&dataref,vector); 98 } 99 else{ 100 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 101 } 102 *pdataref=dataref; 103 104 } 105 106 107 void WriteData(mxArray** pdataref,DofVec* dofvec){ 108 109 mxArray* mxvector=NULL; 110 mxArray* structdataref=NULL; 111 mxArray* dataref=NULL; 112 113 int nfields=4; 114 const char* fnames[nfields]; 115 mwSize onebyone[2] = {1,1}; 116 mwSize ndim=2; 117 118 fnames[0] = "name"; 119 fnames[1] = "numdofs"; 120 fnames[2] = "numentries"; 121 fnames[3] = "vector"; 122 123 if(dofvec){ 124 125 /*call toolkit routine: */ 126 if(dofvec->vector)PetscVectorToMatlabVector(&mxvector,dofvec->vector); 127 else mxvector=mxCreateDoubleMatrix(0,0,mxREAL); 128 129 /*use the mxvector to create a dofvec object: */ 130 structdataref=mxCreateStructArray( ndim,onebyone,nfields,fnames); 131 132 mxSetField( structdataref, 0, "name",mxCreateString(dofvec->name)); 133 mxSetField( structdataref, 0, "numdofs",mxCreateDoubleScalar(dofvec->numdofs)); 134 mxSetField( structdataref, 0, "numentries",mxCreateDoubleScalar(dofvec->numentries)); 135 mxSetField( structdataref, 0, "vector",mxvector); 136 137 138 /*transform structure into dofvec class: */ 139 mexCallMATLAB( 1, &dataref, 1, &structdataref, "dofvec"); 140 } 141 else{ 142 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 143 } 144 *pdataref=dataref; 145 } 146 147 void WriteData(mxArray** pdataref,double* vector, int M){ 148 149 mxArray* dataref=NULL; 150 151 if(vector){ 152 153 /*data is a double* pointer. Copy into a vector: */ 154 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 155 mxSetM(dataref,(mwSize)M); 156 mxSetN(dataref,(mwSize)1); 157 mxSetPr(dataref,vector); 158 } 159 else{ 160 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 161 } 162 163 *pdataref=dataref; 164 } 165 166 void WriteData(mxArray** pdataref,double scalar){ 167 168 *pdataref=mxCreateDoubleScalar(scalar); 169 } 170 171 void WriteData(mxArray** pdataref,int integer){ 172 173 *pdataref=mxCreateDoubleScalar((double)integer); 174 175 } 176 177 void WriteData(mxArray** pdataref,char* string){ 178 179 *pdataref=mxCreateString(string); 180 } 181 25 182 #else 26 183 void WriteData(int* pdummy,void* data,char* data_type){ -
issm/trunk/src/c/io/io.h
r1881 r2316 7 7 8 8 #include "../objects/NodeSets.h" 9 #include "../objects/DofVec.h" 9 10 #include "../DataSet/DataSet.h" 10 11 #include "../include/types.h" … … 13 14 14 15 void FetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type); 15 void WriteData(DataHandle* pdata_handle,void* data,int M,int N,char* data_type,char* sub_data_type);16 16 void IoModelFetchData(void** pdata,int* pM,int* pN,ConstDataHandle model_handle,char* data_name,char* data_type,char* sub_data_type); 17 17 18 18 /*Serial: */ 19 19 #ifdef _SERIAL_ 20 void SerialFetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type); 21 void SerialWriteData(DataHandle* pdata_handle,void* data,int M,int N,char* data_type,char* sub_data_type); 22 void FetchNodeSets(NodeSets** pnodesets,ConstDataHandle dataref); 20 /*Write: */ 21 void WriteData(mxArray** pdataref,DataSet* dataset); 22 void WriteData(mxArray** pdataref,Mat matrix); 23 void WriteData(mxArray** pdataref,double* matrix, int M,int N); 24 void WriteData(mxArray** pdataref,Vec vector); 25 void WriteData(mxArray** pdataref,double* vector, int M); 26 void WriteData(mxArray** pdataref,int integer); 27 void WriteData(mxArray** pdataref,double scalar); 28 void WriteData(mxArray** pdataref,char* string); 29 void WriteData(mxArray** pdataref,DofVec* vector); 23 30 void WriteNodeSets(DataHandle* pdataref,NodeSets* nodesets); 24 31 void WriteParams(DataHandle* pdataref,DataSet* parameters); 32 33 /*Fetch: */ 34 void SerialFetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type); 35 void FetchNodeSets(NodeSets** pnodesets,ConstDataHandle dataref); 25 36 #endif 26 37 … … 33 44 void ParallelFetchInteger(int* pdata,DataHandle data_handle); 34 45 void WriteDataToDisk(void* data,int* pM,int* pN,char* datatype,FILE* fid); 46 void WriteData(int* pdummy,void* data,char* data_type); 35 47 #endif 36 48 -
issm/trunk/src/c/objects/DofVec.cpp
r2310 r2316 15 15 DofVec::DofVec(){ 16 16 return; 17 } 18 19 DofVec::DofVec(char* name){ 20 21 strcpy(this->name,name); 22 this->numdofs=0; 23 this->numentries=0; 24 this->vector=NULL; 25 17 26 } 18 27 -
issm/trunk/src/c/objects/DofVec.h
r2310 r2316 13 13 14 14 class DofVec: public Object{ 15 16 p rivate:15 16 public: 17 17 18 18 char name[DOFVECNAMESIZE]; … … 21 21 Vec vector; //vector itself. 22 22 23 public:24 23 25 24 DofVec(); 25 DofVec(char* name); 26 26 DofVec(int total_size,char* name); //default numdofs=1, numentries=total_size, default_value=0; 27 27 DofVec(int total_size,double default_value,char* name); //default numdofs=1, numentries=total_size -
issm/trunk/src/c/objects/FemModel.cpp
r1935 r2316 34 34 35 35 FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_constraints,DataSet* femmodel_loads, 36 DataSet* femmodel_materials,DataSet* femmodel_parameters, Vec femmodel_partition,Vec femmodel_tpartition,Vecfemmodel_yg,36 DataSet* femmodel_materials,DataSet* femmodel_parameters, DofVec* femmodel_partition,DofVec* femmodel_tpartition,DofVec* femmodel_yg, 37 37 Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){ 38 38 … … 65 65 delete parameters; 66 66 67 VecFree(&partition);68 VecFree(&tpartition);69 VecFree(&yg);67 delete partition; 68 delete tpartition; 69 delete yg; 70 70 MatFree(&Rmg); 71 71 delete nodesets; … … 116 116 117 117 printf(" partition: \n"); 118 VecView(partition,PETSC_VIEWER_STDOUT_WORLD);118 partition->Echo(); 119 119 printf(" tpartition: \n"); 120 VecView(tpartition,PETSC_VIEWER_STDOUT_WORLD);120 tpartition->Echo(); 121 121 printf(" yg: \n"); 122 VecView(yg,PETSC_VIEWER_STDOUT_WORLD);122 yg->Echo(); 123 123 printf(" Rmg: \n"); 124 124 MatView(Rmg,PETSC_VIEWER_STDOUT_WORLD); … … 192 192 DataSet* FemModel::get_materials(void){return materials;} 193 193 DataSet* FemModel::get_parameters(void){return parameters;} 194 VecFemModel::get_partition(void){return partition;}195 VecFemModel::get_tpartition(void){return tpartition;}196 VecFemModel::get_yg(void){return yg;}194 DofVec* FemModel::get_partition(void){return partition;} 195 DofVec* FemModel::get_tpartition(void){return tpartition;} 196 DofVec* FemModel::get_yg(void){return yg;} 197 197 Mat FemModel::get_Rmg(void){return Rmg;} 198 198 NodeSets* FemModel::get_nodesets(void){return nodesets;} -
issm/trunk/src/c/objects/FemModel.h
r1935 r2316 9 9 #include "../DataSet/DataSet.h" 10 10 #include "../parallel/parallel.h" 11 #include "./DofVec.h" 11 12 12 13 class DataSet; … … 26 27 DataSet* parameters; 27 28 28 Vecpartition;29 Vectpartition;30 Vecyg;29 DofVec* partition; 30 DofVec* tpartition; 31 DofVec* yg; 31 32 Mat Rmg; 32 33 NodeSets* nodesets; … … 38 39 ~FemModel(); 39 40 FemModel(DataSet* elements,DataSet* nodes,DataSet* constraints,DataSet* loads,DataSet* materials,DataSet* parameters, 40 Vec partition,Vec tpartition,Vecyg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0);41 DofVec* partition,DofVec* tpartition,DofVec* yg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0); 41 42 42 43 /*virtual resolves: */ … … 59 60 DataSet* get_materials(void); 60 61 DataSet* get_parameters(void); 61 Vecget_partition(void);62 Vecget_tpartition(void);63 Vecget_yg(void);62 DofVec* get_partition(void); 63 DofVec* get_tpartition(void); 64 DofVec* get_yg(void); 64 65 Mat get_Rmg(void); 65 66 NodeSets* get_nodesets(void); -
issm/trunk/src/c/objects/Model.cpp
r1886 r2316 61 61 DataSet* materials=NULL; 62 62 DataSet* parameters=NULL; 63 Vecpartition=NULL;64 Vectpartition=NULL;65 Vecyg=NULL;63 DofVec* partition=NULL; 64 DofVec* tpartition=NULL; 65 DofVec* yg=NULL; 66 66 Mat Rmg=NULL; 67 67 Mat Gmn=NULL; … … 100 100 101 101 _printf_(" reducing single point constraints vector:\n"); 102 Reducevectorgtosx(&ys,&ys0, yg ,nodesets);102 Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets); 103 103 104 104 _printf_(" normalizing rigid body constraints matrix:\n"); … … 109 109 110 110 _printf_(" process parameters:\n"); 111 ProcessParamsx( parameters, partition );111 ProcessParamsx( parameters, partition->vector); 112 112 113 113 _printf_(" free ressources:\n"); … … 135 135 DataSet* materials=NULL; 136 136 DataSet* parameters=NULL; 137 Vecpartition=NULL;138 Vectpartition=NULL;139 Vecyg=NULL;137 DofVec* partition=NULL; 138 DofVec* tpartition=NULL; 139 DofVec* yg=NULL; 140 140 Mat Rmg=NULL; 141 141 Mat Gmn=NULL; … … 178 178 179 179 _printf_(" reducing single point constraints vector:\n"); 180 Reducevectorgtosx(&ys,&ys0, yg ,nodesets);180 Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets); 181 181 182 182 _printf_(" normalizing rigid body constraints matrix:\n"); … … 187 187 188 188 _printf_(" process parameters:\n"); 189 ProcessParamsx( parameters, partition );189 ProcessParamsx( parameters, partition->vector); 190 190 191 191 _printf_(" free ressources:\n"); -
issm/trunk/src/c/parallel/ControlInitialization.cpp
r2019 r2316 128 128 //update spcs 129 129 if(debug)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed..."); 130 xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg ,ug,dofset,3*numberofnodes);130 xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg->vector,ug,dofset,3*numberofnodes); 131 131 132 132 VecFree(&fem_ds->ys); VecFree(&fem_ds->ys0); 133 Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg ,fem_ds->nodesets);133 Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg->vector,fem_ds->nodesets); 134 134 135 135 //Compute Stokes velocities to speed up later runs -
issm/trunk/src/c/parallel/ProcessResults.cpp
r2112 r2316 127 127 if(ismacayealpattyn){ 128 128 fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 129 VecToMPISerial(&partition,fem_dh->partition );129 VecToMPISerial(&partition,fem_dh->partition->vector); 130 130 fem_dh->parameters->FindParam((void*)&yts,"yts"); 131 131 } 132 132 else{ 133 133 fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 134 VecToMPISerial(&partition,fem_dhu->partition );134 VecToMPISerial(&partition,fem_dhu->partition->vector); 135 135 fem_dhu->parameters->FindParam((void*)&yts,"yts"); 136 136 } … … 153 153 if(ismacayealpattyn){ 154 154 fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 155 VecToMPISerial(&partition,fem_dh->partition );155 VecToMPISerial(&partition,fem_dh->partition->vector); 156 156 fem_dh->parameters->FindParam((void*)&yts,"yts"); 157 157 } 158 158 else{ 159 159 fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 160 VecToMPISerial(&partition,fem_dhu->partition );160 VecToMPISerial(&partition,fem_dhu->partition->vector); 161 161 fem_dhu->parameters->FindParam((void*)&yts,"yts"); 162 162 } … … 176 176 /* 4 dofs on number of nodes. discard pressure: */ 177 177 fem_ds->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 178 VecToMPISerial(&partition,fem_ds->partition );178 VecToMPISerial(&partition,fem_ds->partition->vector); 179 179 fem_ds->parameters->FindParam((void*)&yts,"yts"); 180 180 vx=(double*)xmalloc(numberofnodes*sizeof(double)); … … 221 221 if(ismacayealpattyn){ 222 222 fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 223 VecToMPISerial(&partition,fem_dh->partition );223 VecToMPISerial(&partition,fem_dh->partition->vector); 224 224 } 225 225 else{ 226 226 fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 227 VecToMPISerial(&partition,fem_dhu->partition );227 VecToMPISerial(&partition,fem_dhu->partition->vector); 228 228 } 229 229 } 230 230 else{ 231 231 fem_ds->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 232 VecToMPISerial(&partition,fem_ds->partition );232 VecToMPISerial(&partition,fem_ds->partition->vector); 233 233 } 234 234 … … 254 254 VecToMPISerial(&t_g_serial,t_g); 255 255 fem_t->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 256 VecToMPISerial(&partition,fem_t->partition );256 VecToMPISerial(&partition,fem_t->partition->vector); 257 257 258 258 temperature=(double*)xmalloc(numberofnodes*sizeof(double)); … … 278 278 fem_t->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 279 279 fem_t->parameters->FindParam((void*)&yts,"yts"); 280 VecToMPISerial(&partition,fem_t->partition );280 VecToMPISerial(&partition,fem_t->partition->vector); 281 281 282 282 melting=(double*)xmalloc(numberofnodes*sizeof(double)); … … 301 301 VecToMPISerial(&h_g_serial,h_g); 302 302 fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 303 VecToMPISerial(&partition,fem_p->partition );303 VecToMPISerial(&partition,fem_p->partition->vector); 304 304 305 305 thickness=(double*)xmalloc(numberofnodes*sizeof(double)); … … 324 324 VecToMPISerial(&s_g_serial,s_g); 325 325 fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 326 VecToMPISerial(&partition,fem_p->partition );326 VecToMPISerial(&partition,fem_p->partition->vector); 327 327 328 328 surface=(double*)xmalloc(numberofnodes*sizeof(double)); … … 347 347 VecToMPISerial(&b_g_serial,b_g); 348 348 fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 349 VecToMPISerial(&partition,fem_p->partition );349 VecToMPISerial(&partition,fem_p->partition->vector); 350 350 351 351 bed=(double*)xmalloc(numberofnodes*sizeof(double)); … … 369 369 result->GetField(¶m_g); 370 370 fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 371 VecToMPISerial(&partition,fem_dh->partition );371 VecToMPISerial(&partition,fem_dh->partition->vector); 372 372 373 373 parameter=(double*)xmalloc(numberofnodes*sizeof(double)); -
issm/trunk/src/c/parallel/diagnostic_core.cpp
r2110 r2316 116 116 if(debug)_printf_("%s\n"," update boundary conditions for macyeal pattyn using hutter results..."); 117 117 if (ismacayealpattyn){ 118 VecFree(&fem_dh->yg); VecFree(&fem_dh->ys);VecFree(&fem_dh->ys0);119 VecDuplicatePatch(&fem_dh->yg ,ug);120 Reducevectorgtosx(&fem_dh->ys,&fem_dh->ys0, fem_dh->yg ,fem_dh->nodesets);118 xdelete((void**)&fem_dh->yg); VecFree(&fem_dh->ys);VecFree(&fem_dh->ys0); 119 VecDuplicatePatch(&fem_dh->yg->vector,ug); 120 Reducevectorgtosx(&fem_dh->ys,&fem_dh->ys0, fem_dh->yg->vector,fem_dh->nodesets); 121 121 } 122 122 … … 179 179 180 180 if(debug)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed..."); 181 xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg ,ug,dofset,3*numberofnodes);181 xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg->vector,ug,dofset,3*numberofnodes); 182 182 VecFree(&fem_ds->ys); VecFree(&fem_ds->ys0); 183 Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg ,fem_ds->nodesets);183 Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg->vector,fem_ds->nodesets); 184 184 185 185 if(debug)_printf_("%s\n"," computing stokes velocities and pressure ..."); -
issm/trunk/src/c/shared/Alloc/alloc.cpp
r1 r2316 103 103 return value; 104 104 } 105 106 void xdelete( void* *pv) { 107 108 if (pv && *pv) { 109 110 delete *pv; 111 112 *pv=NULL; 113 } 114 } -
issm/trunk/src/c/shared/Alloc/alloc.h
r1 r2316 12 12 void xfree(void** pvptr); 13 13 void* xrealloc ( void* pv, int size); 14 void xdelete( void* *pv) ; 14 15 15 16 #endif -
issm/trunk/src/m/classes/@dofvec/display.m
r2315 r2316 6 6 disp(sprintf('\n%s = \n',inputname(1))); 7 7 disp(sprintf(' name: ''%s''',dofvec.name)); 8 disp(sprintf(' numdof : %i',dofvec.numdof));8 disp(sprintf(' numdofs: %i',dofvec.numdofs)); 9 9 disp(sprintf(' numentries: %i',dofvec.numentries)); 10 10 disp(sprintf('%s\n',' vector = ')); 11 11 for i=1:dofvec.numentries, 12 for j=1:dofvec.numdof ,12 for j=1:dofvec.numdofs, 13 13 disp(sprintf(' %i|%i|%g',i,j,dofvec.vector(i))); 14 14 end -
issm/trunk/src/m/classes/@dofvec/dofvec.m
r2315 r2316 9 9 % if no input arguments, create a default object 10 10 object.name=''; 11 object.numdof =1;11 object.numdofs=1; 12 12 object.numentries=0; 13 13 object.vector=zeros(0,1); … … 17 17 if (isa(varargin{1},'dofvec')) 18 18 object = varargin{1}; 19 elseif (isa(varargin{1},'struct')) 20 object = varargin{1}; 21 object=class(object,'dofvec'); 19 22 elseif ischar(varargin{1}), 20 23 object= dofvec; -
issm/trunk/src/m/solutions/cielo/CreateFemModel.m
r2110 r2316 24 24 25 25 displaystring(md.debug,'%s',' reducing single point constraints vector...'); 26 [m.ys m.ys0]=Reducevectorgtos(m.yg ,m.nodesets);26 [m.ys m.ys0]=Reducevectorgtos(m.yg.vector,m.nodesets); 27 27 28 28 displaystring(md.debug,'%s',' normalizing rigid body constraints matrix...'); … … 33 33 34 34 displaystring(md.debug,'%s',' processing parameters...'); 35 parameters= ProcessParams(parameters,m.part );35 parameters= ProcessParams(parameters,m.part.vector); 36 36 37 37 displaystring(md.debug,'%s',' creating parameters in matlab workspace...'); -
issm/trunk/src/mex/ComputePressure/ComputePressure.cpp
r1464 r2316 45 45 46 46 /*write output datasets: */ 47 WriteData(PRESSURE,p_g ,0,0,"Vector",NULL);47 WriteData(PRESSURE,p_g); 48 48 49 49 /*Free ressources: */ -
issm/trunk/src/mex/ConfigureObjects/ConfigureObjects.cpp
r103 r2316 34 34 35 35 /*write output datasets: */ 36 WriteData(ELEMENTS,elements ,0,0,"DataSet",NULL);37 WriteData(LOADS,loads ,0,0,"DataSet",NULL);38 WriteData(NODESOUT,nodes ,0,0,"DataSet",NULL);36 WriteData(ELEMENTS,elements); 37 WriteData(LOADS,loads); 38 WriteData(NODESOUT,nodes); 39 39 40 40 /*Free ressources: */ -
issm/trunk/src/mex/ContourToMesh/ContourToMesh.cpp
r1904 r2316 101 101 /* output: */ 102 102 if (strcmp(interptype,"node")==0){ 103 WriteData(PLHS0,in_nod ,0,0,"Vector",NULL);103 WriteData(PLHS0,in_nod); 104 104 } 105 105 else if (strcmp(interptype,"element")==0){ 106 WriteData(PLHS0,in_elem ,0,0,"Vector",NULL);106 WriteData(PLHS0,in_elem); 107 107 } 108 108 else if (strcmp(interptype,"element and node")==0){ 109 WriteData(PLHS0,in_nod ,0,0,"Vector",NULL);110 WriteData(PLHS1,in_elem ,0,0,"Vector",NULL);109 WriteData(PLHS0,in_nod); 110 WriteData(PLHS1,in_elem); 111 111 } 112 112 else throw ErrorException(__FUNCT__," wrong interpolation type"); -
issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp
r1904 r2316 90 90 91 91 /* output: */ 92 WriteData(FLAGS,flags ,0,0,"Vector",NULL);92 WriteData(FLAGS,flags); 93 93 94 94 /*end module: */ -
issm/trunk/src/mex/ControlConstrain/ControlConstrain.cpp
r1 r2316 33 33 34 34 /*write output : */ 35 WriteData(PGOUT,p_g,gsize ,1,"Vector","Vec");35 WriteData(PGOUT,p_g,gsize); 36 36 37 37 /*Free ressources: */ -
issm/trunk/src/mex/ControlOptimization/ControlOptimization.cpp
r2267 r2316 66 66 67 67 /*write output : */ 68 WriteData(SEARCHSCALAR, &search_scalar,0,0,"Scalar",NULL);69 WriteData(MISFIT, &J,0,0,"Scalar",NULL);68 WriteData(SEARCHSCALAR,search_scalar); 69 WriteData(MISFIT,J); 70 70 71 71 /*Free ressources: */ -
issm/trunk/src/mex/Dof/Dof.cpp
r1 r2316 16 16 17 17 /* output datasets: */ 18 Vecpartition=NULL;19 Vectpartition=NULL;18 DofVec* partition=NULL; 19 DofVec* tpartition=NULL; 20 20 21 21 /*Boot module: */ … … 34 34 35 35 /*partition and tpartition should be incremented by 1: */ 36 VecShift(partition ,1.0); //matlab indexing starts at 1.37 VecShift(tpartition ,1.0);36 VecShift(partition->vector,1.0); //matlab indexing starts at 1. 37 VecShift(tpartition->vector,1.0); 38 38 39 39 /*write output datasets: */ 40 WriteData(NODES,nodes ,0,0,"DataSet",NULL);41 WriteData(PARTITION,partition ,0,0,"Vector",NULL);42 WriteData(TPARTITION,tpartition ,0,0,"Vector",NULL);40 WriteData(NODES,nodes); 41 WriteData(PARTITION,partition); 42 WriteData(TPARTITION,tpartition); 43 43 44 44 /*Free ressources: */ … … 46 46 delete elements; 47 47 delete params; 48 VecFree(&partition);49 VecFree(&tpartition);48 delete partition; 49 delete tpartition; 50 50 51 51 /*end module: */ -
issm/trunk/src/mex/Du/Du.cpp
r1649 r2316 45 45 46 46 /*write output : */ 47 WriteData(DUG,du_g ,0,0,"Vector",NULL);47 WriteData(DUG,du_g); 48 48 49 49 /*Free ressources: */ -
issm/trunk/src/mex/ElementConnectivity/ElementConnectivity.cpp
r1103 r2316 30 30 31 31 /*write output datasets: */ 32 WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3 ,"Matrix","Mat");32 WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3); 33 33 34 34 /*Free ressources: */ -
issm/trunk/src/mex/FieldDepthAverage/FieldDepthAverage.cpp
r847 r2316 36 36 37 37 /*write output : */ 38 WriteData(FIELDOUT,field,0,0,"Vector",NULL); 38 WriteData(FIELDOUT,field); 39 39 40 /*Free ressources: */ 40 41 delete elements; -
issm/trunk/src/mex/FieldExtrude/FieldExtrude.cpp
r847 r2316 38 38 39 39 /*write output : */ 40 WriteData(FIELDOUT,field,0,0,"Vector",NULL); 40 WriteData(FIELDOUT,field); 41 41 42 /*Free ressources: */ 42 43 delete elements; -
issm/trunk/src/mex/Gradj/Gradj.cpp
r1649 r2316 49 49 50 50 /*write output : */ 51 WriteData(GRADG,grad_g ,0,0,"Vector",NULL);51 WriteData(GRADG,grad_g); 52 52 53 53 /*Free ressources: */ -
issm/trunk/src/mex/HoleFiller/HoleFiller.cpp
r1213 r2316 51 51 52 52 /* output: */ 53 WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols ,"Matrix","Mat");53 WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols); 54 54 55 55 /*end module: */ -
issm/trunk/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp
r2290 r2316 64 64 65 65 /*Write data: */ 66 WriteData(DATAMESH,data_mesh ,0,0,"Vector",NULL);66 WriteData(DATAMESH,data_mesh); 67 67 68 68 /*end module: */ -
issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
r2295 r2316 51 51 52 52 /*Write results: */ 53 WriteData(XM,x_m,ncols+1 ,1,"Vector","Vec");54 WriteData(YM,y_m,nlines+1 ,1,"Vector","Vec");55 WriteData(GRIDDATA,griddata,nlines,ncols ,"Matrix","Mat");53 WriteData(XM,x_m,ncols+1); 54 WriteData(YM,y_m,nlines+1); 55 WriteData(GRIDDATA,griddata,nlines,ncols); 56 56 57 57 /*Free ressources: */ -
issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
r2290 r2316 85 85 86 86 /*Write data: */ 87 WriteData(DATAPRIME,data_prime ,0,0,"Vector",NULL);87 WriteData(DATAPRIME,data_prime); 88 88 89 89 /*end module: */ -
issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
r2290 r2316 90 90 91 91 /*Write data: */ 92 WriteData(DATAPRIME,data_prime ,0,0,"Vector",NULL);92 WriteData(DATAPRIME,data_prime); 93 93 94 94 /*end module: */ -
issm/trunk/src/mex/MassFlux/MassFlux.cpp
r2112 r2316 45 45 46 46 /*write output datasets: */ 47 WriteData(RESPONSE, &mass_flux,0,0,"Scalar",NULL);47 WriteData(RESPONSE,mass_flux); 48 48 49 49 /*Free ressources: */ -
issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp
r1 r2316 35 35 36 36 /*write output datasets: */ 37 WriteData(UG,ug ,0,0,"Vector",NULL);37 WriteData(UG,ug); 38 38 39 39 /*Free ressources: */ -
issm/trunk/src/mex/MeshPartition/MeshPartition.cpp
r1 r2316 90 90 91 91 /*Write data:*/ 92 WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements ,1,"Matrix","Mat");93 WriteData(NODEPARTITIONING,node_partitioning,numberofgrids ,1,"Matrix","Mat");92 WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements); 93 WriteData(NODEPARTITIONING,node_partitioning,numberofgrids); 94 94 95 95 /*Free ressources:*/ -
issm/trunk/src/mex/Misfit/Misfit.cpp
r1649 r2316 44 44 45 45 /*write output : */ 46 WriteData(MISFIT, &J,0,0,"Scalar",NULL);46 WriteData(MISFIT,J); 47 47 48 48 /*Free ressources: */ -
issm/trunk/src/mex/ModelProcessor/ModelProcessor.cpp
r1810 r2316 35 35 36 36 /*Write output data: */ 37 WriteData(ELEMENTS,elements ,0,0,"DataSet",NULL);38 WriteData(NODES,nodes ,0,0,"DataSet",NULL);39 WriteData(CONSTRAINTS,constraints ,0,0,"DataSet",NULL);40 WriteData(LOADS,loads ,0,0,"DataSet",NULL);41 WriteData(MATERIALS,materials ,0,0,"DataSet",NULL);42 WriteData(PARAMETERS,parameters ,0,0,"DataSet",NULL);37 WriteData(ELEMENTS,elements); 38 WriteData(NODES,nodes); 39 WriteData(CONSTRAINTS,constraints); 40 WriteData(LOADS,loads); 41 WriteData(MATERIALS,materials); 42 WriteData(PARAMETERS,parameters); 43 43 44 44 -
issm/trunk/src/mex/MpcNodes/MpcNodes.cpp
r1 r2316 32 32 33 33 /*write output datasets: */ 34 WriteData(RMG,Rmg ,0,0,"Matrix",NULL);35 WriteData(NODES,nodes ,0,0,"DataSet",NULL);34 WriteData(RMG,Rmg); 35 WriteData(NODES,nodes); 36 36 37 37 /*Free ressources: */ -
issm/trunk/src/mex/NodeConnectivity/NodeConnectivity.cpp
r1103 r2316 29 29 30 30 /*write output datasets: */ 31 WriteData(CONNECTIVITY,connectivity,nods,width ,"Matrix","Mat");31 WriteData(CONNECTIVITY,connectivity,nods,width); 32 32 33 33 /*Free ressources: */ -
issm/trunk/src/mex/NormalizeConstraints/NormalizeConstraints.cpp
r1 r2316 31 31 32 32 /*write output datasets: */ 33 WriteData(GMN,Gmn ,0,0,"Matrix",NULL);33 WriteData(GMN,Gmn); 34 34 35 35 /*Free ressources: */ -
issm/trunk/src/mex/Orth/Orth.cpp
r1 r2316 31 31 32 32 /*write output datasets: */ 33 WriteData(NEWGRADJ,newgradj ,0,0,"Vector",NULL);33 WriteData(NEWGRADJ,newgradj); 34 34 35 35 /*Free ressources: */ -
issm/trunk/src/mex/OutputRifts/OutputRifts.cpp
r1805 r2316 32 32 33 33 /*write output : */ 34 WriteData(RIFTPROPERTIES,riftproperties ,0,0,"Vector",NULL);34 WriteData(RIFTPROPERTIES,riftproperties); 35 35 36 36 /*Free ressources: */ -
issm/trunk/src/mex/PenaltyConstraints/PenaltyConstraints.cpp
r1649 r2316 47 47 48 48 /*write output datasets: */ 49 WriteData(LOADS,loads ,0,0,"DataSet",NULL);50 WriteData(CONVERGED, (void*)&converged,0,0,"Integer",NULL);51 WriteData(NUMUNSTABLECONSTRAINTS, (void*)&num_unstable_constraints,0,0,"Integer",NULL);49 WriteData(LOADS,loads); 50 WriteData(CONVERGED,converged); 51 WriteData(NUMUNSTABLECONSTRAINTS,num_unstable_constraints); 52 52 53 53 -
issm/trunk/src/mex/PenaltySystemMatrices/PenaltySystemMatrices.cpp
r1649 r2316 52 52 53 53 /*write output datasets: */ 54 WriteData(KGG,Kgg ,0,0,"Matrix",NULL);55 WriteData(PG,pg ,0,0,"Vector",NULL);56 WriteData(KMAX, &kmax,0,0,"Scalar",NULL);54 WriteData(KGG,Kgg); 55 WriteData(PG,pg); 56 WriteData(KMAX,kmax); 57 57 58 58 /*Free ressources: */ -
issm/trunk/src/mex/ProcessParams/ProcessParams.cpp
r304 r2316 31 31 32 32 /*write output datasets: */ 33 WriteData(PARAMETERSOUT,parameters ,0,0,"DataSet",NULL);33 WriteData(PARAMETERSOUT,parameters); 34 34 35 35 /*Free ressources: */ -
issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp
r1 r2316 37 37 38 38 /*write output datasets: */ 39 WriteData(PF,pf ,0,0,"Vector",NULL);39 WriteData(PF,pf); 40 40 41 41 /*Free ressources: */ -
issm/trunk/src/mex/Reducematrixfromgtof/Reducematrixfromgtof.cpp
r1 r2316 34 34 35 35 /*write output datasets: */ 36 WriteData(KFF,Kff ,0,0,"Matrix",NULL);37 WriteData(KFS,Kfs ,0,0,"Matrix",NULL);36 WriteData(KFF,Kff); 37 WriteData(KFS,Kfs); 38 38 39 39 /*Free ressources: */ -
issm/trunk/src/mex/Reducevectorgtof/Reducevectorgtof.cpp
r1665 r2316 31 31 32 32 /*write output datasets: */ 33 WriteData(UF,uf ,0,0,"Vector",NULL);33 WriteData(UF,uf); 34 34 35 35 /*Free ressources: */ -
issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp
r1 r2316 32 32 33 33 /*write output datasets: */ 34 WriteData(YS,ys ,0,0,"Vector",NULL);35 WriteData(YS0,ys0 ,0,0,"Vector",NULL);34 WriteData(YS,ys); 35 WriteData(YS0,ys0); 36 36 37 37 /*Free ressources: */ -
issm/trunk/src/mex/Solver/Solver.cpp
r1 r2316 35 35 36 36 /*write output datasets: */ 37 WriteData(UF,uf ,0,0,"Vector",NULL);37 WriteData(UF,uf); 38 38 39 39 /*Free ressources: */ -
issm/trunk/src/mex/SpcNodes/SpcNodes.cpp
r1 r2316 16 16 17 17 /* output datasets: */ 18 Vecyg=NULL;18 DofVec* yg=NULL; 19 19 20 20 /*Boot module: */ … … 32 32 33 33 /*write output datasets: */ 34 WriteData(NODES,nodes ,0,0,"DataSet",NULL);35 WriteData(YG,yg ,0,0,"Vector",NULL);34 WriteData(NODES,nodes); 35 WriteData(YG,yg); 36 36 37 37 /*Free ressources: */ 38 38 delete nodes; 39 39 delete constraints; 40 VecFree(&yg);40 delete yg; 41 41 42 42 /*end module: */ -
issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp
r1649 r2316 53 53 54 54 /*write output datasets: */ 55 WriteData(KGG,Kgg ,0,0,"Matrix",NULL);56 WriteData(PG,pg ,0,0,"Vector",NULL);55 WriteData(KGG,Kgg); 56 WriteData(PG,pg); 57 57 58 58 -
issm/trunk/src/mex/UpdateFromInputs/UpdateFromInputs.cpp
r246 r2316 37 37 38 38 /*write output datasets: */ 39 WriteData(ELEMENTS,elements ,0,0,"DataSet",NULL);40 WriteData(NODES,nodes ,0,0,"DataSet",NULL);41 WriteData(LOADS,loads ,0,0,"DataSet",NULL);42 WriteData(MATERIALS,materials ,0,0,"DataSet",NULL);39 WriteData(ELEMENTS,elements); 40 WriteData(NODES,nodes); 41 WriteData(LOADS,loads); 42 WriteData(MATERIALS,materials); 43 43 44 44 /*Free ressources: */ -
issm/trunk/src/mex/UpdateGeometry/UpdateGeometry.cpp
r822 r2316 44 44 45 45 /*write output data: */ 46 WriteData(OUTTHICKNESS,outthickness ,0,0,"Vector",NULL);47 WriteData(OUTBED,outbed ,0,0,"Vector",NULL);48 WriteData(OUTSURFACE,outsurface ,0,0,"Vector",NULL);46 WriteData(OUTTHICKNESS,outthickness); 47 WriteData(OUTBED,outbed); 48 WriteData(OUTSURFACE,outsurface); 49 49 50 50 /*Free ressources: */ -
issm/trunk/src/mex/UpdateNodePositions/UpdateNodePositions.cpp
r876 r2316 36 36 37 37 /*write output datasets: */ 38 WriteData(NODESOUT,nodes ,0,0,"DataSet",NULL);38 WriteData(NODESOUT,nodes); 39 39 40 40 /*Free ressources: */ -
issm/trunk/startup.m
r1572 r2316 43 43 addpath(genpath_ice([ISSM_DIR '/src/m'])); 44 44 addpath(genpath_ice([ISSM_DIR '/src/pro'])); 45 addpath(genpath_ice([ISSM_DIR '/externalpackages/subplotSpacing'])); 45 46 46 47 %Check on any warning messages that might indicate that the paths were not correct. -
issm/trunk/test/Verification/test01_IceShelfIceFrontM2d/testpresolve.m
r2151 r2316 2 2 load Velocities; md.vx=0.5*vx; md.vy=0.5*vy; 3 3 end 4 md.debug=1;
Note:
See TracChangeset
for help on using the changeset viewer.