Changeset 16382
- Timestamp:
- 10/11/13 10:13:16 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r16378 r16382 92 92 ./classes/Inputs/Input.h\ 93 93 ./classes/Inputs/InputLocal.h\ 94 ./classes/Inputs/SegInput.h\ 95 ./classes/Inputs/SegInput.cpp\ 94 96 ./classes/Inputs/TriaInput.h\ 95 97 ./classes/Inputs/TriaInput.cpp\ -
issm/trunk-jpl/src/c/analyses/bedslope_core.cpp
r15849 r16382 14 14 /*parameters: */ 15 15 bool save_results; 16 int meshtype; 16 17 17 18 /*Recover some parameters: */ 18 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 femmodel->parameters->FindParam(&meshtype,MeshTypeEnum); 19 21 20 22 if(VerboseSolution()) _printf0_(" computing slope\n"); … … 23 25 femmodel->SetCurrentConfiguration(BedSlopeAnalysisEnum,BedSlopeXAnalysisEnum); 24 26 solutionsequence_linear(femmodel); 25 femmodel->SetCurrentConfiguration(BedSlopeAnalysisEnum,BedSlopeYAnalysisEnum); 26 solutionsequence_linear(femmodel); 27 if(meshtype!=Mesh2DverticalEnum){ 28 femmodel->SetCurrentConfiguration(BedSlopeAnalysisEnum,BedSlopeYAnalysisEnum); 29 solutionsequence_linear(femmodel); 30 } 27 31 28 32 if(save_results){ 29 33 if(VerboseSolution()) _printf0_(" saving results\n"); 30 34 InputToResultx(femmodel,BedSlopeXEnum); 31 InputToResultx(femmodel,BedSlopeYEnum);35 if(meshtype!=Mesh2DverticalEnum) InputToResultx(femmodel,BedSlopeYEnum); 32 36 } 33 37 -
issm/trunk-jpl/src/c/analyses/stressbalance_core.cpp
r16363 r16382 49 49 /*Compute slopes: */ 50 50 if(isSIA) surfaceslope_core(femmodel); 51 if(isFS && meshtype==Mesh3DEnum){51 if(isFS){ 52 52 bedslope_core(femmodel); 53 53 femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum); -
issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp
r15737 r16382 128 128 } 129 129 /*}}}*/ 130 /*FUNCTION ElementHook::SpawnSegHook{{{*/ 131 void ElementHook::SpawnSegHook(ElementHook* triahook,int index1,int index2){ 132 133 triahook->numanalyses=this->numanalyses; 134 135 int indices[2]; 136 indices[0]=index1; 137 indices[1]=index2; 138 139 /*Spawn nodes hook*/ 140 triahook->hnodes=new Hook*[this->numanalyses]; 141 for(int i=0;i<this->numanalyses;i++){ 142 /*Do not do anything if Hook is empty*/ 143 if (!this->hnodes[i] || this->hnodes[i]->GetNum()==0){ 144 triahook->hnodes[i]=NULL; 145 } 146 else{ 147 triahook->hnodes[i]=this->hnodes[i]->Spawn(indices,2); 148 } 149 } 150 151 /*do not spawn hmaterial. material will be taken care of by Tria*/ 152 triahook->hmaterial=NULL; 153 triahook->hvertices=(Hook*)this->hvertices->Spawn(indices,2); 154 triahook->hmatpar=(Hook*)this->hmatpar->copy(); 155 } 156 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/ElementHook.h
r15737 r16382 26 26 void SetHookNodes(int* node_ids,int numnodes,int analysis_counter); 27 27 void SpawnTriaHook(ElementHook* triahook,int location); //3d only 28 void SpawnSegHook(ElementHook* triahook,int ndex1,int index2); //2d only 28 29 void InitHookNeighbors(int* element_ids); //3d only 29 30 }; -
issm/trunk-jpl/src/c/classes/Elements/Seg.cpp
r16343 r16382 139 139 } 140 140 /*}}}*/ 141 142 /*FUNCTION Seg::CreateMassMatrix {{{*/ 143 ElementMatrix* Seg::CreateMassMatrix(void){ 144 145 /* Intermediaries */ 146 IssmDouble D,Jdet; 147 IssmDouble xyz_list[NUMVERTICES][2]; 148 149 /*Fetch number of nodes and dof for this finite element*/ 150 int numnodes = this->NumberofNodes(); 151 152 /*Initialize Element matrix and vectors*/ 153 ElementMatrix* Ke = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum); 154 IssmDouble* basis = xNew<IssmDouble>(numnodes); 155 156 /*Retrieve all inputs and parameters*/ 157 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 158 159 /* Start looping on the number of gaussian points: */ 160 GaussSeg* gauss=new GaussSeg(2); 161 for(int ig=gauss->begin();ig<gauss->end();ig++){ 162 163 gauss->GaussPoint(ig); 164 165 GetNodalFunctions(basis,gauss); 166 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss); 167 D=gauss->weight*Jdet; 168 169 TripleMultiply(basis,1,numnodes,1, 170 &D,1,1,0, 171 basis,1,numnodes,0, 172 &Ke->values[0],1); 173 } 174 175 /*Clean up and return*/ 176 delete gauss; 177 xDelete<IssmDouble>(basis); 178 return Ke; 179 } 180 /*}}}*/ 181 /*FUNCTION Seg::CreatePVectorSlope {{{*/ 182 ElementVector* Seg::CreatePVectorSlope(void){ 183 184 /*Intermediaries */ 185 int i,analysis_type; 186 IssmDouble Jdet; 187 IssmDouble xyz_list[NUMVERTICES][2]; 188 IssmDouble slope; 189 190 /*Fetch number of nodes and dof for this finite element*/ 191 int numnodes = this->NumberofNodes(); 192 193 /*Initialize Element vector*/ 194 ElementVector* pe = new ElementVector(nodes,numnodes,this->parameters); 195 IssmDouble* basis = xNew<IssmDouble>(numnodes); 196 197 /*Retrieve all inputs and parameters*/ 198 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 199 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 200 Input* slope_input=NULL; 201 if(analysis_type==SurfaceSlopeXAnalysisEnum){ 202 slope_input=inputs->GetInput(SurfaceEnum); _assert_(slope_input); 203 } 204 else if(analysis_type==BedSlopeXAnalysisEnum){ 205 slope_input=inputs->GetInput(BedEnum); _assert_(slope_input); 206 } 207 else{ 208 _error_("Analysis "<<EnumToStringx(analysis_type)<<" not inplemented yet"); 209 } 210 211 /* Start looping on the number of gaussian points: */ 212 GaussSeg* gauss=new GaussSeg(2); 213 for(int ig=gauss->begin();ig<gauss->end();ig++){ 214 215 gauss->GaussPoint(ig); 216 217 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss); 218 GetNodalFunctions(basis,gauss); 219 220 slope_input->GetInputDerivativeValue(&slope,&xyz_list[0][0],gauss); 221 222 for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*slope*basis[i]; 223 } 224 225 /*Clean up and return*/ 226 xDelete<IssmDouble>(basis); 227 delete gauss; 228 return pe; 229 } 230 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16343 r16382 76 76 void CreateDVector(Vector<IssmDouble>* df){_error_("not implemented yet");}; 77 77 void CreatePVector(Vector<IssmDouble>* pf){_error_("not implemented yet");}; 78 ElementVector* CreatePVectorSlope(void); 78 79 void CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("not implemented yet");}; 79 80 void Delta18oParameterization(void){_error_("not implemented yet");}; … … 87 88 bool IsNodeOnShelfFromFlags(IssmDouble* flags){_error_("not implemented yet");}; 88 89 bool NoIceInElement(){_error_("not implemented yet");}; 90 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");}; 91 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");}; 92 void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");}; 93 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");}; 94 #ifdef _HAVE_THERMAL_ 95 void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");}; 96 void ComputeBasalMeltingrate(void){_error_("not implemented yet");}; 97 void DrainWaterfraction(void){_error_("not implemented yet");}; 98 #endif 99 #ifdef _HAVE_HYDROLOGY_ 100 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");}; 101 void GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");}; 102 void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");}; 103 void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");}; 104 #endif 89 105 void GetSolutionFromInputs(Vector<IssmDouble>* solution){_error_("not implemented yet");}; 90 106 void GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");}; … … 173 189 #endif 174 190 /*}}}*/ 191 /*Seg specific routines:*/ 192 ElementMatrix* CreateMassMatrix(void); 175 193 }; 176 194 #endif /* _SEG_H */ -
issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp
r16378 r16382 48 48 49 49 /*Reference Element numerics*/ 50 /*FUNCTION SegRef::GetNodalFunctions {{{*/50 /*FUNCTION SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){{{*/ 51 51 void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){ 52 52 /*This routine returns the values of the nodal functions at the gaussian point.*/ … … 54 54 _assert_(basis); 55 55 56 switch(this->element_type){ 56 GetNodalFunctions(basis,gauss,this->element_type); 57 } 58 /*}}}*/ 59 /*FUNCTION SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){{{*/ 60 void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){ 61 /*This routine returns the values of the nodal functions at the gaussian point.*/ 62 63 _assert_(basis); 64 65 switch(element_type){ 57 66 case P1Enum: case P1DGEnum: 58 67 basis[0]=(1.-gauss->coord1)/2.; … … 60 69 return; 61 70 default: 71 _error_("Element type "<<EnumToStringx(element_type)<<" not supported yet"); 72 } 73 } 74 /*}}}*/ 75 /*FUNCTION SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){{{*/ 76 void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){ 77 78 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type); 79 80 } 81 /*}}}*/ 82 /*FUNCTION SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){{{*/ 83 void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){ 84 85 /*This routine returns the values of the nodal functions derivatives (with respect to the 86 * actual coordinate system): */ 87 IssmDouble Jinv; 88 89 /*Fetch number of nodes for this finite element*/ 90 int numnodes = this->NumberofNodes(finiteelement); 91 92 /*Get nodal functions derivatives in reference triangle*/ 93 IssmDouble* dbasis_ref=xNew<IssmDouble>(numnodes); 94 GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement); 95 96 /*Get Jacobian invert: */ 97 GetJacobianInvert(&Jinv, xyz_list, gauss); 98 99 /*Build dbasis: 100 * [dhi/dx]= Jinv*[dhi/dr] 101 */ 102 for(int i=0;i<numnodes;i++){ 103 dbasis[i] = Jinv*dbasis_ref[i]; 104 } 105 106 /*Clean up*/ 107 xDelete<IssmDouble>(dbasis_ref); 108 109 } 110 /*}}}*/ 111 /*FUNCTION SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){{{*/ 112 void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){ 113 /*This routine returns the values of the nodal functions derivatives (with respect to the 114 * natural coordinate system) at the gaussian point. */ 115 116 GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type); 117 118 } 119 /*}}}*/ 120 /*FUNCTION SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement){{{*/ 121 void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement){ 122 /*This routine returns the values of the nodal functions derivatives (with respect to the 123 * natural coordinate system) at the gaussian point. */ 124 125 _assert_(dbasis && gauss); 126 127 switch(finiteelement){ 128 case P1Enum: case P1DGEnum: 129 /*Nodal function 1*/ 130 dbasis[0] = -0.5; 131 /*Nodal function 2*/ 132 dbasis[1] = 0.5; 133 return; 134 default: 62 135 _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 63 136 } 137 138 } 139 /*}}}*/ 140 /*FUNCTION SegRef::GetInputDerivativeValue{{{*/ 141 void SegRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss){ 142 143 /*From node values of parameter p (plist[0],plist[1]), return parameter derivative value at gaussian 144 * point specified by gauss_basis: 145 * dp/dx=plist[0]*dh1/dx+plist[1]*dh2/dx 146 * 147 * p is a vector already allocated. 148 */ 149 150 /*Output*/ 151 IssmDouble dpx; 152 153 /*Fetch number of nodes for this finite element*/ 154 int numnodes = this->NumberofNodes(); 155 156 /*Get nodal functions derivatives*/ 157 IssmDouble* dbasis=xNew<IssmDouble>(1*numnodes); 158 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 159 160 /*Calculate parameter for this Gauss point*/ 161 for(int i=0;i<numnodes;i++) dpx += dbasis[i]*plist[i]; 162 163 /*Assign values*/ 164 xDelete<IssmDouble>(dbasis); 165 *p=dpx; 166 167 } 168 /*}}}*/ 169 /*FUNCTION SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){{{*/ 170 void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){ 171 172 GetInputValue(p,plist,gauss,this->element_type); 173 } 174 /*}}}*/ 175 /*FUNCTION SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){{{*/ 176 void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){ 177 178 /*Output*/ 179 IssmDouble value =0.; 180 181 /*Fetch number of nodes for this finite element*/ 182 int numnodes = this->NumberofNodes(finiteelement); 183 184 /*Get nodal functions*/ 185 IssmDouble* basis=xNew<IssmDouble>(numnodes); 186 GetNodalFunctions(basis, gauss,finiteelement); 187 188 /*Calculate parameter for this Gauss point*/ 189 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 190 191 /*Assign output pointer*/ 192 xDelete<IssmDouble>(basis); 193 *p = value; 64 194 } 65 195 /*}}}*/ … … 103 233 } 104 234 /*}}}*/ 235 /*FUNCTION SegRef::NumberofNodes(){{{*/ 236 int SegRef::NumberofNodes(void){ 237 238 return this->NumberofNodes(this->element_type); 239 } 240 /*}}}*/ 241 /*FUNCTION SegRef::NumberofNodes(int finiteelement){{{*/ 242 int SegRef::NumberofNodes(int finiteelement){ 243 244 switch(finiteelement){ 245 case P1Enum: return NUMNODESP1; 246 case P1DGEnum: return NUMNODESP1; 247 default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 248 } 249 250 return -1; 251 } 252 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/SegRef.h
r16377 r16382 26 26 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss); 27 27 void GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss); 28 void GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement); 29 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss); 30 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement); 31 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss); 32 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement); 33 void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss); 34 void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss); 35 void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement); 36 37 int NumberofNodes(void); 38 int NumberofNodes(int finiteelement); 28 39 }; 29 40 #endif -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16373 r16382 246 246 #endif 247 247 case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum: 248 return CreateMassMatrix(); 248 int meshtype; 249 parameters->FindParam(&meshtype,MeshTypeEnum); 250 if(meshtype==Mesh2DverticalEnum){ 251 return CreateBasalMassMatrix(); 252 } 253 else{ 254 return CreateMassMatrix(); 255 } 249 256 break; 250 257 #ifdef _HAVE_MASSTRANSPORT_ … … 330 337 } 331 338 /*}}}*/ 339 /*FUNCTION Tria::CreateBasalMassMatrix{{{*/ 340 ElementMatrix* Tria::CreateBasalMassMatrix(void){ 341 342 if(!HasEdgeOnBed()) return NULL; 343 344 int index1,index2; 345 this->EdgeOnBedIndices(&index1,&index2); 346 347 Seg* seg=(Seg*)SpawnSeg(index1,index2); 348 ElementMatrix* Ke=seg->CreateMassMatrix(); 349 delete seg->material; delete seg; 350 351 /*clean up and return*/ 352 return Ke; 353 } 354 /*}}}*/ 332 355 /*FUNCTION Tria::CreateDVector {{{*/ 333 356 void Tria::CreateDVector(Vector<IssmDouble>* df){ … … 413 436 #endif 414 437 case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum: 415 return CreatePVectorSlope(); 438 int meshtype; 439 parameters->FindParam(&meshtype,MeshTypeEnum); 440 if(meshtype==Mesh2DverticalEnum){ 441 return CreateBasalPVectorSlope(); 442 } 443 else{ 444 return CreatePVectorSlope(); 445 } 416 446 break; 417 447 #ifdef _HAVE_MASSTRANSPORT_ … … 459 489 /*make compiler happy*/ 460 490 return NULL; 491 } 492 /*}}}*/ 493 /*FUNCTION Tria::CreateBasalPVectorSlope{{{*/ 494 ElementVector* Tria::CreateBasalPVectorSlope(void){ 495 496 if(!HasEdgeOnBed()) return NULL; 497 498 int index1,index2; 499 this->EdgeOnBedIndices(&index1,&index2); 500 501 Seg* seg=(Seg*)SpawnSeg(index1,index2); 502 ElementVector* pe=seg->CreatePVectorSlope(); 503 delete seg->material; delete seg; 504 505 /*clean up and return*/ 506 return pe; 461 507 } 462 508 /*}}}*/ … … 2459 2505 else this->nodes=NULL; 2460 2506 2507 } 2508 /*}}}*/ 2509 /*FUNCTION Tria::SpawnSeg {{{*/ 2510 Seg* Tria::SpawnSeg(int index1,int index2){ 2511 2512 int analysis_counter; 2513 2514 /*go into parameters and get the analysis_counter: */ 2515 this->parameters->FindParam(&analysis_counter,AnalysisCounterEnum); 2516 2517 /*Create Seg*/ 2518 Seg* seg=new Seg(); 2519 seg->id=this->id; 2520 seg->inputs=(Inputs*)this->inputs->SpawnSegInputs(index1,index2); 2521 seg->parameters=this->parameters; 2522 seg->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED) 2523 this->SpawnSegHook(dynamic_cast<ElementHook*>(seg),index1,index2); 2524 2525 /*Spawn material*/ 2526 seg->material=(Material*)this->material->copy(); 2527 delete seg->material->inputs; 2528 seg->material->inputs=(Inputs*)this->material->inputs->SpawnSegInputs(index1,index2); 2529 2530 /*recover nodes, material and matpar: */ 2531 seg->nodes = (Node**)seg->hnodes[analysis_counter]->deliverp(); 2532 seg->vertices = (Vertex**)seg->hvertices->deliverp(); 2533 seg->matpar = (Matpar*)seg->hmatpar->delivers(); 2534 2535 /*Return new Seg*/ 2536 return seg; 2461 2537 } 2462 2538 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16364 r16382 18 18 class Material; 19 19 class Matpar; 20 class Seg; 20 21 class ElementMatrix; 21 22 class ElementVector; … … 190 191 ElementMatrix* CreateKMatrixFreeSurfaceBase(void); 191 192 ElementMatrix* CreateMassMatrix(void); 193 ElementMatrix* CreateBasalMassMatrix(void); 192 194 ElementVector* CreatePVector(void); 193 195 ElementVector* CreatePVectorBalancethickness(void); … … 203 205 ElementVector* CreatePVectorFreeSurfaceBase(void); 204 206 ElementVector* CreatePVectorSlope(void); 207 ElementVector* CreateBasalPVectorSlope(void); 205 208 IssmDouble GetArea(void); 206 209 void GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints); … … 228 231 bool IsInput(int name); 229 232 void SetClone(int* minranks); 233 Seg* SpawnSeg(int index1,int index2); 230 234 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]); 231 235 -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
r15737 r16382 73 73 /*FUNCTION BoolInput::SpawnTriaInput{{{*/ 74 74 Input* BoolInput::SpawnTriaInput(int location){ 75 76 /*output*/ 77 BoolInput* outinput=new BoolInput(); 78 79 /*only copy current value*/ 80 outinput->enum_type=this->enum_type; 81 outinput->value=this->value; 82 83 /*Assign output*/ 84 return outinput; 85 86 } 87 /*}}}*/ 88 /*FUNCTION BoolInput::SpawnSegInput{{{*/ 89 Input* BoolInput::SpawnSegInput(int index1,int index2){ 75 90 76 91 /*output*/ -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
r16238 r16382 35 35 int InstanceEnum(); 36 36 Input* SpawnTriaInput(int location); 37 Input* SpawnSegInput(int index1,int index2); 37 38 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");}; 38 39 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");}; … … 52 53 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 53 54 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 54 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 55 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
r16169 r16382 186 186 return values->SpawnTriaInput(location); 187 187 }/*}}}*/ 188 /*FUNCTION ControlInput::SpawnSegInput{{{*/ 189 Input* ControlInput::SpawnSegInput(int index1,int index2){ 190 return values->SpawnSegInput(index1,index2); 191 }/*}}}*/ 188 192 /*FUNCTION ControlInput::SpawnGradient{{{*/ 189 193 ElementResult* ControlInput::SpawnGradient(int step, IssmDouble time){ -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
r16238 r16382 39 39 int InstanceEnum(); 40 40 Input* SpawnTriaInput(int location); 41 Input* SpawnSegInput(int index1,int index2); 41 42 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");}; 42 43 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");}; … … 57 58 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 58 59 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 60 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 59 61 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 60 62 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
r16315 r16382 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION DatasetInput::SpawnSegInput{{{*/ 99 Input* DatasetInput::SpawnSegInput(int index1,int index2){ 100 101 /*output*/ 102 DatasetInput* outinput=NULL; 103 104 /*Create new Datasetinput (copy of current input)*/ 105 outinput=new DatasetInput(); 106 outinput->enum_type=this->enum_type; 107 outinput->inputs=dynamic_cast<Inputs*>(this->inputs->SpawnSegInputs(index1,index2)); 108 outinput->numids=this->numids; 109 outinput->ids=xNew<int>(this->numids); 110 xMemCpy(outinput->ids,this->ids,this->numids); 111 112 /*Assign output*/ 113 return outinput; 114 } 115 /*}}}*/ 98 116 99 117 /*DatasetInput management*/ -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
r16313 r16382 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int location); 39 Input* SpawnSegInput(int index1,int index2); 39 40 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");}; 40 41 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");}; … … 54 55 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index); 55 56 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index); 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 56 58 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");}; 57 59 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
r15737 r16382 86 86 } 87 87 /*}}}*/ 88 /*FUNCTION DoubleInput::SpawnSegInput{{{*/ 89 Input* DoubleInput::SpawnSegInput(int index1,int index2){ 90 91 /*output*/ 92 DoubleInput* outinput=new DoubleInput(); 93 94 /*only copy current value*/ 95 outinput->enum_type=this->enum_type; 96 outinput->value=this->value; 97 98 /*Assign output*/ 99 return outinput; 100 101 } 102 /*}}}*/ 88 103 /*FUNCTION DoubleInput::SpawnResult{{{*/ 89 104 ElementResult* DoubleInput::SpawnResult(int step, IssmDouble time){ -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
r16238 r16382 34 34 int InstanceEnum(); 35 35 Input* SpawnTriaInput(int location); 36 Input* SpawnSegInput(int index1,int index2); 36 37 Input* PointwiseDivide(Input* inputB); 37 38 Input* PointwiseMin(Input* inputB); … … 51 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 52 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 54 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 53 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 54 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Inputs/Input.h
r16238 r16382 13 13 class ElementResult; 14 14 class GaussTria; 15 class GaussSeg; 15 16 class Parameters; 16 17 class GaussPenta; … … 34 35 virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index)=0; 35 36 virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index)=0; 37 virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss)=0; 36 38 virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss)=0; 37 39 virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss)=0; … … 65 67 66 68 virtual Input* SpawnTriaInput(int location)=0; 69 virtual Input* SpawnSegInput(int index1,int index2)=0; 67 70 virtual Input* PointwiseDivide(Input* inputB)=0; 68 71 virtual Input* PointwiseMax(Input* inputmax)=0; -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
r16149 r16382 395 395 } 396 396 /*}}}*/ 397 /*FUNCTION Inputs::SpawnSegInputs{{{*/ 398 Inputs* Inputs::SpawnSegInputs(int index1,int index2){ 399 400 /*Intermediary*/ 401 vector<Object*>::iterator object; 402 Input* inputin=NULL; 403 Input* inputout=NULL; 404 405 /*Output*/ 406 Inputs* newinputs=new Inputs(); 407 408 /*Go through inputs and call Spawn function*/ 409 for ( object=objects.begin() ; object < objects.end(); object++ ){ 410 411 /*Create new input*/ 412 inputin=dynamic_cast<Input*>(*object); 413 inputout=inputin->SpawnSegInput(index1,index2); 414 415 /*Add input to new inputs*/ 416 newinputs->AddObject(inputout); 417 } 418 419 /*Assign output pointer*/ 420 return newinputs; 421 } 422 /*}}}*/ 397 423 /*FUNCTION Inputs::AXPY{{{*/ 398 424 void Inputs::AXPY(int inputy_enum, IssmDouble scalar, int inputx_enum){ -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.h
r16149 r16382 29 29 Input* GetInput(int enum_name); 30 30 Inputs* SpawnTriaInputs(int position); 31 Inputs* SpawnSegInputs(int index1,int index2); 32 Inputs* SpawnSegInputs(int position); 31 33 void AXPY(int inputy_enum, IssmDouble scalar, int inputx_enum); 32 34 IssmDouble InfinityNorm(int enumtype); -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
r15737 r16382 73 73 /*FUNCTION IntInput::SpawnTriaInput{{{*/ 74 74 Input* IntInput::SpawnTriaInput(int location){ 75 76 /*output*/ 77 IntInput* outinput=new IntInput(); 78 79 /*only copy current value*/ 80 outinput->enum_type=this->enum_type; 81 outinput->value=this->value; 82 83 /*Assign output*/ 84 return outinput; 85 } 86 /*}}}*/ 87 /*FUNCTION IntInput::SpawnSegInput{{{*/ 88 Input* IntInput::SpawnSegInput(int index1,int index2){ 75 89 76 90 /*output*/ -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
r16238 r16382 35 35 int InstanceEnum(); 36 36 Input* SpawnTriaInput(int location); 37 Input* SpawnSegInput(int index1,int index2); 37 38 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");}; 38 39 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");}; … … 52 53 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 53 54 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 54 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 55 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
r15737 r16382 124 124 } 125 125 /*}}}*/ 126 /*FUNCTION PentaInput::SpawnSegInput{{{*/ 127 Input* PentaInput::SpawnSegInput(int index1,int index2){ 128 129 _error_("not supported"); 130 } 131 /*}}}*/ 126 132 /*FUNCTION PentaInput::SpawnResult{{{*/ 127 133 ElementResult* PentaInput::SpawnResult(int step, IssmDouble time){ -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
r16238 r16382 35 35 int InstanceEnum(); 36 36 Input* SpawnTriaInput(int location); 37 Input* SpawnSegInput(int index1,int index2); 37 38 Input* PointwiseDivide(Input* inputB); 38 39 Input* PointwiseMin(Input* inputB); … … 51 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 52 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 54 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 53 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not implemented yet");}; 54 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
r16151 r16382 120 120 xMemCpy(outinput->timesteps,this->timesteps,this->numtimesteps); 121 121 outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(location); 122 outinput->parameters=this->parameters; 123 124 /*Assign output*/ 125 return outinput; 126 127 } 128 /*}}}*/ 129 /*FUNCTION TransientInput::SpawnSegInput{{{*/ 130 Input* TransientInput::SpawnSegInput(int index1,int index2){ 131 132 /*output*/ 133 TransientInput* outinput=NULL; 134 135 /*Create new Transientinput (copy of current input)*/ 136 outinput=new TransientInput(); 137 outinput->enum_type=this->enum_type; 138 outinput->numtimesteps=this->numtimesteps; 139 outinput->timesteps=xNew<IssmDouble>(this->numtimesteps); 140 xMemCpy(outinput->timesteps,this->timesteps,this->numtimesteps); 141 outinput->inputs=(Inputs*)this->inputs->SpawnSegInputs(index1,index2); 122 142 outinput->parameters=this->parameters; 123 143 -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
r16238 r16382 39 39 int InstanceEnum(); 40 40 Input* SpawnTriaInput(int location); 41 Input* SpawnSegInput(int index1,int index2); 41 42 Input* PointwiseDivide(Input* forcingB){_error_("not implemented yet");}; 42 43 Input* PointwiseMin(Input* forcingB){_error_("not implemented yet");}; … … 55 56 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 56 57 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");}; 58 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 57 59 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 58 60 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
r16238 r16382 97 97 } 98 98 /*}}}*/ 99 /*FUNCTION SegInput::SpawnSegInput{{{*/ 100 Input* TriaInput::SpawnSegInput(int index1,int index2){ 101 102 /*output*/ 103 SegInput* outinput=NULL; 104 IssmDouble newvalues[2]; //Assume P1 interpolation only for now 105 106 /*Create arrow of indices depending on location (0=base 1=surface)*/ 107 108 newvalues[0]=this->values[index1]; 109 newvalues[1]=this->values[index2]; 110 111 /*Create new Seg input*/ 112 outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum); 113 114 /*Assign output*/ 115 return outinput; 116 117 } 118 /*}}}*/ 99 119 /*FUNCTION TriaInput::SpawnResult{{{*/ 100 120 ElementResult* TriaInput::SpawnResult(int step, IssmDouble time){ -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
r16238 r16382 35 35 int InstanceEnum(); 36 36 Input* SpawnTriaInput(int location); 37 Input* SpawnSegInput(int index1,int index2); 37 38 Input* PointwiseDivide(Input* inputB); 38 39 Input* PointwiseMin(Input* inputB); … … 52 53 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; 53 54 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index){_error_("not implemented yet");}; 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussSeg* gauss){_error_("not implemented yet");}; 54 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 55 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Node.cpp
r16343 r16382 95 95 analysis_type==HydrologyDCEfficientAnalysisEnum 96 96 ){ 97 if(iomodel->meshtype==Mesh3DEnum ){97 if(iomodel->meshtype==Mesh3DEnum || iomodel->meshtype==Mesh2DverticalEnum){ 98 98 /*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */ 99 99 _assert_(iomodel->Data(MeshVertexonbedEnum)); -
issm/trunk-jpl/src/c/classes/classes.h
r16343 r16382 59 59 #include "./Inputs/PentaInput.h" 60 60 #include "./Inputs/TriaInput.h" 61 #include "./Inputs/SegInput.h" 61 62 #include "./Inputs/ControlInput.h" 62 63 #include "./Inputs/DatasetInput.h" -
issm/trunk-jpl/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp
r16291 r16382 11 11 void CreateNodesBedSlope(Nodes** pnodes, IoModel* iomodel){ 12 12 13 if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); 13 if(iomodel->meshtype==Mesh3DEnum){ 14 iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); 15 } 16 else if(iomodel->meshtype==Mesh2DverticalEnum){ 17 iomodel->FetchData(1,MeshVertexonbedEnum); 18 } 14 19 CreateNodes(pnodes,iomodel,BedSlopeAnalysisEnum,P1Enum); 15 20 iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
r16291 r16382 28 28 iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum); 29 29 } 30 if(iomodel->meshtype==Mesh2DverticalEnum){ 31 iomodel->FetchDataToInput(elements,MeshVertexonbedEnum); 32 } 30 33 } -
issm/trunk-jpl/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp
r16291 r16382 11 11 void CreateNodesSurfaceSlope(Nodes** pnodes, IoModel* iomodel){ 12 12 13 if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); 13 if(iomodel->meshtype==Mesh3DEnum){ 14 iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); 15 } 16 else if(iomodel->meshtype==Mesh2DverticalEnum){ 17 iomodel->FetchData(1,MeshVertexonbedEnum); 18 } 14 19 CreateNodes(pnodes,iomodel,SurfaceSlopeAnalysisEnum,P1Enum); 15 20 iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
Note:
See TracChangeset
for help on using the changeset viewer.