Changeset 17225
- Timestamp:
- 02/06/14 21:28:00 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp
r17142 r17225 178 178 } 179 179 /*}}}*/ 180 /*FUNCTION PentaRef::GetNodalFunctions{{{*/ 181 void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in){ 180 /*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/ 181 void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){ 182 /*This routine returns the values of the nodal functions at the gaussian point.*/ 183 184 _assert_(basis); 185 GetNodalFunctions(basis,gauss,this->element_type); 186 187 } 188 /*}}}*/ 189 /*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){{{*/ 190 void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){ 182 191 /*This routine returns the values of the nodal functions at the gaussian point.*/ 183 192 … … 191 200 IssmDouble zeta=gauss->coord4; 192 201 193 switch(this->element_type){ 202 switch(finiteelement){ 203 case P0Enum: 204 basis[0]=1.; 205 return; 194 206 case P1Enum: case P1DGEnum: 195 207 basis[0]=gauss->coord1*(1.-zeta)/2.; … … 408 420 409 421 switch(this->element_type){ 422 case P0Enum: 423 /*Zero derivative*/ 424 dbasis[NUMNODESP0*0+0] = 0.; 425 dbasis[NUMNODESP0*1+0] = 0.; 426 dbasis[NUMNODESP0*2+0] = 0.; 427 return; 410 428 case P1Enum: case P1DGEnum: 411 429 /*Nodal function 1*/ … … 996 1014 } 997 1015 /*}}}*/ 998 /*FUNCTION PentaRef::GetInputValue {{{*/1016 /*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){{{*/ 999 1017 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){ 1000 /*P1 interpolation on Gauss point*/ 1001 1002 /*intermediary*/ 1003 IssmDouble basis[6]; 1004 1005 /*nodal functions: */ 1006 GetNodalFunctionsP1(&basis[0],gauss); 1007 1008 /*Assign output pointers:*/ 1009 *pvalue=basis[0]*plist[0]+basis[1]*plist[1]+basis[2]*plist[2]+basis[3]*plist[3]+basis[4]*plist[4]+basis[5]*plist[5]; 1018 1019 GetInputValue(pvalue,plist,gauss,this->element_type); 1020 1021 } 1022 /*}}}*/ 1023 /*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){{{*/ 1024 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){ 1025 1026 /*Output*/ 1027 IssmDouble value =0.; 1028 1029 /*Fetch number of nodes for this finite element*/ 1030 int numnodes = this->NumberofNodes(finiteelement); 1031 1032 /*Get nodal functions*/ 1033 IssmDouble* basis=xNew<IssmDouble>(numnodes); 1034 GetNodalFunctions(basis, gauss,finiteelement); 1035 1036 /*Calculate parameter for this Gauss point*/ 1037 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 1038 1039 /*Assign output pointer*/ 1040 xDelete<IssmDouble>(basis); 1041 *pvalue = value; 1010 1042 1011 1043 } … … 1022 1054 * p is a vector of size 3x1 already allocated. 1023 1055 */ 1024 IssmDouble dbasis[3][NUMNODESP1]; 1025 1026 /*Get nodal funnctions derivatives in actual coordinate system: */ 1027 GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss); 1028 1029 /*Assign output*/ 1030 p[0]=plist[0]*dbasis[0][0]+plist[1]*dbasis[0][1]+plist[2]*dbasis[0][2]+plist[3]*dbasis[0][3]+plist[4]*dbasis[0][4]+plist[5]*dbasis[0][5]; 1031 p[1]=plist[0]*dbasis[1][0]+plist[1]*dbasis[1][1]+plist[2]*dbasis[1][2]+plist[3]*dbasis[1][3]+plist[4]*dbasis[1][4]+plist[5]*dbasis[1][5]; 1032 p[2]=plist[0]*dbasis[2][0]+plist[1]*dbasis[2][1]+plist[2]*dbasis[2][2]+plist[3]*dbasis[2][3]+plist[4]*dbasis[2][4]+plist[5]*dbasis[2][5]; 1033 1034 } 1035 /*}}}*/ 1036 /*FUNCTION PentaRef::NumberofNodes{{{*/ 1056 1057 /*Output*/ 1058 IssmDouble dpx=0.; 1059 IssmDouble dpy=0.; 1060 IssmDouble dpz=0.; 1061 1062 /*Fetch number of nodes for this finite element*/ 1063 int numnodes = this->NumberofNodes(); 1064 1065 /*Get nodal functions derivatives*/ 1066 IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes); 1067 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 1068 1069 /*Calculate parameter for this Gauss point*/ 1070 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i]; 1071 for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i]; 1072 for(int i=0;i<numnodes;i++) dpz += dbasis[2*numnodes+i]*plist[i]; 1073 1074 /*Assign values*/ 1075 xDelete<IssmDouble>(dbasis); 1076 p[0]=dpx; 1077 p[1]=dpy; 1078 p[2]=dpz; 1079 1080 } 1081 /*}}}*/ 1082 /*FUNCTION PentaRef::NumberofNodes(){{{*/ 1037 1083 int PentaRef::NumberofNodes(void){ 1038 1084 1039 switch(this->element_type){ 1085 return this->NumberofNodes(this->element_type); 1086 } 1087 /*}}}*/ 1088 /*FUNCTION PentaRef::NumberofNodes(int finiteelement){{{*/ 1089 int PentaRef::NumberofNodes(int finiteelement){ 1090 1091 switch(finiteelement){ 1040 1092 case P0Enum: return NUMNODESP0; 1041 1093 case P1Enum: return NUMNODESP1; -
issm/trunk-jpl/src/c/classes/Elements/PentaRef.h
r17095 r17225 23 23 /*Numerics*/ 24 24 void GetNodalFunctions(IssmDouble* basis, Gauss* gauss); 25 void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement); 25 26 void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss); 26 27 void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss); … … 43 44 void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss); 44 45 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss); 46 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss,int finiteelement); 45 47 void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss); 46 48 … … 48 50 void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement); 49 51 int NumberofNodes(void); 52 int NumberofNodes(int finiteelement); 50 53 int NumberofNodesVelocity(void); 51 54 int NumberofNodesPressure(void); -
issm/trunk-jpl/src/c/classes/IoModel.cpp
r17175 r17225 1482 1482 for(int i=0;i<elements->Size();i++){ 1483 1483 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 1484 if(!doublearray) element-> InputUpdateFromConstant(default_value,vector_enum);1484 if(!doublearray) element->AddInput(vector_enum,&default_value,P0Enum); 1485 1485 else element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1486 1486 }
Note:
See TracChangeset
for help on using the changeset viewer.