Changeset 4471
- Timestamp:
- 07/08/10 14:58:01 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/InputDepthAveragex/InputDepthAveragex.cpp
r4218 r4471 25 25 } 26 26 27 28 27 /*Then extrude vertically the new inputs*/ 29 InputExtrudex( elements,nodes,vertices,loads,materials,parameters, enum_type);28 InputExtrudex( elements,nodes,vertices,loads,materials,parameters,average_enum_type); 30 29 } -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4470 r4471 1080 1080 /*FUNCTION Penta::InputDepthAverageAtBase{{{1*/ 1081 1081 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){ 1082 ISSMERROR("Not implemented yet (see Node::FieldDepthAverageAtBase)");1083 1082 1084 1083 /*Intermediaries*/ … … 1090 1089 Penta* penta=NULL; 1091 1090 Input* original_input=NULL; 1092 Input* integrated_input=NULL; 1091 Input* element_integrated_input=NULL; 1092 Input* total_integrated_input=NULL; 1093 1093 Input* element_thickness_input=NULL; 1094 1094 Input* total_thickness_input=NULL; … … 1102 1102 inputs->GetParameterValue(&onbed,ElementOnBedEnum); 1103 1103 1104 /*Are we on the base, not on the surface?:*/ 1105 if(onbed==1){ 1106 1107 /*OK, we are on bed. Initialize inputs*/ 1108 total_thickness_input=new PentaVertexInput(ThicknessEnum,zeros_list); 1109 depth_averaged_input =new PentaVertexInput(average_enum_type,zeros_list); 1110 1111 /*Now follow all the upper element from the base to the surface to integrate the input*/ 1112 penta=this; 1113 for(;;){ 1114 1115 /*Step1: Get original input (to be depth avegaged): */ 1116 original_input=(Input*)penta->inputs->GetInput(enum_type); 1117 if(!original_input) ISSMERROR("%s%s"," could not find input with enum:",EnumAsString(enum_type)); 1118 1119 /*Step2: Create element thickness input*/ 1120 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices); 1121 for(i=0;i<3;i++){ 1122 Helem_list[i]=xyz_list[i+3][2]-xyz_list[i][2]; 1123 Helem_list[i+3]=Helem_list[i]; 1124 } 1125 element_thickness_input=new PentaVertexInput(ThicknessEnum,Helem_list); 1126 1127 /*Step3: Vertically integrate original input and update totalthickness_input*/ 1128 //integrated_input=original_input->VerticallyIntegrate(element_thickness_input); //TO BE ADDED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1129 total_thickness_input->AXPY(element_thickness_input,1.0); 1130 1131 /*Stop if we have reached the surface, else, take upper penta*/ 1132 if (penta->IsOnSurface()){ 1133 break; 1134 } 1135 else{ 1136 /* get upper Penta*/ 1137 penta=penta->GetUpperElement(); 1138 ISSMASSERT(penta->Id()!=this->id); 1139 } 1104 /*Are we on the base? If not, return*/ 1105 if(!onbed) return; 1106 1107 /*OK, we are on bed. Initialize global inputs as 0*/ 1108 total_thickness_input =new PentaVertexInput(ThicknessEnum,zeros_list); 1109 total_integrated_input=new PentaVertexInput(average_enum_type,zeros_list); 1110 1111 /*Now follow all the upper element from the base to the surface to integrate the input*/ 1112 penta=this; 1113 for(;;){ 1114 1115 /*Step1: Get original input (to be depth avegaged): */ 1116 original_input=(Input*)penta->inputs->GetInput(enum_type); 1117 if(!original_input) ISSMERROR("could not find input with enum %s",EnumAsString(enum_type)); 1118 1119 /*Step2: Create element thickness input*/ 1120 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices); 1121 for(i=0;i<3;i++){ 1122 Helem_list[i]=xyz_list[i+3][2]-xyz_list[i][2]; 1123 Helem_list[i+3]=Helem_list[i]; 1140 1124 } 1141 1142 /*OK, now we only need to divide the depth integrated input by the total thickness!*/ 1143 //depth_averaged_input=integrated_input->InputPointwiseDivide(total_thickness_input); //TO BE ADDED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1144 depth_averaged_input->ChangeEnum(average_enum_type); 1145 1146 /*Finally, add to inputs*/ 1147 this->inputs->AddInput((Input*)depth_averaged_input); 1148 } 1149 1125 element_thickness_input=new PentaVertexInput(ThicknessEnum,Helem_list); 1126 1127 /*Step3: Vertically integrate A COPY of the original*/ 1128 element_integrated_input=(Input*)original_input->copy(); 1129 element_integrated_input->VerticallyIntegrate(element_thickness_input); 1130 1131 /*Add contributions to global inputs*/ 1132 total_integrated_input->AXPY(element_integrated_input,1.0); 1133 total_thickness_input ->AXPY(element_thickness_input,1.0); 1134 1135 /*Clean up*/ 1136 delete element_thickness_input; 1137 delete element_integrated_input; 1138 1139 /*Stop if we have reached the surface, else, take upper penta*/ 1140 if (penta->IsOnSurface()){ 1141 break; 1142 } 1143 else{ 1144 /* get upper Penta*/ 1145 penta=penta->GetUpperElement(); 1146 ISSMASSERT(penta->Id()!=this->id); 1147 } 1148 } 1149 1150 /*OK, now we only need to divide the depth integrated input by the total thickness!*/ 1151 depth_averaged_input=total_integrated_input->PointwiseDivide(total_thickness_input); 1152 depth_averaged_input->ChangeEnum(average_enum_type); 1153 1154 /*Clean up*/ 1155 delete total_thickness_input; 1156 delete total_integrated_input; 1157 1158 /*Finally, add to inputs*/ 1159 this->inputs->AddInput((Input*)depth_averaged_input); 1150 1160 return; 1151 1161 } -
issm/trunk/src/c/objects/Inputs/BeamVertexInput.h
r4274 r4471 41 41 Input* SpawnBeamInput(int* indices); 42 42 Input* SpawnTriaInput(int* indices); 43 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 43 44 ElementResult* SpawnResult(int step, double time); 44 45 /*}}}*/ … … 70 71 void Constrain(double cm_min, double cm_max); 71 72 void Extrude(void){ISSMERROR("not supported yet");}; 73 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 72 74 void GetVectorFromInputs(Vec vector,int* doflist); 73 75 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/BoolInput.h
r4274 r4471 41 41 Input* SpawnBeamInput(int* indices); 42 42 Input* SpawnTriaInput(int* indices); 43 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 43 44 ElementResult* SpawnResult(int step, double time); 44 45 /*}}}*/ … … 70 71 void Constrain(double cm_min, double cm_max); 71 72 void Extrude(void){ISSMERROR("not supported yet");}; 73 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 72 74 void GetVectorFromInputs(Vec vector,int* doflist); 73 75 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r4274 r4471 40 40 Input* SpawnBeamInput(int* indices); 41 41 Input* SpawnTriaInput(int* indices); 42 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 42 43 ElementResult* SpawnResult(int step, double time); 43 44 /*}}}*/ … … 69 70 void Constrain(double cm_min, double cm_max); 70 71 void Extrude(void){ISSMERROR("not supported yet");}; 72 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 71 73 void GetVectorFromInputs(Vec vector,int* doflist); 72 74 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/Input.h
r4274 r4471 47 47 virtual Input* SpawnBeamInput(int* indices)=0; 48 48 virtual Input* SpawnTriaInput(int* indices)=0; 49 virtual Input* PointwiseDivide(Input* inputB)=0; 49 50 virtual ElementResult* SpawnResult(int step, double time)=0; 50 51 virtual void SquareMin(double* psquaremin, bool process_units,Parameters* parameters)=0; … … 52 53 virtual void AXPY(Input* xinput,double scalar)=0; 53 54 virtual void Constrain(double cm_min, double cm_max)=0; 55 virtual void VerticallyIntegrate(Input* thickness_input)=0; 54 56 virtual void Extrude()=0; 55 57 virtual void GetVectorFromInputs(Vec vector,int* doflist)=0; -
issm/trunk/src/c/objects/Inputs/IntInput.h
r4274 r4471 41 41 Input* SpawnBeamInput(int* indices); 42 42 Input* SpawnTriaInput(int* indices); 43 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 43 44 ElementResult* SpawnResult(int step, double time); 44 45 /*}}}*/ … … 70 71 void Constrain(double cm_min, double cm_max); 71 72 void Extrude(void){ISSMERROR("not supported yet");}; 73 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 72 74 void GetVectorFromInputs(Vec vector,int* doflist); 73 75 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
r4274 r4471 878 878 } 879 879 /*}}}*/ 880 /*FUNCTION PentaVertexInput::SquareMin (double* psquaremin, bool process_units){{{1*/880 /*FUNCTION PentaVertexInput::SquareMin{{{1*/ 881 881 void PentaVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 882 882 … … 901 901 } 902 902 /*}}}*/ 903 /*FUNCTION PentaVertexInput::Scale (double scale_factor){{{1*/903 /*FUNCTION PentaVertexInput::Scale{{{1*/ 904 904 void PentaVertexInput::Scale(double scale_factor){ 905 905 … … 910 910 } 911 911 /*}}}*/ 912 /*FUNCTION PentaVertexInput::AXPY (Input* xinput,double scalar);{{{1*/912 /*FUNCTION PentaVertexInput::AXPY{{{1*/ 913 913 void PentaVertexInput::AXPY(Input* xinput,double scalar){ 914 914 … … 933 933 } 934 934 /*}}}*/ 935 /*FUNCTION PentaVertexInput::Constrain (double cm_min, double cm_max){{{1*/935 /*FUNCTION PentaVertexInput::Constrain{{{1*/ 936 936 void PentaVertexInput::Constrain(double cm_min, double cm_max){ 937 937 … … 944 944 } 945 945 /*}}}*/ 946 /*FUNCTION PentaVertexInput::Extrude (double cm_min, double cm_max){{{1*/946 /*FUNCTION PentaVertexInput::Extrude{{{1*/ 947 947 void PentaVertexInput::Extrude(void){ 948 948 … … 954 954 } 955 955 /*}}}*/ 956 /*FUNCTION PentaVertexInput::VerticallyIntegrate{{{1*/ 957 void PentaVertexInput::VerticallyIntegrate(Input* thickness_input){ 958 959 /*Intermediaries*/ 960 int i; 961 const int numgrids = 6; 962 int num_thickness_values; 963 double *thickness_values = NULL; 964 965 /*Check that input provided is a thickness*/ 966 if (thickness_input->EnumType()!=ThicknessEnum) ISSMERROR("Input provided is not a Thickness (enum_type is %s)",EnumAsString(thickness_input->EnumType())); 967 968 /*Get Thickness value pointer*/ 969 thickness_input->GetValuesPtr(&thickness_values,&num_thickness_values); 970 971 /*vertically integrate depending on type:*/ 972 switch(thickness_input->Enum()){ 973 974 case PentaVertexInputEnum: 975 for(i=0;i<3;i++){ 976 this->values[i]=0.5*(this->values[i]+this->values[i+3]) * thickness_values[i]; 977 this->values[i+3]=this->values[i]; 978 } 979 return; 980 981 default: 982 ISSMERROR("not implemented yet"); 983 } 984 } 985 /*}}}*/ 986 /*FUNCTION PentaVertexInput::PointwiseDivide{{{1*/ 987 Input* PentaVertexInput::PointwiseDivide(Input* inputB){ 988 989 /*Ouput*/ 990 PentaVertexInput* outinput=NULL; 991 992 /*Intermediaries*/ 993 int i; 994 PentaVertexInput *xinputB = NULL; 995 int B_numvalues; 996 double *B_values = NULL; 997 const int numgrids = 6; 998 double AdotBvalues[numgrids]; 999 1000 /*Check that inputB is of the same type*/ 1001 if (inputB->Enum()!=PentaVertexInputEnum) ISSMERROR("Operation not permitted because inputB is of type %s",EnumAsString(inputB->Enum())); 1002 xinputB=(PentaVertexInput*)inputB; 1003 1004 /*Create point wise sum*/ 1005 for(i=0;i<numgrids;i++){ 1006 ISSMASSERT(xinputB->values[i]!=0); 1007 AdotBvalues[i]=this->values[i]/xinputB->values[i]; 1008 } 1009 1010 /*Create new Sing input (copy of current input)*/ 1011 outinput=new PentaVertexInput(this->enum_type,&AdotBvalues[0]); 1012 1013 /*Return output pointer*/ 1014 return outinput; 1015 1016 } 1017 /*}}}*/ 956 1018 /*FUNCTION PentaVertexInput::GetVectorFromInputs(Vec vector,int* doflist){{{1*/ 957 1019 void PentaVertexInput::GetVectorFromInputs(Vec vector,int* doflist){ -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
r4274 r4471 40 40 Input* SpawnBeamInput(int* indices); 41 41 Input* SpawnTriaInput(int* indices); 42 Input* PointwiseDivide(Input* inputB); 42 43 ElementResult* SpawnResult(int step, double time); 43 44 /*}}}*/ … … 79 80 void Constrain(double cm_min, double cm_max); 80 81 void Extrude(void); 82 void VerticallyIntegrate(Input* thickness_input); 81 83 void GetVectorFromInputs(Vec vector,int* doflist); 82 84 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/SingVertexInput.h
r4274 r4471 40 40 Input* SpawnBeamInput(int* indices); 41 41 Input* SpawnTriaInput(int* indices); 42 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 42 43 ElementResult* SpawnResult(int step, double time); 43 44 /*}}}*/ … … 69 70 void Constrain(double cm_min, double cm_max); 70 71 void Extrude(void){ISSMERROR("not supported yet");}; 72 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 71 73 void GetVectorFromInputs(Vec vector,int* doflist); 72 74 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
r4274 r4471 41 41 Input* SpawnBeamInput(int* indices); 42 42 Input* SpawnTriaInput(int* indices); 43 Input* PointwiseDivide(Input* inputB){ISSMERROR("not implemented yet");}; 43 44 ElementResult* SpawnResult(int step, double time); 44 45 /*}}}*/ … … 77 78 void Constrain(double cm_min, double cm_max); 78 79 void Extrude(void){ISSMERROR("not supported yet");}; 80 void VerticallyIntegrate(Input* thickness_input){ISSMERROR("not supported yet");}; 79 81 void GetVectorFromInputs(Vec vector,int* doflist); 80 82 void GetValuesPtr(double** pvalues,int* pnum_values);
Note:
See TracChangeset
for help on using the changeset viewer.