Changeset 4021
- Timestamp:
- 06/03/10 15:20:44 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/DataSet/DataSet.cpp
r4004 r4021 550 550 /*Objects methods*/ 551 551 /*FUNCTION DataSet::Configure{{{1*/ 552 void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters, analysis_counter,analysis_type){552 void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_counter,int analysis_type){ 553 553 554 554 vector<Object*>::iterator object; … … 562 562 563 563 element=(Element*)(*object); 564 element->Configure(elements,loads,nodes,materials,parameters );564 element->Configure(elements,loads,nodes,materials,parameters,analysis_counter); 565 565 } 566 566 if(EnumIsLoad((*object)->Enum())){ … … 924 924 925 925 rgb=(Rgb*)(*object); 926 if(rgb->InAnalysis(analysis_type))count++ 926 if(rgb->InAnalysis(analysis_type))count++; 927 927 } 928 928 } -
issm/trunk/src/c/DataSet/DataSet.h
r4004 r4021 58 58 void FlagClones(int numberofnodes); 59 59 int NumberOfDofs(int analysis_type); 60 int NumberOfRgbs( );60 int NumberOfRgbs(int analysis_type); 61 61 void SetupSpcs(DataSet* nodes,Vec yg,int analysis_type); 62 62 void SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type); -
issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
r4004 r4021 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_ type){12 int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_counter,int analysis_type){ 13 13 14 14 /*Intermediary*/ -
issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h
r4009 r4021 9 9 10 10 /* local prototypes: */ 11 int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters,int analysis_ type);11 int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters,int analysis_counter, int analysis_type); 12 12 13 13 #endif /* _CONFIGUREOBJECTSX_H */ -
issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp
r3913 r4021 10 10 11 11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofgrids,double* elements, 12 int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, char* meshtype,int num_procs){12 int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){ 13 13 14 14 int noerr=1; … … 30 30 int edgecut=1; 31 31 32 if( strcmp(meshtype,"2d")==0){32 if(dim==2){ 33 33 epart=(int*)xmalloc(numberofelements*sizeof(int)); 34 34 npart=(int*)xmalloc(numberofgrids*sizeof(int)); -
issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h
r3067 r4021 8 8 /* local prototypes: */ 9 9 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofgrids,double* elements, 10 int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, char* meshtype,int numareas);10 int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, int dim,int numareas); 11 11 12 12 #endif /* _MESHPARTITIONX_H */ -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r4013 r4021 13 13 #include "../../io/io.h" 14 14 #include "../../objects/objects.h" 15 16 void OutputResults(DataSet* results,char* filename){17 18 int i;19 Result* result=NULL;20 FILE* fid=NULL;21 extern int my_rank;22 23 /* Open output file to write raw binary data: */24 if(my_rank==0){25 fid=pfopen(filename,"wb");26 27 for(i=0;i<results->Size();i++){28 result=(Result*)results->GetObjectByOffset(i);29 30 /*write result to disk: */31 result->WriteData(fid);32 }33 15 34 /*Close file: */ 35 pfclose(fid,filename); 36 } 16 void OutputResults(FemModel* femmodel, char* filename,int analysis_type){ 37 17 38 18 39 /*output if we have rifts: */ 40 if(numrifts){ 41 OutputRiftsx( &riftproperties,fem_dh->loads,numrifts); 42 results->AddObject(new Result(results->Size()+1,0,1,"riftproperties",riftproperties)); 43 } 44 19 ISSMERROR(" not supported yet!"); 20 21 22 // 23 // 24 // int i; 25 // Result* result=NULL; 26 // FILE* fid=NULL; 27 // extern int my_rank; 28 // 29 // /* Open output file to write raw binary data: */ 30 // if(my_rank==0){ 31 // fid=pfopen(filename,"wb"); 32 // 33 // for(i=0;i<results->Size();i++){ 34 // result=(Result*)results->GetObjectByOffset(i); 35 // 36 // /*write result to disk: */ 37 // result->WriteData(fid); 38 // } 39 // 40 // /*Close file: */ 41 // pfclose(fid,filename); 42 // } 43 // 44 // 45 // /*output if we have rifts: */ 46 // if(numrifts){ 47 // OutputRiftsx( &riftproperties,fem_dh->loads,numrifts); 48 // results->AddObject(new Result(results->Size()+1,0,1,"riftproperties",riftproperties)); 49 // } 50 // 45 51 46 52 } -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h
r3938 r4021 9 9 10 10 /* local prototypes: */ 11 void OutputResults( DataSet* results,char* filename);11 void OutputResults(FemModel* femmodel, char* filename,int analysis_type); 12 12 13 13 #endif /* _OUTPUTRESULTS_H */ -
issm/trunk/src/c/objects/Elements/Beam.cpp
r4013 r4021 33 33 34 34 /*Object management*/ 35 /*FUNCTION Beam::Configure{{{1*/36 void Beam::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){37 38 int i;39 40 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective41 * datasets, using internal ids and offsets hidden in hooks: */42 hnodes.configure(nodesin);43 hmatice.configure(materialsin);44 hmatpar.configure(materialsin);45 46 /*point parameters to real dataset: */47 this->parameters=parametersin;48 49 }50 /*}}}*/51 35 /*FUNCTION Beam::copy{{{1*/ 52 36 Object* Beam::copy() { 53 54 return new Beam(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs); 55 37 38 int i; 39 Beam* beam=NULL; 40 41 beam=new Beam(); 42 43 /*copy fields: */ 44 beam->id=this->id; 45 if(this->inputs){ 46 beam->inputs=(Inputs*)this->inputs->Copy(); 47 } 48 else{ 49 beam->inputs=new Inputs(); 50 } 51 /*point parameters: */ 52 beam->parameters=this->parameters; 53 54 /*pointers: */ 55 beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 56 for(i=0;i<2;i++)beam->nodes[i]=this->nodes[i]; 57 beam->matice=this->matice; 58 beam->matpar=this->matpar; 59 60 return beam; 56 61 } 57 62 /*}}}*/ … … 59 64 void Beam::DeepEcho(void){ 60 65 66 int i; 67 61 68 printf("Beam:\n"); 62 69 printf(" id: %i\n",id); 63 hnodes.DeepEcho(); 64 hmatice.DeepEcho(); 65 hmatpar.DeepEcho(); 70 for(i=0;i<2;i++){ 71 nodes[i]->DeepEcho(); 72 } 73 matice->DeepEcho(); 74 matpar->DeepEcho(); 66 75 printf(" parameters\n"); 67 76 parameters->DeepEcho(); … … 74 83 /*FUNCTION Beam::Demarshall{{{1*/ 75 84 void Beam::Demarshall(char** pmarshalled_dataset){ 76 77 char* marshalled_dataset=NULL; 78 int i; 79 80 /*recover marshalled_dataset: */ 81 marshalled_dataset=*pmarshalled_dataset; 82 83 /*this time, no need to get enum type, the pointer directly points to the beginning of the 84 *object data (thanks to DataSet::Demarshall):*/ 85 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 86 87 /*demarshall hooks: */ 88 hnodes.Demarshall(&marshalled_dataset); 89 hmatice.Demarshall(&marshalled_dataset); 90 hmatpar.Demarshall(&marshalled_dataset); 91 92 /*demarshall inputs: */ 93 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 94 95 /*parameters: may not exist even yet, so let Configure handle it: */ 96 this->parameters=NULL; 97 98 /*return: */ 99 *pmarshalled_dataset=marshalled_dataset; 100 return; 85 ISSMERROR("not supported yet!"); 101 86 } 102 87 /*}}}*/ … … 104 89 void Beam::Echo(void){ 105 90 91 int i; 92 106 93 printf("Beam:\n"); 107 94 printf(" id: %i\n",id); 108 hnodes.Echo(); 109 hmatice.Echo(); 110 hmatpar.Echo(); 95 for(i=0;i<2;i++){ 96 nodes[i]->DeepEcho(); 97 } 98 matice->DeepEcho(); 99 matpar->DeepEcho(); 111 100 printf(" parameters\n"); 112 101 parameters->Echo(); … … 128 117 /*FUNCTION Beam::Marshall{{{1*/ 129 118 void Beam::Marshall(char** pmarshalled_dataset){ 130 131 char* marshalled_dataset=NULL; 132 int enum_type=0; 133 char* marshalled_inputs=NULL; 134 int marshalled_inputs_size; 135 136 /*recover marshalled_dataset: */ 137 marshalled_dataset=*pmarshalled_dataset; 138 139 /*get enum type of Beam: */ 140 enum_type=BeamEnum; 141 142 /*marshall enum: */ 143 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 144 145 /*marshall Beam data: */ 146 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 147 148 /*Marshall hooks: */ 149 hnodes.Marshall(&marshalled_dataset); 150 hmatice.Marshall(&marshalled_dataset); 151 hmatpar.Marshall(&marshalled_dataset); 152 153 /*Marshall inputs: */ 154 marshalled_inputs_size=inputs->MarshallSize(); 155 marshalled_inputs=inputs->Marshall(); 156 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 157 marshalled_dataset+=marshalled_inputs_size; 158 159 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 160 161 xfree((void**)&marshalled_inputs); 162 163 *pmarshalled_dataset=marshalled_dataset; 164 return; 119 ISSMERROR("not supported yet!"); 165 120 } 166 121 /*}}}*/ 167 122 /*FUNCTION Beam::MarshallSize{{{1*/ 168 123 int Beam::MarshallSize(){ 169 170 return sizeof(id) 171 +hnodes.MarshallSize() 172 +hmatice.MarshallSize() 173 +hmatpar.MarshallSize() 174 +inputs->MarshallSize() 175 +sizeof(int); //sizeof(int) for enum type 124 ISSMERROR("not supported yet!"); 176 125 } 177 126 /*}}}*/ … … 207 156 double gauss[numgrids][numgrids]={{1,0},{0,1}}; 208 157 209 /*dynamic objects pointed to by hooks: */210 Node** nodes=NULL;211 Matpar* matpar=NULL;212 Matice* matice=NULL;213 214 158 /*Get dof list on which we will plug the pressure values: */ 215 159 GetDofList1(&doflist[0]); 216 217 /*recover objects from hooks: */218 nodes=(Node**)hnodes.deliverp();219 matpar=(Matpar*)hmatpar.delivers();220 matice=(Matice*)hmatice.delivers();221 160 222 161 /*Get node data: */ … … 288 227 double one0,one1; 289 228 290 /*dynamic objects pointed to by hooks: */291 Node** nodes=NULL;292 293 /*recover objects from hooks: */294 nodes=(Node**)hnodes.deliverp();295 296 229 connectivity[0]=nodes[0]->GetConnectivity(); 297 230 connectivity[1]=nodes[1]->GetConnectivity(); … … 387 320 bool onsurface; 388 321 int connectivity[2]; 389 390 /*dynamic objects pointed to by hooks: */391 Node** nodes=NULL;392 Matpar* matpar=NULL;393 Matice* matice=NULL;394 395 /*recover objects from hooks: */396 nodes=(Node**)hnodes.deliverp();397 matpar=(Matpar*)hmatpar.delivers();398 matice=(Matice*)hmatice.delivers();399 322 400 323 /*recover doflist: */ … … 510 433 int numberofdofspernode; 511 434 512 /*dynamic objects pointed to by hooks: */513 Node** nodes=NULL;514 515 /*recover objects from hooks: */516 nodes=(Node**)hnodes.deliverp();517 518 435 for(i=0;i<2;i++){ 519 436 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 531 448 void Beam::GetDofList1(int* doflist){ 532 449 533 /*dynamic objects pointed to by hooks: */534 Node** nodes=NULL;535 536 /*recover objects from hooks: */537 nodes=(Node**)hnodes.deliverp();538 539 450 int i; 540 451 for(i=0;i<2;i++){ … … 564 475 /*FUNCTION Beam::GetMatPar{{{1*/ 565 476 void* Beam::GetMatPar(){ 566 567 /*dynamic objects pointed to by hooks: */568 Matpar* matpar=NULL;569 570 /*recover objects from hooks: */571 matpar=(Matpar*)hmatpar.delivers();572 477 573 478 return matpar; … … 591 496 Node** pnodes=NULL; 592 497 593 /*dynamic objects pointed to by hooks: */594 Node** nodes=NULL;595 596 498 /*recover nodes: */ 597 499 pnodes=(Node**)vpnodes; 598 500 599 /*recover objects from hooks: */600 nodes=(Node**)hnodes.deliverp();601 602 501 for(i=0;i<3;i++){ 603 502 pnodes[i]=nodes[i]; … … 677 576 /*Check that name is an element input*/ 678 577 if (!IsInput(name)) return; 679 Node** nodes=NULL;680 681 578 switch(type){ 682 579 … … 687 584 688 585 /*Get values on the 6 vertices*/ 689 nodes=(Node**)hnodes.deliverp();690 586 for (int i=0;i<2;i++){ 691 587 values[i]=vector[nodes[i]->GetVertexDof()]; … … 780 676 bool found = false; 781 677 int count = 0; 782 Node **nodes = NULL;783 678 double *this_patch = NULL; 784 679 … … 801 696 count=*pcount; 802 697 803 /*Recover nodes: */804 nodes=(Node**)hnodes.deliverp();805 806 698 /*set this_patch to point at the beginning of the patches row, where we will plug our information :*/ 807 699 this_patch=patches+numcols*count; -
issm/trunk/src/c/objects/Elements/Beam.h
r4011 r4021 14 14 class Inputs; 15 15 class IoModel; 16 class Node; 17 class Matice; 18 class Matpar; 16 19 17 20 #include "../../shared/Exceptions/exceptions.h" … … 26 29 int id; 27 30 28 Hook hnodes; //hook to2 nodes29 Hook hmatice; //hook to 1 matice30 Hook hmatpar; //hook to 1 matpar31 Node** nodes; //2 nodes 32 Matice* matice; 33 Matpar* matpar; 31 34 32 35 Parameters* parameters; //pointer to solution parameters … … 39 42 /*}}}*/ 40 43 /*object management: {{{1*/ 44 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter); 41 45 void Echo(); 42 46 void DeepEcho(); … … 48 52 bool IsInput(int name); 49 53 int MyRank(); 50 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);51 54 Object* copy(); 52 55 void SetClone(int* minranks); -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4015 r4021 78 78 79 79 //collpase flags 80 collapse=(bool*)xcalloc(nummodels *sizeof(bool));81 82 } 83 /*}}}*/ 84 /*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter ) {{{1*/85 Penta::Update(IoModel* iomodel,int analysis_counter){80 collapse=(bool*)xcalloc(nummodels,sizeof(bool)); 81 82 } 83 /*}}}*/ 84 /*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter,int analysis_type) {{{1*/ 85 void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type){ 86 86 87 87 /*Intermediaries*/ … … 107 107 108 108 /*hooks: */ 109 this->Set tHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type109 this->SetHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type 110 110 111 111 //intialize inputs, and add as many inputs per element as requested: … … 227 227 Object* Penta::copy() { 228 228 229 int i; 230 229 231 Penta* penta=NULL; 230 232 … … 243 245 244 246 /*now deal with hooks and objects: */ 245 penta->InitHookNodes(this->num models);246 for(i=0;i<this->num models;i++)penta->hnodes[i].copy(&this->hnodes[i]);247 penta->InitHookNodes(this->numanalyses); 248 for(i=0;i<this->numanalyses;i++)penta->hnodes[i].copy(&this->hnodes[i]); 247 249 penta->hmatice.copy(&this->hmatice); 248 250 penta->hmatpar.copy(&this->hmatpar); … … 294 296 295 297 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 296 memcpy(&num models,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);298 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 297 299 298 300 /*allocate dynamic memory: */ 299 collapse=(bool*)xmalloc(num models*sizeof(bool));300 InitHookNodes(num models);301 collapse=(bool*)xmalloc(numanalyses*sizeof(bool)); 302 InitHookNodes(numanalyses); 301 303 302 304 /*demarshall hooks: */ 303 for(i=0;i<num models;i++)hnodes[i].Demarshall(&marshalled_dataset);305 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 304 306 hmatice.Demarshall(&marshalled_dataset); 305 307 hmatpar.Demarshall(&marshalled_dataset); … … 316 318 317 319 /*demarshall internal parameters: */ 318 memcpy(collapse,marshalled_dataset,num models*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);320 memcpy(collapse,marshalled_dataset,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool); 319 321 320 322 /*parameters: may not exist even yet, so let Configure handle it: */ … … 347 349 inputs->DeepEcho(); 348 350 printf(" collapse: \n "); 349 for(i=0;i<num models;i++)printf("%s|",value?"true":"false");351 for(i=0;i<numanalyses;i++)printf("%s|",collapse[i]?"true":"false"); 350 352 return; 351 353 } … … 384 386 /*marshall Penta data: */ 385 387 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 386 memcpy(marshalled_dataset,&num models,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);388 memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 387 389 388 390 /*Marshall hooks: */ 389 for(i=0;i<num models;i++)hnodes[i].Marshall(&marshalled_dataset);391 for(i=0;i<numanalyses;i++)hnodes[i].Marshall(&marshalled_dataset); 390 392 hmatice.Marshall(&marshalled_dataset); 391 393 hmatpar.Marshall(&marshalled_dataset); … … 399 401 400 402 /*marshall internal parameters: */ 401 memcpy(marshalled_dataset,collapse,num models*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);403 memcpy(marshalled_dataset,collapse,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool); 402 404 403 405 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ … … 415 417 int hnodes_size=0;; 416 418 417 for(i=0;i<num models;i++)hnodes_size+=hnodes[i].MarshallSize;419 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i].MarshallSize(); 418 420 419 421 return sizeof(id) … … 423 425 +hneighbors.MarshallSize() 424 426 +inputs->MarshallSize() 425 +num models*sizeof(bool)427 +numanalyses*sizeof(bool) 426 428 +sizeof(int); //sizeof(int) for enum type 427 429 } … … 429 431 /*FUNCTION Penta::SpawnTria {{{1*/ 430 432 void* Penta::SpawnTria(int g0, int g1, int g2){ 433 434 int i; 431 435 432 436 /*out of grids g0,g1 and g2 from Penta, build a tria element: */ … … 460 464 /*FUNCTION Penta::SpawnBeam {{{1*/ 461 465 void* Penta::SpawnBeam(int g0, int g1){ 466 467 int i; 462 468 463 469 /*out of grids g0,g1 and g2 from Penta, build a beam element: */ … … 1173 1179 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); 1174 1180 } 1175 else if (analysis_type==Slope computeAnalysisEnum){1181 else if (analysis_type==SlopeComputeAnalysisEnum){ 1176 1182 CreateKMatrixSlopeCompute( Kgg,analysis_type,sub_analysis_type); 1177 1183 } … … 1667 1673 1668 1674 /*build friction object, used later on: */ 1669 friction=new Friction("2d",inputs,matpar );1675 friction=new Friction("2d",inputs,matpar,analysis_type); 1670 1676 1671 1677 for(i=0;i<numgrids2d;i++){ … … 2250 2256 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); 2251 2257 } 2252 else if (analysis_type==Slope computeAnalysisEnum){2258 else if (analysis_type==SlopeComputeAnalysisEnum){ 2253 2259 CreatePVectorSlopeCompute( pg,analysis_type,sub_analysis_type); 2254 2260 } -
issm/trunk/src/c/objects/Elements/Penta.h
r4015 r4021 43 43 Penta(); 44 44 Penta(int penta_id,int i, IoModel* iomodel,int nummodels); 45 void Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type); 45 46 ~Penta(); 46 47 /*}}}*/ 47 48 /*FUNCTION object management {{{1*/ 48 49 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter); 49 void Update(IoModel* iomodel,int analysis_counter,int analysis_type);50 50 Object* copy(); 51 51 void DeepEcho(); -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r3984 r4021 24 24 PentaHook::PentaHook(){ 25 25 numanalyses=UNDEF; 26 this->h ooks=NULL;26 this->hnodes=NULL; 27 27 } 28 28 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Sing.cpp
r4013 r4021 36 36 void Sing::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){ 37 37 38 int i; 39 40 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 41 * datasets, using internal ids and offsets hidden in hooks: */ 42 hnodes.configure(nodesin); 43 hmatice.configure(materialsin); 44 hmatpar.configure(materialsin); 45 46 /*point parameters to real dataset: */ 47 this->parameters=parametersin; 38 ISSMERROR(" not supported yet!"); 48 39 49 40 } … … 51 42 /*FUNCTION Sing::copy {{{1*/ 52 43 Object* Sing::copy() { 53 54 return new Sing(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs); 55 44 45 int i; 46 Sing* sing=NULL; 47 48 sing=new Sing(); 49 50 /*copy fields: */ 51 sing->id=this->id; 52 if(this->inputs){ 53 sing->inputs=(Inputs*)this->inputs->Copy(); 54 } 55 else{ 56 sing->inputs=new Inputs(); 57 } 58 /*point parameters: */ 59 sing->parameters=this->parameters; 60 61 /*pointers: */ 62 sing->node=this->node; 63 sing->matice=this->matice; 64 sing->matpar=this->matpar; 65 66 return sing; 56 67 } 57 68 /*}}}*/ … … 61 72 printf("Sing:\n"); 62 73 printf(" id: %i\n",id); 63 hnodes.DeepEcho();64 hmatice.DeepEcho();65 hmatpar.DeepEcho();74 node->DeepEcho(); 75 matice->DeepEcho(); 76 matpar->DeepEcho(); 66 77 printf(" parameters\n"); 67 78 parameters->DeepEcho(); … … 74 85 /*FUNCTION Sing::Demarshall {{{1*/ 75 86 void Sing::Demarshall(char** pmarshalled_dataset){ 76 77 char* marshalled_dataset=NULL; 78 79 /*recover marshalled_dataset: */ 80 marshalled_dataset=*pmarshalled_dataset; 81 82 /*this time, no need to get enum type, the pointer directly points to the beginning of the 83 *object data (thanks to DataSet::Demarshall):*/ 84 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 85 86 /*demarshall hooks: */ 87 hnodes.Demarshall(&marshalled_dataset); 88 hmatice.Demarshall(&marshalled_dataset); 89 hmatpar.Demarshall(&marshalled_dataset); 90 91 /*demarshall inputs: */ 92 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 93 94 /*parameters: may not exist even yet, so let Configure handle it: */ 95 this->parameters=NULL; 96 97 /*return: */ 98 *pmarshalled_dataset=marshalled_dataset; 99 return; 87 ISSMERROR(" not supported yet!"); 100 88 } 101 89 /*}}}*/ … … 106 94 printf("Sing:\n"); 107 95 printf(" id: %i\n",id); 108 hnodes.Echo();109 hmatice.Echo();110 hmatpar.Echo();96 node->Echo(); 97 matice->Echo(); 98 matpar->Echo(); 111 99 printf(" parameters\n"); 112 100 parameters->Echo(); … … 126 114 /*FUNCTION Sing::Marshall {{{1*/ 127 115 void Sing::Marshall(char** pmarshalled_dataset){ 128 129 char* marshalled_dataset=NULL; 130 int enum_type=0; 131 char* marshalled_inputs=NULL; 132 int marshalled_inputs_size; 133 134 /*recover marshalled_dataset: */ 135 marshalled_dataset=*pmarshalled_dataset; 136 137 /*get enum type of Sing: */ 138 enum_type=SingEnum; 139 140 /*marshall enum: */ 141 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 142 143 /*marshall Sing data: */ 144 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 145 146 /*Marshall hooks: */ 147 hnodes.Marshall(&marshalled_dataset); 148 hmatice.Marshall(&marshalled_dataset); 149 hmatpar.Marshall(&marshalled_dataset); 150 151 /*Marshall inputs: */ 152 marshalled_inputs_size=inputs->MarshallSize(); 153 marshalled_inputs=inputs->Marshall(); 154 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 155 marshalled_dataset+=marshalled_inputs_size; 156 157 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 158 159 160 xfree((void**)&marshalled_inputs); 161 162 *pmarshalled_dataset=marshalled_dataset; 163 return; 116 ISSMERROR(" not supported yet!"); 164 117 } 165 118 /*}}}*/ 166 119 /*FUNCTION Sing::MashallSize {{{1*/ 167 120 int Sing::MarshallSize(){ 168 169 return sizeof(id) 170 +hnodes.MarshallSize() 171 +hmatice.MarshallSize() 172 +hmatpar.MarshallSize() 173 +inputs->MarshallSize() 174 +sizeof(int); //sizeof(int) for enum type 121 ISSMERROR(" not supported yet!"); 175 122 } 176 123 /*}}}*/ … … 202 149 double rho_ice,g; 203 150 204 /*dynamic objects pointed to by hooks: */205 Matpar* matpar=NULL;206 Matice* matice=NULL;207 208 151 /*Get dof list on which we will plug the pressure values: */ 209 152 GetDofList1(&dof); 210 211 /*recover objects from hooks: */212 matpar=(Matpar*)hmatpar.delivers();213 matice=(Matice*)hmatice.delivers();214 153 215 154 /*pressure is lithostatic: */ … … 263 202 int connectivity; 264 203 265 /*dynamic objects pointed to by hooks: */266 Node** node=NULL;267 268 /*recover objects from hooks: */269 node=(Node**)hnodes.deliverp();270 271 204 /*Find connectivity of the node and divide Ke_gg by this connectivity*/ 272 connectivity=node [0]->GetConnectivity();205 connectivity=node->GetConnectivity(); 273 206 Ke_gg[0][0]=1/(double)connectivity; 274 207 Ke_gg[1][1]=1/(double)connectivity; … … 314 247 int connectivity; 315 248 316 /*dynamic objects pointed to by hooks: */317 Node** node=NULL;318 Matpar* matpar=NULL;319 Matice* matice=NULL;320 321 /*recover objects from hooks: */322 node=(Node**)hnodes.deliverp();323 matpar=(Matpar*)hmatpar.delivers();324 matice=(Matice*)hmatice.delivers();325 326 249 inputs->GetParameterValue(&slope[0],SurfaceSlopeXEnum); 327 250 inputs->GetParameterValue(&slope[1],SurfaceSlopeYEnum); … … 330 253 331 254 //Get connectivity of the node 332 connectivity=node [0]->GetConnectivity();255 connectivity=node->GetConnectivity(); 333 256 334 257 //compute slope2 … … 379 302 int numberofdofspernode; 380 303 381 /*dynamic objects pointed to by hooks: */ 382 Node** nodes=NULL; 383 384 /*recover objects from hooks: */ 385 nodes=(Node**)hnodes.deliverp(); 386 387 nodes[0]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 304 node->GetDofList(&doflist_per_node[0],&numberofdofspernode); 388 305 for(i=0;i<numberofdofspernode;i++){ 389 306 doflist[i]=doflist_per_node[i]; … … 398 315 void Sing::GetDofList1(int* doflist){ 399 316 400 /*dynamic objects pointed to by hooks: */401 Node** nodes=NULL;402 403 /*recover objects from hooks: */404 nodes=(Node**)hnodes.deliverp();405 406 317 int i; 407 doflist[0]=node s[0]->GetDofList1();318 doflist[0]=node->GetDofList1(); 408 319 409 320 } … … 415 326 void* Sing::GetMatPar(){ 416 327 417 /*dynamic objects pointed to by hooks: */418 Matpar* matpar=NULL;419 420 /*recover objects from hooks: */421 matpar=(Matpar*)hmatpar.delivers();422 423 328 return matpar; 424 329 } … … 429 334 Node** pnodes=NULL; 430 335 431 /*dynamic objects pointed to by hooks: */432 Node** nodes=NULL;433 434 336 /*recover nodes: */ 435 337 pnodes=(Node**)vpnodes; 436 338 437 /*recover objects from hooks: */ 438 nodes=(Node**)hnodes.deliverp(); 439 440 pnodes[0]=nodes[0]; 339 pnodes[0]=node; 441 340 } 442 341 /*}}}*/ … … 503 402 /*Check that name is an element input*/ 504 403 if (!IsInput(name)) return; 505 Node* node=NULL;506 404 507 405 switch(type){ … … 513 411 514 412 /*Get values on the 6 vertices*/ 515 node=(Node*)this->hnodes.delivers();516 413 value=vector[node->GetVertexDof()]; 517 414 … … 602 499 bool found = false; 603 500 int count = 0; 604 Node **nodes = NULL;605 501 double *this_patch = NULL; 606 502 … … 623 519 count=*pcount; 624 520 625 /*Recover nodes: */626 nodes=(Node**)hnodes.deliverp();627 628 521 /*set this_patch to point at the beginning of the patches row, where we will plug our information :*/ 629 522 this_patch=patches+numcols*count; … … 633 526 634 527 /*Fill in vertices ids: */ 635 for(i=0;i<1;i++) this_patch[2+i]=node s[i]->GetVertexId(); //vertices id start at column 3 of the patch.528 for(i=0;i<1;i++) this_patch[2+i]=node->GetVertexId(); //vertices id start at column 3 of the patch. 636 529 637 530 /*We found the input, get it to fill the interpolation type, and the nodal values:*/ -
issm/trunk/src/c/objects/Elements/Sing.h
r4011 r4021 13 13 class Inputs; 14 14 class IoModel; 15 class Node; 16 class Matice; 17 class Matpar; 15 18 16 19 #include "../../include/include.h" … … 26 29 int id; 27 30 28 Hook hnodes; //hook to 1 nodes29 Hook hmatice; //hook to 1 matice30 Hook hmatpar; //hook to 1 matpar31 Node* node; 32 Matice* matice; 33 Matpar* matpar; 31 34 32 35 Parameters* parameters; //pointer to solution parameters -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4015 r4021 28 28 this->inputs=NULL; 29 29 this->parameters=NULL; 30 this->collapse=NULL;31 30 } 32 31 /*}}}*/ … … 35 34 delete inputs; 36 35 this->parameters=NULL; 37 xfree((void**)&collapse);38 36 } 39 37 /*}}}*/ … … 56 54 57 55 this->InitHookNodes(nummodels);this->nodes=NULL; 58 this->InitHookNodes(tria_node_ids); this->nodes=NULL;59 56 this->InitHookMatice(tria_matice_id);this->matice=NULL; 60 57 this->InitHookMatpar(tria_matpar_id);this->matpar=NULL; … … 66 63 /*}}}*/ 67 64 /*FUNCTION Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){{{1*/ 68 Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index65 void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index 69 66 70 67 /*Intermediaries*/ … … 85 82 86 83 /*Recover nodes ids needed to initialize the node hook.*/ 87 if ( iomodel->analysis_type==Prognostic2AnalysisEnum || iomodel->analysis_type==Balancedthickness2AnalysisEnum){84 if (analysis_type==Prognostic2AnalysisEnum || analysis_type==Balancedthickness2AnalysisEnum){ 88 85 /*Discontinuous Galerkin*/ 89 86 tria_node_ids[0]=iomodel->nodecounter+3*index+1; … … 214 211 Object* Tria::copy() { 215 212 213 int i; 216 214 Tria* tria=NULL; 217 215 … … 231 229 232 230 /*now deal with hooks and objects: */ 233 tria->InitHookNodes(this->num models);234 for(i=0;i<this->num models;i++)tria->hnodes[i].copy(&this->hnodes[i]);231 tria->InitHookNodes(this->numanalyses); 232 for(i=0;i<this->numanalyses;i++)tria->hnodes[i].copy(&this->hnodes[i]); 235 233 tria->hmatice.copy(&this->hmatice); 236 234 tria->hmatpar.copy(&this->hmatpar); … … 279 277 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 280 278 memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 281 memcpy(&num models,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);279 memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 282 280 283 281 /*allocate dynamic memory: */ 284 InitHookNodes(num models);282 InitHookNodes(numanalyses); 285 283 286 284 /*demarshall hooks: */ 287 for(i=0;i<num models;i++)hnodes[i].Demarshall(&marshalled_dataset);285 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 288 286 hmatice.Demarshall(&marshalled_dataset); 289 287 hmatpar.Demarshall(&marshalled_dataset); … … 362 360 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 363 361 memcpy(marshalled_dataset,&interpolation_type,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 364 memcpy(marshalled_dataset,&num models,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);362 memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses); 365 363 366 364 /*Marshall hooks: */ 367 for(i=0;i<num models;i++)hnodes[i].Marshall(&marshalled_dataset);365 for(i=0;i<numanalyses;i++)hnodes[i].Marshall(&marshalled_dataset); 368 366 hmatice.Marshall(&marshalled_dataset); 369 367 hmatpar.Marshall(&marshalled_dataset); … … 389 387 int hnodes_size=0;; 390 388 391 for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize; 392 393 389 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i].MarshallSize(); 390 394 391 return sizeof(id) 395 392 +hnodes_size … … 403 400 /*FUNCTION Tria::SpawnBeam {{{1*/ 404 401 void* Tria::SpawnBeam(int g0, int g1){ 402 403 int i; 405 404 406 405 /*out of grids g0,g1 and g2 from Tria, build a beam element: */ … … 1534 1533 /*build friction object, used later on: */ 1535 1534 if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 1536 friction=new Friction("2d",inputs,matpar );1535 friction=new Friction("2d",inputs,matpar,analysis_type); 1537 1536 1538 1537 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 2300 2299 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); 2301 2300 } 2302 else if (analysis_type==Slope computeAnalysisEnum){2301 else if (analysis_type==SlopeComputeAnalysisEnum){ 2303 2302 CreatePVectorSlopeCompute( pg,analysis_type,sub_analysis_type); 2304 2303 } … … 3196 3195 inputs->GetParameterValue(&drag_type,DragTypeEnum); 3197 3196 if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 3198 friction=new Friction("3d",inputs,matpar );3197 friction=new Friction("3d",inputs,matpar,analysis_type); 3199 3198 3200 3199 /* Ice/ocean heat exchange flux on ice shelf base */ … … 4268 4267 /*Build frictoin element, needed later: */ 4269 4268 inputs->GetParameterValue(&drag_type,DragTypeEnum); 4270 friction=new Friction("2d",inputs,matpar );4269 friction=new Friction("2d",inputs,matpar,analysis_type); 4271 4270 4272 4271 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4423 4422 /*Build frictoin element, needed later: */ 4424 4423 inputs->GetParameterValue(&drag_type,DragTypeEnum); 4425 friction=new Friction("2d",inputs,matpar );4424 friction=new Friction("2d",inputs,matpar,analysis_type); 4426 4425 4427 4426 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ -
issm/trunk/src/c/objects/Elements/Tria.h
r4004 r4021 37 37 /*FUNCTION constructors, destructors {{{1*/ 38 38 Tria(); 39 Tria(int tria_id,int i, IoModel* iomodel); 39 Tria(int tria_id,int i, IoModel* iomodel,int nummodels); 40 void Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type); 40 41 ~Tria(); 41 42 /*}}}*/ 42 43 /*FUNCTION object management {{{1*/ 43 44 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter); 44 void Update(IoModel* iomodel,int analysis_counter,int analysis_type);45 45 Object* copy(); 46 46 void DeepEcho(); -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r3984 r4021 24 24 TriaHook::TriaHook(){ 25 25 numanalyses=UNDEF; 26 this->h ooks=NULL;26 this->hnodes=NULL; 27 27 } 28 28 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r4007 r4021 41 41 42 42 /*First, retrieve element index and element type: */ 43 if ( strcmp(iomodel->meshtype,"2d")==0){43 if (iomodel->dim==2){ 44 44 segment_width=4; 45 45 } … … 56 56 icefront_node_ids[1]=(int)*(iomodel->pressureload+segment_width*i+1); 57 57 58 if ( iomodel->sub_analysis_type==HorizAnalysisEnum){58 if (analysis_type==DiagnosticHorizAnalysisEnum){ 59 59 if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d 60 60 icefront_type=SegmentIcefrontEnum; … … 67 67 else ISSMERROR(" element type %i not supported yet",(int)*(iomodel->elements_type+2*element+0)); 68 68 } 69 else if ( iomodel->sub_analysis_type==StokesAnalysisEnum){69 else if (analysis_type==DiagnosticStokesAnalysisEnum){ 70 70 //We have a Stokes element, so we need a 3d Icefront 71 71 icefront_type=QuadIceFrontEnum; … … 108 108 /*copy fields: */ 109 109 icefront->id=this->id; 110 icefront->analysis =this->analysis;110 icefront->analysis_type=this->analysis_type; 111 111 if(this->inputs){ 112 112 icefront->inputs=(Inputs*)this->inputs->Copy(); … … 122 122 icefront->helement.copy(&this->helement); 123 123 icefront->hmatpar.copy(&this->hmatpar); 124 125 /*recover objects: */126 icefront->nodes=(Node**)icefront->hnodes.deliverp();127 icefront->element=(Element*)icefront->helement.delivers();128 icefront->matpar=(Matpar*)icefront->hmatpar.delivers();129 124 130 125 return icefront; -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r4007 r4021 129 129 /*copy fields: */ 130 130 numericalflux->id=this->id; 131 numericalflux->analysis =this->analysis;131 numericalflux->analysis_type=this->analysis_type; 132 132 if(this->inputs){ 133 133 numericalflux->inputs=(Inputs*)this->inputs->Copy(); … … 141 141 /*now deal with hooks and objects: */ 142 142 numericalflux->hnodes.copy(&this->hnodes); 143 numericalflux->helement.copy(&this->helement); 144 145 /*recover objects: */ 146 numericalflux->nodes=(Node**)numericalflux->hnodes.deliverp(); 147 numericalflux->element=(Element*)numericalflux->helement.delivers(); 143 numericalflux->helements.copy(&this->helements); 148 144 149 145 return numericalflux; -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r4007 r4021 76 76 /*copy fields: */ 77 77 pengrid->id=this->id; 78 pengrid->analysis =this->analysis;78 pengrid->analysis_type=this->analysis_type; 79 79 if(this->inputs){ 80 80 pengrid->inputs=(Inputs*)this->inputs->Copy(); … … 87 87 88 88 /*now deal with hooks and objects: */ 89 pengrid->hnode.copy(&this->hnode s);89 pengrid->hnode.copy(&this->hnode); 90 90 pengrid->helement.copy(&this->helement); 91 91 pengrid->hmatpar.copy(&this->hmatpar); 92 93 /*recover objects: */94 pengrid->node=(Node**)pengrid->hnode.deliverp();95 pengrid->element=(Element*)pengrid->helement.delivers();96 pengrid->matpar=(Matpar*)pengrid->hmatpar.delivers();97 92 98 93 //let's not forget internals … … 456 451 457 452 //recover slope: */ 458 penta->inputs->GetParameterValue(&slope[0],node,BedSlope xEnum);459 penta->inputs->GetParameterValue(&slope[1],node,BedSlope yEnum);453 penta->inputs->GetParameterValue(&slope[0],node,BedSlopeXEnum); 454 penta->inputs->GetParameterValue(&slope[1],node,BedSlopeYEnum); 460 455 461 456 /*recover parameters: */ -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r4007 r4021 56 56 /*copy fields: */ 57 57 penpair->id=this->id; 58 penpair->analysis =this->analysis;58 penpair->analysis_type=this->analysis_type; 59 59 60 60 /*now deal with hooks and objects: */ 61 61 penpair->hnodes.copy(&this->hnodes); 62 63 /*recover objects: */64 penpair->nodes=(Node**)penpair->hnodes.deliverp();65 62 66 63 return penpair; -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r4003 r4021 103 103 /*copy fields: */ 104 104 riftfront->id=this->id; 105 riftfront->analysis =this->analysis;105 riftfront->analysis_type=this->analysis_type; 106 106 if(this->inputs){ 107 107 riftfront->inputs=(Inputs*)this->inputs->Copy(); … … 115 115 /*now deal with hooks and objects: */ 116 116 riftfront->hnodes.copy(&this->hnodes); 117 riftfront->helement .copy(&this->helement);117 riftfront->helements.copy(&this->helements); 118 118 riftfront->hmatpar.copy(&this->hmatpar); 119 120 /*recover objects: */121 riftfront->nodes=(Node**)riftfront->hnodes.deliverp();122 riftfront->element=(Element*)riftfront->helement.delivers();123 riftfront->matpar=(Matpar*)riftfront->hmatpar.delivers();124 119 125 120 return riftfront; -
issm/trunk/src/c/objects/Materials/Matice.cpp
r3984 r4021 42 42 double matice_B; 43 43 double matice_n; 44 int num_vertices; 44 45 45 46 /*intermediary: */ … … 47 48 48 49 /*2d or 3d? */ 49 if( strcmp(iomodel->meshtype,"2d")==0){50 if(iomodel->dim==2){ 50 51 num_vertices=3; //tria elements 51 52 } 52 else if( strcmp(iomodel->meshtype,"3d")==0){53 else if(iomodel->dim==3){ 53 54 num_vertices=6; //penta elements 54 55 } -
issm/trunk/src/c/objects/Node.cpp
r4002 r4021 67 67 68 68 /*indexing:*/ 69 DistributeNumDofs(&numdofs, iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node69 DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node 70 70 71 71 this->indexing.Init(numdofs); … … 74 74 vertex_id=this->id; //node and vertex have the same id, as we are running galerkin continuous, with same number of nodes and vertices. 75 75 76 if ( strcmp(iomodel->meshtype,"3d")==0){76 if (iomodel->dim==3){ 77 77 if (isnan(iomodel->uppernodes[i])){ 78 78 upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves. … … 93 93 94 94 /*Diagnostic Horiz*/ 95 if ( iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==HorizAnalysisEnum){96 if ( strcmp(iomodel->meshtype,"3d")==0){95 if (analysis_type==DiagnosticHorizAnalysisEnum){ 96 if (iomodel->dim==3){ 97 97 /*We have a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */ 98 98 if (!iomodel->deadgrids) ISSMERROR("iomodel->deadgrids is NULL"); … … 113 113 114 114 /*Diagnostic Stokes*/ 115 if ( iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==StokesAnalysisEnum){115 if (analysis_type==DiagnosticStokesAnalysisEnum){ 116 116 /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */ 117 117 if (!iomodel->borderstokes) ISSMERROR("iomodel->borderstokes is NULL"); … … 130 130 131 131 /*Diagnostic Hutter*/ 132 if ( iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==HutterAnalysisEnum){132 if (analysis_type==DiagnosticHutterAnalysisEnum){ 133 133 /*Spc all nodes that are not Hutter*/ 134 134 if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL"); … … 142 142 /*Prognostic/ Melting/ Slopecompute/ Balancedvelocities/ Balancedthickness*/ 143 143 if ( 144 iomodel->analysis_type==PrognosticAnalysisEnum ||145 iomodel->analysis_type==MeltingAnalysisEnum ||146 iomodel->analysis_type==SlopecomputeAnalysisEnum ||147 iomodel->analysis_type==BalancedvelocitiesAnalysisEnum ||148 iomodel->analysis_type==BalancedthicknessAnalysisEnum144 analysis_type==PrognosticAnalysisEnum || 145 analysis_type==MeltingAnalysisEnum || 146 analysis_type==SlopeComputeAnalysisEnum || 147 analysis_type==BalancedvelocitiesAnalysisEnum || 148 analysis_type==BalancedthicknessAnalysisEnum 149 149 ){ 150 if ( strcmp(iomodel->meshtype,"3d")==0){150 if (iomodel->dim==3){ 151 151 /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */ 152 152 if (!iomodel->gridonbed) ISSMERROR("iomodel->gridonbed is NULL"); … … 183 183 184 184 /*indexing:*/ 185 DistributeNumDofs(&numdofs, iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node185 DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node 186 186 187 187 this->indexing.Init(numdofs); … … 191 191 vertex_id=i+1; //matlab indexing 192 192 193 if ( strcmp(iomodel->meshtype,"3d")==0){193 if (iomodel->dim==3){ 194 194 if (isnan(iomodel->uppernodes[i])){ 195 195 upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves. -
issm/trunk/src/c/shared/Dofs/DistributeNumDofs.cpp
r3775 r4021 7 7 #include "../shared.h" 8 8 9 int DistributeNumDofs(int *pnumdofs,int analysis_type ,int sub_analysis_type){9 int DistributeNumDofs(int *pnumdofs,int analysis_type){ 10 10 11 11 int numdofs=2; //default numdofs … … 13 13 14 14 /*ok, according to analysis type: */ 15 if (analysis_type==ControlAnalysisEnum){ 16 if (sub_analysis_type==HorizAnalysisEnum){ 17 numdofs=2; 18 } 19 else if (sub_analysis_type==VertAnalysisEnum){ 20 numdofs=1; 21 } 22 else if (sub_analysis_type==StokesAnalysisEnum){ 23 numdofs=4; 24 } 25 else if (sub_analysis_type==HutterAnalysisEnum){ 26 numdofs=2; 27 } 15 if (analysis_type==DiagnosticHorizAnalysisEnum){ 16 numdofs=2; 28 17 } 29 else if (analysis_type==DiagnosticAnalysisEnum){ 30 if (sub_analysis_type==HorizAnalysisEnum){ 31 numdofs=2; 32 } 33 else if (sub_analysis_type==VertAnalysisEnum){ 34 numdofs=1; 35 } 36 else if (sub_analysis_type==StokesAnalysisEnum){ 37 numdofs=4; 38 } 39 else if (sub_analysis_type==HutterAnalysisEnum){ 40 numdofs=2; 41 } 18 else if (analysis_type==DiagnosticVertAnalysisEnum){ 19 numdofs=1; 42 20 } 43 else if (analysis_type==SlopecomputeAnalysisEnum){ 21 else if (analysis_type==DiagnosticStokesAnalysisEnum){ 22 numdofs=4; 23 } 24 else if (analysis_type==DiagnosticHutterAnalysisEnum){ 25 numdofs=2; 26 } 27 else if (analysis_type==SlopeComputeAnalysisEnum){ 44 28 numdofs=1; 45 29 } -
issm/trunk/src/c/shared/Dofs/dofs.h
r465 r4021 7 7 8 8 double* dofsetgen(int numdofs,int* doflist,int dofspernode,int totaldofs); 9 int DistributeNumDofs(int *pnumdofs,int analysis_type ,int sub_analysis_type);9 int DistributeNumDofs(int *pnumdofs,int analysis_type); 10 10 11 11 -
issm/trunk/src/c/solutions/diagnostic.cpp
r4015 r4021 38 38 double start_init, finish_init; 39 39 40 int analyses[5]={DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,Slope computeAnalysisEnum};40 int analyses[5]={DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopeComputeAnalysisEnum}; 41 41 42 42 MODULEBOOT(); … … 95 95 96 96 _printf_("write results to disk:\n"); 97 OutputResults(femmodel,outputfilename );97 OutputResults(femmodel,outputfilename,DiagnosticAnalysisEnum); 98 98 } 99 99 else{ -
issm/trunk/src/c/solutions/solutions.h
r4015 r4021 13 13 14 14 /*cores: */ 15 Results* gradjcompute_core( Model* model);16 void* diagnostic_core( Model* model);17 Results* prognostic_core( Model* model);18 Results* prognostic2_core( Model* model);19 Results* balancedthickness_core( Model* model);20 Results* balancedthickness2_core( Model* model);21 Results* balancedvelocities_core( Model* model);22 Results* slopecompute_core( Model* model);23 Results* control_core( Model* model);24 Results* steadystate_core( Model* model);25 Results* transient_core( Model* model);26 Results* transient_core_2d( Model* model);27 Results* transient_core_3d( Model* model);28 Results* thermal_core( Model* model);15 Results* gradjcompute_core(FemModel* model); 16 void* diagnostic_core(FemModel* model); 17 Results* prognostic_core(FemModel* model); 18 Results* prognostic2_core(FemModel* model); 19 Results* balancedthickness_core(FemModel* model); 20 Results* balancedthickness2_core(FemModel* model); 21 Results* balancedvelocities_core(FemModel* model); 22 Results* slopecompute_core(FemModel* model); 23 Results* control_core(FemModel* model); 24 Results* steadystate_core(FemModel* model); 25 Results* transient_core(FemModel* model); 26 Results* transient_core_2d(FemModel* model); 27 Results* transient_core_3d(FemModel* model); 28 Results* thermal_core(FemModel* model); 29 29 void slope_core(FemModel* fem,int sub_analysis_type); 30 30 … … 51 51 void WriteLockFile(char* filename); 52 52 53 void ControlInitialization( Model* model);54 void ControlRestart( Model* model,double* param_g);53 void ControlInitialization(FemModel* model); 54 void ControlRestart(FemModel* model,double* param_g); 55 55 56 56 void CreateFemModel(FemModel* femmodel,ConstDataHandle MODEL,int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/toolkits/metis/metisincludes.h
r586 r4021 9 9 #include <metis.h> 10 10 11 extern "C"void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *);11 void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *); 12 12 13 13 #endif
Note:
See TracChangeset
for help on using the changeset viewer.