Changeset 16387
- Timestamp:
- 10/11/13 11:48:46 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16382 r16387 2182 2182 } 2183 2183 /*}}}*/ 2184 /*FUNCTION Tria::EdgeOnBedIndex{{{*/ 2185 int Tria::EdgeOnBedIndex(void){ 2186 2187 IssmDouble values[NUMVERTICES]; 2188 int indices[3][2] = {{1,2},{2,0},{0,1}}; 2189 2190 /*Retrieve all inputs and parameters*/ 2191 GetInputListOnVertices(&values[0],MeshVertexonbedEnum); 2192 2193 for(int i=0;i<3;i++){ 2194 if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){ 2195 return i; 2196 } 2197 } 2198 2199 _printf_("list of vertices on bed: "<<values[0]<<" "<<values[1]<<" "<<values[2]); 2200 _error_("Could not find 2 vertices on bed"); 2201 } 2202 /*}}}*/ 2184 2203 /*FUNCTION Tria::IsFloating {{{*/ 2185 2204 bool Tria::IsFloating(){ … … 2408 2427 2409 2428 /*clean-up*/ 2429 delete gauss; 2430 } 2431 /*}}}*/ 2432 /*FUNCTION Tria::ResetCoordinateSystem{{{*/ 2433 void Tria::ResetCoordinateSystem(void){ 2434 2435 int approximation; 2436 int numindices; 2437 int *indices = NULL; 2438 IssmDouble slope; 2439 IssmDouble xz_plane[6]; 2440 2441 /*For FS only: we want the CS to be tangential to the bedrock*/ 2442 inputs->GetInputValue(&approximation,ApproximationEnum); 2443 if(IsFloating() || !HasEdgeOnBed() || approximation!=FSApproximationEnum) return; 2444 2445 /*Get number of nodes for velocity only and base*/ 2446 int index = this->EdgeOnBedIndex(); 2447 NodeOnEdgeIndices(&numindices,&indices,index,this->VelocityInterpolation()); 2448 2449 /*Get inputs*/ 2450 Input* slope_input=inputs->GetInput(BedSlopeXEnum); _assert_(slope_input); 2451 2452 /*Loop over basal nodes and update their CS*/ 2453 GaussTria* gauss = new GaussTria(); 2454 for(int i=0;i<numindices;i++){//FIXME 2455 2456 2457 gauss->GaussNode(this->VelocityInterpolation(),indices[i]); 2458 2459 slope_input->GetInputValue(&slope,gauss); 2460 2461 IssmDouble theta = atan(slope); 2462 2463 /*New X axis New Z axis*/ 2464 xz_plane[0]=cos(theta); xz_plane[3]=0.; 2465 xz_plane[1]=sin(theta); xz_plane[4]=0.; 2466 xz_plane[2]=0.; xz_plane[5]=1.; 2467 2468 XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]); 2469 } 2470 2471 /*cleanup*/ 2472 xDelete<int>(indices); 2410 2473 delete gauss; 2411 2474 } -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16382 r16387 87 87 bool HasEdgeOnBed(); 88 88 void EdgeOnBedIndices(int* pindex1,int* pindex); 89 int EdgeOnBedIndex(); 89 90 bool IsFloating(); 90 91 bool IsNodeOnShelfFromFlags(IssmDouble* flags); … … 106 107 void PatchFill(int* pcount, Patch* patch); 107 108 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 108 void ResetCoordinateSystem(void) {_error_("not implemented yet");};109 void ResetCoordinateSystem(void); 109 110 void SmbGradients(); 110 111 IssmDouble SurfaceArea(void); -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r16373 r16387 1038 1038 } 1039 1039 /*}}}*/ 1040 /*FUNCTION TriaRef::NodeOnEdgeIndices{{{*/ 1041 void TriaRef::NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement){ 1042 1043 /*Output*/ 1044 int numindices; 1045 int* indices = NULL; 1046 1047 switch(finiteelement){ 1048 case P1Enum: case P1DGEnum: case P1bubbleEnum: case P1bubblecondensedEnum: 1049 numindices = 2; 1050 indices = xNew<int>(numindices); 1051 switch(index){ 1052 case 0: 1053 indices[0] = 1; 1054 indices[1] = 2; 1055 break; 1056 case 1: 1057 indices[0] = 2; 1058 indices[1] = 0; 1059 break; 1060 case 2: 1061 indices[0] = 0; 1062 indices[1] = 1; 1063 break; 1064 default: 1065 _error_("Edge index provided ("<<index<<") is not between 0 and 2"); 1066 } 1067 break; 1068 case P2Enum: 1069 numindices = 3; 1070 indices = xNew<int>(numindices); 1071 switch(index){ 1072 case 0: 1073 indices[0] = 1; 1074 indices[1] = 2; 1075 indices[2] = 5; 1076 break; 1077 case 1: 1078 indices[0] = 2; 1079 indices[1] = 0; 1080 indices[2] = 3; 1081 break; 1082 case 2: 1083 indices[0] = 0; 1084 indices[1] = 1; 1085 indices[2] = 4; 1086 break; 1087 default: 1088 _error_("Edge index provided ("<<index<<") is not between 0 and 2"); 1089 } 1090 break; 1091 default: 1092 _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 1093 } 1094 1095 /*Assign output pointer*/ 1096 *pnumindices = numindices; 1097 *pindices = indices; 1098 } 1099 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.h
r16373 r16387 55 55 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss); 56 56 57 void NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement); 57 58 int NumberofNodes(void); 58 59 int NumberofNodes(int finiteelement);
Note:
See TracChangeset
for help on using the changeset viewer.