Changeset 3637
- Timestamp:
- 04/29/10 21:56:47 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Beam.h
r3632 r3637 6 6 #define _BEAM_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 9 11 #include "./Element.h" … … 21 23 class Element; 22 24 class Hook; 25 /*}}}*/ 23 26 24 27 class Beam: public Element{ -
issm/trunk/src/c/objects/BeamVertexInput.h
r3620 r3637 3 3 */ 4 4 5 #include "./Input.h"6 5 7 6 #ifndef _BEAMVERTEXINPUT_H_ 8 7 #define _BEAMVERTEXINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 /*}}}*/ 13 9 14 10 15 class BeamVertexInput: public Input{ -
issm/trunk/src/c/objects/BoolInput.h
r3612 r3637 3 3 */ 4 4 5 #include "./Input.h"6 #include "../include/types.h"7 5 8 6 #ifndef _BOOLINPUT_H_ 9 7 #define _BOOLINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 #include "../include/types.h" 13 /*}}}*/ 10 14 11 15 class BoolInput: public Input{ -
issm/trunk/src/c/objects/DakotaPlugin.h
r3420 r3637 8 8 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in. 9 9 10 /*Headers:*/ 11 /*{{{1*/ 12 13 10 14 #include "DirectApplicInterface.H" 11 15 #include "../toolkits/toolkits.h" 12 16 #include "../objects/objects.h" 17 18 /*}}}*/ 13 19 14 20 namespace SIM { -
issm/trunk/src/c/objects/DofObject.h
r3464 r3637 7 7 #define _DOFOBJECT_H_ 8 8 9 /*Headers:*/ 10 /*{{{1*/ 9 11 #include "./Object.h" 10 12 #include "../toolkits/toolkits.h" 13 /*}}}*/ 11 14 12 15 class DofObject{ -
issm/trunk/src/c/objects/DofVec.h
r3463 r3637 6 6 #define _DOFVEC_H_ 7 7 8 8 /*Headers:*/ 9 /*{{{1*/ 9 10 #include "./Object.h" 10 11 #include "../toolkits/toolkits.h" 11 12 12 13 #define DOFVECNAMESIZE 20 14 /*}}}*/ 15 13 16 14 17 class DofVec: public Object{ -
issm/trunk/src/c/objects/DoubleInput.h
r3612 r3637 3 3 */ 4 4 5 #include "./Input.h"6 #include "../include/types.h"7 5 8 6 #ifndef _DOUBLEINPUT_H_ 9 7 #define _DOUBLEINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 #include "../include/types.h" 13 /*}}}*/ 10 14 11 15 class DoubleInput: public Input{ -
issm/trunk/src/c/objects/Element.h
r3620 r3637 9 9 #define _ELEMENT_H_ 10 10 11 /*Headers:*/ 12 /*{{{1*/ 11 13 #include "./Object.h" 12 14 #include "../DataSet/DataSet.h" 13 15 #include "../DataSet/Parameters.h" 14 16 #include "../toolkits/toolkits.h" 17 /*}}}*/ 15 18 16 19 class Element: public Object{ -
issm/trunk/src/c/objects/FemModel.h
r3620 r3637 6 6 #define _FEMMODEL_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 class DataSet; 9 11 class DofVec; 10 11 12 #include "./Object.h" 12 13 #include "../DataSet/DataSet.h" … … 15 16 #include "../toolkits/toolkits.h" 16 17 #include "../parallel/parallel.h" 18 /*}}}*/ 17 19 18 20 class FemModel: public Object{ -
issm/trunk/src/c/objects/Hook.h
r3420 r3637 9 9 #define _HOOK_H_ 10 10 11 /*Headers:*/ 12 /*{{{1*/ 11 13 class DataSet; 12 14 class Object; 13 14 15 #include "./Object.h" 15 16 #include "../DataSet/DataSet.h" 16 17 #include "../toolkits/toolkits.h" 18 /*}}}*/ 17 19 18 20 class Hook{ -
issm/trunk/src/c/objects/Icefront.cpp
r3632 r3637 3 3 */ 4 4 5 5 /*Headers:*/ 6 /*{{{1*/ 6 7 #ifdef HAVE_CONFIG_H 7 8 #include "config.h" … … 17 18 #include "../include/macros.h" 18 19 #include "./Icefront.h" 19 20 /*}}}*/ 21 20 22 /*Object constructors and destructor*/ 21 23 /*FUNCTION Icefront::Icefront() {{{1*/ … … 25 27 } 26 28 /*}}}*/ 27 /*FUNCTION Icefront::Icefront(int i cefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id){{{1*/28 Icefront::Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id):29 hnodes(icefront_node_ids, num_nodes),30 helement(&icefront_ matice_id,1),29 /*FUNCTION Icefront::Icefront(int id, int* node_ids, int numnodes, int element_id, int matpar_id){{{1*/ 30 Icefront::Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id, int icefront_matpar_id): 31 hnodes(icefront_node_ids,icefront_numnodes), 32 helement(&icefront_element_id,1), 31 33 hmatpar(&icefront_matpar_id,1) 32 34 { 33 35 34 /*all the initialization has been done by the initializer, just fill in the id : */36 /*all the initialization has been done by the initializer, just fill in the id : */ 35 37 this->id=icefront_id; 36 38 this->parameters=NULL; 37 39 this->inputs=new Inputs(); 38 } 39 /*}}}*/ 40 /*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, DataSet* parameters, Inputs* icefront_inputs) {{{1*/ 40 41 } 42 /*}}}*/ 43 /*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* helement, Hook* hmatpar, DataSet* parameters, Inputs* icefront_inputs) {{{1*/ 41 44 Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs): 42 45 hnodes(icefront_hnodes), … … 61 64 62 65 int segment_width; 63 int i1,i2,i3,i4;64 66 int element; 65 66 /*icefront intermediary data: */ 67 int num_nodes; 68 69 /*icefront constructor data: */ 70 int icefront_eid; 71 int icefront_mparid; 67 72 int icefront_node_ids[MAX_ICEFRONT_GRIDS]; 68 int num_nodes;69 int icefront_mparid;70 int icefront_eid;71 73 int icefront_fill; 74 int icefront_type; 72 75 73 76 /*First, retrieve element index and element type: */ … … 80 83 element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill) 81 84 82 /*Setup all ids, so we can get our hooks setup: */ 85 /*Build ids for hook constructors: */ 86 icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing 83 87 icefront_mparid=iomodel->numberofelements+1; //matlab indexing 84 icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing85 88 86 89 icefront_node_ids[0]=(int)*(iomodel->pressureload+segment_width*i+0); … … 89 92 if (iomodel->sub_analysis_type==HorizAnalysisEnum){ 90 93 if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d 91 num_nodes=2;94 icefront_type=SegmentIcefrontEnum; 92 95 } 93 96 else if ((int)*(iomodel->elements_type+2*element+0)==PattynFormulationEnum){ //this is a real 3d element, icefront will be 3d. 94 num_nodes=4;97 icefront_type=QuadIceFrontEnum; 95 98 icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2); 96 99 icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3); 97 100 } 98 else{ 99 ISSMERROR(" element type %i not supported yet",(int)*(iomodel->elements_type+2*element+0)); 100 } 101 else ISSMERROR(" element type %i not supported yet",(int)*(iomodel->elements_type+2*element+0)); 101 102 } 102 103 else if (iomodel->sub_analysis_type==StokesAnalysisEnum){ 103 104 //We have a Stokes element, so we need a 3d Icefront 104 num_nodes=4;105 icefront_type=QuadIceFrontEnum; 105 106 icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2); 106 107 icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3); … … 108 109 else ISSMERROR("Not supported yet!"); 109 110 110 /*Ok, get the hooks setup: */ 111 if (icefront_type==QuadIceFrontEnum) num_nodes=4; 112 else num_nodes=2; 113 icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1); 114 115 /*Ok, we have everything to build the object: */ 116 this->id=icefront_id; 117 118 /*Hooks: */ 111 119 this->hnodes.Init(icefront_node_ids,num_nodes); 112 this->helement.Init(&icefront_e lement_id,1);113 this->hmatpar.Init(&icefront_m atpar_id,1);114 115 //intialize inputs,and add as many inputs per element as requested:120 this->helement.Init(&icefront_eid,1); 121 this->hmatpar.Init(&icefront_mparid,1); 122 123 //intialize and add as many inputs per element as requested: 116 124 this->inputs=new Inputs(); 117 118 icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1);119 125 this->inputs->AddInput(new IntInput(FillEnum,icefront_fill)); 120 126 this->inputs->AddInput(new IntInput(TypeEnum,icefront_type)); 127 121 128 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 122 129 this->parameters=NULL; 123 124 130 } 125 131 … … 128 134 /*FUNCTION Icefront::~Icefront() {{{1*/ 129 135 Icefront::~Icefront(){ 130 return; 136 delete inputs; 137 this->parameters=NULL; 131 138 } 132 139 /*}}}*/ … … 134 141 /*Object marshall*/ 135 142 /*FUNCTION Icefront Configure {{{1*/ 136 void Icefront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin) ;137 138 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective143 void Icefront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){ 144 145 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 139 146 * datasets, using internal ids and offsets hidden in hooks: */ 140 147 hnodes.configure(nodesin); … … 151 158 } 152 159 /*}}}*/ 153 /*FUNCTION Icefront DeepEcho{{{1*/160 /*FUNCTION Icefront::DeepEcho{{{1*/ 154 161 void Icefront::DeepEcho(void){ 155 162 156 163 printf("Icefront:\n"); 157 164 printf(" id: %i\n",id); 158 hnodes. Echo();159 helement. Echo();160 hmatpar. Echo();165 hnodes.DeepEcho(); 166 helement.DeepEcho(); 167 hmatpar.DeepEcho(); 161 168 printf(" parameters\n"); 162 parameters-> Echo();169 parameters->DeepEcho(); 163 170 printf(" inputs\n"); 164 inputs-> Echo();165 } 166 /*}}}*/ 167 /*FUNCTION Icefront 171 inputs->DeepEcho(); 172 } 173 /*}}}*/ 174 /*FUNCTION Icefront::Demarshall {{{1*/ 168 175 void Icefront::Demarshall(char** pmarshalled_dataset){ 169 176 … … 197 204 /*FUNCTION Icefront Echo {{{1*/ 198 205 void Icefront::Echo(void){ 199 200 206 this->DeepEcho(); 201 207 } … … 209 215 /*}}}*/ 210 216 /*FUNCTION Icefront GetId {{{1*/ 211 int Icefront::GetId(void){ return sid; }217 int Icefront::GetId(void){ return id; } 212 218 /*}}}*/ 213 219 /*FUNCTION Icefront GetName {{{1*/ … … 216 222 } 217 223 /*}}}*/ 218 /*FUNCTION Icefront 224 /*FUNCTION Icefront::Marshall {{{1*/ 219 225 void Icefront::Marshall(char** pmarshalled_dataset){ 220 221 226 222 227 char* marshalled_dataset=NULL; … … 228 233 marshalled_dataset=*pmarshalled_dataset; 229 234 230 /*get enum type of Tria: */231 enum_type= TriaEnum;235 /*get enum type of Icefront: */ 236 enum_type=IcefrontEnum; 232 237 233 238 /*marshall enum: */ 234 239 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 235 240 236 /*marshall Triadata: */241 /*marshall Icefront data: */ 237 242 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 238 243 … … 253 258 254 259 *pmarshalled_dataset=marshalled_dataset; 255 return; 256 } 257 /*}}}*/ 258 /*FUNCTION Icefront MarshallSize{{{1*/ 260 } 261 /*}}}*/ 262 /*FUNCTION Icefront::MarshallSize {{{1*/ 259 263 int Icefront::MarshallSize(){ 260 264 261 265 return sizeof(id) 262 266 +hnodes.MarshallSize() … … 277 281 /*FUNCTION Icefront CreateKMatrix {{{1*/ 278 282 279 void Icefront::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){283 void Icefront::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 280 284 281 285 /*No stiffness loads applied, do nothing: */ … … 286 290 /*}}}*/ 287 291 /*FUNCTION Icefront CreatePVector {{{1*/ 288 void Icefront::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){292 void Icefront::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){ 289 293 290 294 /*Just branch to the correct element icefront vector generator, according to the type of analysis we are carrying out: */ 291 295 if (analysis_type==ControlAnalysisEnum){ 292 296 293 CreatePVectorDiagnosticHoriz( pg, inputs,analysis_type,sub_analysis_type);297 CreatePVectorDiagnosticHoriz( pg,analysis_type,sub_analysis_type); 294 298 295 299 } … … 298 302 if (sub_analysis_type==HorizAnalysisEnum){ 299 303 300 CreatePVectorDiagnosticHoriz( pg, inputs,analysis_type,sub_analysis_type);304 CreatePVectorDiagnosticHoriz( pg,analysis_type,sub_analysis_type); 301 305 302 306 } 303 307 else if (sub_analysis_type==StokesAnalysisEnum){ 304 308 305 CreatePVectorDiagnosticStokes( pg, inputs,analysis_type,sub_analysis_type);309 CreatePVectorDiagnosticStokes( pg,analysis_type,sub_analysis_type); 306 310 307 311 } … … 315 319 /*}}}*/ 316 320 /*FUNCTION Icefront CreatePVectorDiagnosticHoriz {{{1*/ 317 void Icefront::CreatePVectorDiagnosticHoriz( Vec pg, void* inputs, int analysis_type,int sub_analysis_type){ 321 void Icefront::CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type){ 322 323 int type; 324 inputs->GetParameterValue(&type,TypeEnum); 318 325 319 326 /*Branck on the type of icefront: */ 320 if ( strcmp(type,"segment")==0){321 CreatePVectorDiagnosticHorizSegment(pg, inputs,analysis_type,sub_analysis_type);327 if (type==SegmentIcefrontEnum){ 328 CreatePVectorDiagnosticHorizSegment(pg,analysis_type,sub_analysis_type); 322 329 } 323 330 else{ 324 CreatePVectorDiagnosticHorizQuad(pg, inputs,analysis_type,sub_analysis_type);331 CreatePVectorDiagnosticHorizQuad(pg,analysis_type,sub_analysis_type); 325 332 } 326 333 } 327 334 /*}}}*/ 328 335 /*FUNCTION Icefront CreatePVectorDiagnosticHorizSegment{{{1*/ 329 330 void Icefront::CreatePVectorDiagnosticHorizSegment( Vec pg,void* vinputs, int analysis_type,int sub_analysis_type){ 336 void Icefront::CreatePVectorDiagnosticHorizSegment( Vec pg,int analysis_type,int sub_analysis_type){ 331 337 332 338 int i,j; … … 350 356 double normal[2]; 351 357 double length; 358 int element_type; 352 359 353 360 /*Objects: */ 354 double pe_g[numdofs]; 355 Matpar* matpar=NULL; 356 Node** element_nodes=NULL; 357 ParameterInputs* inputs=NULL; 358 359 inputs=(ParameterInputs*)vinputs; 360 361 /*Recover material */ 362 matpar=(Matpar*)element->GetMatPar(); 361 double pe_g[numdofs]={0.0}; 362 Matpar* matpar=NULL; 363 Node** element_nodes=NULL; 364 Node** nodes=NULL; 365 Element* element=NULL; 366 367 /*Recover hook objects: */ 368 matpar=(Matpar*)hmatpar.delivers(); 369 element=(Element*)helement.delivers(); 370 nodes=(Node**)hnodes.deliverp(); 371 372 element_type=element->Enum(); 363 373 364 374 //check that the element is onbed (collapsed formulation) otherwise:pe=0 … … 368 378 } 369 379 } 370 /* Set pe_g to 0: */371 for(i=0;i<numdofs;i++) pe_g[i]=0.0;372 380 373 381 /*Identify which grids are comprised in the segment. */ … … 419 427 /*}}}*/ 420 428 /*FUNCTION Icefront CreatePVectorDiagnosticHorizQuad {{{1*/ 421 void Icefront::CreatePVectorDiagnosticHorizQuad( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){429 void Icefront::CreatePVectorDiagnosticHorizQuad( Vec pg,int analysis_type,int sub_analysis_type){ 422 430 423 431 int i,j; … … 439 447 440 448 /*Objects: */ 441 double pe_g[numdofs] ;449 double pe_g[numdofs]={0.0}; 442 450 Matpar* matpar=NULL; 443 451 Node** element_nodes=NULL; 444 ParameterInputs* inputs=NULL; 445 452 Node** nodes=NULL; 453 Element* element=NULL; 454 int element_type; 455 446 456 /*quad grids: */ 447 457 int grid1,grid2,grid3,grid4; … … 458 468 double v45[3]; 459 469 460 inputs=(ParameterInputs*)vinputs; 470 /*Recover hook objects: */ 471 matpar=(Matpar*)hmatpar.delivers(); 472 element=(Element*)helement.delivers(); 473 nodes=(Node**)hnodes.deliverp(); 474 475 element_type=element->Enum(); 461 476 462 477 /*check icefront is associated to a pentaelem: */ … … 464 479 ISSMERROR(" quad icefront is associated to a TriaElem!"); 465 480 } 466 /*Recover material*/467 matpar=(Matpar*)element->GetMatPar();468 469 /* Set pe_g to 0: */470 for(i=0;i<numdofs;i++) pe_g[i]=0.0;471 481 472 482 /* Get dof list and node coordinates: */ … … 555 565 /*}}}*/ 556 566 /*FUNCTION Icefront CreatePVectorDiagnosticStokes {{{1*/ 557 void Icefront::CreatePVectorDiagnosticStokes( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){567 void Icefront::CreatePVectorDiagnosticStokes( Vec pg,int analysis_type,int sub_analysis_type){ 558 568 559 569 int i,j; … … 575 585 576 586 /*Objects: */ 577 double pe_g[numdofs] ;587 double pe_g[numdofs]={0.0}; 578 588 Matpar* matpar=NULL; 579 589 Node** element_nodes=NULL; 580 ParameterInputs* inputs=NULL; 590 Node** nodes=NULL; 591 Element* element=NULL; 592 int element_type; 593 581 594 582 595 /*quad grids: */ … … 594 607 double v45[3]; 595 608 596 inputs=(ParameterInputs*)vinputs; 597 609 /*Recover hook objects: */ 610 matpar=(Matpar*)hmatpar.delivers(); 611 element=(Element*)helement.delivers(); 612 nodes=(Node**)hnodes.deliverp(); 613 598 614 /*check icefront is associated to a pentaelem: */ 599 615 if(element_type!=PentaEnum){ 600 616 ISSMERROR(" quad icefront is associated to a TriaElem!"); 601 617 } 602 /*Recover material*/603 matpar=(Matpar*)element->GetMatPar();604 605 /* Set pe_g to 0: */606 for(i=0;i<numdofs;i++) pe_g[i]=0.0;607 618 608 619 /* Get dof list and node coordinates: */ … … 701 712 int doflist_per_node[MAXDOFSPERNODE]; 702 713 int numberofdofspernode; 703 704 if (strcmp(type,"segment")==0){ 714 int type; 715 716 Node** nodes=NULL; 717 nodes=(Node**)hnodes.deliverp(); 718 inputs->GetParameterValue(&type,TypeEnum); 719 720 if(type==SegmentIcefrontEnum){ 705 721 for(i=0;i<2;i++){ 706 722 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 726 742 /*}}}*/ 727 743 /*FUNCTION Icefront PenaltyCreateKMatrix {{{1*/ 728 void Icefront::PenaltyCreateKMatrix(Mat Kgg, void* inputs,double kmax,int analysis_type,int sub_analysis_type){744 void Icefront::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){ 729 745 /*do nothing: */ 730 746 } 731 747 /*}}}*/ 732 748 /*FUNCTION Icefront PenaltyCreatePVector{{{1*/ 733 void Icefront::PenaltyCreatePVector(Vec pg, void* inputs,double kmax,int analysis_type,int sub_analysis_type){749 void Icefront::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){ 734 750 /*do nothing: */ 735 751 } … … 798 814 double water_pressure_tria; 799 815 double pressure_tria[4]; 816 int fill; 817 800 818 801 819 /*To use tria functionalities: */ 802 820 Tria* tria=NULL; 821 822 /*Recover inputs: */ 823 inputs->GetParameterValue(&fill,FillEnum); 803 824 804 825 /*Initialize fake tria: */ … … 1054 1075 double water_pressure_tria; 1055 1076 double pressure_tria; 1077 int fill; 1056 1078 1057 1079 /*To use tria functionalities: */ 1058 1080 Tria* tria=NULL; 1081 1082 /*Recover inputs: */ 1083 inputs->GetParameterValue(&fill,FillEnum); 1059 1084 1060 1085 /*Initialize fake tria: */ … … 1262 1287 double surface_under_water,base_under_water; 1263 1288 double pressure; 1289 int fill; 1290 1291 /*Recover inputs: */ 1292 inputs->GetParameterValue(&fill,FillEnum); 1264 1293 1265 1294 nx=normal[0]; 1266 1295 ny=normal[1]; 1296 1267 1297 1268 1298 //Get gaussian points and weights. order 2 since we have a product of 2 nodal functions -
issm/trunk/src/c/objects/Icefront.h
r3632 r3637 6 6 #define _ICEFRONT_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 10 class Element; 11 class Load; 12 class Matpar; 13 class Element; 14 class Node; 15 8 16 #include "./Load.h" 17 #include "./Matpar.h" 18 #include "./Element.h" 19 #include "./Node.h" 20 #include "../ModelProcessorx/IoModel.h" 9 21 10 22 #define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load 11 23 #define ICEFRONTSTRING 20 //max string length 24 /*}}}*/ 12 25 13 26 class Icefront: public Load { 14 27 15 28 public: 16 int id; 17 18 Hook* hnodes; //2 or 4 nodes 19 Hook* helement; //tria or penta 20 Hook* hmatpar; 29 int id; 21 30 31 /*hooks: */ 32 Hook hnodes; 33 Hook helement; 34 Hook hmatpar; 35 36 /*inputs and parameters: */ 37 Inputs* inputs; 22 38 Parameters* parameters; 23 Inputs* inputs;24 39 25 40 /*constructors: {{{1*/ 26 41 Icefront(); 27 Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id,int icefront_matpar_id);28 Icefront(int icefront_id, Hook* icefront_hnodes, Hook* icefront_helement,Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs);29 Icefront(int i d,int i, IoModel* iomodel);42 Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id,int icefront_matpar_id); 43 Icefront(int icefront_id, Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* parameters, Inputs* icefront_inputs); 44 Icefront(int icefront_id,int i, IoModel* iomodel); 30 45 ~Icefront(); 31 46 /*}}}*/ 32 47 /*object management: {{{1*/ 33 void Configure(DataSet* elements ,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters);48 void Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin); 34 49 Object* copy(); 35 50 void DeepEcho(); … … 48 63 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 49 64 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 50 void CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type);51 void CreatePVectorDiagnosticHorizSegment( Vec pg, int analysis_type,int sub_analysis_type);65 void CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type); 66 void CreatePVectorDiagnosticHorizSegment( Vec pg, int analysis_type,int sub_analysis_type); 52 67 void CreatePVectorDiagnosticHorizQuad( Vec pg, int analysis_type,int sub_analysis_type); 53 68 void CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/objects/Input.h
r3612 r3637 7 7 #define _EINPUT_H_ 8 8 9 /*Headers:*/ 10 /*{{{1*/ 9 11 #include "./Object.h" 12 /*}}}*/ 10 13 11 14 class Input: public Object{ -
issm/trunk/src/c/objects/IntInput.h
r3612 r3637 3 3 */ 4 4 5 #include "./Input.h"6 #include "../include/types.h"7 5 8 6 #ifndef _INTINPUT_H_ 9 7 #define _INTINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 #include "../include/types.h" 13 /*}}}*/ 10 14 11 15 class IntInput: public Input{ -
issm/trunk/src/c/objects/Load.h
r3632 r3637 9 9 #define _LOAD_H_ 10 10 11 /*Headers:*/ 12 /*{{{1*/ 11 13 class Object; 12 14 … … 15 17 #include "../DataSet/DataSet.h" 16 18 #include "../DataSet/Parameters.h" 19 /*}}}*/ 17 20 18 21 class Load: public Object{ -
issm/trunk/src/c/objects/Material.h
r3463 r3637 7 7 #define _MATERIAL_H_ 8 8 9 /*Headers:*/ 10 /*{{{1*/ 9 11 class Object; 10 11 12 #include "./Object.h" 12 13 #include "../toolkits/toolkits.h" 14 /*}}}*/ 13 15 14 16 class Material: public Object{ -
issm/trunk/src/c/objects/Matice.h
r3622 r3637 6 6 #define MATICE_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 struct IoModel; 9 10 11 #include "./Material.h" 11 12 #include "../ModelProcessorx/IoModel.h" 13 /*}}}*/ 14 12 15 class Matice: public Material{ 13 16 -
issm/trunk/src/c/objects/Matpar.h
r3622 r3637 6 6 #define _MATPAR_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 struct IoModel; 9 10 11 #include "./Material.h" 11 12 #include "../ModelProcessorx/IoModel.h" 13 /*}}}*/ 12 14 13 15 class Matpar: public Material{ -
issm/trunk/src/c/objects/Model.h
r2333 r3637 6 6 #define _MODEL_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "../include/types.h" 9 10 11 struct FemModel; 11 12 class DataSet; 13 /*}}}*/ 12 14 13 15 class Model{ -
issm/trunk/src/c/objects/Node.h
r3632 r3637 6 6 #define _NODE_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 /*indefinitions: */ 9 11 #include "./Object.h" … … 13 15 #include "./DofIndexing.h" 14 16 #include "../ModelProcessorx/IoModel.h" 17 /*}}}*/ 15 18 16 19 class Node: public Object,public DofObject{ -
issm/trunk/src/c/objects/NodeSets.h
r1 r3637 6 6 #define _NODESETS_H 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "../toolkits/toolkits.h" 11 /*}}}*/ 9 12 10 13 class NodeSets { -
issm/trunk/src/c/objects/Numericalflux.h
r3570 r3637 6 6 #define _NUMERICALFLUX_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Load.h" 9 11 #include "./Matpar.h" 10 12 #include "./Element.h" 11 13 #include "./Node.h" 14 class Element; 12 15 13 16 #define NUMERICALFLUXSTRING 20 //max string length 14 17 #define MAX_NUMERICALFLUX_NODES 4 //max number of grids for a certain load 15 18 #define MAX_NUMERICALFLUX_ELEMS 2 //max number of elements for a certain load 19 /*}}}*/ 16 20 17 class Element;18 21 class Numericalflux: public Load { 19 22 -
issm/trunk/src/c/objects/Numpar.h
r3612 r3637 6 6 #define _NUMPAR_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 11 /*}}}*/ 9 12 10 13 class Numpar: public Object{ -
issm/trunk/src/c/objects/Param.h
r3463 r3637 6 6 #define _PARAM_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 9 11 #include "../toolkits/toolkits.h" … … 11 13 12 14 #define PARAMSTRING 200 //max string length 13 15 /*}}}*/ 14 16 15 17 class Param: public Object{ -
issm/trunk/src/c/objects/Pengrid.h
r3632 r3637 5 5 #define _PENGRID_H_ 6 6 7 /*Headers:*/ 8 /*{{{1*/ 7 9 #include "./Load.h" 8 10 #include "./Node.h" … … 11 13 12 14 class Element; 15 /*}}}*/ 16 13 17 class Pengrid: public Load{ 14 18 -
issm/trunk/src/c/objects/Penpair.h
r3632 r3637 5 5 #define _PENPAIR_H_ 6 6 7 /*Headers:*/ 8 /*{{{1*/ 7 9 #include "./Load.h" 8 10 #include "./Node.h" … … 10 12 11 13 class Element; 14 /*}}}*/ 15 12 16 class Penpair: public Load{ 13 17 -
issm/trunk/src/c/objects/Penta.h
r3632 r3637 6 6 #define _PENTA_H 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 class Object; 9 11 class Node; … … 24 26 #include "../DataSet/Parameters.h" 25 27 #include "../DataSet/Inputs.h" 28 /*}}}*/ 26 29 27 30 class Penta: public Element{ -
issm/trunk/src/c/objects/PentaVertexInput.h
r3620 r3637 3 3 */ 4 4 5 #include "./Input.h"6 5 7 6 #ifndef _PENTAVERTEXINPUT_H_ 8 7 #define _PENTAVERTEXINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 /*}}}*/ 9 13 10 14 class PentaVertexInput: public Input{ -
issm/trunk/src/c/objects/Result.h
r3463 r3637 6 6 #define _RESULT_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "stdio.h" 9 11 #include "./Object.h" 10 12 #include "../toolkits/toolkits.h" 13 /*}}}*/ 11 14 12 15 class Result: public Object{ -
issm/trunk/src/c/objects/Rgb.h
r3463 r3637 6 6 #define _RGB_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 9 11 #include "../DataSet/DataSet.h" 12 /*}}}*/ 10 13 11 14 class Rgb: public Object{ -
issm/trunk/src/c/objects/Riftfront.cpp
r3622 r3637 3 3 */ 4 4 5 5 /*Headers:*/ 6 /*{{{1*/ 6 7 #ifdef HAVE_CONFIG_H 7 8 #include "config.h" … … 16 17 #include "../include/typedefs.h" 17 18 #include "../include/macros.h" 19 #include "../ModelProcessorx/ModelProcessorx.h" 18 20 #include "./objects.h" 19 20 21 /*}}}*/ 22 21 23 /*Object constructors and destructor*/ 22 24 /*FUNCTION Riftfront::Riftfront(){{{1*/ 23 25 Riftfront::Riftfront(){ 24 /*in case :*/ 25 material_converged=0; 26 return; 27 } 28 /*}}}1*/ 29 /*FUNCTION Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], ...){{{1*/ 30 Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,bool riftfront_frozen, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 31 32 this->Init(riftfront_type,riftfront_id, riftfront_node_ids, riftfront_mparid, riftfront_h,riftfront_b,riftfront_s,riftfront_normal,riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction,riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_frozen, riftfront_counter,riftfront_prestable,riftfront_shelf); 33 34 } 35 /*}}}1*/ 26 this->inputs=NULL; 27 this->parameters=NULL; 28 } 29 /*}}}*/ 30 /*FUNCTION Riftfront::Riftfront(int id, int* node_ids, int matice_id, int matpar_id){{{1*/ 31 Riftfront::Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id): 32 hnodes(riftfront_node_ids,2), 33 hmatpar(&riftfront_matpar_id,1) 34 { 35 36 /*all the initialization has been done by the initializer, just fill in the id: */ 37 this->id=riftfront_id; 38 this->parameters=NULL; 39 this->inputs=new Inputs(); 40 41 } 42 /*}}}*/ 43 /*FUNCTION Riftfront::Riftfront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, DataSet* parameters, Inputs* riftfront_inputs) {{{1*/ 44 Riftfront::Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* riftfront_parameters, Inputs* riftfront_inputs): 45 hnodes(riftfront_hnodes), 46 hmatpar(riftfront_hmatpar) 47 { 48 49 /*all the initialization has been done by the initializer, just fill in the id: */ 50 this->id=riftfront_id; 51 if(riftfront_inputs){ 52 this->inputs=(Inputs*)riftfront_inputs->Copy(); 53 } 54 else{ 55 this->inputs=new Inputs(); 56 } 57 /*point parameters: */ 58 this->parameters=riftfront_parameters; 59 } 60 /*}}}*/ 36 61 /*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel){{{1*/ 37 62 Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel){ 38 63 39 /*rifts: */ 40 char riftfront_type[RIFTFRONTSTRING]; 41 int riftfront_node_ids[2]; 42 int riftfront_mparid; 43 double riftfront_h[2]; 44 double riftfront_b[2]; 45 double riftfront_s[2]; 46 double riftfront_normal[2]; 47 double riftfront_length; 48 int riftfront_fill; 64 /*data: */ 65 int riftfront_node_ids[2]; 66 int riftfront_matpar_id; 67 int riftfront_type; 68 double riftfront_fill; 49 69 double riftfront_friction; 50 double riftfront_fraction;51 70 double riftfront_fractionincrement; 52 71 bool riftfront_shelf; 53 double riftfront_penalty_offset; 54 int riftfront_penalty_lock; 55 bool riftfront_active; 56 bool riftfront_frozen; 57 int riftfront_counter; 58 bool riftfront_prestable; 59 int el1,el2; 60 int grid1,grid2; 61 double normal[2]; 62 double length; 63 int fill; 64 double friction; 65 double fraction; 66 double fractionincrement; 72 73 /*intermediary: */ 74 int el1 ,el2; 75 int grid1 ,grid2; 67 76 68 77 /*Ok, retrieve all the data needed to add a penalty between the two grids: */ … … 73 82 grid2=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+1); 74 83 75 normal[0]=*(iomodel->riftinfo+RIFTINFOSIZE*i+4); 76 normal[1]=*(iomodel->riftinfo+RIFTINFOSIZE*i+5); 77 length=*(iomodel->riftinfo+RIFTINFOSIZE*i+6); 78 79 fill = (int)*(iomodel->riftinfo+RIFTINFOSIZE*i+7); 80 friction=*(iomodel->riftinfo+RIFTINFOSIZE*i+8); 81 fraction=*(iomodel->riftinfo+RIFTINFOSIZE*i+9); 82 fractionincrement=*(iomodel->riftinfo+RIFTINFOSIZE*i+10); 83 84 strcpy(riftfront_type,"2d"); 84 /*id: */ 85 this->id=riftfront_id; 86 87 /*hooks: */ 85 88 riftfront_node_ids[0]=grid1; 86 89 riftfront_node_ids[1]=grid2; 87 riftfront_mparid=iomodel->numberofelements+1; //matlab indexing 88 89 riftfront_h[0]=iomodel->thickness[grid1-1]; 90 riftfront_h[1]=iomodel->thickness[grid2-1]; 91 92 riftfront_b[0]=iomodel->bed[grid1-1]; 93 riftfront_b[1]=iomodel->bed[grid2-1]; 94 95 riftfront_s[0]=iomodel->surface[grid1-1]; 96 riftfront_s[1]=iomodel->surface[grid2-1]; 97 98 riftfront_normal[0]=normal[0]; 99 riftfront_normal[1]=normal[1]; 100 riftfront_length=length; 101 102 riftfront_fill=fill; 103 riftfront_friction=friction; 104 riftfront_fraction=fraction; 105 riftfront_fractionincrement=fractionincrement; 90 riftfront_matpar_id=iomodel->numberofelements+1; //matlab indexing 91 92 this->hnodes.Init(riftfront_node_ids,2); 93 this->hmatpar.Init(&riftfront_matpar_id,1); 94 95 /*computational parameters: */ 96 this->active=0; 97 this->frozen=0; 98 this->counter=0; 99 this->prestable=0; 100 this->penalty_lock=0; 101 this->material_converged=0; 102 this->normal[0]=*(iomodel->riftinfo+RIFTINFOSIZE*i+4); 103 this->normal[1]=*(iomodel->riftinfo+RIFTINFOSIZE*i+5); 104 this->length=*(iomodel->riftinfo+RIFTINFOSIZE*i+6); 105 this->fraction=*(iomodel->riftinfo+RIFTINFOSIZE*i+9); 106 107 //intialize inputs, and add as many inputs per element as requested: 108 this->inputs=new Inputs(); 109 110 riftfront_type=SegmentRiftfrontEnum; 111 riftfront_fill = (int)*(iomodel->riftinfo+RIFTINFOSIZE*i+7); 112 riftfront_friction=*(iomodel->riftinfo+RIFTINFOSIZE*i+8); 113 riftfront_fractionincrement=*(iomodel->riftinfo+RIFTINFOSIZE*i+10); 106 114 riftfront_shelf=(bool)iomodel->gridoniceshelf[grid1-1]; 107 115 108 riftfront_penalty_offset=iomodel->penalty_offset; 109 riftfront_penalty_lock=iomodel->penalty_lock; 110 111 riftfront_active=0; 112 riftfront_frozen=0; 113 riftfront_counter=0; 114 riftfront_prestable=0; 115 116 this->Init(riftfront_type,riftfront_id, riftfront_node_ids, riftfront_mparid, riftfront_h,riftfront_b,riftfront_s,riftfront_normal,riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction,riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_frozen, riftfront_counter,riftfront_prestable,riftfront_shelf); 117 118 } 119 /*}}}1*/ 120 /*FUNCTION Riftfront::Init {{{1*/ 121 void Riftfront::Init(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,bool riftfront_frozen, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 122 123 int i; 124 125 strcpy(type,riftfront_type); 126 id=riftfront_id; 127 128 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 129 node_ids[i]=riftfront_node_ids[i]; 130 node_offsets[i]=UNDEF; 131 nodes[i]=NULL; 132 } 133 134 mparid=riftfront_mparid; 135 matpar=NULL; 136 matpar_offset=UNDEF; 137 138 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 139 h[i]=riftfront_h[i]; 140 b[i]=riftfront_b[i]; 141 s[i]=riftfront_s[i]; 142 } 143 144 normal[0]=riftfront_normal[0]; 145 normal[1]=riftfront_normal[1]; 146 length=riftfront_length; 147 fill=riftfront_fill; 148 friction=riftfront_friction; 149 fraction=riftfront_fraction; 150 fractionincrement=riftfront_fractionincrement; 151 penalty_offset=riftfront_penalty_offset; 152 penalty_lock=riftfront_penalty_lock; 153 active=riftfront_active; 154 frozen=riftfront_frozen; 155 counter=riftfront_counter; 156 prestable=riftfront_prestable; 157 shelf=riftfront_shelf; 158 159 /*not in the constructor, but still needed: */ 160 material_converged=0; 161 162 return; 116 this->inputs->AddInput(new IntInput(TypeEnum,riftfront_type)); 117 this->inputs->AddInput(new DoubleInput(FillEnum,riftfront_fill)); 118 this->inputs->AddInput(new DoubleInput(FrictionEnum,riftfront_friction)); 119 this->inputs->AddInput(new DoubleInput(FractionIncrementEnum,riftfront_fractionincrement)); 120 this->inputs->AddInput(new BoolInput(SegmentOnIceShelfEnum,riftfront_shelf)); 121 122 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 123 this->parameters=NULL; 124 163 125 } 164 126 /*}}}1*/ 165 127 /*FUNCTION Riftfront::~Riftfront(){{{1*/ 166 128 Riftfront::~Riftfront(){ 167 return; 168 } 169 /*}}}1*/ 170 129 delete inputs; 130 this->parameters=NULL; 131 } 132 /*}}}*/ 133 171 134 /*Object marshall*/ 135 /*FUNCTION Riftfront::copy {{{1*/ 136 Object* Riftfront::copy() { 137 return new Riftfront(*this); 138 } 139 /*}}}1*/ 140 /*FUNCTION Riftfront::Configure {{{1*/ 141 void Riftfront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){ 142 143 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 144 * datasets, using internal ids and offsets hidden in hooks: */ 145 hnodes.configure(nodesin); 146 hmatpar.configure(materialsin); 147 148 /*point parameters to real dataset: */ 149 this->parameters=parametersin; 150 151 } 152 /*}}}*/ 153 /*FUNCTION Riftfront::DeepEcho{{{1*/ 154 void Riftfront::DeepEcho(void){ 155 156 printf("Riftfront:\n"); 157 printf(" id: %i\n",id); 158 hnodes.DeepEcho(); 159 hmatpar.DeepEcho(); 160 printf(" parameters\n"); 161 parameters->DeepEcho(); 162 printf(" inputs\n"); 163 inputs->DeepEcho(); 164 } 165 /*}}}*/ 166 /*FUNCTION Riftfront::Demarshall {{{1*/ 167 void Riftfront::Demarshall(char** pmarshalled_dataset){ 168 169 char* marshalled_dataset=NULL; 170 int i; 171 172 /*recover marshalled_dataset: */ 173 marshalled_dataset=*pmarshalled_dataset; 174 175 /*this time, no need to get enum type, the pointer directly points to the beginning of the 176 *object data (thanks to DataSet::Demarshall):*/ 177 178 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 179 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active); 180 memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal); 181 memcpy(&length,marshalled_dataset,sizeof(length));marshalled_dataset+=sizeof(length); 182 memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 183 memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 184 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter); 185 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 186 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 187 memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 188 189 /*demarshall hooks: */ 190 hnodes.Demarshall(&marshalled_dataset); 191 hmatpar.Demarshall(&marshalled_dataset); 192 193 /*demarshall inputs: */ 194 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 195 196 /*parameters: may not exist even yet, so let Configure handle it: */ 197 this->parameters=NULL; 198 199 /*return: */ 200 *pmarshalled_dataset=marshalled_dataset; 201 } 202 /*}}}*/ 203 /*FUNCTION Riftfront::Echo {{{1*/ 204 void Riftfront::Echo(void){ 205 this->DeepEcho(); 206 } 207 /*}}}1*/ 208 /*FUNCTION Riftfront::Enum {{{1*/ 209 int Riftfront::Enum(void){ 210 211 return RiftfrontEnum; 212 213 } 214 /*}}}1*/ 215 /*FUNCTION Riftfront::GetId {{{1*/ 216 int Riftfront::GetId(void){ return id; } 217 /*}}}1*/ 218 /*FUNCTION Riftfront::GetName {{{1*/ 219 char* Riftfront::GetName(void){ 220 return "riftfront"; 221 } 222 /*}}}1*/ 172 223 /*FUNCTION Riftfront::Marshall {{{1*/ 173 224 void Riftfront::Marshall(char** pmarshalled_dataset){ … … 175 226 char* marshalled_dataset=NULL; 176 227 int enum_type=0; 228 char* marshalled_inputs=NULL; 229 int marshalled_inputs_size; 177 230 178 231 /*recover marshalled_dataset: */ … … 181 234 /*get enum type of Riftfront: */ 182 235 enum_type=RiftfrontEnum; 183 236 184 237 /*marshall enum: */ 185 238 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 186 239 187 240 /*marshall Riftfront data: */ 188 memcpy(marshalled_dataset,&type,sizeof(type));marshalled_dataset+=sizeof(type);189 241 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 190 memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 191 memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 192 memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 193 memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 194 195 memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h); 196 memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b); 197 memcpy(marshalled_dataset,&s,sizeof(s));marshalled_dataset+=sizeof(s); 198 242 memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active); 199 243 memcpy(marshalled_dataset,&normal,sizeof(normal));marshalled_dataset+=sizeof(normal); 200 244 memcpy(marshalled_dataset,&length,sizeof(length));marshalled_dataset+=sizeof(length); 201 memcpy(marshalled_dataset,&fill,sizeof(fill));marshalled_dataset+=sizeof(fill);202 memcpy(marshalled_dataset,&friction,sizeof(friction));marshalled_dataset+=sizeof(friction);203 245 memcpy(marshalled_dataset,&fraction,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 204 memcpy(marshalled_dataset,&fractionincrement,sizeof(fractionincrement));marshalled_dataset+=sizeof(fractionincrement);205 memcpy(marshalled_dataset,&penalty_offset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset);206 memcpy(marshalled_dataset,&penalty_lock,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock);207 memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);208 246 memcpy(marshalled_dataset,&frozen,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 209 247 memcpy(marshalled_dataset,&counter,sizeof(counter));marshalled_dataset+=sizeof(counter); 210 248 memcpy(marshalled_dataset,&prestable,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 211 memcpy(marshalled_dataset,&material_converged,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 212 memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 249 memcpy(marshalled_dataset,&penalty_lock,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 250 251 /*Marshall hooks: */ 252 hnodes.Marshall(&marshalled_dataset); 253 hmatpar.Marshall(&marshalled_dataset); 254 255 /*Marshall inputs: */ 256 marshalled_inputs_size=inputs->MarshallSize(); 257 marshalled_inputs=inputs->Marshall(); 258 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 259 marshalled_dataset+=marshalled_inputs_size; 260 261 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 262 263 xfree((void**)&marshalled_inputs); 213 264 214 265 *pmarshalled_dataset=marshalled_dataset; 215 266 return; 216 267 } 217 /*}}} 1*/268 /*}}}*/ 218 269 /*FUNCTION Riftfront::MarshallSize {{{1*/ 219 270 int Riftfront::MarshallSize(){ 220 221 return sizeof(type)+ 222 sizeof(id)+ 223 sizeof(node_ids)+ 224 sizeof(node_offsets)+ 225 sizeof(mparid)+ 226 sizeof(matpar_offset)+ 227 sizeof(h)+ 228 sizeof(b)+ 229 sizeof(s)+ 230 sizeof(normal)+ 231 sizeof(length)+ 232 sizeof(fill)+ 233 sizeof(friction)+ 234 sizeof(fraction)+ 235 sizeof(fractionincrement)+ 236 sizeof(penalty_offset)+ 237 sizeof(penalty_lock)+ 238 sizeof(active)+ 239 sizeof(frozen)+ 240 sizeof(counter)+ 241 sizeof(prestable)+ 242 sizeof(material_converged)+ 243 sizeof(shelf)+ 244 sizeof(int); //sizeof(int) for enum type 245 } 246 /*}}}1*/ 247 /*FUNCTION Riftfront::Demarshall {{{1*/ 248 void Riftfront::Demarshall(char** pmarshalled_dataset){ 249 250 int i; 251 char* marshalled_dataset=NULL; 252 253 /*recover marshalled_dataset: */ 254 marshalled_dataset=*pmarshalled_dataset; 255 256 /*this time, no need to get enum type, the pointer directly points to the beginning of the 257 *object data (thanks to DataSet::Demarshall):*/ 258 259 memcpy(&type,marshalled_dataset,sizeof(type));marshalled_dataset+=sizeof(type); 260 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 261 memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 262 memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 263 memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 264 memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 265 266 memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h); 267 memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b); 268 memcpy(&s,marshalled_dataset,sizeof(s));marshalled_dataset+=sizeof(s); 269 memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal); 270 memcpy(&length,marshalled_dataset,sizeof(length));marshalled_dataset+=sizeof(length); 271 memcpy(&fill,marshalled_dataset,sizeof(fill));marshalled_dataset+=sizeof(fill); 272 memcpy(&friction,marshalled_dataset,sizeof(friction));marshalled_dataset+=sizeof(friction); 273 memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 274 memcpy(&fractionincrement,marshalled_dataset,sizeof(fractionincrement));marshalled_dataset+=sizeof(fractionincrement); 275 memcpy(&penalty_offset,marshalled_dataset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset); 276 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 277 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active); 278 memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 279 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter); 280 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 281 memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 282 memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 283 284 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)nodes[i]=NULL; 285 matpar=NULL; 286 287 /*return: */ 288 *pmarshalled_dataset=marshalled_dataset; 289 return; 271 272 return sizeof(id) 273 +sizeof(active) 274 +sizeof(normal) 275 +sizeof(length) 276 +sizeof(fraction) 277 +sizeof(frozen) 278 +sizeof(counter) 279 +sizeof(prestable) 280 +sizeof(penalty_lock) 281 +hnodes.MarshallSize() 282 +hmatpar.MarshallSize() 283 +inputs->MarshallSize() 284 +sizeof(int); //sizeof(int) for enum type 285 } 286 /*}}}*/ 287 /*FUNCTION Riftfront::MyRank {{{1*/ 288 int Riftfront::MyRank(void){ 289 extern int my_rank; 290 return my_rank; 290 291 } 291 292 /*}}}1*/ 292 293 293 294 /*Object functions*/ 294 /*FUNCTION Riftfront::Configure {{{1*/295 void Riftfront::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){296 297 DataSet* nodesin=NULL;298 DataSet* materialsin=NULL;299 300 /*Recover pointers :*/301 nodesin=(DataSet*)pnodesin;302 materialsin=(DataSet*)pmaterialsin;303 304 /*Link this load with its nodes: */305 ResolvePointers((Object**)nodes,node_ids,node_offsets,MAX_RIFTFRONT_GRIDS,nodesin);306 307 /*Same for materials: */308 ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);309 310 }311 /*}}}1*/312 295 /*FUNCTION Riftfront::Constrain {{{1*/ 313 296 #define _ZIGZAGCOUNTER_ 314 297 315 int Riftfront::Constrain(int* punstable, void* vinputs, int analysis_type){ 316 317 const int numgrids=2; 318 int dofs[2]={0,1}; 319 double vxvy_list[2][2]; //velocities for all grids 320 double max_penetration; 321 double penetration; 322 int activate; 323 int found; 324 int unstable; 325 326 ParameterInputs* inputs=NULL; 327 328 inputs=(ParameterInputs*)vinputs; 298 int Riftfront::Constrain(int* punstable, int analysis_type){ 299 300 const int numgrids = 2; 301 double max_penetration; 302 double penetration; 303 int activate; 304 int found; 305 int unstable; 306 double vx1; 307 double vy1; 308 double vx2; 309 double vy2; 310 double fractionincrement; 311 312 313 /*Objects: */ 314 Element **elements = NULL; 315 Node **nodes = NULL; 316 Tria *tria1 = NULL; 317 Tria *tria2 = NULL; 318 319 /*Recover hook objects: */ 320 elements=(Element**)helements.deliverp(); 321 nodes=(Node**)hnodes.deliverp(); 322 323 /*enum of element? */ 324 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 325 326 /*recover elements on both side of rift: */ 327 tria1=(Tria*)elements[0]; 328 tria2=(Tria*)elements[1]; 329 329 330 330 /*Is this constraint frozen? In which case we don't touch: */ … … 334 334 } 335 335 336 /*First recover parameter inputs: */ 337 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 338 if(!found)ISSMERROR(" could not find velocity in inputs!"); 339 340 341 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 342 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 336 /*recover parameters: */ 337 this->inputs->GetParameterValue(&fractionincrement,FractionIncrementEnum); 338 339 /*First recover velocity: */ 340 tria1->inputs->GetParameterValueAtNode(&vx1,nodes[0],VxEnum); 341 tria2->inputs->GetParameterValueAtNode(&vx2,nodes[1],VxEnum); 342 tria1->inputs->GetParameterValueAtNode(&vy1,nodes[0],VyEnum); 343 tria2->inputs->GetParameterValueAtNode(&vy2,nodes[1],VyEnum); 344 345 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 346 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 343 347 344 348 /*activation: */ … … 352 356 this->counter=0; 353 357 /*increase melange fraction: */ 354 this->fraction+= this->fractionincrement;358 this->fraction+=fractionincrement; 355 359 if (this->fraction>1)this->fraction=(double)1.0; 356 360 //printf("riftfront %i fraction: %g\n",this->GetId(),this->fraction); … … 375 379 } 376 380 /*}}}1*/ 377 /*FUNCTION Riftfront::copy {{{1*/378 Object* Riftfront::copy() {379 return new Riftfront(*this);380 }381 /*}}}1*/382 381 /*FUNCTION Riftfront::CreateKMatrix {{{1*/ 383 void Riftfront::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){382 void Riftfront::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 384 383 /*do nothing: */ 385 384 } 386 385 /*}}}1*/ 387 386 /*FUNCTION Riftfront::CreatePVector {{{1*/ 388 void Riftfront::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){387 void Riftfront::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){ 389 388 /*do nothing: */ 390 389 } 391 390 /*}}}1*/ 392 /*FUNCTION Riftfront::DeepEcho {{{1*/393 void Riftfront::DeepEcho(void){394 395 int i;396 397 printf("Riftfront:\n");398 printf(" type: %s\n",type);399 printf(" id: %i\n",id);400 401 printf(" node_ids: ");402 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);403 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){404 if (nodes[i])nodes[i]->Echo();405 }406 printf("\n");407 408 printf(" mparid: %i\n",mparid);409 if(matpar)matpar->Echo();410 411 printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);412 printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);413 printf("penalty_offset %g\n",penalty_offset);414 printf("penalty_lock %i\n",penalty_lock);415 printf("active %i\n",active);416 printf("frozen %i\n",frozen);417 printf("counter %i\n",counter);418 printf("prestable %i\n",prestable);419 printf("material_converged %i\n",material_converged);420 printf("shelf %i\n",shelf);421 422 }423 /*}}}1*/424 /*FUNCTION Riftfront::Echo {{{1*/425 void Riftfront::Echo(void){426 427 int i;428 429 printf("Riftfront:\n");430 printf(" type: %s\n",type);431 printf(" id: %i\n",id);432 printf(" mparid: %i\n",mparid);433 434 printf(" node_ids: ");435 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);436 printf("\n");437 438 printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);439 printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);440 printf("penalty_offset %g\n",penalty_offset);441 printf("penalty_lock %i\n",penalty_lock);442 printf("active %i\n",active);443 printf("frozen %i\n",frozen);444 printf("counter %i\n",counter);445 printf("prestable %i\n",prestable);446 printf("material_converged %i\n",material_converged);447 printf("shelf %i\n",shelf);448 }449 /*}}}1*/450 /*FUNCTION Riftfront::Enum {{{1*/451 int Riftfront::Enum(void){452 453 return RiftfrontEnum;454 455 }456 /*}}}1*/457 391 /*FUNCTION Riftfront::FreezeConstraints{{{1*/ 458 void Riftfront::FreezeConstraints( void* vinputs,int analysis_type){392 void Riftfront::FreezeConstraints( int analysis_type){ 459 393 460 394 /*Just set frozen flag to 1: */ … … 470 404 int doflist_per_node[MAXDOFSPERNODE]; 471 405 int numberofdofspernode; 472 406 Node **nodes = NULL; 407 408 nodes=(Node**)hnodes.deliverp(); 409 473 410 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 474 411 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 482 419 } 483 420 /*}}}1*/ 484 /*FUNCTION Riftfront::GetId {{{1*/485 int Riftfront::GetId(void){ return id; }486 /*}}}1*/487 /*FUNCTION Riftfront::GetName {{{1*/488 char* Riftfront::GetName(void){489 return "riftfront";490 }491 /*}}}1*/492 421 /*FUNCTION Riftfront::IsFrozen{{{1*/ 493 422 bool Riftfront::IsFrozen(void){ … … 499 428 /*}}}1*/ 500 429 /*FUNCTION Riftfront::IsMaterialStable {{{1*/ 501 int Riftfront::IsMaterialStable( void* vinputs,int analysis_type){430 int Riftfront::IsMaterialStable( int analysis_type){ 502 431 503 432 int found=0; 504 ParameterInputs* inputs=NULL;505 433 double converged=0; 506 434 507 inputs=(ParameterInputs*)vinputs; 508 509 found=inputs->Recover("converged",&converged); 510 if(!found)ISSMERROR(" could not find converged flag in inputs!"); 435 this->inputs->GetParameterValue(&converged,ConvergedEnum); 511 436 512 437 if(converged){ … … 521 446 /*}}}1*/ 522 447 /*FUNCTION Riftfront::MaxPenetration {{{1*/ 523 int Riftfront::MaxPenetration(double* ppenetration, void* vinputs,int analysis_type){448 int Riftfront::MaxPenetration(double* ppenetration, int analysis_type){ 524 449 525 450 const int numgrids=2; 526 int dofs[2]={0,1};527 double vxvy_list[2][2]; //velocities for all grids528 451 double max_penetration; 529 452 double penetration=0; 530 453 int found; 531 532 ParameterInputs* inputs=NULL; 533 534 inputs=(ParameterInputs*)vinputs; 454 double vx1; 455 double vy1; 456 double vx2; 457 double vy2; 458 459 /*Objects: */ 460 Element **elements = NULL; 461 Node **nodes = NULL; 462 Tria *tria1 = NULL; 463 Tria *tria2 = NULL; 464 465 /*Recover hook objects: */ 466 elements=(Element**)helements.deliverp(); 467 nodes=(Node**)hnodes.deliverp(); 468 469 /*enum of element? */ 470 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 471 472 /*recover elements on both side of rift: */ 473 tria1=(Tria*)elements[0]; 474 tria2=(Tria*)elements[1]; 535 475 536 476 //initialize: 537 477 penetration=-1; 538 478 539 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 540 if(!found)ISSMERROR(" could not find velocity in inputs!"); 479 /*recover velocity: */ 480 tria1->inputs->GetParameterValueAtNode(&vx1,nodes[0],VxEnum); 481 tria2->inputs->GetParameterValueAtNode(&vx2,nodes[1],VxEnum); 482 tria1->inputs->GetParameterValueAtNode(&vy1,nodes[0],VyEnum); 483 tria2->inputs->GetParameterValueAtNode(&vy2,nodes[1],VyEnum); 541 484 542 485 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 543 penetration=(vx vy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];486 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 544 487 545 488 /*Now, we return penetration only if we are active!: */ … … 552 495 *ppenetration=penetration; 553 496 554 }555 /*}}}1*/556 /*FUNCTION Riftfront::MyRank {{{1*/557 int Riftfront::MyRank(void){558 extern int my_rank;559 return my_rank;560 497 } 561 498 /*}}}1*/ … … 575 512 /*}}}1*/ 576 513 /*FUNCTION Riftfront::PenaltyCreateKMatrix {{{1*/ 577 void Riftfront::PenaltyCreateKMatrix(Mat Kgg,void* vinputs,double kmax,int analysis_type,int sub_analysis_type){ 578 579 int i,j; 580 const int numgrids=MAX_RIFTFRONT_GRIDS; 581 int dofs[1]={0}; 582 double Ke_gg[4][4]; 583 const int numdof=2*numgrids; 584 int doflist[numdof]; 585 int numberofdofspernode; 586 double thickness; 587 ParameterInputs* inputs=NULL; 588 589 /*Some pointer intialization: */ 590 inputs=(ParameterInputs*)vinputs; 591 514 void Riftfront::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){ 515 516 int i; 517 int j; 518 const int numgrids = MAX_RIFTFRONT_GRIDS; 519 int dofs[1] = {0}; 520 double Ke_gg[4][4]; 521 const int numdof = 2 *numgrids; 522 int doflist[numdof]; 523 int numberofdofspernode; 524 double thickness; 525 double h[2]; 526 double penalty_offset; 527 double friction; 528 529 /*Objects: */ 530 Element **elements = NULL; 531 Node **nodes = NULL; 532 Tria *tria1 = NULL; 533 Tria *tria2 = NULL; 534 535 /*Recover hook objects: */ 536 elements=(Element**)helements.deliverp(); 537 nodes=(Node**)hnodes.deliverp(); 538 539 /*enum of element? */ 540 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 541 542 /*recover elements on both side of rift: */ 543 tria1=(Tria*)elements[0]; 544 tria2=(Tria*)elements[1]; 545 546 592 547 /* Get node coordinates and dof list: */ 593 548 GetDofList(&doflist[0],&numberofdofspernode); … … 596 551 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]=0.0; 597 552 553 /*Get some parameters: */ 554 this->parameters->FindParam(&penalty_offset,"penalty_offset"); 555 this->inputs->GetParameterValue(&friction,FrictionEnum); 598 556 599 557 if(this->active){ … … 602 560 *contact slip friction. */ 603 561 604 /*Recover input parameters: */ 605 inputs->Recover("thickness",&h[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes); 562 /*Recover thickness: */ 563 tria1->inputs->GetParameterValueAtNode(&h[0],nodes[0],ThicknessEnum); 564 tria2->inputs->GetParameterValueAtNode(&h[1],nodes[1],ThicknessEnum); 565 606 566 if (h[0]!=h[1])ISSMERROR(" different thicknesses not supported for rift fronts"); 607 567 thickness=h[0]; … … 664 624 /*}}}1*/ 665 625 /*FUNCTION Riftfront::PenaltyCreatePVector {{{1*/ 666 void Riftfront::PenaltyCreatePVector(Vec pg,void* vinputs,double kmax,int analysis_type,int sub_analysis_type){ 667 668 int i,j; 669 const int numgrids=MAX_RIFTFRONT_GRIDS; 670 int dofs[1]={0}; 671 double pe_g[4]; 672 const int numdof=2*numgrids; 673 int doflist[numdof]; 674 int numberofdofspernode; 675 ParameterInputs* inputs=NULL; 676 double rho_ice; 677 double rho_water; 678 double gravity; 679 double thickness; 680 double bed; 681 double pressure; 682 double pressure_litho; 683 double pressure_air; 684 double pressure_melange; 685 double pressure_water; 686 687 /*Some pointer intialization: */ 688 inputs=(ParameterInputs*)vinputs; 626 void Riftfront::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){ 627 628 int i ,j; 629 const int numgrids = MAX_RIFTFRONT_GRIDS; 630 double pe_g[4]={0.0}; 631 const int numdof = 2 *numgrids; 632 int doflist[numdof]; 633 int numberofdofspernode; 634 635 double rho_ice; 636 double rho_water; 637 double gravity; 638 double thickness; 639 double h[2]; 640 double bed; 641 double b[2]; 642 double pressure; 643 double pressure_litho; 644 double pressure_air; 645 double pressure_melange; 646 double pressure_water; 647 double fill; 648 bool shelf; 649 650 651 /*Objects: */ 652 Element **elements = NULL; 653 Node **nodes = NULL; 654 Tria *tria1 = NULL; 655 Tria *tria2 = NULL; 656 Matpar *matpar = NULL; 657 658 659 /*Recover hook objects: */ 660 elements=(Element**)helements.deliverp(); 661 nodes=(Node**)hnodes.deliverp(); 662 matpar=(Matpar*)hmatpar.delivers(); 663 664 /*enum of element? */ 665 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 666 667 /*recover elements on both side of rift: */ 668 tria1=(Tria*)elements[0]; 669 tria2=(Tria*)elements[1]; 689 670 690 671 /* Get node coordinates and dof list: */ 691 672 GetDofList(&doflist[0],&numberofdofspernode); 692 673 693 /* Set pe_g to 0: */ 694 for(i=0;i<numdof;i++) pe_g[i]=0; 674 /*Get some inputs: */ 675 this->inputs->GetParameterValue(&fill,FillEnum); 676 this->inputs->GetParameterValue(&shelf,SegmentOnIceShelfEnum); 695 677 696 678 if(!this->active){ … … 706 688 707 689 /*get thickness: */ 708 inputs->Recover("thickness",&h[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes); 690 tria1->inputs->GetParameterValueAtNode(&h[0],nodes[0],ThicknessEnum); 691 tria2->inputs->GetParameterValueAtNode(&h[1],nodes[1],ThicknessEnum); 692 709 693 if (h[0]!=h[1])ISSMERROR(" different thicknesses not supported for rift fronts"); 710 694 thickness=h[0]; 711 695 712 inputs->Recover("bed",&b[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes); 696 tria1->inputs->GetParameterValueAtNode(&b[0],nodes[0],BedEnum); 697 tria2->inputs->GetParameterValueAtNode(&b[1],nodes[1],BedEnum); 698 713 699 if (b[0]!=b[1])ISSMERROR(" different beds not supported for rift fronts"); 714 700 bed=b[0]; … … 765 751 /*}}}1*/ 766 752 /*FUNCTION Riftfront::Penetration {{{1*/ 767 int Riftfront::Penetration(double* ppenetration, void* vinputs, int analysis_type){ 768 769 const int numgrids=2; 770 int dofs[2]={0,1}; 771 double vxvy_list[2][2]; //velocities for all grids 772 double max_penetration; 773 double penetration; 774 int found; 775 776 ParameterInputs* inputs=NULL; 777 778 inputs=(ParameterInputs*)vinputs; 779 780 781 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 782 if(!found)ISSMERROR(" could not find velocity in inputs!"); 783 784 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 785 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 753 int Riftfront::Penetration(double* ppenetration, int analysis_type){ 754 755 double vx1; 756 double vy1; 757 double vx2; 758 double vy2; 759 760 double penetration; 761 int found; 762 763 /*Objects: */ 764 Element **elements = NULL; 765 Node **nodes = NULL; 766 Tria *tria1 = NULL; 767 Tria *tria2 = NULL; 768 769 /*Recover hook objects: */ 770 elements=(Element**)helements.deliverp(); 771 nodes=(Node**)hnodes.deliverp(); 772 773 /*enum of element? */ 774 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 775 776 /*recover elements on both side of rift: */ 777 tria1=(Tria*)elements[0]; 778 tria2=(Tria*)elements[1]; 779 780 /*First recover velocity: */ 781 tria1->inputs->GetParameterValueAtNode(&vx1,nodes[0],VxEnum); 782 tria2->inputs->GetParameterValueAtNode(&vx2,nodes[1],VxEnum); 783 tria1->inputs->GetParameterValueAtNode(&vy1,nodes[0],VyEnum); 784 tria2->inputs->GetParameterValueAtNode(&vy2,nodes[1],VyEnum); 785 786 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 787 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 786 788 787 789 /*Now, we return penetration only if we are active!: */ … … 794 796 /*}}}1*/ 795 797 /*FUNCTION Riftfront::PotentialUnstableConstraint {{{1*/ 796 int Riftfront::PotentialUnstableConstraint(int* punstable, void* vinputs, int analysis_type){ 797 798 799 const int numgrids=2; 800 int dofs[2]={0,1}; 801 double vxvy_list[2][2]; //velocities for all grids 802 double max_penetration; 803 double penetration; 804 int activate; 805 int unstable; 806 int found; 807 808 ParameterInputs* inputs=NULL; 809 810 inputs=(ParameterInputs*)vinputs; 811 812 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 813 if(!found)ISSMERROR(" could not find velocity in inputs!"); 814 815 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 816 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 798 int Riftfront::PotentialUnstableConstraint(int* punstable, int analysis_type){ 799 800 801 const int numgrids = 2; 802 double max_penetration; 803 double penetration; 804 int activate; 805 int unstable; 806 int found; 807 double vx1; 808 double vy1; 809 double vx2; 810 double vy2; 811 812 813 /*Objects: */ 814 Element **elements = NULL; 815 Node **nodes = NULL; 816 Tria *tria1 = NULL; 817 Tria *tria2 = NULL; 818 819 /*Recover hook objects: */ 820 elements=(Element**)helements.deliverp(); 821 nodes=(Node**)hnodes.deliverp(); 822 823 /*enum of element? */ 824 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 825 826 /*recover elements on both side of rift: */ 827 tria1=(Tria*)elements[0]; 828 tria2=(Tria*)elements[1]; 829 830 /*First recover velocity: */ 831 tria1->inputs->GetParameterValueAtNode(&vx1,nodes[0],VxEnum); 832 tria2->inputs->GetParameterValueAtNode(&vx2,nodes[1],VxEnum); 833 tria1->inputs->GetParameterValueAtNode(&vy1,nodes[0],VyEnum); 834 tria2->inputs->GetParameterValueAtNode(&vy2,nodes[1],VyEnum); 835 836 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 837 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 817 838 818 839 /*Ok, we are looking for positive penetration in an active constraint: */ … … 834 855 /*}}}1*/ 835 856 /*FUNCTION Riftfront::PreConstrain {{{1*/ 836 int Riftfront::PreConstrain(int* punstable, void* vinputs, int analysis_type){ 837 838 const int numgrids=2; 839 int dofs[2]={0,1}; 840 double vxvy_list[2][2]; //velocities for all grids 841 double penetration; 842 int unstable; 843 ParameterInputs* inputs=NULL; 844 int found; 845 846 inputs=(ParameterInputs*)vinputs; 857 int Riftfront::PreConstrain(int* punstable, int analysis_type){ 858 859 const int numgrids = 2; 860 double penetration; 861 int unstable; 862 int found; 863 double vx1; 864 double vy1; 865 double vx2; 866 double vy2; 867 868 869 /*Objects: */ 870 Element **elements = NULL; 871 Node **nodes = NULL; 872 Tria *tria1 = NULL; 873 Tria *tria2 = NULL; 874 875 /*Recover hook objects: */ 876 elements=(Element**)helements.deliverp(); 877 nodes=(Node**)hnodes.deliverp(); 878 879 /*enum of element? */ 880 if(elements[0]->Enum()!=TriaEnum)ISSMERROR(" only Tria element allowed for Riftfront load!"); 881 882 /*recover elements on both side of rift: */ 883 tria1=(Tria*)elements[0]; 884 tria2=(Tria*)elements[1]; 847 885 848 886 /*First recover velocity: */ 849 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 850 if(!found)ISSMERROR(" could not find velocity in inputs!"); 851 852 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 853 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 887 tria1->inputs->GetParameterValueAtNode(&vx1,nodes[0],VxEnum); 888 tria2->inputs->GetParameterValueAtNode(&vx2,nodes[1],VxEnum); 889 tria1->inputs->GetParameterValueAtNode(&vy1,nodes[0],VyEnum); 890 tria2->inputs->GetParameterValueAtNode(&vy2,nodes[1],VyEnum); 891 892 /*Node 1 faces node 2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 893 penetration=(vx2-vx1)*normal[0]+(vy2-vy1)*normal[1]; 854 894 855 895 /*Ok, we are preconstraining here. Ie, anything that penetrates is constrained until stability of the entire set … … 895 935 } 896 936 /*}}}1*/ 897 /*FUNCTION Riftfront::UpdateFromInputs {{{1*/898 void Riftfront::UpdateFromInputs(void* vinputs){899 900 int dofs[1]={0};901 ParameterInputs* inputs=NULL;902 903 inputs=(ParameterInputs*)vinputs;904 905 inputs->Recover("thickness",&h[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);906 inputs->Recover("bed",&b[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);907 inputs->Recover("surface",&s[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);908 909 }910 /*}}}1*/ -
issm/trunk/src/c/objects/Riftfront.h
r3622 r3637 6 6 #define _RIFTFRONT_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Load.h" 9 11 #include "./Matpar.h" … … 15 17 16 18 class Element; 19 /*}}}*/ 20 17 21 class Riftfront: public Load { 18 22 19 private: 20 char type[RIFTFRONTSTRING]; 23 public: 21 24 int id; 22 25 23 /*nodes: */ 24 int node_ids[MAX_RIFTFRONT_GRIDS]; //node ids 25 Node* nodes[MAX_RIFTFRONT_GRIDS]; //node pointers 26 int node_offsets[MAX_RIFTFRONT_GRIDS]; //node offsets in nodes dataset 26 Hook hnodes; //2 nodes 27 Hook helements; //2 elements 28 Hook hmatpar; 29 30 /*computational: */ 31 int penalty_lock; 32 bool active; 33 bool frozen; 34 int counter; 35 bool prestable; 36 bool material_converged; 37 double normal[2]; 38 double length; 39 double fraction; 40 41 Parameters* parameters; //pointer to solution parameters 42 Inputs* inputs; 27 43 28 /*material: */29 int mparid;30 Matpar* matpar;31 int matpar_offset;32 33 /*properties: */34 double h[MAX_RIFTFRONT_GRIDS]; //thickness35 double b[MAX_RIFTFRONT_GRIDS]; //bed36 double s[MAX_RIFTFRONT_GRIDS]; //surface37 38 double normal[2];39 double length;40 int fill;41 double friction;42 double fraction;43 double fractionincrement;44 bool shelf;45 46 double penalty_offset;47 int penalty_lock;48 49 /*computational: */50 bool active;51 bool frozen;52 int counter;53 bool prestable;54 bool material_converged;55 56 public:57 44 58 45 /*constructors,destructors: {{{1*/ 59 46 Riftfront(); 60 void Init(char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active,bool frozen, int counter,bool prestable,bool shelf);61 Riftfront( char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active,bool frozen, int counter,bool prestable,bool shelf);62 Riftfront(int id,int i, IoModel* iomodel);47 Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id); 48 Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* parameters, Inputs* riftfront_inputs); 49 Riftfront(int riftfront_id,int i, IoModel* iomodel); 63 50 ~Riftfront(); 64 51 /*}}}*/ 65 52 /*object management: {{{1*/ 66 void Configure( void* elements,void* nodes,void* materials);53 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters); 67 54 Object* copy(); 68 55 void DeepEcho(); … … 78 65 /*}}}*/ 79 66 /*numerics: {{{1*/ 80 void UpdateFromInputs(void* inputs);81 67 void GetDofList(int* doflist,int* pnumberofdofs); 82 void CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);83 void CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);84 void PenaltyCreateKMatrix(Mat Kgg, void* inputs,double kmax,int analysis_type,int sub_analysis_type);85 void PenaltyCreatePVector(Vec pg, void* inputs,double kmax,int analysis_type,int sub_analysis_type);68 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 69 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 70 void PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type); 71 void PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type); 86 72 bool PreStable(); 87 73 void SetPreStable(); 88 int PreConstrain(int* punstable, void* inputs,int analysis_type);89 int Constrain(int* punstable, void* inputs,int analysis_type);90 void FreezeConstraints( void* inputs,int analysis_type);74 int PreConstrain(int* punstable, int analysis_type); 75 int Constrain(int* punstable, int analysis_type); 76 void FreezeConstraints( int analysis_type); 91 77 bool IsFrozen(void); 92 int Penetration(double* ppenetration, void* inputs,int analysis_type);93 int MaxPenetration(double* ppenetration, void* inputs,int analysis_type);94 int PotentialUnstableConstraint(int* punstable, void* inputs,int analysis_type);95 int IsMaterialStable( void* inputs,int analysis_type);78 int Penetration(double* ppenetration, int analysis_type); 79 int MaxPenetration(double* ppenetration, int analysis_type); 80 int PotentialUnstableConstraint(int* punstable, int analysis_type); 81 int IsMaterialStable( int analysis_type); 96 82 void OutputProperties(Vec riftproperties); 97 83 /*}}}*/ -
issm/trunk/src/c/objects/Sing.h
r3632 r3637 6 6 #define _SING_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Element.h" 9 11 #include "./Node.h" … … 15 17 #include "../DataSet/DataSet.h" 16 18 #include "../DataSet/Parameters.h" 19 /*}}}*/ 17 20 18 21 class Sing: public Element{ -
issm/trunk/src/c/objects/SingVertexInput.h
r3620 r3637 3 3 */ 4 4 5 #include "./Input.h"6 5 7 6 #ifndef _SINGVERTEXINPUT_H_ 8 7 #define _SINGVERTEXINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 /*}}}*/ 9 13 10 14 class SingVertexInput: public Input{ -
issm/trunk/src/c/objects/SolPar.h
r3463 r3637 6 6 #define _SOLPAR_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 11 /*}}}*/ 9 12 10 13 class SolPar: public Object{ -
issm/trunk/src/c/objects/Spc.h
r3463 r3637 6 6 #define _SPC_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 9 11 #include "../DataSet/DataSet.h" 12 /*}}}*/ 10 13 11 14 class Spc: public Object{ -
issm/trunk/src/c/objects/Tria.cpp
r3636 r3637 3 3 */ 4 4 5 /*Headers:*/ 6 /*{{{1*/ 5 7 #ifdef HAVE_CONFIG_H 6 8 #include "config.h" … … 22 24 #include "../include/typedefs.h" 23 25 #include "../include/macros.h" 26 /*}}}*/ 24 27 25 28 /*Object constructors and destructor*/ … … 66 69 Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index 67 70 68 int i,j; 69 int tria_node_ids[3]; 70 int tria_matice_id; 71 int tria_matpar_id; 71 int i; 72 int j; 73 int tria_node_ids[3]; 74 int tria_matice_id; 75 int tria_matpar_id; 72 76 double nodeinputs[3]; 73 77 … … 443 447 /*}}}*/ 444 448 445 446 449 /*Object functions*/ 447 450 /*FUNCTION Tria::ComputeBasalStress {{{1*/ … … 518 521 519 522 /*dynamic objects pointed to by hooks: */ 520 Node** nodes= NULL;521 Matpar* matpar =NULL;522 Matice* matice= NULL;523 Node** nodes= NULL; 524 Matpar* matpar =NULL; 525 Matice* matice= NULL; 523 526 524 527 /*recover objects from hooks: */ -
issm/trunk/src/c/objects/Tria.h
r3632 r3637 6 6 #define _TRIA_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 #include "./Object.h" 9 11 #include "./Element.h" … … 14 16 #include "../DataSet/Parameters.h" 15 17 #include "../DataSet/Inputs.h" 18 /*}}}*/ 16 19 17 20 class Tria: public Element{ -
issm/trunk/src/c/objects/TriaVertexInput.h
r3612 r3637 3 3 */ 4 4 5 #include "./Input.h"6 5 7 6 #ifndef _TRIAVERTEXINPUT_H_ 8 7 #define _TRIAVERTEXINPUT_H_ 8 9 /*Headers:*/ 10 /*{{{1*/ 11 #include "./Input.h" 12 /*}}}*/ 9 13 10 14 class TriaVertexInput: public Input{ -
issm/trunk/src/c/objects/Vertex.h
r3622 r3637 6 6 #define _VERTEX_H_ 7 7 8 /*Headers:*/ 9 /*{{{1*/ 8 10 class Object; 9 11 class DofObject; … … 12 14 #include "./Object.h" 13 15 #include "./DofObject.h" 16 /*}}}*/ 14 17 15 18 class Vertex: public Object,public DofObject{
Note:
See TracChangeset
for help on using the changeset viewer.