Changeset 3632
- Timestamp:
- 04/27/10 16:44:21 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Beam.h
r3622 r3632 24 24 class Beam: public Element{ 25 25 26 p rivate:26 public: 27 27 28 28 /*ids:*/ … … 36 36 Inputs* inputs; 37 37 38 public:39 38 40 39 /*constructors, destructors: {{{1*/ -
issm/trunk/src/c/objects/Icefront.cpp
r3622 r3632 21 21 /*FUNCTION Icefront::Icefront() {{{1*/ 22 22 Icefront::Icefront(){ 23 return; 24 } 25 /*}}}*/ 26 /*FUNCTION Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, ...) {{{1*/ 27 Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 28 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double icefront_b[MAX_ICEFRONT_GRIDS]){ 29 30 this->Init(icefront_type,icefront_fill,icefront_sid, icefront_mparid, icefront_eid, icefront_element_type, 31 icefront_node_ids,icefront_h,icefront_b); 32 33 } 34 /*}}}*/ 35 /*FUNCTION Icefront::Init {{{1*/ 36 void Icefront::Init(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 37 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double icefront_b[MAX_ICEFRONT_GRIDS]){ 38 39 int i; 40 41 strcpy(type,icefront_type); 42 fill=icefront_fill; 43 sid=icefront_sid; 44 45 mparid=icefront_mparid; 46 47 eid=icefront_eid; 48 element_type=icefront_element_type; 49 for(i=0;i<MAX_ICEFRONT_GRIDS;i++){ 50 node_ids[i]=icefront_node_ids[i]; 51 node_offsets[i]=UNDEF; 52 nodes[i]=NULL; 53 h[i]=icefront_h[i]; 54 b[i]=icefront_b[i]; 55 } 56 57 matpar=NULL; 58 matpar_offset=UNDEF; 59 60 element=NULL; 61 element_offset=UNDEF; 23 this->inputs=NULL; 24 this->parameters=NULL; 25 } 26 /*}}}*/ 27 /*FUNCTION Icefront::Icefront(int icefront_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), 31 hmatpar(&icefront_matpar_id,1) 32 { 33 34 /*all the initialization has been done by the initializer, just fill in the id: */ 35 this->id=icefront_id; 36 this->parameters=NULL; 37 this->inputs=new Inputs(); 38 } 39 /*}}}*/ 40 /*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, DataSet* parameters, Inputs* icefront_inputs) {{{1*/ 41 Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs): 42 hnodes(icefront_hnodes), 43 helement(icefront_helement), 44 hmatpar(icefront_hmatpar) 45 { 46 47 /*all the initialization has been done by the initializer, just fill in the id: */ 48 this->id=icefront_id; 49 if(icefront_inputs){ 50 this->inputs=(Inputs*)icefront_inputs->Copy(); 51 } 52 else{ 53 this->inputs=new Inputs(); 54 } 55 /*point parameters: */ 56 this->parameters=icefront_parameters; 62 57 } 63 58 /*}}}*/ … … 66 61 67 62 int segment_width; 68 int element_type;69 63 int i1,i2,i3,i4; 70 64 int element; 71 65 72 66 /*icefront intermediary data: */ 73 char icefront_type[ICEFRONTSTRING]; 67 int icefront_node_ids[MAX_ICEFRONT_GRIDS]; 68 int num_nodes; 69 int icefront_mparid; 70 int icefront_eid; 74 71 int icefront_fill; 75 int icefront_element_type;76 int icefront_eid;77 int icefront_mparid;78 int icefront_node_ids[MAX_ICEFRONT_GRIDS];79 double icefront_h[MAX_ICEFRONT_GRIDS];80 double icefront_b[MAX_ICEFRONT_GRIDS];81 72 82 73 /*First, retrieve element index and element type: */ 83 74 if (strcmp(iomodel->meshtype,"2d")==0){ 84 75 segment_width=4; 85 element_type=TriaEnum;86 76 } 87 77 else{ 88 78 segment_width=6; 89 element_type=PentaEnum;90 79 } 91 80 element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill) 92 81 82 /*Setup all ids, so we can get our hooks setup: */ 93 83 icefront_mparid=iomodel->numberofelements+1; //matlab indexing 94 icefront_mparid=iomodel->numberofelements+1; //matlab indexing95 icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1);96 84 icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing 97 icefront_element_type=element_type; 98 99 i1=(int)*(iomodel->pressureload+segment_width*i+0); 100 i2=(int)*(iomodel->pressureload+segment_width*i+1); 101 102 icefront_node_ids[0]=i1; 103 icefront_node_ids[1]=i2; 104 105 icefront_h[0]=iomodel->thickness[i1-1]; 106 icefront_h[1]=iomodel->thickness[i2-1]; 107 108 icefront_b[0]=iomodel->bed[i1-1]; 109 icefront_b[1]=iomodel->bed[i2-1]; 85 86 icefront_node_ids[0]=(int)*(iomodel->pressureload+segment_width*i+0); 87 icefront_node_ids[1]=(int)*(iomodel->pressureload+segment_width*i+1); 110 88 111 89 if (iomodel->sub_analysis_type==HorizAnalysisEnum){ 112 90 if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d 113 strcpy(icefront_type,"segment");91 num_nodes=2; 114 92 } 115 93 else if ((int)*(iomodel->elements_type+2*element+0)==PattynFormulationEnum){ //this is a real 3d element, icefront will be 3d. 116 strcpy(icefront_type,"quad"); 117 i3=(int)*(iomodel->pressureload+segment_width*i+2); 118 i4=(int)*(iomodel->pressureload+segment_width*i+3); 119 icefront_node_ids[2]=i3; 120 icefront_node_ids[3]=i4; 121 122 icefront_h[2]=iomodel->thickness[i3-1]; 123 icefront_h[3]=iomodel->thickness[i4-1]; 124 125 icefront_b[2]=iomodel->bed[i3-1]; 126 icefront_b[3]=iomodel->bed[i4-1]; 94 num_nodes=4; 95 icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2); 96 icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3); 127 97 } 128 98 else{ … … 132 102 else if (iomodel->sub_analysis_type==StokesAnalysisEnum){ 133 103 //We have a Stokes element, so we need a 3d Icefront 134 strcpy(icefront_type,"quad"); 135 i3=(int)*(iomodel->pressureload+segment_width*i+2); 136 i4=(int)*(iomodel->pressureload+segment_width*i+3); 137 icefront_node_ids[2]=i3; 138 icefront_node_ids[3]=i4; 139 140 icefront_h[2]=iomodel->thickness[i3-1]; 141 icefront_h[3]=iomodel->thickness[i4-1]; 142 143 icefront_b[2]=iomodel->bed[i3-1]; 144 icefront_b[3]=iomodel->bed[i4-1]; 104 num_nodes=4; 105 icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2); 106 icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3); 145 107 } 146 108 else ISSMERROR("Not supported yet!"); 147 109 148 this->Init(icefront_type,icefront_fill,icefront_id,icefront_mparid,icefront_eid,icefront_element_type,icefront_node_ids,icefront_h,icefront_b); 110 /*Ok, get the hooks setup: */ 111 this->hnodes.Init(icefront_node_ids,num_nodes); 112 this->helement.Init(&icefront_element_id,1); 113 this->hmatpar.Init(&icefront_matpar_id,1); 114 115 //intialize inputs, and add as many inputs per element as requested: 116 this->inputs=new Inputs(); 117 118 icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1); 119 this->inputs->AddInput(new IntInput(FillEnum,icefront_fill)); 120 121 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 122 this->parameters=NULL; 123 149 124 } 150 125 … … 158 133 159 134 /*Object marshall*/ 135 /*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 respective 139 * datasets, using internal ids and offsets hidden in hooks: */ 140 hnodes.configure(nodesin); 141 helement.configure(elementsin); 142 hmatpar.configure(materialsin); 143 144 /*point parameters to real dataset: */ 145 this->parameters=parametersin; 146 } 147 /*}}}*/ 148 /*FUNCTION Icefront copy {{{1*/ 149 Object* Icefront::copy() { 150 return new Icefront(this->id,&this->hnodes,&this->helement,&this->hmatpar,this->parameters,this->inputs); 151 } 152 /*}}}*/ 153 /*FUNCTION Icefront DeepEcho {{{1*/ 154 void Icefront::DeepEcho(void){ 155 156 printf("Icefront:\n"); 157 printf(" id: %i\n",id); 158 hnodes.Echo(); 159 helement.Echo(); 160 hmatpar.Echo(); 161 printf(" parameters\n"); 162 parameters->Echo(); 163 printf(" inputs\n"); 164 inputs->Echo(); 165 } 166 /*}}}*/ 160 167 /*FUNCTION Icefront Demarshall {{{1*/ 161 168 void Icefront::Demarshall(char** pmarshalled_dataset){ 162 169 163 int i;164 170 char* marshalled_dataset=NULL; 171 int i; 165 172 166 173 /*recover marshalled_dataset: */ … … 170 177 *object data (thanks to DataSet::Demarshall):*/ 171 178 172 memcpy(&type,marshalled_dataset,sizeof(type));marshalled_dataset+=sizeof(type); 173 memcpy(&fill,marshalled_dataset,sizeof(fill));marshalled_dataset+=sizeof(fill); 174 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid); 175 176 memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 177 memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 178 179 memcpy(&element_type,marshalled_dataset,sizeof(element_type));marshalled_dataset+=sizeof(element_type); 180 memcpy(&eid,marshalled_dataset,sizeof(eid));marshalled_dataset+=sizeof(eid); 181 memcpy(&element_offset,marshalled_dataset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset); 182 183 memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 184 memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 185 186 memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h); 187 memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b); 188 189 for(i=0;i<MAX_ICEFRONT_GRIDS;i++)nodes[i]=NULL; 190 matpar=NULL; 191 element=NULL; 179 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 180 181 /*demarshall hooks: */ 182 hnodes.Demarshall(&marshalled_dataset); 183 helement.Demarshall(&marshalled_dataset); 184 hmatpar.Demarshall(&marshalled_dataset); 185 186 /*demarshall inputs: */ 187 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 188 189 /*parameters: may not exist even yet, so let Configure handle it: */ 190 this->parameters=NULL; 192 191 193 192 /*return: */ … … 196 195 } 197 196 /*}}}*/ 197 /*FUNCTION Icefront Echo {{{1*/ 198 void Icefront::Echo(void){ 199 200 this->DeepEcho(); 201 } 202 /*}}}*/ 203 /*FUNCTION Icefront Enum {{{1*/ 204 int Icefront::Enum(void){ 205 206 return IcefrontEnum; 207 208 } 209 /*}}}*/ 210 /*FUNCTION Icefront GetId {{{1*/ 211 int Icefront::GetId(void){ return sid; } 212 /*}}}*/ 213 /*FUNCTION Icefront GetName {{{1*/ 214 char* Icefront::GetName(void){ 215 return "icefront"; 216 } 217 /*}}}*/ 198 218 /*FUNCTION Icefront Marshall {{{1*/ 199 219 void Icefront::Marshall(char** pmarshalled_dataset){ 200 220 221 201 222 char* marshalled_dataset=NULL; 202 223 int enum_type=0; 224 char* marshalled_inputs=NULL; 225 int marshalled_inputs_size; 203 226 204 227 /*recover marshalled_dataset: */ 205 228 marshalled_dataset=*pmarshalled_dataset; 206 229 207 /*get enum type of Icefront: */208 enum_type= IcefrontEnum;209 230 /*get enum type of Tria: */ 231 enum_type=TriaEnum; 232 210 233 /*marshall enum: */ 211 234 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type); 212 213 /*marshall Icefrontdata: */214 memcpy(marshalled_dataset,& type,sizeof(type));marshalled_dataset+=sizeof(type);215 memcpy(marshalled_dataset,&fill,sizeof(fill));marshalled_dataset+=sizeof(fill); 216 memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);217 218 memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid);219 memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);220 221 memcpy(marshalled_dataset,&element_type,sizeof(element_type));marshalled_dataset+=sizeof(element_type);222 m emcpy(marshalled_dataset,&eid,sizeof(eid));marshalled_dataset+=sizeof(eid);223 m emcpy(marshalled_dataset,&element_offset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset);224 225 m emcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);226 memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 227 228 memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h); 229 memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b);235 236 /*marshall Tria data: */ 237 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 238 239 /*Marshall hooks: */ 240 hnodes.Marshall(&marshalled_dataset); 241 helement.Marshall(&marshalled_dataset); 242 hmatpar.Marshall(&marshalled_dataset); 243 244 /*Marshall inputs: */ 245 marshalled_inputs_size=inputs->MarshallSize(); 246 marshalled_inputs=inputs->Marshall(); 247 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 248 marshalled_dataset+=marshalled_inputs_size; 249 250 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 251 252 xfree((void**)&marshalled_inputs); 230 253 231 254 *pmarshalled_dataset=marshalled_dataset; … … 236 259 int Icefront::MarshallSize(){ 237 260 238 return sizeof(type)+ 239 sizeof(fill)+ 240 sizeof(sid)+ 241 sizeof(mparid)+ 242 sizeof(matpar_offset)+ 243 sizeof(eid)+ 244 sizeof(element_offset)+ 245 sizeof(element_type)+ 246 sizeof(node_ids)+ 247 sizeof(node_offsets)+ 248 sizeof(h)+ 249 sizeof(b)+ 250 sizeof(int); //sizeof(int) for enum type 261 return sizeof(id) 262 +hnodes.MarshallSize() 263 +helement.MarshallSize() 264 +hmatpar.MarshallSize() 265 +inputs->MarshallSize() 266 +sizeof(int); //sizeof(int) for enum type 267 } 268 /*}}}*/ 269 /*FUNCTION Icefront MyRank {{{1*/ 270 int Icefront::MyRank(void){ 271 extern int my_rank; 272 return my_rank; 251 273 } 252 274 /*}}}*/ 253 275 254 276 /*Object functions*/ 255 /*FUNCTION Icefront Configure {{{1*/256 257 void Icefront::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){258 259 DataSet* elementsin=NULL;260 DataSet* nodesin=NULL;261 DataSet* materialsin=NULL;262 263 /*Recover pointers :*/264 elementsin=(DataSet*)pelementsin;265 nodesin=(DataSet*)pnodesin;266 materialsin=(DataSet*)pmaterialsin;267 268 /*Link this load with its nodes: */269 if (strcmp(type,"segment")==0){270 ResolvePointers((Object**)nodes,node_ids,node_offsets,2,nodesin);271 }272 else{273 ResolvePointers((Object**)nodes,node_ids,node_offsets,4,nodesin);274 }275 276 277 /*Same for materials: */278 ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);279 280 281 /*Same for element: */282 ResolvePointers((Object**)&element,&eid,&element_offset,1,elementsin);283 284 }285 /*}}}*/286 /*FUNCTION Icefront copy {{{1*/287 Object* Icefront::copy() {288 return new Icefront(*this);289 }290 /*}}}*/291 277 /*FUNCTION Icefront CreateKMatrix {{{1*/ 292 278 … … 704 690 } 705 691 /*}}}*/ 706 /*FUNCTION Icefront DeepEcho {{{1*/707 void Icefront::DeepEcho(void){708 709 int i;710 711 printf("Icefront:\n");712 printf(" type: %s\n",type);713 printf(" fill: %i\n",fill);714 printf(" sid: %i\n",sid);715 716 printf(" mparid: %i\n",mparid);717 printf(" matpar_offset: %i\n",matpar_offset);718 printf(" matpar: \n");719 720 printf(" element_type: %i\n",element_type);721 printf(" eid: %i\n",eid);722 printf(" element_offset: %i\n",eid);723 printf(" element\n");724 725 if (strcmp(type,"segment")==0){726 printf(" node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);727 printf(" node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);728 printf(" h=[%g,%g]\n",h[0],h[1]);729 printf(" b=[%g,%g]\n",b[0],b[1]);730 for(i=0;i<2;i++){731 if(nodes[i])nodes[i]->Echo();732 }733 }734 else{735 printf(" node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);736 printf(" node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);737 printf(" h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);738 printf(" b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);739 for(i=0;i<4;i++){740 if(nodes[i])nodes[i]->Echo();741 }742 }743 744 return;745 }746 /*}}}*/747 692 /*FUNCTION Icefront DistributeNumDofs {{{1*/ 748 693 void Icefront::DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type){return;} 749 694 750 /*}}}*/751 /*FUNCTION Icefront Echo {{{1*/752 void Icefront::Echo(void){753 754 int i;755 756 printf("Icefront:\n");757 printf(" type: %s\n",type);758 printf(" fill: %i\n",fill);759 printf(" sid: %i\n",sid);760 761 printf(" mparid: %i\n",mparid);762 printf(" matpar_offset: %i\n",matpar_offset);763 printf(" matpar: \n");764 765 printf(" element_type: %i\n",element_type);766 printf(" eid: %i\n",eid);767 printf(" element_offset: %i\n",eid);768 printf(" element\n");769 770 if (strcmp(type,"segment")==0){771 printf(" node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);772 printf(" node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);773 printf(" h=[%g,%g]\n",h[0],h[1]);774 printf(" b=[%g,%g]\n",b[0],b[1]);775 for(i=0;i<2;i++){776 if(nodes[i])nodes[i]->Echo();777 }778 }779 else{780 printf(" node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);781 printf(" node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);782 printf(" h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);783 printf(" b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);784 for(i=0;i<4;i++){785 if(nodes[i])nodes[i]->Echo();786 }787 }788 789 return;790 }791 /*}}}*/792 /*FUNCTION Icefront Enum {{{1*/793 int Icefront::Enum(void){794 795 return IcefrontEnum;796 797 }798 695 /*}}}*/ 799 696 /*FUNCTION Icefront GetDofList{{{1*/ … … 826 723 *pnumberofdofspernode=numberofdofspernode; 827 724 828 }829 /*}}}*/830 /*FUNCTION Icefront GetId {{{1*/831 int Icefront::GetId(void){ return sid; }832 /*}}}*/833 /*FUNCTION Icefront GetName {{{1*/834 char* Icefront::GetName(void){835 return "icefront";836 }837 /*}}}*/838 /*FUNCTION Icefront MyRank {{{1*/839 int Icefront::MyRank(void){840 extern int my_rank;841 return my_rank;842 725 } 843 726 /*}}}*/ … … 1433 1316 } 1434 1317 /*}}}*/ 1435 /*FUNCTION Icefront UpdateFromInputs {{{1*/1436 void Icefront::UpdateFromInputs(void* vinputs){1437 1438 int i;1439 int numberofdofspernode;1440 1441 /*element: */1442 double* h_param=NULL;1443 double* b_param=NULL;1444 int dofs[1]={0};1445 1446 ParameterInputs* inputs=NULL;1447 1448 inputs=(ParameterInputs*)vinputs;1449 1450 if(strcmp(type,"quad")==0){1451 inputs->Recover("thickness",&h[0],1,dofs,4,(void**)nodes);1452 inputs->Recover("bed",&b[0],1,dofs,4,(void**)nodes);1453 }1454 else{1455 inputs->Recover("thickness",&h[0],1,dofs,2,(void**)nodes);1456 inputs->Recover("bed",&h[0],1,dofs,2,(void**)nodes);1457 }1458 1459 1460 }1461 /*}}}*/ -
issm/trunk/src/c/objects/Icefront.h
r3622 r3632 6 6 #define _ICEFRONT_H_ 7 7 8 class Element;9 class Load;10 class Matpar;11 class Element;12 class Node;13 14 8 #include "./Load.h" 15 #include "./Matpar.h"16 #include "./Element.h"17 #include "./Node.h"18 #include "../ModelProcessorx/IoModel.h"19 9 20 10 #define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load … … 23 13 class Icefront: public Load { 24 14 25 private: 26 char type[ICEFRONTSTRING]; 27 int fill; 28 int sid; 15 public: 16 int id; 29 17 30 /*material: */ 31 int mparid; //material id 32 Matpar* matpar; 33 int matpar_offset; 34 35 /*element of icefront: */ 36 int element_type; 37 int eid; //id of element on ice front 38 Element* element; 39 int element_offset; 18 Hook* hnodes; //2 or 4 nodes 19 Hook* helement; //tria or penta 20 Hook* hmatpar; 40 21 41 /*nodes: */ 42 int node_ids[MAX_ICEFRONT_GRIDS]; //node ids 43 Node* nodes[MAX_ICEFRONT_GRIDS]; //node pointers 44 int node_offsets[MAX_ICEFRONT_GRIDS]; //node offsets in nodes dataset 45 46 /*properties: */ 47 double h[MAX_ICEFRONT_GRIDS]; //thickness 48 double b[MAX_ICEFRONT_GRIDS]; //bed 49 50 public: 22 Parameters* parameters; 23 Inputs* inputs; 51 24 52 25 /*constructors: {{{1*/ 53 26 Icefront(); 54 Icefront( char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double b[MAX_ICEFRONT_GRIDS]);55 void Init(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double b[MAX_ICEFRONT_GRIDS]);56 Icefront(int sid,int i, IoModel* iomodel);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 id,int i, IoModel* iomodel); 57 30 ~Icefront(); 58 31 /*}}}*/ 59 32 /*object management: {{{1*/ 60 void Configure( void* elements,void* nodes,void* materials);33 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters); 61 34 Object* copy(); 62 35 void DeepEcho(); … … 73 46 /*numerics: {{{1*/ 74 47 void DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type); 75 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 76 void UpdateFromInputs(void* inputs); 77 void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 78 void CreatePVectorDiagnosticHoriz( Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 79 void CreatePVectorDiagnosticHorizSegment( Vec pg,void* inputs, int analysis_type,int sub_analysis_type); 80 void CreatePVectorDiagnosticHorizQuad( Vec pg,void* inputs, int analysis_type,int sub_analysis_type); 81 void CreatePVectorDiagnosticStokes( Vec pg,void* inputs, int analysis_type,int sub_analysis_type); 48 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 49 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); 52 void CreatePVectorDiagnosticHorizQuad( Vec pg, int analysis_type,int sub_analysis_type); 53 void CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type); 82 54 void GetDofList(int* doflist,int* pnumberofdofs); 83 55 void SegmentPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, double* normal,double length); … … 86 58 void QuadPressureLoadStokes(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, 87 59 double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list); 88 void PenaltyCreateKMatrix(Mat Kgg, void* inputs,double kmax,int analysis_type,int sub_analysis_type);89 void PenaltyCreatePVector(Vec pg, void* inputs,double kmax,int analysis_type,int sub_analysis_type);60 void PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type); 61 void PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type); 90 62 /*}}}*/ 91 63 }; -
issm/trunk/src/c/objects/Load.h
r3463 r3632 13 13 #include "./Object.h" 14 14 #include "../toolkits/toolkits.h" 15 #include "../DataSet/DataSet.h" 16 #include "../DataSet/Parameters.h" 15 17 16 18 class Load: public Object{ … … 26 28 virtual char* GetName()=0; 27 29 virtual void Demarshall(char** pmarshalled_dataset)=0; 28 virtual void Configure(void* elements,void* nodes,void* materials)=0; 29 virtual void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type)=0; 30 virtual void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type)=0; 31 virtual void UpdateFromInputs(void* inputs)=0; 32 virtual void PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0; 33 virtual void PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0; 30 virtual void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters)=0; 31 virtual void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type)=0; 32 virtual void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type)=0; 33 virtual void PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type)=0; 34 virtual void PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type)=0; 34 35 35 36 int Enum(); -
issm/trunk/src/c/objects/Model.cpp
r3620 r3632 61 61 62 62 _printf_(" fill model with matlab workspace data\n"); 63 IoModelInit(&iomodel,MODEL);63 iomodel=new IoModel(MODEL); 64 64 65 65 _printf_(" specifying analysis\n"); … … 99 99 100 100 _printf_(" free ressources:\n"); 101 DeleteIoModel(&iomodel);101 delete iomodel; 102 102 103 103 /*Use all the data created to create an femmodel: */ … … 136 136 137 137 _printf_(" fill model with matlab workspace data\n"); 138 IoModelInit(&iomodel,MODEL);138 iomodel=new IoModel(MODEL); 139 139 140 140 _printf_(" specifying analysis\n"); … … 177 177 178 178 _printf_(" free ressources:\n"); 179 DeleteIoModel(&iomodel);179 delete iomodel; 180 180 181 181 /*Use all the data created to create an femmodel: */ -
issm/trunk/src/c/objects/Node.cpp
r3622 r3632 25 25 /*FUNCTION Node::Node() default constructor {{{2*/ 26 26 Node::Node(){ 27 this->inputs=NULL; 27 28 return; 28 29 } 29 30 /*}}}*/ 30 31 /*FUNCTION Node::Node(int id, int vertex_id, int uppernode_id, int numdofs, NodeProperties*) {{{2*/ 31 Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs , NodeProperties* node_properties):32 Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs): 32 33 indexing(node_numdofs), 33 properties(node_properties),34 34 hvertex(&node_vertex_id,1), 35 35 hupper_node(&node_upper_node_id,1){ 36 36 37 37 this->id=node_id; 38 39 return; 40 } 41 /*}}}*/ 42 /*FUNCTION Node::Node(int id, DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* uppernode){{{2*/ 43 Node::Node(int node_id,DofIndexing* node_indexing, NodeProperties* node_properties, Hook* node_vertex, Hook* node_upper_node): 38 this->inputs=new Inputs(); 39 } 40 /*}}}*/ 41 /*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs){{{2*/ 42 Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs): 44 43 indexing(node_indexing), 45 properties(node_properties),46 44 hvertex(node_vertex), 47 45 hupper_node(node_upper_node) { … … 50 48 this->id=node_id; 51 49 50 if(node_inputs){ 51 this->inputs=(Inputs*)node_inputs->Copy(); 52 } 53 else{ 54 this->inputs=new Inputs(); 55 } 52 56 } 53 57 /*}}}*/ … … 68 72 69 73 this->indexing.Init(numdofs); 70 71 /*properties: */72 this->properties.Init(i,iomodel);73 74 74 75 /*hooks: */ … … 159 160 } 160 161 } 162 163 164 //intialize inputs, and add as many inputs per element as requested: 165 this->inputs=new Inputs(); 166 if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i])); 167 if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i])); 168 if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i])); 169 if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i])); 170 161 171 } 162 172 /*}}}*/ … … 178 188 this->indexing.Init(numdofs); 179 189 180 /*properties (come from vertex number i): */ 181 this->properties.Init( 182 (int)iomodel->gridonbed[i], 183 (int)iomodel->gridonsurface[i], 184 (int)iomodel->gridoniceshelf[i], 185 (int)iomodel->gridonicesheet[i]); 186 190 187 191 /*hooks: */ 188 192 vertex_id=i+1; //matlab indexing … … 203 207 this->hvertex.Init(&vertex_id,1); 204 208 this->hupper_node.Init(&upper_node_id,1); 209 210 //intialize inputs, and add as many inputs per element as requested: 211 this->inputs=new Inputs(); 212 if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i])); 213 if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i])); 214 if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i])); 215 if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i])); 216 205 217 206 218 } … … 208 220 /*FUNCTION Node::~Node(){{{2*/ 209 221 Node::~Node(){ 222 delete inputs; 210 223 return; 211 224 } … … 214 227 /*Object management: {{{1*/ 215 228 /*FUNCTION Node::Configure {{{2*/ 216 void Node::Configure( void* pnodes, void* pvertices){229 void Node::Configure(DataSet* nodesin){ 217 230 218 231 int i; 219 232 220 DataSet* nodesin=NULL;221 DataSet* verticesin=NULL;222 223 /*Recover pointers :*/224 nodesin=(DataSet*)pnodes;225 verticesin=(DataSet*)pvertices;226 227 233 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 228 * datasets, using internal ids and of this->indexing.f_sets hidden in hooks: */229 hvertex.configure( verticesin);234 * datasets, using internal ids and offsets hidden in hooks: */ 235 hvertex.configure(nodesin); 230 236 hupper_node.configure(nodesin); 231 237 232 238 } 233 /*}}}*/234 239 /*FUNCTION Node::copy {{{2*/ 235 240 Object* Node::copy() { 236 241 237 return new Node(this->id,&this->indexing, &this-> properties, &this->hvertex,&this->hupper_node);242 return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs); 238 243 239 244 } … … 246 251 printf(" id: %i\n",id); 247 252 indexing.DeepEcho(); 248 properties.DeepEcho();249 253 printf("Vertex:\n"); 250 254 hvertex.DeepEcho(); … … 252 256 //Do not Deepecho the upper_node otherwise DeepEcho will go crazy! 253 257 hupper_node.Echo(); 258 printf(" inputs\n"); 259 inputs->DeepEcho(); 254 260 255 261 } … … 270 276 /*demarshall objects: */ 271 277 indexing.Demarshall(&marshalled_dataset); 272 properties.Demarshall(&marshalled_dataset);273 278 hvertex.Demarshall(&marshalled_dataset); 274 279 hupper_node.Demarshall(&marshalled_dataset); 275 280 281 /*demarshall inputs: */ 282 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 283 276 284 /*return: */ 277 285 *pmarshalled_dataset=marshalled_dataset; … … 285 293 printf(" id: %i\n",id); 286 294 indexing.Echo(); 287 properties.Echo();288 295 hvertex.Echo(); 289 296 hupper_node.Echo(); 297 printf(" inputs\n"); 298 inputs->DeepEcho(); 299 290 300 291 301 } … … 348 358 char* marshalled_dataset=NULL; 349 359 int enum_type=0; 360 char* marshalled_inputs=NULL; 361 int marshalled_inputs_size; 350 362 351 363 /*recover marshalled_dataset: */ … … 363 375 /*marshall objects: */ 364 376 indexing.Marshall(&marshalled_dataset); 365 properties.Marshall(&marshalled_dataset);366 377 hvertex.Marshall(&marshalled_dataset); 367 378 hupper_node.Marshall(&marshalled_dataset); 368 379 380 /*Marshall inputs: */ 381 marshalled_inputs_size=inputs->MarshallSize(); 382 marshalled_inputs=inputs->Marshall(); 383 memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char)); 384 marshalled_dataset+=marshalled_inputs_size; 385 386 /*Free ressources:*/ 387 xfree((void**)&marshalled_inputs); 388 369 389 *pmarshalled_dataset=marshalled_dataset; 370 390 return; … … 375 395 376 396 return sizeof(id)+ 377 +indexing.MarshallSize()+378 +properties.MarshallSize()+379 +hvertex.MarshallSize()+380 +hupper_node.MarshallSize()+397 indexing.MarshallSize()+ 398 hvertex.MarshallSize()+ 399 hupper_node.MarshallSize()+ 400 inputs->MarshallSize()+ 381 401 sizeof(int); //sizeof(int) for enum type 382 402 } … … 513 533 int dofx,dofy; 514 534 int isnodeonsurface; 535 536 bool onbed; 537 bool onsurface; 515 538 516 539 Node* node=NULL; … … 519 542 double thickness; 520 543 544 /*recover parameters: */ 545 inputs->GetParameterValue(&onbed,NodeOnBedEnum); 546 inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum); 547 521 548 /*Are we on the base, not on the surface, and not on a clone node?:*/ 522 549 523 if( properties.onbed==1 & indexing.clone==0 &properties.onsurface==0){550 if(onbed==1 & indexing.clone==0 & onsurface==0){ 524 551 525 552 vertexdof=this->GetVertexDof(); … … 636 663 int i; 637 664 665 bool onbed; 666 667 /*recover parameters: */ 668 inputs->GetParameterValue(&onbed,NodeOnBedEnum); 669 638 670 /*Is this node on bed? :*/ 639 if ( properties.onbed){671 if (onbed){ 640 672 641 673 if (strcmp(field_name,"velocity")==0){ … … 802 834 /*FUNCTION Node::IsOnBed {{{2*/ 803 835 int Node::IsOnBed(){ 804 return properties.onbed; 836 837 bool onbed; 838 839 /*recover parameters: */ 840 inputs->GetParameterValue(&onbed,NodeOnBedEnum); 841 842 return onbed; 805 843 } 806 844 /*}}}*/ 807 845 /*FUNCTION Node::IsOnSheet {{{2*/ 808 846 int Node::IsOnSheet(){ 809 return properties.onsheet; 847 848 bool onsheet; 849 850 /*recover parameters: */ 851 inputs->GetParameterValue(&onsheet,NodeOnIceSheetEnum); 852 853 return onsheet; 810 854 } 811 855 /*}}}*/ 812 856 /*FUNCTION Node::IsOnShelf {{{2*/ 813 857 int Node::IsOnShelf(){ 814 return properties.onshelf; 858 859 bool onshelf; 860 861 /*recover parameters: */ 862 inputs->GetParameterValue(&onshelf,NodeOnIceShelfEnum); 863 864 return onshelf; 815 865 } 816 866 /*}}}*/ 817 867 /*FUNCTION Node::IsOnSurface {{{2*/ 818 868 int Node::IsOnSurface(){ 819 return properties.onsurface; 869 870 bool onsurface; 871 872 /*recover parameters: */ 873 inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum); 874 875 return onsurface; 820 876 } 821 877 /*}}}*/ -
issm/trunk/src/c/objects/Node.h
r3556 r3632 7 7 8 8 /*indefinitions: */ 9 class Object;10 class Vertex;11 struct IoModel;12 class Hook;13 class DofIndexing;14 class NodeProperties;15 class Node;16 class DofObject;17 18 9 #include "./Object.h" 19 10 #include "./DofObject.h" 20 #include "../DataSet/ DataSet.h"11 #include "../DataSet/Inputs.h" 21 12 #include "./Hook.h" 22 #include "./Vertex.h"23 13 #include "./DofIndexing.h" 24 #include "./NodeProperties.h"25 #include "../toolkits/toolkits.h"26 14 #include "../ModelProcessorx/IoModel.h" 27 15 … … 33 21 34 22 DofIndexing indexing; 35 NodeProperties properties;36 23 Hook hvertex; 37 24 Hook hupper_node; 38 25 Inputs* inputs; //properties of this node 39 26 40 27 public: … … 42 29 /*FUNCTION constructors, destructors {{{1*/ 43 30 Node(); 44 Node(int id,int vertex_id, int upper_node_id, int numberofdofs , NodeProperties* node_properties);45 Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node);46 Node(int i , IoModel* iomodel);47 Node(int i ,int j,IoModel* iomodel);31 Node(int id,int vertex_id, int upper_node_id, int numberofdofs); 32 Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs); 33 Node(int id, int i, IoModel* iomodel); 34 Node(int id, int i,int j,IoModel* iomodel); 48 35 ~Node(); 49 36 /*}}}*/ 50 37 /*FUNCTION object management {{{1*/ 51 void Configure( void* pnodes, void* pvertices);38 void Configure(DataSet* nodes); 52 39 void DeepEcho(); 53 40 void Demarshall(char** pmarshalled_dataset); -
issm/trunk/src/c/objects/Pengrid.cpp
r3623 r3632 35 35 /*FUNCTION Pengrid::Pengrid(int id, int node_ids int matpar_id){{{1*/ 36 36 Pengrid::Pengrid(int pengrid_id,int pengrid_node_id, int pengrid_element_id,int pengrid_matpar_id): 37 hnode(pengrid_node_id,1), 38 helement(pengrid_element_id,1), 39 hmatice(&pengrid_matice_id,1), 37 hnode(&pengrid_node_id,1), 38 helement(&pengrid_element_id,1), 40 39 hmatpar(&pengrid_matpar_id,1) 41 40 { … … 76 75 } 77 76 /*}}}*/ 78 Pengrid::Pengrid(int pengrid_id, int pengrid_node_id,int pengrid_mparid, int pengrid_dof, int pengrid_active, double pengrid_penalty_offset,int pengrid_thermal_steadystate,int pengrid_stabilize_constraints){79 80 id=pengrid_id;81 node_id=pengrid_node_id;82 mparid=pengrid_mparid;83 dof=pengrid_dof;84 active=pengrid_active;85 penalty_offset =pengrid_penalty_offset;86 thermal_steadystate=pengrid_thermal_steadystate;87 stabilize_constraints=pengrid_stabilize_constraints;88 89 node_offset=UNDEF;90 node=NULL;91 matpar=NULL;92 matpar_offset=UNDEF;93 94 95 return;96 }97 /*}}}1*/98 77 /*FUNCTION Pengrid::Pengrid(int index, int id, IoModel* iomodel){{{1*/ 99 78 Pengrid::Pengrid(int id, int index, IoModel* iomodel){ //i is the element index … … 112 91 pengrid_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 113 92 114 this->hnode.Init( pengrid_node_ids,1);115 this->helement.Init( pengrid_element_id,1);93 this->hnode.Init(&pengrid_node_id,1); 94 this->helement.Init(&pengrid_element_id,1); 116 95 this->hmatpar.Init(&pengrid_matpar_id,1); 117 96 … … 136 115 /*Object management*/ 137 116 /*FUNCTION Pengrid::Configure {{{1*/ 138 void Pengrid::Configure(DataSet* elementsin, DataSet* nodesin, DataSet* materialsin,Parameters* parametersin){117 void Pengrid::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){ 139 118 140 119 /*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective … … 310 289 311 290 /*dynamic objects pointed to by hooks: */ 312 Node node=NULL;291 Node* node=NULL; 313 292 314 293 /*recover objects from hooks: */ 315 node=(Node* *)hnode.deliverp();294 node=(Node*)hnode.delivers(); 316 295 317 296 node->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 356 335 // The penalty is stable if it doesn't change during to successive iterations. 357 336 358 int found=0;337 int found=0; 359 338 const int numgrids=1; 360 361 362 339 double pressure; 363 340 double temperature; … … 365 342 double meltingpoint; 366 343 int new_active; 367 int dofs1[1]={0}; 368 int unstable=0; 369 int reset_penalties=0; 370 371 ParameterInputs* inputs=NULL; 372 344 int unstable=0; 345 int reset_penalties=0; 346 int stabilize_constraints; 347 348 /*pointers: */ 349 Node* node=NULL; 350 Penta* penta=NULL; 351 Matpar* matpar=NULL; 352 373 353 /*check that pengrid is not a clone (penalty to be added only once)*/ 374 354 if (node->IsClone()){ … … 378 358 } 379 359 380 //First recover beta, pressure and temperature vectors; 381 found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node); 382 if(!found)ISSMERROR(" could not find pressure in inputs!"); 383 384 found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node); 385 if(!found)ISSMERROR(" could not find temperature in inputs!"); 386 387 found=inputs->Recover("reset_penalties",&reset_penalties); 388 389 if(reset_penalties)zigzag_counter=0; 390 391 //Compute pressure melting point 360 /*recover pointers: */ 361 node=(Node*)hnode.delivers(); 362 penta=(Penta*)helement.delivers(); 363 matpar=(Matpar*)hmatpar.delivers(); 364 365 //First recover pressure and temperature values, using the element: */ 366 penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum); 367 penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum); 368 369 //Recover our data: 370 inputs->GetParameterValue(&reset_penalties,ResetPenaltiesEnum); 392 371 meltingpoint=matpar->GetMeltingPoint(); 393 372 beta=matpar->GetBeta(); 394 373 parameters->FindParam(&stabilize_constraints,"stabilize_constraints"); 374 375 if(reset_penalties)zigzag_counter=0; 376 377 //Compute pressure melting point 395 378 t_pmp=meltingpoint-beta*pressure; 396 379 … … 466 449 int found=0; 467 450 double Ke[4][4]={0.0}; 468 469 ParameterInputs* inputs=NULL; 470 471 /*recover pointers: */472 inputs=(ParameterInputs*)vinputs;451 double penalty_offset; 452 453 /*pointers: */ 454 Node* node=NULL; 455 Penta* penta=NULL; 473 456 474 457 /*Get dof list: */ 475 458 GetDofList(&doflist[0],&numberofdofspernode); 476 477 /*recover slope: */ 478 found=inputs->Recover("bedslopex",&slope[0],1,dofs1,numgrids,(void**)&node); 479 if(!found)ISSMERROR(" bedslopex needed in inputs!"); 480 found=inputs->Recover("bedslopey",&slope[1],1,dofs2,numgrids,(void**)&node); 481 if(!found)ISSMERROR(" bedslopey needed in inputs!"); 459 460 /*recover pointers: */ 461 node=(Node*)hnode.delivers(); 462 penta=(Penta*)helement.delivers(); 463 464 //recover slope: */ 465 penta->inputs->GetParameterValueAtNode(&slope[0],node,BedSlopexEnum); 466 penta->inputs->GetParameterValueAtNode(&slope[1],node,BedSlopeyEnum); 467 468 /*recover parameters: */ 469 parameters->FindParam(&penalty_offset,"penalty_offset"); 482 470 483 471 //Create elementary matrix: add penalty to contrain wb (wb=ub*db/dx+vb*db/dy) … … 507 495 double temperature; 508 496 double beta,t_pmp; 509 510 ParameterInputs* inputs=NULL; 497 double penalty_offset; 498 499 /*pointers: */ 500 Node* node=NULL; 501 Penta* penta=NULL; 502 Matpar* matpar=NULL; 503 504 /*recover pointers: */ 505 node=(Node*)hnode.delivers(); 506 penta=(Penta*)helement.delivers(); 507 matpar=(Matpar*)hmatpar.delivers(); 511 508 512 509 /*check that pengrid is not a clone (penalty to be added only once)*/ 513 510 if (node->IsClone()) return; 514 511 515 /*recover pointers: */ 516 inputs=(ParameterInputs*)vinputs; 517 518 found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node); 519 if(!found)ISSMERROR(" could not find pressure in inputs!"); 520 521 found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node); 522 if(!found)ISSMERROR(" could not find temperature in inputs!"); 512 //First recover pressure and temperature values, using the element: */ 513 penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum); 514 penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum); 515 516 /*recover parameters: */ 517 parameters->FindParam(&penalty_offset,"penalty_offset"); 523 518 524 519 /*Get dof list: */ … … 549 544 int doflist[numdof]; 550 545 int numberofdofspernode; 551 552 ParameterInputs* inputs=NULL; 553 554 /*recover pointers: */ 555 inputs=(ParameterInputs*)vinputs; 556 557 558 if(!active)return; 546 double penalty_offset; 547 548 if(!this->active)return; 549 550 /*recover parameters: */ 551 parameters->FindParam(&penalty_offset,"penalty_offset"); 559 552 560 553 /*Get dof list: */ … … 610 603 double latentheat; 611 604 double t_pmp; 612 double dt; 613 614 ParameterInputs* inputs=NULL; 605 double dt,penalty_offset; 606 607 /*pointers: */ 608 Node* node=NULL; 609 Penta* penta=NULL; 610 Matpar* matpar=NULL; 611 612 /*recover pointers: */ 613 node=(Node*)hnode.delivers(); 614 penta=(Penta*)helement.delivers(); 615 matpar=(Matpar*)hmatpar.delivers(); 615 616 616 617 /*check that pengrid is not a clone (penalty to be added only once)*/ 617 618 if (node->IsClone()) return; 618 619 619 /*recover pointers: */620 inputs=(ParameterInputs*)vinputs;621 622 620 /*Get dof list: */ 623 621 GetDofList(&doflist[0],&numberofdofspernode); 624 622 625 //First recover pressure,melting offset and temperature vectors 626 found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node); 627 if(!found)ISSMERROR(" could not find pressure in inputs!"); 628 629 found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node); 630 if(!found)ISSMERROR(" could not find temperature in inputs!"); 631 632 found=inputs->Recover("melting_offset",&melting_offset); 633 if(!found)ISSMERROR(" could not find melting_offset in inputs!"); 634 635 found=inputs->Recover("dt",&dt); 636 if(!found)ISSMERROR(" could not find dt in inputs!"); 623 //First recover pressure and temperature values, using the element: */ 624 penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum); 625 penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum); 626 inputs->GetParameterValue(&melting_offset,MeltingOffsetEnum); 627 parameters->FindParam(&dt,"dt"); 628 parameters->FindParam(&penalty_offset,"penalty_offset"); 637 629 638 630 meltingpoint=matpar->GetMeltingPoint(); … … 679 671 double beta; 680 672 double t_pmp; 681 682 ParameterInputs* inputs=NULL; 673 double penalty_offset; 674 675 /*pointers: */ 676 Node* node=NULL; 677 Penta* penta=NULL; 678 Matpar* matpar=NULL; 683 679 684 680 /*recover pointers: */ 685 inputs=(ParameterInputs*)vinputs; 686 687 if(!active)return; 681 node=(Node*)hnode.delivers(); 682 penta=(Penta*)helement.delivers(); 683 matpar=(Matpar*)hmatpar.delivers(); 684 685 if(!this->active)return; 688 686 689 687 /*Get dof list: */ 690 688 GetDofList(&doflist[0],&numberofdofspernode); 691 689 692 //First recover pressure 693 found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);694 if(!found)ISSMERROR(" could not find pressure in inputs!");690 //First recover pressure and penalty_offset 691 penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum); 692 parameters->FindParam(&penalty_offset,"penalty_offset"); 695 693 696 694 //Compute pressure melting point -
issm/trunk/src/c/objects/Pengrid.h
r3623 r3632 38 38 /*}}}*/ 39 39 /*FUNCTION object management {{{1*/ 40 void Configure( void* elements,void* nodes,void* materials);40 void Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin); 41 41 Object* copy(); 42 42 void DeepEcho(); -
issm/trunk/src/c/objects/Penpair.cpp
r3594 r3632 55 55 /*Object marshall*/ 56 56 /*FUNCTION Penpair::Configure {{{1*/ 57 58 void Penpair::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){ 59 60 DataSet* nodesin=NULL; 61 62 /*Recover pointers :*/ 63 nodesin=(DataSet*)pnodesin; 57 void Penpair::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){ 64 58 65 59 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective … … 151 145 } 152 146 /*}}}1*/ 153 /*FUNCTION Penpair::UpdateFromInputs {{{1*/154 void Penpair::UpdateFromInputs(void* inputs){155 156 }157 /*}}}1*/158 147 159 148 /*Object functions*/ 160 149 /*FUNCTION Penpair::CreateKMatrix {{{1*/ 161 150 162 void Penpair::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){151 void Penpair::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 163 152 164 153 /*No loads applied, do nothing: */ … … 168 157 /*}}}1*/ 169 158 /*FUNCTION Penpair::CreatePVector {{{1*/ 170 void Penpair::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){159 void Penpair::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){ 171 160 172 161 /*No loads applied, do nothing: */ … … 196 185 /*}}}1*/ 197 186 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/ 198 void Penpair::PenaltyCreateKMatrix(Mat Kgg, void* inputs,double kmax,int analysis_type,int sub_analysis_type){187 void Penpair::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){ 199 188 200 189 /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/ … … 204 193 /*}}}1*/ 205 194 /*FUNCTION Penpair::PenaltyCreatePVector {{{1*/ 206 void Penpair::PenaltyCreatePVector(Vec pg, void* inputs,double kmax,int analysis_type,int sub_analysis_type){195 void Penpair::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){ 207 196 /*No loads applied, do nothing: */ 208 197 return; -
issm/trunk/src/c/objects/Penpair.h
r3594 r3632 34 34 int GetId(); 35 35 int MyRank(); 36 void Configure(void* elements,void* nodes,void* materials); 37 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 38 void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 39 void UpdateFromInputs(void* inputs); 40 void PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type); 41 void PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type); 36 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters); 37 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 38 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 39 void PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type); 40 void PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type); 42 41 Object* copy(); 43 42 -
issm/trunk/src/c/objects/Penta.h
r3622 r3632 27 27 class Penta: public Element{ 28 28 29 p rivate:29 public: 30 30 31 31 int id; … … 36 36 Parameters* parameters; //pointer to solution parameters 37 37 Inputs* inputs; 38 39 public:40 38 41 39 /*FUNCTION constructors, destructors {{{1*/ -
issm/trunk/src/c/objects/Sing.h
r3622 r3632 18 18 class Sing: public Element{ 19 19 20 p rivate:20 public: 21 21 22 22 /*ids:*/ … … 30 30 Inputs* inputs; 31 31 32 public:33 32 34 33 /*constructors, destructors: {{{1*/ -
issm/trunk/src/c/objects/Tria.cpp
r3622 r3632 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION Tria::Tria(int id, int i , IoModel* iomodel){{{1*/65 /*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel){{{1*/ 66 66 Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index 67 67 … … 154 154 /*FUNCTION Tria::Configure {{{1*/ 155 155 void Tria::Configure(DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){ 156 157 int i;158 156 159 157 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective -
issm/trunk/src/c/objects/Tria.h
r3622 r3632 17 17 class Tria: public Element{ 18 18 19 p rivate:19 public: 20 20 21 21 int id; … … 27 27 Parameters* parameters; //pointer to solution parameters 28 28 Inputs* inputs; 29 30 public:31 29 32 30 /*FUNCTION constructors, destructors {{{1*/
Note:
See TracChangeset
for help on using the changeset viewer.