Changeset 5749
- Timestamp:
- 09/10/10 13:44:40 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Inputs.cpp
r5743 r5749 43 43 44 44 /*Object management*/ 45 /*FUNCTION Inputs::GetParameterValue(double* pvalue,GaussTria* gauss,int enum_type){{{1*/46 void Inputs::GetParameterValue(double* pvalue,GaussTria* gauss, int enum_type){47 48 vector<Object*>::iterator object;49 Input* input=NULL;50 bool found=false;51 52 /*Go through inputs and check whether any input with the same name is already in: */53 for ( object=objects.begin() ; object < objects.end(); object++ ){54 55 input=(Input*)(*object);56 if (input->EnumType()==enum_type){57 found=true;58 break;59 }60 }61 62 if (!found){63 /*we could not find an input with the correct enum type. No defaults values were provided,64 * error out: */65 ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumToString(enum_type));66 }67 68 /*Ok, we have an input if we made it here, request the input to return the values: */69 input->GetParameterValue(pvalue,gauss);70 71 }72 /*}}}*/73 /*FUNCTION Inputs::GetParameterValue(double* pvalue,GaussTria* gauss,int enum_type){{{1*/74 void Inputs::GetParameterValue(double* pvalue,GaussPenta* gauss, int enum_type){75 76 vector<Object*>::iterator object;77 Input* input=NULL;78 bool found=false;79 80 /*Go through inputs and check whether any input with the same name is already in: */81 for ( object=objects.begin() ; object < objects.end(); object++ ){82 83 input=(Input*)(*object);84 if (input->EnumType()==enum_type){85 found=true;86 break;87 }88 }89 90 if (!found){91 /*we could not find an input with the correct enum type. No defaults values were provided,92 * error out: */93 ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumToString(enum_type));94 }95 96 /*Ok, we have an input if we made it here, request the input to return the values: */97 input->GetParameterValue(pvalue,gauss);98 99 }100 /*}}}*/101 45 /*FUNCTION Inputs::GetParameterValue(bool* pvalue,int enum-type){{{1*/ 102 46 void Inputs::GetParameterValue(bool* pvalue,int enum_type){ -
issm/trunk/src/c/Container/Inputs.h
r5743 r5749 48 48 void GetParameterValue(int* pvalue,int enum_type); 49 49 void GetParameterValue(double* pvalue,int enum_type); 50 void GetParameterValue(double* pvalue,GaussTria* gauss,int enum_type);51 void GetParameterValue(double* pvalue,GaussPenta* gauss,int enum_type);52 50 /*}}}*/ 53 51 -
issm/trunk/src/c/objects/Elements/Penta.cpp
r5747 r5749 877 877 int Penta::GetNodeIndex(Node* node){ 878 878 879 int i; 880 881 for(i=0;i<NUMVERTICES;i++){ 879 ISSMASSERT(nodes); 880 for(int i=0;i<NUMVERTICES;i++){ 882 881 if(node==nodes[i]) 883 882 return i; … … 3927 3926 void Penta::GetParameterValue(double* pvalue,Node* node,int enumtype){ 3928 3927 3928 Input* input=inputs->GetInput(enumtype); 3929 if(!input) ISSMERROR("No input of type %s found in tria",EnumToString(enumtype)); 3930 3929 3931 GaussPenta* gauss=new GaussPenta(); 3930 3931 ISSMASSERT(nodes);3932 3932 gauss->GaussVertex(this->GetNodeIndex(node)); 3933 3933 3934 inputs->GetParameterValue(pvalue,gauss,enumtype); 3934 input->GetParameterValue(pvalue,gauss); 3935 delete gauss; 3935 3936 } 3936 3937 /*}}}*/ … … 3989 3990 /*Get approximation enum and dof list: */ 3990 3991 inputs->GetParameterValue(&approximation,ApproximationEnum); 3992 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 3993 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 3991 3994 3992 3995 /*If the element is a coupling, do nothing: every grid is also on an other elements … … 4006 4009 /*Recover vx and vy*/ 4007 4010 gauss->GaussVertex(i); 4008 inputs->GetParameterValue(&vx,gauss,VxEnum);4009 inputs->GetParameterValue(&vy,gauss,VyEnum);4011 vx_input->GetParameterValue(&vx,gauss); 4012 vy_input->GetParameterValue(&vy,gauss); 4010 4013 values[i*numdofpervertex+0]=vx; 4011 4014 values[i*numdofpervertex+1]=vy; … … 4035 4038 /*Get dof list: */ 4036 4039 GetDofList(&doflist); 4040 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 4041 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 4037 4042 4038 4043 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4043 4048 /*Recover vx and vy*/ 4044 4049 gauss->GaussVertex(i); 4045 inputs->GetParameterValue(&vx,gauss,VxEnum);4046 inputs->GetParameterValue(&vy,gauss,VyEnum);4050 vx_input->GetParameterValue(&vx,gauss); 4051 vy_input->GetParameterValue(&vy,gauss); 4047 4052 values[i*numdofpervertex+0]=vx; 4048 4053 values[i*numdofpervertex+1]=vy; … … 4071 4076 /*Get dof list: */ 4072 4077 GetDofList(&doflist); 4078 Input* vz_input=inputs->GetInput(VzEnum); ISSMASSERT(vz_input); 4073 4079 4074 4080 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4079 4085 /*Recover vz */ 4080 4086 gauss->GaussVertex(i); 4081 inputs->GetParameterValue(&vz,gauss,VxEnum);4087 vz_input->GetParameterValue(&vz,gauss); 4082 4088 values[i]=vz; 4083 4089 } … … 4106 4112 /*Get dof list: */ 4107 4113 GetDofList(&doflist); 4114 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 4115 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 4116 Input* vz_input=inputs->GetInput(VzEnum); ISSMASSERT(vz_input); 4117 Input* p_input =inputs->GetInput(VxEnum); ISSMASSERT(p_input); 4108 4118 4109 4119 /*Recondition pressure: */ … … 4114 4124 gauss=new GaussPenta(); 4115 4125 for(i=0;i<NUMVERTICES;i++){ 4116 4117 /*Recover vx and vy*/4118 4126 gauss->GaussVertex(i); 4119 inputs->GetParameterValue(&vx,gauss,VxEnum);4120 inputs->GetParameterValue(&vy,gauss,VyEnum);4121 inputs->GetParameterValue(&vz,gauss,VzEnum);4122 inputs->GetParameterValue(&p ,gauss,PressureEnum);4127 vx_input->GetParameterValue(&vx,gauss); 4128 vy_input->GetParameterValue(&vy,gauss); 4129 vz_input->GetParameterValue(&vz,gauss); 4130 p_input ->GetParameterValue(&p ,gauss); 4123 4131 values[i*numdofpervertex+0]=vx; 4124 4132 values[i*numdofpervertex+1]=vy; … … 4145 4153 int* doflist=NULL; 4146 4154 double values[numdof]; 4147 double vz;4155 double temp; 4148 4156 4149 4157 4150 4158 /*Get dof list: */ 4151 4159 GetDofList(&doflist); 4160 Input* t_input=inputs->GetInput(TemperatureEnum); ISSMASSERT(t_input); 4152 4161 4153 4162 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4158 4167 /*Recover vz */ 4159 4168 gauss->GaussVertex(i); 4160 inputs->GetParameterValue(&vz,gauss,TemperatureEnum);4161 values[i]= vz;4169 t_input->GetParameterValue(&temp,gauss); 4170 values[i]=temp; 4162 4171 } 4163 4172 -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5748 r5749 804 804 int Tria::GetNodeIndex(Node* node){ 805 805 806 int i; 807 808 for(i=0;i<NUMVERTICES;i++){ 806 ISSMASSERT(nodes); 807 for(int i=0;i<NUMVERTICES;i++){ 809 808 if(node==nodes[i]) 810 809 return i; … … 1337 1336 1338 1337 /*get thickness and velocity at two segment extremities: */ 1339 inputs->GetParameterValue(&h1, gauss_1,ThicknessEnum); 1340 inputs->GetParameterValue(&h2, gauss_2,ThicknessEnum); 1341 inputs->GetParameterValue(&vx1,gauss_1,VxEnum); 1342 inputs->GetParameterValue(&vx2,gauss_2,VxEnum); 1343 inputs->GetParameterValue(&vy1,gauss_1,VyEnum); 1344 inputs->GetParameterValue(&vy2,gauss_2,VyEnum); 1338 Input* thickness_input=inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input); 1339 thickness_input->GetParameterValue(&h1, gauss_1); 1340 thickness_input->GetParameterValue(&h2, gauss_2); 1341 1342 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 1343 vx_input->GetParameterValue(&vx1,gauss_1); 1344 vx_input->GetParameterValue(&vx2,gauss_2); 1345 1346 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 1347 vy_input->GetParameterValue(&vy1,gauss_1); 1348 vy_input->GetParameterValue(&vy2,gauss_2); 1345 1349 1346 1350 mass_flux= rho_ice*length*( … … 5323 5327 void Tria::GetParameterValue(double* pvalue,Node* node,int enumtype){ 5324 5328 5329 Input* input=inputs->GetInput(enumtype); 5330 if(!input) ISSMERROR("No input of type %s found in tria",EnumToString(enumtype)); 5331 5325 5332 GaussTria* gauss=new GaussTria(); 5326 5327 ISSMASSERT(nodes);5328 5333 gauss->GaussVertex(this->GetNodeIndex(node)); 5329 5334 5330 inputs->GetParameterValue(pvalue,gauss,enumtype); 5335 input->GetParameterValue(pvalue,gauss); 5336 delete gauss; 5331 5337 } 5332 5338 /*}}}*/ … … 5481 5487 /*retrieve inputs :*/ 5482 5488 inputs->GetParameterValue(&drag_type,DragTypeEnum); 5483 Input* drag_input=inputs->GetInput(DragCoefficientEnum); ISSMASSERT(drag_input); 5489 Input* drag_input =inputs->GetInput(DragCoefficientEnum); ISSMASSERT(drag_input); 5490 Input* vx_input =inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 5491 Input* vy_input =inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 5492 Input* vz_input =inputs->GetInput(VzEnum); ISSMASSERT(vz_input); 5493 Input* adjointx_input=inputs->GetInput(AdjointxEnum); ISSMASSERT(adjointx_input); 5494 Input* adjointy_input=inputs->GetInput(AdjointyEnum); ISSMASSERT(adjointy_input); 5495 Input* adjointz_input=inputs->GetInput(AdjointzEnum); ISSMASSERT(adjointz_input); 5484 5496 5485 5497 /*retrieve some parameters: */ … … 5506 5518 if (drag_type==2) friction->GetAlphaComplement(&alpha_complement, gauss,VxEnum,VyEnum); 5507 5519 else alpha_complement=0; 5508 inputs->GetParameterValue(&drag,gauss,DragCoefficientEnum);5520 drag_input->GetParameterValue(&drag,gauss); 5509 5521 5510 5522 /*recover lambda mu and xi: */ 5511 inputs->GetParameterValue(&lambda,gauss,AdjointxEnum);5512 inputs->GetParameterValue(&mu, gauss,AdjointyEnum);5513 inputs->GetParameterValue(&xi, gauss,AdjointzEnum);5523 adjointx_input->GetParameterValue(&lambda,gauss); 5524 adjointy_input->GetParameterValue(&mu ,gauss); 5525 adjointz_input->GetParameterValue(&xi ,gauss); 5514 5526 5515 5527 /*recover vx vy and vz: */ 5516 inputs->GetParameterValue(&vx, gauss,VxEnum);5517 inputs->GetParameterValue(&vy, gauss,VyEnum);5518 inputs->GetParameterValue(&vz, gauss,VzEnum);5528 vx_input->GetParameterValue(&vx, gauss); 5529 vy_input->GetParameterValue(&vy, gauss); 5530 vz_input->GetParameterValue(&vz, gauss); 5519 5531 5520 5532 /*Get normal vector to the bed */ -
issm/trunk/src/c/objects/Loads/Friction.cpp
r5743 r5749 75 75 inputs->GetParameterValue(&drag_p,DragPEnum); 76 76 inputs->GetParameterValue(&drag_q,DragQEnum); 77 inputs->GetParameterValue(&thickness, gauss,ThicknessEnum);78 inputs->GetParameterValue(&bed, gauss,BedEnum);79 inputs->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum);77 this->GetParameterValue(&thickness, gauss,ThicknessEnum); 78 this->GetParameterValue(&bed, gauss,BedEnum); 79 this->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum); 80 80 81 81 /*Get material parameters: */ … … 98 98 99 99 if(strcmp(element_type,"2d")==0){ 100 inputs->GetParameterValue(&vx, gauss,vxenum);101 inputs->GetParameterValue(&vy, gauss,vyenum);100 this->GetParameterValue(&vx, gauss,vxenum); 101 this->GetParameterValue(&vy, gauss,vyenum); 102 102 vmag=sqrt(pow(vx,2)+pow(vy,2)); 103 103 } 104 104 else if (strcmp(element_type,"3d")==0){ 105 inputs->GetParameterValue(&vx, gauss,vxenum);106 inputs->GetParameterValue(&vy, gauss,vyenum);107 inputs->GetParameterValue(&vz, gauss,vzenum);105 this->GetParameterValue(&vx, gauss,vxenum); 106 this->GetParameterValue(&vy, gauss,vyenum); 107 this->GetParameterValue(&vz, gauss,vzenum); 108 108 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 109 109 } … … 136 136 inputs->GetParameterValue(&drag_p,DragPEnum); 137 137 inputs->GetParameterValue(&drag_q,DragQEnum); 138 inputs->GetParameterValue(&thickness, gauss,ThicknessEnum);139 inputs->GetParameterValue(&bed, gauss,BedEnum);140 inputs->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum);138 this->GetParameterValue(&thickness, gauss,ThicknessEnum); 139 this->GetParameterValue(&bed, gauss,BedEnum); 140 this->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum); 141 141 142 142 /*Get material parameters: */ … … 159 159 160 160 if(strcmp(element_type,"2d")==0){ 161 inputs->GetParameterValue(&vx, gauss,vxenum);162 inputs->GetParameterValue(&vy, gauss,vyenum);161 this->GetParameterValue(&vx, gauss,vxenum); 162 this->GetParameterValue(&vy, gauss,vyenum); 163 163 vmag=sqrt(pow(vx,2)+pow(vy,2)); 164 164 } 165 165 else if (strcmp(element_type,"3d")==0){ 166 inputs->GetParameterValue(&vx, gauss,vxenum);167 inputs->GetParameterValue(&vy, gauss,vyenum);168 inputs->GetParameterValue(&vz, gauss,vzenum);166 this->GetParameterValue(&vx, gauss,vxenum); 167 this->GetParameterValue(&vy, gauss,vyenum); 168 this->GetParameterValue(&vz, gauss,vzenum); 169 169 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 170 170 } … … 200 200 inputs->GetParameterValue(&drag_p,DragPEnum); 201 201 inputs->GetParameterValue(&drag_q,DragQEnum); 202 inputs->GetParameterValue(&thickness, gauss,ThicknessEnum);203 inputs->GetParameterValue(&bed, gauss,BedEnum);204 inputs->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum);202 this->GetParameterValue(&thickness, gauss,ThicknessEnum); 203 this->GetParameterValue(&bed, gauss,BedEnum); 204 this->GetParameterValue(&drag_coefficient, gauss,DragCoefficientEnum); 205 205 206 206 /*Get material parameters: */ … … 224 224 225 225 //We need the velocity magnitude to evaluate the basal stress: 226 inputs->GetParameterValue(&vx, gauss,vxenum);227 inputs->GetParameterValue(&vy, gauss,vyenum);226 this->GetParameterValue(&vx, gauss,vxenum); 227 this->GetParameterValue(&vy, gauss,vyenum); 228 228 vmag=sqrt(pow(vx,2)+pow(vy,2)); 229 229 … … 235 235 } 236 236 /*}}}*/ 237 /*FUNCTION Friction::GetParameterValue{{{1*/ 238 void Friction::GetParameterValue(double* pvalue,GaussTria* gauss,int enum_type){ 239 240 Input* input=inputs->GetInput(enum_type); 241 if(!input) ISSMERROR("input %s not found",EnumToString(enum_type)); 242 input->GetParameterValue(pvalue,gauss); 243 244 } 245 /*}}}*/ 246 /*FUNCTION Friction::GetParameterValue{{{1*/ 247 void Friction::GetParameterValue(double* pvalue,GaussPenta* gauss,int enum_type){ 248 249 Input* input=inputs->GetInput(enum_type); 250 if(!input) ISSMERROR("input %s not found",EnumToString(enum_type)); 251 input->GetParameterValue(pvalue,gauss); 252 253 } 254 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Friction.h
r5743 r5749 30 30 void GetAlpha2(double* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum); 31 31 void GetAlphaComplement(double* alpha_complement, GaussTria* gauss,int vxenum,int vyenum); 32 void GetParameterValue(double* pvalue,GaussTria* gauss,int enum_type); 33 void GetParameterValue(double* pvalue,GaussPenta* gauss,int enum_type); 32 34 33 35 };
Note:
See TracChangeset
for help on using the changeset viewer.