Changeset 18078
- Timestamp:
- 05/31/14 23:49:20 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r18068 r18078 26 26 this->inputs = NULL; 27 27 this->parameters = NULL; 28 this->element_type_list=NULL; 28 29 }/*}}}*/ 29 30 Element::~Element(){/*{{{*/ 31 xDelete<int>(element_type_list); 30 32 delete inputs; 31 33 } -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r18062 r18078 46 46 Matpar *matpar; 47 47 Parameters *parameters; 48 49 int* element_type_list; 50 int element_type; 48 51 49 52 public: -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r18068 r18078 25 25 /*}}}*/ 26 26 Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/ 27 :PentaRef(nummodels) 28 ,ElementHook(nummodels,index+1,NUMVERTICES,iomodel){ 27 :ElementHook(nummodels,index+1,NUMVERTICES,iomodel){ 29 28 30 29 int penta_elements_ids[2]; … … 35 34 36 35 /*id: */ 37 this->id =penta_id;38 this->sid =penta_sid;36 this->id = penta_id; 37 this->sid = penta_sid; 39 38 40 39 /*Build neighbors list*/ … … 57 56 this->matpar = NULL; 58 57 this->verticalneighbors = NULL; 58 59 /*Only allocate pointer*/ 60 this->element_type_list=xNew<int>(nummodels); 59 61 } 60 62 /*}}}*/ … … 869 871 870 872 _assert_(nodes); 871 int numnodes = this->NumberofNodes( );873 int numnodes = this->NumberofNodes(this->element_type); 872 874 873 875 for(int i=0;i<numnodes;i++){ … … 879 881 /*}}}*/ 880 882 int Penta::GetNumberOfNodes(void){/*{{{*/ 881 return this->NumberofNodes( );883 return this->NumberofNodes(this->element_type); 882 884 } 883 885 /*}}}*/ … … 888 890 Node* Penta::GetNode(int node_number){/*{{{*/ 889 891 _assert_(node_number>=0); 890 _assert_(node_number<this->NumberofNodes( ));892 _assert_(node_number<this->NumberofNodes(this->element_type)); 891 893 return this->nodes[node_number]; 892 894 } … … 1169 1171 /*Step3: Vertically integrate A COPY of the original*/ 1170 1172 if(original_input->ObjectEnum()==PentaInputEnum){ 1171 if(((PentaInput*)original_input)-> element_type==P0Enum){1173 if(((PentaInput*)original_input)->interpolation_type==P0Enum){ 1172 1174 original_input->GetInputValue(&p0top1_list[i]); 1173 1175 element_integrated_input= new PentaInput(original_input->InstanceEnum(),p0top1_list,P1Enum); … … 1358 1360 1359 1361 /*Fetch number of nodes for this finite element*/ 1360 int numnodes = this->NumberofNodes( );1362 int numnodes = this->NumberofNodes(this->element_type); 1361 1363 1362 1364 /*Fetch dof list and allocate solution vector*/ … … 1645 1647 1646 1648 _assert_(gauss->Enum()==GaussPentaEnum); 1647 this->GetNodalFunctions(basis,(GaussPenta*)gauss );1649 this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->element_type); 1648 1650 1649 1651 } … … 1652 1654 1653 1655 _assert_(gauss->Enum()==GaussPentaEnum); 1654 this->GetNodalFunctions P1(basis,(GaussPenta*)gauss);1656 this->GetNodalFunctions(basis,(GaussPenta*)gauss,P1Enum); 1655 1657 1656 1658 } … … 1659 1661 1660 1662 _assert_(gauss->Enum()==GaussPentaEnum); 1661 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss );1663 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss,this->element_type); 1662 1664 1663 1665 } … … 1666 1668 1667 1669 _assert_(gauss->Enum()==GaussPentaEnum); 1668 this->GetNodalFunctions P1Derivatives(dbasis,xyz_list,(GaussPenta*)gauss);1670 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss,P1Enum); 1669 1671 1670 1672 } … … 1673 1675 1674 1676 _assert_(gauss->Enum()==GaussPentaEnum); 1675 this->GetNodalFunctions MINIDerivatives(dbasis,xyz_list,(GaussPenta*)gauss);1677 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss,P1bubbleEnum); 1676 1678 1677 1679 } … … 2103 2105 2104 2106 /*Recover element type*/ 2105 this-> SetElementType(finiteelement_type,analysis_counter);2107 this->element_type_list[analysis_counter]=finiteelement_type; 2106 2108 2107 2109 /*Recover vertices ids needed to initialize inputs*/ … … 2400 2402 2401 2403 GaussPenta* gauss=new GaussPenta(); 2402 for(int iv=0;iv<this->NumberofNodes( );iv++){2404 for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){ 2403 2405 gauss->GaussNode(this->element_type,iv); 2404 2406 onbase->GetInputValue(&isonbase,gauss); … … 2438 2440 /*}}}*/ 2439 2441 void Penta::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 2440 PentaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss );2442 PentaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss,P1Enum); 2441 2443 } 2442 2444 /*}}}*/ … … 2476 2478 /*}}}*/ 2477 2479 int Penta::VelocityInterpolation(void){/*{{{*/ 2478 return PentaRef::VelocityInterpolation( );2480 return PentaRef::VelocityInterpolation(this->element_type); 2479 2481 } 2480 2482 /*}}}*/ 2481 2483 int Penta::PressureInterpolation(void){/*{{{*/ 2482 return PentaRef::PressureInterpolation( );2484 return PentaRef::PressureInterpolation(this->element_type); 2483 2485 } 2484 2486 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp
r18075 r18078 28 28 /*Object constructors and destructor*/ 29 29 PentaRef::PentaRef(){/*{{{*/ 30 this->element_type_list=NULL;31 }32 /*}}}*/33 PentaRef::PentaRef(const int nummodels){/*{{{*/34 35 /*Only allocate pointer*/36 element_type_list=xNew<int>(nummodels);37 38 30 } 39 31 /*}}}*/ 40 32 PentaRef::~PentaRef(){/*{{{*/ 41 xDelete<int>(element_type_list);42 }43 /*}}}*/44 45 /*Management*/46 void PentaRef::SetElementType(int type,int type_counter){/*{{{*/47 48 /*initialize element type*/49 this->element_type_list[type_counter]=type;50 33 } 51 34 /*}}}*/ … … 167 150 /*Invert Jacobian matrix: */ 168 151 Matrix3x3Invert(Jinv,&J[0][0]); 169 }170 /*}}}*/171 void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){/*{{{*/172 /*This routine returns the values of the nodal functions at the gaussian point.*/173 174 _assert_(basis);175 GetNodalFunctions(basis,gauss,this->element_type);176 177 152 } 178 153 /*}}}*/ … … 321 296 } 322 297 /*}}}*/ 323 void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/324 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);325 }326 /*}}}*/327 298 void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 328 299 … … 356 327 /*Clean up*/ 357 328 xDelete<IssmDouble>(dbasis_ref); 358 }359 /*}}}*/360 void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){/*{{{*/361 GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);362 329 } 363 330 /*}}}*/ … … 784 751 } 785 752 /*}}}*/ 786 void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/787 788 /*This routine returns the values of the nodal functions derivatives (with respect to the789 * actual coordinate system): */790 791 IssmDouble dbasismini_ref[3][NUMNODESP1b];792 IssmDouble Jinv[3][3];793 794 /*Get derivative values with respect to parametric coordinate system: */795 GetNodalFunctionsMINIDerivativesReference(&dbasismini_ref[0][0], gauss);796 797 /*Get Jacobian invert: */798 GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);799 800 /*Build dbasis:801 *802 * [dhi/dx]= Jinv'*[dhi/dr]803 * [dhi/dy] [dhi/ds]804 * [dhi/dz] [dhi/dzeta]805 */806 807 for(int i=0;i<NUMNODESP1b;i++){808 *(dbasismini+NUMNODESP1b*0+i)=Jinv[0][0]*dbasismini_ref[0][i]+Jinv[0][1]*dbasismini_ref[1][i]+Jinv[0][2]*dbasismini_ref[2][i];809 *(dbasismini+NUMNODESP1b*1+i)=Jinv[1][0]*dbasismini_ref[0][i]+Jinv[1][1]*dbasismini_ref[1][i]+Jinv[1][2]*dbasismini_ref[2][i];810 *(dbasismini+NUMNODESP1b*2+i)=Jinv[2][0]*dbasismini_ref[0][i]+Jinv[2][1]*dbasismini_ref[1][i]+Jinv[2][2]*dbasismini_ref[2][i];811 }812 813 }814 /*}}}*/815 void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){/*{{{*/816 /*This routine returns the values of the nodal functions derivatives (with respect to the817 * natural coordinate system) at the gaussian point. */818 819 /*Cast gauss to GaussPenta*/820 _assert_(gauss_in->Enum()==GaussPentaEnum);821 GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);822 823 824 IssmDouble zeta=gauss->coord4;825 826 /*Nodal function 1*/827 dbasis[NUMNODESP1b*0+0]=-0.5*(1.0-zeta)/2.0;828 dbasis[NUMNODESP1b*1+0]=-SQRT3/6.0*(1.0-zeta)/2.0;829 dbasis[NUMNODESP1b*2+0]=-0.5*gauss->coord1;830 /*Nodal function 2*/831 dbasis[NUMNODESP1b*0+1]=0.5*(1.0-zeta)/2.0;832 dbasis[NUMNODESP1b*1+1]=-SQRT3/6.0*(1.0-zeta)/2.0;833 dbasis[NUMNODESP1b*2+1]=-0.5*gauss->coord2;834 /*Nodal function 3*/835 dbasis[NUMNODESP1b*0+2]=0.;836 dbasis[NUMNODESP1b*1+2]=SQRT3/3.0*(1.0-zeta)/2.0;837 dbasis[NUMNODESP1b*2+2]=-0.5*gauss->coord3;838 /*Nodal function 4*/839 dbasis[NUMNODESP1b*0+3]=-0.5*(1.0+zeta)/2.0;840 dbasis[NUMNODESP1b*1+3]=-SQRT3/6.0*(1.0+zeta)/2.0;841 dbasis[NUMNODESP1b*2+3]=0.5*gauss->coord1;842 /*Nodal function 5*/843 dbasis[NUMNODESP1b*0+4]=0.5*(1.0+zeta)/2.0;844 dbasis[NUMNODESP1b*1+4]=-SQRT3/6.0*(1.0+zeta)/2.0;845 dbasis[NUMNODESP1b*2+4]=0.5*gauss->coord2;846 /*Nodal function 6*/847 dbasis[NUMNODESP1b*0+5]=0.;848 dbasis[NUMNODESP1b*1+5]=SQRT3/3.0*(1.0+zeta)/2.0;849 dbasis[NUMNODESP1b*2+5]=0.5*gauss->coord3;850 /*Nodal function 7*/851 dbasis[NUMNODESP1b*0+6]=27.*(1.+zeta)*(1.-zeta)*(-.5*gauss->coord2*gauss->coord3 + .5*gauss->coord1*gauss->coord3);852 dbasis[NUMNODESP1b*1+6]=27.*(1.+zeta)*(1.-zeta)*SQRT3*(-1./6.*gauss->coord2*gauss->coord3 - 1./6.*gauss->coord1*gauss->coord3 +1./3.*gauss->coord1*gauss->coord2);853 dbasis[NUMNODESP1b*2+6]=27*gauss->coord1*gauss->coord2*gauss->coord3*(-2.0*zeta);854 }855 /*}}}*/856 void PentaRef::GetNodalFunctionsP1(IssmDouble* basis, Gauss* gauss_in){/*{{{*/857 /*This routine returns the values of the nodal functions at the gaussian point.*/858 859 /*Cast gauss to GaussPenta*/860 _assert_(gauss_in->Enum()==GaussPentaEnum);861 GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);862 863 basis[0]=gauss->coord1*(1-gauss->coord4)/2.0;864 basis[1]=gauss->coord2*(1-gauss->coord4)/2.0;865 basis[2]=gauss->coord3*(1-gauss->coord4)/2.0;866 basis[3]=gauss->coord1*(1+gauss->coord4)/2.0;867 basis[4]=gauss->coord2*(1+gauss->coord4)/2.0;868 basis[5]=gauss->coord3*(1+gauss->coord4)/2.0;869 870 }871 /*}}}*/872 void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/873 874 /*This routine returns the values of the nodal functions derivatives (with respect to the875 * actual coordinate system): */876 IssmDouble dbasis_ref[NDOF3][NUMNODESP1];877 IssmDouble Jinv[NDOF3][NDOF3];878 879 /*Get derivative values with respect to parametric coordinate system: */880 GetNodalFunctionsP1DerivativesReference(&dbasis_ref[0][0], gauss);881 882 /*Get Jacobian invert: */883 GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);884 885 /*Build basis function derivatives:886 *887 * [dhi/dx]= Jinv*[dhi/dr]888 * [dhi/dy] [dhi/ds]889 * [dhi/dz] [dhi/dn]890 */891 892 for (int i=0;i<NUMNODESP1;i++){893 *(dbasis+NUMNODESP1*0+i)=Jinv[0][0]*dbasis_ref[0][i]+Jinv[0][1]*dbasis_ref[1][i]+Jinv[0][2]*dbasis_ref[2][i];894 *(dbasis+NUMNODESP1*1+i)=Jinv[1][0]*dbasis_ref[0][i]+Jinv[1][1]*dbasis_ref[1][i]+Jinv[1][2]*dbasis_ref[2][i];895 *(dbasis+NUMNODESP1*2+i)=Jinv[2][0]*dbasis_ref[0][i]+Jinv[2][1]*dbasis_ref[1][i]+Jinv[2][2]*dbasis_ref[2][i];896 }897 898 }899 /*}}}*/900 void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){/*{{{*/901 902 /*This routine returns the values of the nodal functions derivatives (with respect to the903 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */904 905 /*Cast gauss to GaussPenta*/906 _assert_(gauss_in->Enum()==GaussPentaEnum);907 GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);908 909 IssmDouble zeta=gauss->coord4;910 911 /*Nodal function 1*/912 dbasis[NUMNODESP1*0+0]=-0.5*(1.0-zeta)/2.0;913 dbasis[NUMNODESP1*1+0]=-SQRT3/6.0*(1.0-zeta)/2.0;914 dbasis[NUMNODESP1*2+0]=-0.5*gauss->coord1;915 /*Nodal function 2*/916 dbasis[NUMNODESP1*0+1]=0.5*(1.0-zeta)/2.0;917 dbasis[NUMNODESP1*1+1]=-SQRT3/6.0*(1.0-zeta)/2.0;918 dbasis[NUMNODESP1*2+1]=-0.5*gauss->coord2;919 /*Nodal function 3*/920 dbasis[NUMNODESP1*0+2]=0.;921 dbasis[NUMNODESP1*1+2]=SQRT3/3.0*(1.0-zeta)/2.0;922 dbasis[NUMNODESP1*2+2]=-0.5*gauss->coord3;923 /*Nodal function 4*/924 dbasis[NUMNODESP1*0+3]=-0.5*(1.0+zeta)/2.0;925 dbasis[NUMNODESP1*1+3]=-SQRT3/6.0*(1.0+zeta)/2.0;926 dbasis[NUMNODESP1*2+3]=0.5*gauss->coord1;927 /*Nodal function 5*/928 dbasis[NUMNODESP1*0+4]=0.5*(1.0+zeta)/2.0;929 dbasis[NUMNODESP1*1+4]=-SQRT3/6.0*(1.0+zeta)/2.0;930 dbasis[NUMNODESP1*2+4]=0.5*gauss->coord2;931 /*Nodal function 6*/932 dbasis[NUMNODESP1*0+5]=0.;933 dbasis[NUMNODESP1*1+5]=SQRT3/3.0*(1.0+zeta)/2.0;934 dbasis[NUMNODESP1*2+5]=0.5*gauss->coord3;935 }936 /*}}}*/937 753 void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 938 754 /*This routine returns the values of the nodal functions at the gaussian point.*/ … … 960 776 } 961 777 /*}}}*/ 962 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){/*{{{*/963 964 GetInputValue(pvalue,plist,gauss,this->element_type);965 966 }967 /*}}}*/968 778 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){/*{{{*/ 969 779 … … 987 797 } 988 798 /*}}}*/ 989 void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss ){/*{{{*/799 void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 990 800 /*From node values of parameter p (p_list[0], p_list[1], p_list[2], 991 801 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at … … 1004 814 1005 815 /*Fetch number of nodes for this finite element*/ 1006 int numnodes = this->NumberofNodes( );816 int numnodes = this->NumberofNodes(finiteelement); 1007 817 1008 818 /*Get nodal functions derivatives*/ 1009 819 IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes); 1010 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss );820 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement); 1011 821 1012 822 /*Calculate parameter for this Gauss point*/ … … 1021 831 p[2]=dpz; 1022 832 1023 }1024 /*}}}*/1025 int PentaRef::NumberofNodes(void){/*{{{*/1026 1027 return this->NumberofNodes(this->element_type);1028 833 } 1029 834 /*}}}*/ … … 1046 851 case P2xP4Enum: return NUMNODESP2xP4; 1047 852 case P1xP3Enum: return NUMNODESP1xP3; 1048 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");853 default: _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 1049 854 } 1050 855 … … 1052 857 } 1053 858 /*}}}*/ 1054 int PentaRef::VelocityInterpolation( void){/*{{{*/1055 1056 switch( this->element_type){859 int PentaRef::VelocityInterpolation(int fe_stokes){/*{{{*/ 860 861 switch(fe_stokes){ 1057 862 case P1P1Enum: return P1Enum; 1058 863 case P1P1GLSEnum: return P1Enum; … … 1061 866 case TaylorHoodEnum: return P2Enum; 1062 867 case OneLayerP4zEnum: return P2xP4Enum; 1063 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");868 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 1064 869 } 1065 870 … … 1067 872 } 1068 873 /*}}}*/ 1069 int PentaRef::PressureInterpolation( void){/*{{{*/1070 1071 switch( this->element_type){874 int PentaRef::PressureInterpolation(int fe_stokes){/*{{{*/ 875 876 switch(fe_stokes){ 1072 877 case P1P1Enum: return P1Enum; 1073 878 case P1P1GLSEnum: return P1Enum; … … 1076 881 case TaylorHoodEnum: return P1Enum; 1077 882 case OneLayerP4zEnum: return P1Enum; 1078 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");883 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 1079 884 } 1080 885 … … 1082 887 } 1083 888 /*}}}*/ 1084 int PentaRef::TensorInterpolation( void){/*{{{*/1085 1086 switch( this->element_type){889 int PentaRef::TensorInterpolation(int fe_stokes){/*{{{*/ 890 891 switch(fe_stokes){ 1087 892 case XTaylorHoodEnum: return P1DGEnum; 1088 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");893 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 1089 894 } 1090 895 … … 1158 963 break; 1159 964 default: 1160 _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");965 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 1161 966 } 1162 967 … … 1215 1020 break; 1216 1021 default: 1217 _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");1022 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 1218 1023 } 1219 1024 -
issm/trunk-jpl/src/c/classes/Elements/PentaRef.h
r18075 r18078 11 11 12 12 public: 13 int* element_type_list; //P1CG, P1DG, MINI, P2...14 int element_type;15 16 13 PentaRef(); 17 PentaRef(const int nummodels);18 14 ~PentaRef(); 19 15 20 /*Management*/21 void SetElementType(int type,int type_counter);22 23 16 /*Numerics*/ 24 void GetNodalFunctions(IssmDouble* basis, Gauss* gauss);25 17 void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement); 26 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);27 18 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss,int finiteelement); 28 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);29 19 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement); 30 void GetNodalFunctionsP1(IssmDouble* basis, Gauss* gauss);31 void GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss);32 void GetNodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss);33 void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,Gauss* gauss);34 void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,Gauss* gauss);35 20 void GetQuadJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss); 36 21 void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss); … … 40 25 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,Gauss* gauss); 41 26 void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss); 42 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss);43 27 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss,int finiteelement); 44 void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss );28 void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement); 45 29 46 30 void BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement); 47 31 void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement); 48 int NumberofNodes(void);49 32 int NumberofNodes(int finiteelement); 50 int VelocityInterpolation( void);51 int PressureInterpolation( void);52 int TensorInterpolation( void);33 int VelocityInterpolation(int fe_stokes); 34 int PressureInterpolation(int fe_stokes); 35 int TensorInterpolation(int fe_stokes); 53 36 }; 54 37 #endif -
issm/trunk-jpl/src/c/classes/Elements/Seg.cpp
r18062 r18078 20 20 /*Constructors/destructor/copy*/ 21 21 Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/ 22 : SegRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){22 :ElementHook(nummodels,index+1,NUMVERTICES,iomodel){ 23 23 24 24 /*id: */ … … 37 37 this->material = NULL; 38 38 this->matpar = NULL; 39 40 /*Only allocate pointer*/ 41 this->element_type_list=xNew<int>(nummodels); 39 42 } 40 43 /*}}}*/ … … 100 103 }/*}}}*/ 101 104 int Seg::GetNumberOfNodes(void){/*{{{*/ 102 return this->NumberofNodes( );105 return this->NumberofNodes(this->element_type); 103 106 } 104 107 /*}}}*/ … … 177 180 178 181 _assert_(gauss->Enum()==GaussSegEnum); 179 this->GetNodalFunctions(basis,(GaussSeg*)gauss );182 this->GetNodalFunctions(basis,(GaussSeg*)gauss,this->element_type); 180 183 181 184 } … … 184 187 185 188 _assert_(gauss->Enum()==GaussSegEnum); 186 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussSeg*)gauss );189 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussSeg*)gauss,this->element_type); 187 190 188 191 } -
issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp
r17962 r18078 21 21 /*Object constructors and destructor*/ 22 22 SegRef::SegRef(){/*{{{*/ 23 this->element_type_list=NULL;24 }25 /*}}}*/26 SegRef::SegRef(const int nummodels){/*{{{*/27 28 /*Only allocate pointer*/29 element_type_list=xNew<int>(nummodels);30 31 23 } 32 24 /*}}}*/ 33 25 SegRef::~SegRef(){/*{{{*/ 34 xDelete<int>(element_type_list);35 }36 /*}}}*/37 38 /*Management*/39 void SegRef::SetElementType(int type,int type_counter){/*{{{*/40 41 /*initialize element type*/42 this->element_type_list[type_counter]=type;43 26 } 44 27 /*}}}*/ 45 28 46 29 /*Reference Element numerics*/ 47 void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){/*{{{*/48 /*This routine returns the values of the nodal functions at the gaussian point.*/49 50 _assert_(basis);51 52 GetNodalFunctions(basis,gauss,this->element_type);53 }54 /*}}}*/55 30 void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){/*{{{*/ 56 31 /*This routine returns the values of the nodal functions at the gaussian point.*/ … … 74 49 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 75 50 } 76 }77 /*}}}*/78 void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){/*{{{*/79 80 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);81 82 51 } 83 52 /*}}}*/ … … 107 76 /*Clean up*/ 108 77 xDelete<IssmDouble>(dbasis_ref); 109 110 }111 /*}}}*/112 void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){/*{{{*/113 /*This routine returns the values of the nodal functions derivatives (with respect to the114 * natural coordinate system) at the gaussian point. */115 116 GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);117 78 118 79 } … … 147 108 } 148 109 /*}}}*/ 149 void SegRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss ){/*{{{*/110 void SegRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){/*{{{*/ 150 111 151 112 /*From node values of parameter p (plist[0],plist[1]), return parameter derivative value at gaussian … … 160 121 161 122 /*Fetch number of nodes for this finite element*/ 162 int numnodes = this->NumberofNodes( );123 int numnodes = this->NumberofNodes(finiteelement); 163 124 164 125 /*Get nodal functions derivatives*/ 165 126 IssmDouble* dbasis=xNew<IssmDouble>(1*numnodes); 166 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss );127 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement); 167 128 168 129 /*Calculate parameter for this Gauss point*/ … … 175 136 } 176 137 /*}}}*/ 177 void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){/*{{{*/178 179 GetInputValue(p,plist,gauss,this->element_type);180 }181 /*}}}*/182 138 void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){/*{{{*/ 183 139 … … 230 186 /*Invert Jacobian matrix: */ 231 187 *Jinv = 1./J; 232 }233 /*}}}*/234 int SegRef::NumberofNodes(void){/*{{{*/235 236 return this->NumberofNodes(this->element_type);237 188 } 238 189 /*}}}*/ … … 243 194 case P1Enum: return NUMNODESP1; 244 195 case P1DGEnum: return NUMNODESP1; 245 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");196 default: _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 246 197 } 247 198 -
issm/trunk-jpl/src/c/classes/Elements/SegRef.h
r17926 r18078 13 13 14 14 public: 15 int* element_type_list;16 int element_type;17 18 15 SegRef(); 19 SegRef(const int nummodels);20 16 ~SegRef(); 21 17 22 /*Management*/23 void SetElementType(int type,int type_counter);24 18 void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss); 25 19 void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussSeg* gauss); 26 20 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss); 27 void GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss);28 21 void GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement); 29 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss);30 22 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement); 31 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss);32 23 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); 24 void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement); 35 25 void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement); 36 37 int NumberofNodes(void);38 26 int NumberofNodes(int finiteelement); 39 27 }; -
issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp
r17962 r18078 21 21 /*Constructors/destructor/copy*/ 22 22 Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/ 23 : TetraRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){23 :ElementHook(nummodels,index+1,NUMVERTICES,iomodel){ 24 24 25 25 /*id: */ … … 38 38 this->material = NULL; 39 39 this->matpar = NULL; 40 41 /*Only allocate pointer*/ 42 this->element_type_list=xNew<int>(nummodels); 40 43 } 41 44 /*}}}*/ … … 202 205 203 206 _assert_(nodes); 204 int numnodes = this->NumberofNodes( );207 int numnodes = this->NumberofNodes(this->element_type); 205 208 206 209 for(int i=0;i<numnodes;i++){ … … 212 215 /*}}}*/ 213 216 int Tetra::GetNumberOfNodes(void){/*{{{*/ 214 return this->NumberofNodes( );217 return this->NumberofNodes(this->element_type); 215 218 } 216 219 /*}}}*/ … … 400 403 401 404 /*Fetch number of nodes for this finite element*/ 402 int numnodes = this->NumberofNodes( );405 int numnodes = this->NumberofNodes(this->element_type); 403 406 404 407 /*Fetch dof list and allocate solution vector*/ … … 502 505 503 506 _assert_(gauss->Enum()==GaussTetraEnum); 504 this->GetNodalFunctions(basis,(GaussTetra*)gauss );507 this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->element_type); 505 508 506 509 } … … 530 533 531 534 _assert_(gauss->Enum()==GaussTetraEnum); 532 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss );535 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->element_type); 533 536 534 537 } … … 788 791 789 792 /*Recover element type*/ 790 this-> SetElementType(finiteelement_type,analysis_counter);793 this->element_type_list[analysis_counter]=finiteelement_type; 791 794 792 795 /*Recover vertices ids needed to initialize inputs*/ … … 872 875 /*}}}*/ 873 876 int Tetra::VelocityInterpolation(void){/*{{{*/ 874 return TetraRef::VelocityInterpolation( );877 return TetraRef::VelocityInterpolation(this->element_type); 875 878 } 876 879 /*}}}*/ … … 892 895 /*}}}*/ 893 896 int Tetra::PressureInterpolation(void){/*{{{*/ 894 return TetraRef::PressureInterpolation( );897 return TetraRef::PressureInterpolation(this->element_type); 895 898 } 896 899 /*}}}*/ 897 900 int Tetra::TensorInterpolation(void){/*{{{*/ 898 return TetraRef::TensorInterpolation( );901 return TetraRef::TensorInterpolation(this->element_type); 899 902 } 900 903 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp
r17962 r18078 4 4 5 5 /*Headers:*/ 6 /*{{{*/ /*{{{*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 23 23 /*Object constructors and destructor*/ 24 24 TetraRef::TetraRef(){/*{{{*/ 25 this->element_type_list=NULL;26 }27 /*}}}*/28 TetraRef::TetraRef(const int nummodels){/*{{{*/29 30 /*Only allocate pointer*/31 element_type_list=xNew<int>(nummodels);32 33 25 } 34 26 /*}}}*/ 35 27 TetraRef::~TetraRef(){/*{{{*/ 36 xDelete<int>(element_type_list);37 }38 /*}}}*/39 40 /*Management*/41 void TetraRef::SetElementType(int type,int type_counter){/*{{{*/42 43 /*initialize element type*/44 this->element_type_list[type_counter]=type;45 28 } 46 29 /*}}}*/ 47 30 48 31 /*Reference Element numerics*/ 49 void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){/*{{{*/50 /*This routine returns the values of the nodal functions at the gaussian point.*/51 _assert_(basis);52 GetNodalFunctions(basis,gauss,this->element_type);53 }54 /*}}}*/55 32 void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){/*{{{*/ 56 33 /*This routine returns the values of the nodal functions at the gaussian point.*/ … … 96 73 } 97 74 /*}}}*/ 98 void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){/*{{{*/99 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);100 }101 /*}}}*/102 75 void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){/*{{{*/ 103 76 … … 133 106 } 134 107 /*}}}*/ 135 void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){/*{{{*/136 /*This routine returns the values of the nodal functions derivatives (with respect to the137 * natural coordinate system) at the gaussian point. */138 139 GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);140 141 }142 /*}}}*/143 108 void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){/*{{{*/ 144 109 /*This routine returns the values of the nodal functions derivatives (with respect to the … … 239 204 } 240 205 /*}}}*/ 241 void TetraRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss ){/*{{{*/206 void TetraRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){/*{{{*/ 242 207 /*From node values of parameter p (p_list[0], p_list[1], p_list[2], 243 208 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at … … 256 221 257 222 /*Fetch number of nodes for this finite element*/ 258 int numnodes = this->NumberofNodes( );223 int numnodes = this->NumberofNodes(finiteelement); 259 224 260 225 /*Get nodal functions derivatives*/ 261 226 IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes); 262 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss );227 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement); 263 228 264 229 /*Calculate parameter for this Gauss point*/ … … 272 237 p[1]=dpy; 273 238 p[2]=dpz; 274 }275 /*}}}*/276 void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){/*{{{*/277 278 GetInputValue(p,plist,gauss,this->element_type);279 239 } 280 240 /*}}}*/ … … 374 334 /*Invert Jacobian matrix: */ 375 335 Matrix3x3Invert(Jinv,&J[0][0]); 376 }377 /*}}}*/378 int TetraRef::NumberofNodes(void){/*{{{*/379 380 return this->NumberofNodes(this->element_type);381 336 } 382 337 /*}}}*/ … … 395 350 case MINIEnum: return NUMNODESP1b+NUMNODESP1; 396 351 case TaylorHoodEnum: return NUMNODESP2+NUMNODESP1; 397 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");352 default: _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 398 353 } 399 354 … … 401 356 } 402 357 /*}}}*/ 403 int TetraRef::VelocityInterpolation( void){/*{{{*/404 405 switch( this->element_type){358 int TetraRef::VelocityInterpolation(int fe_stokes){/*{{{*/ 359 360 switch(fe_stokes){ 406 361 case P1P1Enum: return P1Enum; 407 362 case P1P1GLSEnum: return P1Enum; … … 409 364 case MINIEnum: return P1bubbleEnum; 410 365 case TaylorHoodEnum: return P2Enum; 411 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");366 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 412 367 } 413 368 … … 415 370 } 416 371 /*}}}*/ 417 int TetraRef::PressureInterpolation( void){/*{{{*/418 419 switch( this->element_type){372 int TetraRef::PressureInterpolation(int fe_stokes){/*{{{*/ 373 374 switch(fe_stokes){ 420 375 case P1P1Enum: return P1Enum; 421 376 case P1P1GLSEnum: return P1Enum; … … 423 378 case MINIEnum: return P1Enum; 424 379 case TaylorHoodEnum: return P1Enum; 425 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");380 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 426 381 } 427 382 428 383 return -1; 429 384 }/*}}}*/ 430 int TetraRef::TensorInterpolation( void){/*{{{*/385 int TetraRef::TensorInterpolation(int fe_stokes){/*{{{*/ 431 386 /*This routine returns the values of the nodal functions at the gaussian point.*/ 432 387 433 switch( this->element_type){388 switch(fe_stokes){ 434 389 case XTaylorHoodEnum: return P1DGEnum; 435 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");436 } 437 } 438 /*}}}*/ 390 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 391 } 392 } 393 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/TetraRef.h
r17926 r18078 13 13 14 14 public: 15 int* element_type_list;16 int element_type;17 18 15 TetraRef(); 19 TetraRef(const int nummodels);20 16 ~TetraRef(); 21 17 22 /*Management*/23 void SetElementType(int type,int type_counter);24 18 void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss); 25 19 void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTetra* gauss); 26 20 void GetJacobianDeterminantFace(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTetra* gauss); 27 21 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss); 28 void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);29 22 void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement); 30 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss);31 23 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement); 32 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss);33 24 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement); 34 void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss); 35 void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss); 25 void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement); 36 26 void GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement); 37 27 38 int NumberofNodes(void);39 28 int NumberofNodes(int finiteelement); 40 int VelocityInterpolation( void);41 int PressureInterpolation( void);42 int TensorInterpolation( void);29 int VelocityInterpolation(int fe_stokes); 30 int PressureInterpolation(int fe_stokes); 31 int TensorInterpolation(int fe_stokes); 43 32 }; 44 33 #endif -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r18068 r18078 25 25 /*Constructors/destructor/copy*/ 26 26 Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/ 27 : TriaRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){27 :ElementHook(nummodels,index+1,NUMVERTICES,iomodel){ 28 28 29 29 /*id: */ … … 42 42 this->material = NULL; 43 43 this->matpar = NULL; 44 this->element_type_list=xNew<int>(nummodels); 44 45 } 45 46 /*}}}*/ … … 900 901 /*}}}*/ 901 902 int Tria::GetNumberOfNodes(void){/*{{{*/ 902 return this->NumberofNodes( );903 return this->NumberofNodes(this->element_type); 903 904 } 904 905 /*}}}*/ … … 921 922 Node* Tria::GetNode(int node_number){/*{{{*/ 922 923 _assert_(node_number>=0); 923 _assert_(node_number<this->NumberofNodes( ));924 _assert_(node_number<this->NumberofNodes(this->element_type)); 924 925 return this->nodes[node_number]; 925 926 … … 1059 1060 1060 1061 /*Fetch number of nodes for this finite element*/ 1061 int numnodes = this->NumberofNodes( );1062 int numnodes = this->NumberofNodes(this->element_type); 1062 1063 1063 1064 /*Fetch dof list and allocate solution vector*/ … … 1110 1111 1111 1112 /*Get number of nodes and dof list: */ 1112 numnodes = this->NumberofNodes( );1113 numnodes = this->NumberofNodes(this->element_type); 1113 1114 values = xNew<IssmDouble>(numnodes); 1114 1115 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); … … 1124 1125 1125 1126 /*Get number of nodes and dof list: */ 1126 numnodes = this->NumberofNodes( );1127 numnodes = this->NumberofNodes(this->element_type); 1127 1128 values = xNew<IssmDouble>(numnodes); 1128 1129 … … 1453 1454 1454 1455 _assert_(gauss->Enum()==GaussTriaEnum); 1455 this->GetNodalFunctions(basis,(GaussTria*)gauss );1456 this->GetNodalFunctions(basis,(GaussTria*)gauss,this->element_type); 1456 1457 1457 1458 } … … 1467 1468 1468 1469 _assert_(gauss->Enum()==GaussTriaEnum); 1469 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss );1470 this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,this->element_type); 1470 1471 1471 1472 } … … 1573 1574 /*}}}*/ 1574 1575 int Tria::VelocityInterpolation(void){/*{{{*/ 1575 return TriaRef::VelocityInterpolation( );1576 return TriaRef::VelocityInterpolation(this->element_type); 1576 1577 } 1577 1578 /*}}}*/ 1578 1579 int Tria::PressureInterpolation(void){/*{{{*/ 1579 return TriaRef::PressureInterpolation( );1580 return TriaRef::PressureInterpolation(this->element_type); 1580 1581 } 1581 1582 /*}}}*/ 1582 1583 int Tria::TensorInterpolation(void){/*{{{*/ 1583 return TriaRef::TensorInterpolation( );1584 return TriaRef::TensorInterpolation(this->element_type); 1584 1585 } 1585 1586 /*}}}*/ … … 1890 1891 1891 1892 /*Recover element type*/ 1892 this-> SetElementType(finiteelement_type,analysis_counter);1893 this->element_type_list[analysis_counter]=finiteelement_type; 1893 1894 1894 1895 /*Recover nodes ids needed to initialize the node hook.*/ … … 1988 1989 1989 1990 GaussTria* gauss=new GaussTria(); 1990 for(int iv=0;iv<this->NumberofNodes( );iv++){1991 for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){ 1991 1992 gauss->GaussNode(this->element_type,iv); 1992 1993 onbase->GetInputValue(&isonbase,gauss); … … 2027 2028 /*}}}*/ 2028 2029 void Tria::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 2029 TriaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss );2030 TriaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss,P1Enum); 2030 2031 } 2031 2032 /*}}}*/ … … 2828 2829 2829 2830 /*Fetch number of nodes for this finite element*/ 2830 int numnodes = this->NumberofNodes( );2831 int numnodes = this->NumberofNodes(this->element_type); 2831 2832 2832 2833 /*Fetch dof list and allocate solution vector*/ -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r18060 r18078 23 23 /*Object constructors and destructor*/ 24 24 TriaRef::TriaRef(){/*{{{*/ 25 this->element_type_list=NULL;26 }27 /*}}}*/28 TriaRef::TriaRef(const int nummodels){/*{{{*/29 30 /*Only allocate pointer*/31 element_type_list=xNew<int>(nummodels);32 33 25 } 34 26 /*}}}*/ 35 27 TriaRef::~TriaRef(){/*{{{*/ 36 xDelete<int>(element_type_list);37 }38 /*}}}*/39 40 /*Management*/41 void TriaRef::SetElementType(int type,int type_counter){/*{{{*/42 43 /*initialize element type*/44 this->element_type_list[type_counter]=type;45 28 } 46 29 /*}}}*/ 47 30 48 31 /*Reference Element numerics*/ 49 void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2 ){/*{{{*/32 void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2,int finiteelement){/*{{{*/ 50 33 /*Compute B matrix. B=[phi1 phi2 -phi3 -phi4] 51 34 * … … 56 39 57 40 /*Fetch number of nodes for this finite element*/ 58 int numnodes = this->NumberofNodes( );41 int numnodes = this->NumberofNodes(finiteelement); 59 42 60 43 /*Get nodal functions*/ 61 44 IssmDouble* basis=xNew<IssmDouble>(numnodes); 62 GetNodalFunctions(basis,gauss );45 GetNodalFunctions(basis,gauss,finiteelement); 63 46 64 47 /*Build B for this segment*/ … … 72 55 } 73 56 /*}}}*/ 74 void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2 ){/*{{{*/57 void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2,int finiteelement){/*{{{*/ 75 58 /*Compute Bprime matrix. Bprime=[phi1 phi2 phi3 phi4] 76 59 * … … 81 64 82 65 /*Fetch number of nodes for this finite element*/ 83 int numnodes = this->NumberofNodes( );66 int numnodes = this->NumberofNodes(finiteelement); 84 67 85 68 /*Get nodal functions*/ 86 69 IssmDouble* basis=xNew<IssmDouble>(numnodes); 87 GetNodalFunctions(basis,gauss );70 GetNodalFunctions(basis,gauss,finiteelement); 88 71 89 72 /*Build B'*/ … … 152 135 /*Invert Jacobian matrix: */ 153 136 Matrix2x2Invert(Jinv,&J[0][0]); 154 155 }156 /*}}}*/157 void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){/*{{{*/158 /*This routine returns the values of the nodal functions at the gaussian point.*/159 160 _assert_(basis);161 GetNodalFunctions(basis,gauss,this->element_type);162 137 163 138 } … … 204 179 } 205 180 /*}}}*/ 206 void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2 ){/*{{{*/181 void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2,int finiteelement){/*{{{*/ 207 182 /*This routine returns the values of the nodal functions at the gaussian point.*/ 208 183 … … 211 186 212 187 /*Fetch number of nodes for this finite element*/ 213 int numnodes = this->NumberofNodes( );188 int numnodes = this->NumberofNodes(finiteelement); 214 189 215 190 /*Get nodal functions*/ 216 191 IssmDouble* triabasis=xNew<IssmDouble>(numnodes); 217 GetNodalFunctions(triabasis,gauss );218 219 switch( this->element_type){192 GetNodalFunctions(triabasis,gauss,finiteelement); 193 194 switch(finiteelement){ 220 195 case P1Enum: case P1DGEnum: 221 196 basis[0]=triabasis[index1]; … … 236 211 return; 237 212 default: 238 _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");213 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 239 214 } 240 215 241 216 /*Clean up*/ 242 217 xDelete<IssmDouble>(triabasis); 243 }244 /*}}}*/245 void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/246 247 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);248 249 218 } 250 219 /*}}}*/ … … 276 245 /*Clean up*/ 277 246 xDelete<IssmDouble>(dbasis_ref); 278 279 }280 /*}}}*/281 void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){/*{{{*/282 /*This routine returns the values of the nodal functions derivatives (with respect to the283 * natural coordinate system) at the gaussian point. */284 285 GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);286 247 287 248 } … … 354 315 } 355 316 /*}}}*/ 356 void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss ){/*{{{*/317 void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 357 318 358 319 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian … … 369 330 370 331 /*Fetch number of nodes for this finite element*/ 371 int numnodes = this->NumberofNodes( );332 int numnodes = this->NumberofNodes(finiteelement); 372 333 373 334 /*Get nodal functions derivatives*/ 374 335 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 375 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss );336 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement); 376 337 377 338 /*Calculate parameter for this Gauss point*/ … … 386 347 } 387 348 /*}}}*/ 388 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){/*{{{*/389 390 GetInputValue(p,plist,gauss,this->element_type);391 }392 /*}}}*/393 349 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){/*{{{*/ 394 350 … … 409 365 xDelete<IssmDouble>(basis); 410 366 *p = value; 411 }412 /*}}}*/413 int TriaRef::NumberofNodes(void){/*{{{*/414 415 return this->NumberofNodes(this->element_type);416 367 } 417 368 /*}}}*/ … … 431 382 case TaylorHoodEnum: return NUMNODESP2+NUMNODESP1; 432 383 case XTaylorHoodEnum: return NUMNODESP2+NUMNODESP1; 433 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");384 default: _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 434 385 } 435 386 … … 437 388 } 438 389 /*}}}*/ 439 int TriaRef::VelocityInterpolation( void){/*{{{*/440 441 switch( this->element_type){390 int TriaRef::VelocityInterpolation(int fe_stokes){/*{{{*/ 391 392 switch(fe_stokes){ 442 393 case P1P1Enum: return P1Enum; 443 394 case P1P1GLSEnum: return P1Enum; … … 446 397 case TaylorHoodEnum: return P2Enum; 447 398 case XTaylorHoodEnum: return P2Enum; 448 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");399 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 449 400 } 450 401 … … 452 403 } 453 404 /*}}}*/ 454 int TriaRef::PressureInterpolation( void){/*{{{*/455 456 switch( this->element_type){405 int TriaRef::PressureInterpolation(int fe_stokes){/*{{{*/ 406 407 switch(fe_stokes){ 457 408 case P1P1Enum: return P1Enum; 458 409 case P1P1GLSEnum: return P1Enum; … … 461 412 case TaylorHoodEnum: return P1Enum; 462 413 case XTaylorHoodEnum: return P1Enum; 463 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");414 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 464 415 } 465 416 … … 467 418 } 468 419 /*}}}*/ 469 int TriaRef::TensorInterpolation( void){/*{{{*/420 int TriaRef::TensorInterpolation(int fe_stokes){/*{{{*/ 470 421 /*This routine returns the values of the nodal functions at the gaussian point.*/ 471 422 472 switch( this->element_type){423 switch(fe_stokes){ 473 424 case XTaylorHoodEnum: return P1DGEnum; 474 default: _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");425 default: _error_("Element type "<<EnumToStringx(fe_stokes)<<" not supported yet"); 475 426 } 476 427 } … … 527 478 break; 528 479 default: 529 _error_("Element type "<<EnumToStringx( this->element_type)<<" not supported yet");480 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 530 481 } 531 482 -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.h
r17875 r18078 12 12 13 13 public: 14 int* element_type_list; //P1CG, P1DG, MINI, P2...15 int element_type;16 17 14 TriaRef(); 18 TriaRef(const int nummodels);19 15 ~TriaRef(); 20 21 /*Management*/22 void SetElementType(int type,int type_counter);23 16 24 17 /*Numerics*/ … … 27 20 void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss); 28 21 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,Gauss* gauss); 29 void GetNodalFunctions(IssmDouble* basis,Gauss* gauss);30 22 void GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement); 31 void GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss, int index1,int index2); 32 void GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2); 33 void GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2); 34 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss); 23 void GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss, int index1,int index2,int finiteelement); 24 void GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2,int finiteelement); 25 void GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2,int finiteelement); 35 26 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement); 36 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);37 27 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement); 38 void GetInputValue(IssmDouble* pp, IssmDouble* plist, Gauss* gauss);39 28 void GetInputValue(IssmDouble* pp, IssmDouble* plist, Gauss* gauss,int finiteelement); 40 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss );29 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement); 41 30 42 31 void NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement); 43 int NumberofNodes(void);44 32 int NumberofNodes(int finiteelement); 45 int VelocityInterpolation( void);46 int PressureInterpolation( void);47 int TensorInterpolation( void);33 int VelocityInterpolation(int fe_stokes); 34 int PressureInterpolation(int fe_stokes); 35 int TensorInterpolation(int fe_stokes); 48 36 }; 49 37 #endif -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
r18064 r18078 17 17 } 18 18 /*}}}*/ 19 PentaInput::PentaInput(int in_enum_type,IssmDouble* in_values,int element_type_in)/*{{{*/ 20 :PentaRef(1) 21 { 22 23 /*Set PentaRef*/ 24 this->SetElementType(element_type_in,0); 25 this->element_type=element_type_in; 19 PentaInput::PentaInput(int in_enum_type,IssmDouble* in_values,int interpolation_type_in){/*{{{*/ 26 20 27 21 /*Set Enum*/ 28 22 enum_type=in_enum_type; 23 this->interpolation_type=interpolation_type_in; 29 24 30 25 /*Set values*/ 31 this->values=xNew<IssmDouble>(this->NumberofNodes( ));32 for(int i=0;i<this->NumberofNodes( );i++) values[i]=in_values[i];26 this->values=xNew<IssmDouble>(this->NumberofNodes(this->interpolation_type)); 27 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i]; 33 28 } 34 29 /*}}}*/ … … 46 41 47 42 _printf_(setw(15)<<" PentaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" ["); 48 for(int i=0;i<this->NumberofNodes( );i++) _printf_(" "<<this->values[i]);43 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) _printf_(" "<<this->values[i]); 49 44 _printf_("]\n"); 50 45 } … … 60 55 Object* PentaInput::copy() {/*{{{*/ 61 56 62 return new PentaInput(this->enum_type,this->values,this-> element_type);57 return new PentaInput(this->enum_type,this->values,this->interpolation_type); 63 58 64 59 } … … 77 72 TriaInput* outinput=NULL; 78 73 79 if(this-> element_type==P0Enum){74 if(this->interpolation_type==P0Enum){ 80 75 outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum); 81 76 } … … 109 104 int PentaInput::GetResultInterpolation(void){/*{{{*/ 110 105 111 if(this-> element_type==P0Enum){106 if(this->interpolation_type==P0Enum){ 112 107 return P0Enum; 113 108 } … … 118 113 int PentaInput::GetResultNumberOfNodes(void){/*{{{*/ 119 114 120 return this->NumberofNodes( );;115 return this->NumberofNodes(this->interpolation_type);; 121 116 122 117 } … … 124 119 void PentaInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){/*{{{*/ 125 120 126 int numnodes = this->NumberofNodes( );121 int numnodes = this->NumberofNodes(this->interpolation_type); 127 122 128 123 /*Some checks*/ … … 138 133 void PentaInput::GetInputValue(IssmDouble* pvalue){/*{{{*/ 139 134 140 if(this-> element_type==P0Enum){135 if(this->interpolation_type==P0Enum){ 141 136 pvalue=&values[0]; 142 137 } … … 148 143 /*Call PentaRef function*/ 149 144 _assert_(gauss->Enum()==GaussPentaEnum); 150 PentaRef::GetInputValue(pvalue,&values[0],(GaussPenta*)gauss );145 PentaRef::GetInputValue(pvalue,&values[0],(GaussPenta*)gauss,this->interpolation_type); 151 146 152 147 } … … 156 151 /*Call PentaRef function*/ 157 152 _assert_(gauss->Enum()==GaussPentaEnum); 158 PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussPenta*)gauss );153 PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussPenta*)gauss,this->interpolation_type); 159 154 } 160 155 /*}}}*/ … … 165 160 void PentaInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 166 161 167 int numnodes = this->NumberofNodes( );162 int numnodes = this->NumberofNodes(this->interpolation_type); 168 163 IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes); 169 164 IssmDouble value = 0.; … … 179 174 void PentaInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){/*{{{*/ 180 175 181 int numnodes=this->NumberofNodes( );176 int numnodes=this->NumberofNodes(this->interpolation_type); 182 177 IssmDouble squaremin; 183 178 … … 193 188 void PentaInput::ConstrainMin(IssmDouble minimum){/*{{{*/ 194 189 195 int numnodes = this->NumberofNodes( );190 int numnodes = this->NumberofNodes(this->interpolation_type); 196 191 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum; 197 192 } … … 201 196 /*Output*/ 202 197 IssmDouble norm=0.; 203 int numnodes=this->NumberofNodes( );198 int numnodes=this->NumberofNodes(this->interpolation_type); 204 199 205 200 for(int i=0;i<numnodes;i++) if(fabs(values[i])>norm) norm=fabs(values[i]); … … 209 204 IssmDouble PentaInput::Max(void){/*{{{*/ 210 205 211 int numnodes=this->NumberofNodes( );206 int numnodes=this->NumberofNodes(this->interpolation_type); 212 207 IssmDouble max=values[0]; 213 208 … … 220 215 IssmDouble PentaInput::MaxAbs(void){/*{{{*/ 221 216 222 int numnodes=this->NumberofNodes( );217 int numnodes=this->NumberofNodes(this->interpolation_type); 223 218 IssmDouble max=fabs(values[0]); 224 219 … … 231 226 IssmDouble PentaInput::Min(void){/*{{{*/ 232 227 233 const int numnodes=this->NumberofNodes( );228 const int numnodes=this->NumberofNodes(this->interpolation_type); 234 229 IssmDouble min=values[0]; 235 230 … … 242 237 IssmDouble PentaInput::MinAbs(void){/*{{{*/ 243 238 244 const int numnodes=this->NumberofNodes( );239 const int numnodes=this->NumberofNodes(this->interpolation_type); 245 240 IssmDouble min=fabs(values[0]); 246 241 … … 253 248 void PentaInput::Scale(IssmDouble scale_factor){/*{{{*/ 254 249 255 const int numnodes=this->NumberofNodes( );250 const int numnodes=this->NumberofNodes(this->interpolation_type); 256 251 for(int i=0;i<numnodes;i++)values[i]=values[i]*scale_factor; 257 252 } … … 259 254 void PentaInput::AXPY(Input* xinput,IssmDouble scalar){/*{{{*/ 260 255 261 const int numnodes=this->NumberofNodes( );256 const int numnodes=this->NumberofNodes(this->interpolation_type); 262 257 PentaInput* xpentainput=NULL; 263 258 … … 271 266 _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 272 267 xpentainput=(PentaInput*)xinput; 273 if(xpentainput-> element_type!=this->element_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xpentainput->element_type));268 if(xpentainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xpentainput->interpolation_type)); 274 269 275 270 /*Carry out the AXPY operation depending on type:*/ … … 281 276 282 277 int i; 283 const int numnodes=this->NumberofNodes( );278 const int numnodes=this->NumberofNodes(this->interpolation_type); 284 279 285 280 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min; … … 290 285 void PentaInput::Extrude(void){/*{{{*/ 291 286 292 switch(this-> element_type){287 switch(this->interpolation_type){ 293 288 case P1Enum: 294 289 for(int i=0;i<3;i++) this->values[3+i]=this->values[i]; 295 290 break; 296 291 default: 297 _error_("not supported yet for type "<<EnumToStringx(this-> element_type));292 _error_("not supported yet for type "<<EnumToStringx(this->interpolation_type)); 298 293 } 299 294 } … … 308 303 309 304 /*vertically integrate depending on type (and use P1 interpolation from now on)*/ 310 switch(this-> element_type){305 switch(this->interpolation_type){ 311 306 case P1Enum: 312 307 case P1bubbleEnum: 313 308 case P2Enum: 314 309 { 315 this-> element_type=P1Enum;310 this->interpolation_type=P1Enum; 316 311 GaussPenta *gauss=new GaussPenta(); 317 312 for(int iv=0;iv<3;iv++){ … … 325 320 } 326 321 default: 327 _error_("not supported yet for type "<<EnumToStringx(this-> element_type));322 _error_("not supported yet for type "<<EnumToStringx(this->interpolation_type)); 328 323 } 329 324 } … … 336 331 /*Intermediaries*/ 337 332 PentaInput *xinputB = NULL; 338 const int numnodes = this->NumberofNodes( );333 const int numnodes = this->NumberofNodes(this->interpolation_type); 339 334 340 335 /*Check that inputB is of the same type*/ 341 336 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 342 337 xinputB=(PentaInput*)inputB; 343 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));338 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 344 339 345 340 /*Allocate intermediary*/ … … 353 348 354 349 /*Create new Penta vertex input (copy of current input)*/ 355 outinput=new PentaInput(this->enum_type,AdotBvalues,this-> element_type);350 outinput=new PentaInput(this->enum_type,AdotBvalues,this->interpolation_type); 356 351 357 352 /*Return output pointer*/ … … 369 364 int i; 370 365 PentaInput *xinputB = NULL; 371 const int numnodes = this->NumberofNodes( );366 const int numnodes = this->NumberofNodes(this->interpolation_type); 372 367 IssmDouble *minvalues = xNew<IssmDouble>(numnodes); 373 368 … … 375 370 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 376 371 xinputB=(PentaInput*)inputB; 377 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));372 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 378 373 379 374 /*Create point wise min*/ … … 384 379 385 380 /*Create new Penta vertex input (copy of current input)*/ 386 outinput=new PentaInput(this->enum_type,&minvalues[0],this-> element_type);381 outinput=new PentaInput(this->enum_type,&minvalues[0],this->interpolation_type); 387 382 388 383 /*Return output pointer*/ … … 399 394 int i; 400 395 PentaInput *xinputB = NULL; 401 const int numnodes = this->NumberofNodes( );396 const int numnodes = this->NumberofNodes(this->interpolation_type); 402 397 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes); 403 398 … … 405 400 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 406 401 xinputB=(PentaInput*)inputB; 407 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));402 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 408 403 409 404 /*Create point wise max*/ … … 414 409 415 410 /*Create new Penta vertex input (copy of current input)*/ 416 outinput=new PentaInput(this->enum_type,&maxvalues[0],this-> element_type);411 outinput=new PentaInput(this->enum_type,&maxvalues[0],this->interpolation_type); 417 412 418 413 /*Return output pointer*/ -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
r17514 r18078 17 17 18 18 public: 19 int enum_type; 19 int enum_type; 20 int interpolation_type; 20 21 IssmDouble* values; 21 22 -
issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp
r18064 r18078 17 17 } 18 18 /*}}}*/ 19 SegInput::SegInput(int in_enum_type,IssmDouble* in_values,int element_type_in)/*{{{*/ 20 :SegRef(1) 21 { 22 23 /*Set SegRef*/ 24 this->SetElementType(element_type_in,0); 25 this->element_type=element_type_in; 19 SegInput::SegInput(int in_enum_type,IssmDouble* in_values,int interpolation_type_in){/*{{{*/ 26 20 27 21 /*Set Enum*/ 28 22 enum_type=in_enum_type; 23 this->interpolation_type=interpolation_type_in; 29 24 30 25 /*Set values*/ 31 this->values=xNew<IssmDouble>(this->NumberofNodes( ));32 for(int i=0;i<this->NumberofNodes( );i++) values[i]=in_values[i];26 this->values=xNew<IssmDouble>(this->NumberofNodes(this->interpolation_type)); 27 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i]; 33 28 } 34 29 /*}}}*/ … … 46 41 47 42 _printf_(setw(15)<<" SegInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" ["); 48 for(int i=0;i<this->NumberofNodes( );i++) _printf_(" "<<this->values[i]);43 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) _printf_(" "<<this->values[i]); 49 44 _printf_("]\n"); 50 45 } … … 60 55 Object* SegInput::copy() {/*{{{*/ 61 56 62 return new SegInput(this->enum_type,this->values,this-> element_type);57 return new SegInput(this->enum_type,this->values,this->interpolation_type); 63 58 64 59 } … … 76 71 void SegInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 77 72 78 int numnodes = this->NumberofNodes( );73 int numnodes = this->NumberofNodes(this->interpolation_type); 79 74 IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes); 80 75 IssmDouble value = 0.; … … 90 85 /*Call SegRef function*/ 91 86 _assert_(gauss->Enum()==GaussSegEnum); 92 SegRef::GetInputValue(pvalue,&values[0],(GaussSeg*)gauss );87 SegRef::GetInputValue(pvalue,&values[0],(GaussSeg*)gauss,this->interpolation_type); 93 88 94 89 } … … 98 93 /*Call SegRef function*/ 99 94 _assert_(gauss->Enum()==GaussSegEnum); 100 SegRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussSeg*)gauss );95 SegRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussSeg*)gauss,this->interpolation_type); 101 96 } 102 97 /*}}}*/ … … 107 102 IssmDouble SegInput::Min(void){/*{{{*/ 108 103 109 const int numnodes=this->NumberofNodes( );104 const int numnodes=this->NumberofNodes(this->interpolation_type); 110 105 IssmDouble min=values[0]; 111 106 -
issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
r17514 r18078 18 18 public: 19 19 int enum_type; 20 int interpolation_type; 20 21 IssmDouble* values; 21 22 -
issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
r18064 r18078 17 17 } 18 18 /*}}}*/ 19 TetraInput::TetraInput(int in_enum_type,IssmDouble* in_values,int element_type_in)/*{{{*/ 20 :TetraRef(1) 21 { 22 23 /*Set TetraRef*/ 24 this->SetElementType(element_type_in,0); 25 this->element_type=element_type_in; 19 TetraInput::TetraInput(int in_enum_type,IssmDouble* in_values,int interpolation_type_in){/*{{{*/ 26 20 27 21 /*Set Enum*/ 28 22 enum_type=in_enum_type; 23 this->interpolation_type=interpolation_type_in; 29 24 30 25 /*Set values*/ 31 this->values=xNew<IssmDouble>(this->NumberofNodes( ));32 for(int i=0;i<this->NumberofNodes( );i++) values[i]=in_values[i];26 this->values=xNew<IssmDouble>(this->NumberofNodes(this->interpolation_type)); 27 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i]; 33 28 } 34 29 /*}}}*/ … … 46 41 47 42 _printf_(setw(15)<<" TetraInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" ["); 48 for(int i=0;i<this->NumberofNodes( );i++) _printf_(" "<<this->values[i]);49 _printf_("] ("<<EnumToStringx(this-> element_type)<<")\n");43 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) _printf_(" "<<this->values[i]); 44 _printf_("] ("<<EnumToStringx(this->interpolation_type)<<")\n"); 50 45 } 51 46 /*}}}*/ … … 60 55 Object* TetraInput::copy() {/*{{{*/ 61 56 62 return new TetraInput(this->enum_type,this->values,this-> element_type);57 return new TetraInput(this->enum_type,this->values,this->interpolation_type); 63 58 64 59 } … … 74 69 int TetraInput::GetResultInterpolation(void){/*{{{*/ 75 70 76 if(this-> element_type==P0Enum){71 if(this->interpolation_type==P0Enum){ 77 72 return P0Enum; 78 73 } … … 83 78 int TetraInput::GetResultNumberOfNodes(void){/*{{{*/ 84 79 85 return this->NumberofNodes( );80 return this->NumberofNodes(this->interpolation_type); 86 81 87 82 } … … 89 84 void TetraInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){/*{{{*/ 90 85 91 int numnodes = this->NumberofNodes( );86 int numnodes = this->NumberofNodes(this->interpolation_type); 92 87 93 88 /*Some checks*/ … … 105 100 /*Call TetraRef function*/ 106 101 _assert_(gauss->Enum()==GaussTetraEnum); 107 TetraRef::GetInputValue(pvalue,&values[0],(GaussTetra*)gauss );102 TetraRef::GetInputValue(pvalue,&values[0],(GaussTetra*)gauss,this->interpolation_type); 108 103 109 104 } … … 113 108 /*Call TetraRef function*/ 114 109 _assert_(gauss->Enum()==GaussTetraEnum); 115 TetraRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTetra*)gauss );110 TetraRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTetra*)gauss,this->interpolation_type); 116 111 } 117 112 /*}}}*/ … … 122 117 void TetraInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 123 118 124 int numnodes = this->NumberofNodes( );119 int numnodes = this->NumberofNodes(this->interpolation_type); 125 120 IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes); 126 121 IssmDouble value = 0.; … … 175 170 TriaInput* outinput=NULL; 176 171 177 if(this-> element_type==P0Enum){172 if(this->interpolation_type==P0Enum){ 178 173 outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum); 179 174 } … … 204 199 void TetraInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){/*{{{*/ 205 200 206 int numnodes=this->NumberofNodes( );201 int numnodes=this->NumberofNodes(this->interpolation_type); 207 202 IssmDouble squaremin; 208 203 … … 218 213 void TetraInput::ConstrainMin(IssmDouble minimum){/*{{{*/ 219 214 220 int numnodes = this->NumberofNodes( );215 int numnodes = this->NumberofNodes(this->interpolation_type); 221 216 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum; 222 217 } … … 226 221 /*Output*/ 227 222 IssmDouble norm=0.; 228 int numnodes=this->NumberofNodes( );223 int numnodes=this->NumberofNodes(this->interpolation_type); 229 224 230 225 for(int i=0;i<numnodes;i++) if(fabs(values[i])>norm) norm=fabs(values[i]); … … 234 229 IssmDouble TetraInput::Max(void){/*{{{*/ 235 230 236 int numnodes=this->NumberofNodes( );231 int numnodes=this->NumberofNodes(this->interpolation_type); 237 232 IssmDouble max=values[0]; 238 233 … … 245 240 IssmDouble TetraInput::MaxAbs(void){/*{{{*/ 246 241 247 int numnodes=this->NumberofNodes( );242 int numnodes=this->NumberofNodes(this->interpolation_type); 248 243 IssmDouble max=fabs(values[0]); 249 244 … … 256 251 IssmDouble TetraInput::Min(void){/*{{{*/ 257 252 258 const int numnodes=this->NumberofNodes( );253 const int numnodes=this->NumberofNodes(this->interpolation_type); 259 254 IssmDouble min=values[0]; 260 255 … … 267 262 IssmDouble TetraInput::MinAbs(void){/*{{{*/ 268 263 269 const int numnodes=this->NumberofNodes( );264 const int numnodes=this->NumberofNodes(this->interpolation_type); 270 265 IssmDouble min=fabs(values[0]); 271 266 … … 278 273 void TetraInput::Scale(IssmDouble scale_factor){/*{{{*/ 279 274 280 const int numnodes=this->NumberofNodes( );275 const int numnodes=this->NumberofNodes(this->interpolation_type); 281 276 for(int i=0;i<numnodes;i++)values[i]=values[i]*scale_factor; 282 277 } … … 284 279 void TetraInput::Set(IssmDouble setvalue){/*{{{*/ 285 280 286 const int numnodes=this->NumberofNodes( );281 const int numnodes=this->NumberofNodes(this->interpolation_type); 287 282 for(int i=0;i<numnodes;i++)values[i]=setvalue; 288 283 } … … 290 285 void TetraInput::AXPY(Input* xinput,IssmDouble scalar){/*{{{*/ 291 286 292 const int numnodes=this->NumberofNodes( );287 const int numnodes=this->NumberofNodes(this->interpolation_type); 293 288 TetraInput* xtriainput=NULL; 294 289 … … 296 291 if(xinput->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 297 292 xtriainput=(TetraInput*)xinput; 298 if(xtriainput-> element_type!=this->element_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));293 if(xtriainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 299 294 300 295 /*Carry out the AXPY operation depending on type:*/ … … 306 301 307 302 int i; 308 const int numnodes=this->NumberofNodes( );303 const int numnodes=this->NumberofNodes(this->interpolation_type); 309 304 310 305 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min; … … 325 320 int i; 326 321 TetraInput *xinputB = NULL; 327 const int numnodes = this->NumberofNodes( );322 const int numnodes = this->NumberofNodes(this->interpolation_type); 328 323 IssmDouble *minvalues = xNew<IssmDouble>(numnodes); 329 324 … … 331 326 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 332 327 xinputB=(TetraInput*)inputB; 333 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));328 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 334 329 335 330 /*Create point wise min*/ … … 340 335 341 336 /*Create new Tetra vertex input (copy of current input)*/ 342 outinput=new TetraInput(this->enum_type,&minvalues[0],this-> element_type);337 outinput=new TetraInput(this->enum_type,&minvalues[0],this->interpolation_type); 343 338 344 339 /*Return output pointer*/ … … 356 351 int i; 357 352 TetraInput *xinputB = NULL; 358 const int numnodes = this->NumberofNodes( );353 const int numnodes = this->NumberofNodes(this->interpolation_type); 359 354 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes); 360 355 … … 362 357 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 363 358 xinputB=(TetraInput*)inputB; 364 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));359 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 365 360 366 361 /*Create point wise max*/ … … 371 366 372 367 /*Create new Tetra vertex input (copy of current input)*/ 373 outinput=new TetraInput(this->enum_type,&maxvalues[0],this-> element_type);368 outinput=new TetraInput(this->enum_type,&maxvalues[0],this->interpolation_type); 374 369 375 370 /*Return output pointer*/ … … 386 381 /*Intermediaries*/ 387 382 TetraInput *xinputB = NULL; 388 const int numnodes = this->NumberofNodes( );383 const int numnodes = this->NumberofNodes(this->interpolation_type); 389 384 390 385 /*Check that inputB is of the same type*/ 391 386 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 392 387 xinputB=(TetraInput*)inputB; 393 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));388 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 394 389 395 390 /*Allocate intermediary*/ … … 403 398 404 399 /*Create new Tetra vertex input (copy of current input)*/ 405 outinput=new TetraInput(this->enum_type,AdotBvalues,this-> element_type);400 outinput=new TetraInput(this->enum_type,AdotBvalues,this->interpolation_type); 406 401 407 402 /*Return output pointer*/ -
issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h
r17514 r18078 18 18 public: 19 19 int enum_type; 20 int interpolation_type; 20 21 IssmDouble* values; 21 22 -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
r18064 r18078 17 17 } 18 18 /*}}}*/ 19 TriaInput::TriaInput(int in_enum_type,IssmDouble* in_values,int element_type_in)/*{{{*/ 20 :TriaRef(1) 21 { 22 23 /*Set TriaRef*/ 24 this->SetElementType(element_type_in,0); 25 this->element_type=element_type_in; 19 TriaInput::TriaInput(int in_enum_type,IssmDouble* in_values,int interpolation_type_in){/*{{{*/ 26 20 27 21 /*Set Enum*/ 28 22 enum_type=in_enum_type; 23 this->interpolation_type=interpolation_type_in; 29 24 30 25 /*Set values*/ 31 this->values=xNew<IssmDouble>(this->NumberofNodes( ));32 for(int i=0;i<this->NumberofNodes( );i++) values[i]=in_values[i];26 this->values=xNew<IssmDouble>(this->NumberofNodes(this->interpolation_type)); 27 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i]; 33 28 } 34 29 /*}}}*/ … … 46 41 47 42 _printf_(setw(15)<<" TriaInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" ["); 48 for(int i=0;i<this->NumberofNodes( );i++) _printf_(" "<<this->values[i]);49 _printf_("] ("<<EnumToStringx(this-> element_type)<<")\n");43 for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) _printf_(" "<<this->values[i]); 44 _printf_("] ("<<EnumToStringx(this->interpolation_type)<<")\n"); 50 45 } 51 46 /*}}}*/ … … 60 55 Object* TriaInput::copy() {/*{{{*/ 61 56 62 return new TriaInput(this->enum_type,this->values,this-> element_type);57 return new TriaInput(this->enum_type,this->values,this->interpolation_type); 63 58 64 59 } … … 78 73 79 74 /*Create new Tria input (copy of current input)*/ 80 outinput=new TriaInput(this->enum_type,&this->values[0],this-> element_type);75 outinput=new TriaInput(this->enum_type,&this->values[0],this->interpolation_type); 81 76 82 77 /*Assign output*/ … … 90 85 SegInput* outinput=NULL; 91 86 92 if(this-> element_type==P0Enum){87 if(this->interpolation_type==P0Enum){ 93 88 outinput=new SegInput(this->enum_type,&this->values[0],P0Enum); 94 89 } … … 112 107 int TriaInput::GetResultInterpolation(void){/*{{{*/ 113 108 114 if(this-> element_type==P0Enum){109 if(this->interpolation_type==P0Enum){ 115 110 return P0Enum; 116 111 } … … 121 116 int TriaInput::GetResultNumberOfNodes(void){/*{{{*/ 122 117 123 return this->NumberofNodes( );118 return this->NumberofNodes(this->interpolation_type); 124 119 125 120 } … … 127 122 void TriaInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){/*{{{*/ 128 123 129 int numnodes = this->NumberofNodes( );124 int numnodes = this->NumberofNodes(this->interpolation_type); 130 125 131 126 /*Some checks*/ … … 143 138 /*Call TriaRef function*/ 144 139 _assert_(gauss->Enum()==GaussTriaEnum); 145 TriaRef::GetInputValue(pvalue,&values[0],(GaussTria*)gauss );140 TriaRef::GetInputValue(pvalue,&values[0],(GaussTria*)gauss,this->interpolation_type); 146 141 147 142 } … … 151 146 /*Call TriaRef function*/ 152 147 _assert_(gauss->Enum()==GaussTriaEnum); 153 TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTria*)gauss );148 TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,(GaussTria*)gauss,this->interpolation_type); 154 149 } 155 150 /*}}}*/ … … 160 155 void TriaInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 161 156 162 int numnodes = this->NumberofNodes( );157 int numnodes = this->NumberofNodes(this->interpolation_type); 163 158 IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes); 164 159 IssmDouble value = 0.; … … 212 207 void TriaInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){/*{{{*/ 213 208 214 int numnodes=this->NumberofNodes( );209 int numnodes=this->NumberofNodes(this->interpolation_type); 215 210 IssmDouble squaremin; 216 211 … … 226 221 void TriaInput::ConstrainMin(IssmDouble minimum){/*{{{*/ 227 222 228 int numnodes = this->NumberofNodes( );223 int numnodes = this->NumberofNodes(this->interpolation_type); 229 224 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum; 230 225 } … … 234 229 /*Output*/ 235 230 IssmDouble norm=0.; 236 int numnodes=this->NumberofNodes( );231 int numnodes=this->NumberofNodes(this->interpolation_type); 237 232 238 233 for(int i=0;i<numnodes;i++) if(fabs(values[i])>norm) norm=fabs(values[i]); … … 242 237 IssmDouble TriaInput::Max(void){/*{{{*/ 243 238 244 int numnodes=this->NumberofNodes( );239 int numnodes=this->NumberofNodes(this->interpolation_type); 245 240 IssmDouble max=values[0]; 246 241 … … 253 248 IssmDouble TriaInput::MaxAbs(void){/*{{{*/ 254 249 255 int numnodes=this->NumberofNodes( );250 int numnodes=this->NumberofNodes(this->interpolation_type); 256 251 IssmDouble max=fabs(values[0]); 257 252 … … 264 259 IssmDouble TriaInput::Min(void){/*{{{*/ 265 260 266 const int numnodes=this->NumberofNodes( );261 const int numnodes=this->NumberofNodes(this->interpolation_type); 267 262 IssmDouble min=values[0]; 268 263 … … 275 270 IssmDouble TriaInput::MinAbs(void){/*{{{*/ 276 271 277 const int numnodes=this->NumberofNodes( );272 const int numnodes=this->NumberofNodes(this->interpolation_type); 278 273 IssmDouble min=fabs(values[0]); 279 274 … … 286 281 void TriaInput::Scale(IssmDouble scale_factor){/*{{{*/ 287 282 288 const int numnodes=this->NumberofNodes( );283 const int numnodes=this->NumberofNodes(this->interpolation_type); 289 284 for(int i=0;i<numnodes;i++)values[i]=values[i]*scale_factor; 290 285 } … … 292 287 void TriaInput::Set(IssmDouble setvalue){/*{{{*/ 293 288 294 const int numnodes=this->NumberofNodes( );289 const int numnodes=this->NumberofNodes(this->interpolation_type); 295 290 for(int i=0;i<numnodes;i++)values[i]=setvalue; 296 291 } … … 298 293 void TriaInput::AXPY(Input* xinput,IssmDouble scalar){/*{{{*/ 299 294 300 const int numnodes=this->NumberofNodes( );295 const int numnodes=this->NumberofNodes(this->interpolation_type); 301 296 TriaInput* xtriainput=NULL; 302 297 … … 304 299 if(xinput->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 305 300 xtriainput=(TriaInput*)xinput; 306 if(xtriainput-> element_type!=this->element_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));301 if(xtriainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 307 302 308 303 /*Carry out the AXPY operation depending on type:*/ … … 314 309 315 310 int i; 316 const int numnodes=this->NumberofNodes( );311 const int numnodes=this->NumberofNodes(this->interpolation_type); 317 312 318 313 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min; … … 333 328 int i; 334 329 TriaInput *xinputB = NULL; 335 const int numnodes = this->NumberofNodes( );330 const int numnodes = this->NumberofNodes(this->interpolation_type); 336 331 IssmDouble *minvalues = xNew<IssmDouble>(numnodes); 337 332 … … 339 334 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 340 335 xinputB=(TriaInput*)inputB; 341 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));336 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 342 337 343 338 /*Create point wise min*/ … … 348 343 349 344 /*Create new Tria vertex input (copy of current input)*/ 350 outinput=new TriaInput(this->enum_type,&minvalues[0],this-> element_type);345 outinput=new TriaInput(this->enum_type,&minvalues[0],this->interpolation_type); 351 346 352 347 /*Return output pointer*/ … … 364 359 int i; 365 360 TriaInput *xinputB = NULL; 366 const int numnodes = this->NumberofNodes( );361 const int numnodes = this->NumberofNodes(this->interpolation_type); 367 362 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes); 368 363 … … 370 365 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 371 366 xinputB=(TriaInput*)inputB; 372 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));367 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 373 368 374 369 /*Create point wise max*/ … … 379 374 380 375 /*Create new Tria vertex input (copy of current input)*/ 381 outinput=new TriaInput(this->enum_type,&maxvalues[0],this-> element_type);376 outinput=new TriaInput(this->enum_type,&maxvalues[0],this->interpolation_type); 382 377 383 378 /*Return output pointer*/ … … 394 389 /*Intermediaries*/ 395 390 TriaInput *xinputB = NULL; 396 const int numnodes = this->NumberofNodes( );391 const int numnodes = this->NumberofNodes(this->interpolation_type); 397 392 398 393 /*Check that inputB is of the same type*/ 399 394 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 400 395 xinputB=(TriaInput*)inputB; 401 if(xinputB-> element_type!=this->element_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->element_type));396 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type)); 402 397 403 398 /*Allocate intermediary*/ … … 411 406 412 407 /*Create new Tria vertex input (copy of current input)*/ 413 outinput=new TriaInput(this->enum_type,AdotBvalues,this-> element_type);408 outinput=new TriaInput(this->enum_type,AdotBvalues,this->interpolation_type); 414 409 415 410 /*Return output pointer*/ -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
r17514 r18078 18 18 public: 19 19 int enum_type; 20 int interpolation_type; 20 21 IssmDouble* values; 21 22 -
issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
r18064 r18078 451 451 gauss->GaussPoint(ig); 452 452 453 tria->GetSegmentBFlux(&B[0],gauss,index1,index2 );454 tria->GetSegmentBprimeFlux(&Bprime[0],gauss,index1,index2 );453 tria->GetSegmentBFlux(&B[0],gauss,index1,index2,tria->FiniteElement()); 454 tria->GetSegmentBprimeFlux(&Bprime[0],gauss,index1,index2,tria->FiniteElement()); 455 455 456 456 vxaverage_input->GetInputValue(&vx,gauss); … … 529 529 gauss->GaussPoint(ig); 530 530 531 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2 );531 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2,tria->FiniteElement()); 532 532 533 533 vxaverage_input->GetInputValue(&vx,gauss); … … 597 597 gauss->GaussPoint(ig); 598 598 599 tria->GetSegmentBFlux(&B[0],gauss,index1,index2 );600 tria->GetSegmentBprimeFlux(&Bprime[0],gauss,index1,index2 );599 tria->GetSegmentBFlux(&B[0],gauss,index1,index2,tria->FiniteElement()); 600 tria->GetSegmentBprimeFlux(&Bprime[0],gauss,index1,index2,tria->FiniteElement()); 601 601 602 602 vxaverage_input->GetInputValue(&vx,gauss); … … 674 674 gauss->GaussPoint(ig); 675 675 676 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2 );676 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2,tria->FiniteElement()); 677 677 678 678 vxaverage_input->GetInputValue(&vx,gauss); … … 790 790 gauss->GaussPoint(ig); 791 791 792 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2 );792 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2,tria->FiniteElement()); 793 793 794 794 vxaverage_input->GetInputValue(&vx,gauss); … … 876 876 gauss->GaussPoint(ig); 877 877 878 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2 );878 tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2,tria->FiniteElement()); 879 879 880 880 vxaverage_input->GetInputValue(&vx,gauss);
Note:
See TracChangeset
for help on using the changeset viewer.