Changeset 4042
- Timestamp:
- 06/14/10 08:25:32 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 6 added
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/DataSet/Inputs.cpp
r3956 r4042 543 543 } 544 544 } 545 ISSMERROR("input with enum %i (%s) not found",enum_name,EnumAsString(enum_name));545 return NULL; 546 546 } 547 547 /*}}}*/ -
issm/trunk/src/c/DataSet/Results.cpp
r4037 r4042 62 62 63 63 /*Add result to new results*/ 64 newresults->AddObject( resultout);64 newresults->AddObject((Object*)resultout); 65 65 } 66 66 … … 88 88 89 89 /*Add result to new results*/ 90 newresults->AddObject( resultout);90 newresults->AddObject((Object*)resultout); 91 91 } 92 92 … … 114 114 115 115 /*Add result to new results*/ 116 newresults->AddObject( resultout);116 newresults->AddObject((Object*)resultout); 117 117 } 118 118 -
issm/trunk/src/c/Makefile.am
r4039 r4042 329 329 ./modules/ModelProcessorx/SlopeCompute/UpdateElementsSlopeCompute.cpp\ 330 330 ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp \ 331 ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp 331 ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp\ 332 332 ./modules/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp\ 333 333 ./modules/ModelProcessorx/Control/CreateParametersControl.cpp\ … … 367 367 ./modules/Dux/Dux.h\ 368 368 ./modules/Dux/Dux.cpp\ 369 ./modules/MinVelx/MinVelx.h\ 370 ./modules/MinVelx/MinVelx.cpp\ 371 ./modules/MaxVelx/MaxVelx.h\ 372 ./modules/MaxVelx/MaxVelx.cpp\ 369 373 ./modules/ControlConstrainx/ControlConstrainx.h\ 370 374 ./modules/ControlConstrainx/ControlConstrainx.cpp\ … … 524 528 ./objects/Bamg/GeometricalVertex.cpp\ 525 529 ./objects/Bamg/Geometry.h\ 530 ./objects/Bamg/Geometry.cpp\ 526 531 ./objects/Bamg/ListofIntersectionTriangles.cpp\ 527 532 ./objects/Bamg/ListofIntersectionTriangles.h\ … … 541 546 ./objects/Bamg/Triangle.h\ 542 547 ./objects/Bamg/Triangles.h\ 548 ./objects/Bamg/Triangles.cpp\ 543 549 ./objects/Bamg/MeshVertex.cpp\ 544 550 ./objects/Bamg/MeshVertex.h\ … … 770 776 ./EnumDefinitions/StringAsEnum.cpp\ 771 777 ./modules/ModelProcessorx/ModelProcessorx.h\ 772 ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp 773 ./modules/ModelProcessorx/NodesPartitioning.cpp 774 ./modules/ModelProcessorx/Partitioning.cpp\ 778 ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp\ 779 ./modules/ModelProcessorx/NodesPartitioning.cpp\ 775 780 ./modules/ModelProcessorx/SortDataSets.cpp\ 776 781 ./modules/ModelProcessorx/UpdateCounters.cpp\ … … 781 786 ./modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\ 782 787 ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\ 788 ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \ 783 789 ./modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp \ 784 790 ./modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp\ 785 ./modules/ModelProcessorx/Diagnostic Horiz/CreateNodesDiagnosticHoriz.cpp\786 ./modules/ModelProcessorx/DiagnosticVert/Create ElementsNodesAndMaterialsDiagnosticVert.cpp\791 ./modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp\ 792 ./modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp \ 787 793 ./modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp \ 788 794 ./modules/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp\ 789 ./modules/ModelProcessorx/Diagnostic Vert/CreateNodesDiagnosticVert.cpp\790 ./modules/ModelProcessorx/DiagnosticHutter/Create ElementsNodesAndMaterialsDiagnosticHutter.cpp\795 ./modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp\ 796 ./modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp \ 791 797 ./modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp \ 792 798 ./modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp\ 793 ./modules/ModelProcessorx/Diagnostic Hutter/CreateNodesDiagnosticHutter.cpp\794 ./modules/ModelProcessorx/DiagnosticStokes/Create ElementsNodesAndMaterialsDiagnosticStokes.cpp\799 ./modules/ModelProcessorx/DiagnosticStokes/UpdateElementsDiagnosticStokes.cpp\ 800 ./modules/ModelProcessorx/DiagnosticStokes/CreateNodesDiagnosticStokes.cpp \ 795 801 ./modules/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp \ 796 802 ./modules/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp\ 797 ./modules/ModelProcessorx/ DiagnosticStokes/CreateNodesDiagnosticStokes.cpp\798 ./modules/ModelProcessorx/SlopeCompute/Create ElementsNodesAndMaterialsSlopeCompute.cpp\799 ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp 803 ./modules/ModelProcessorx/SlopeCompute/UpdateElementsSlopeCompute.cpp\ 804 ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp \ 805 ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp\ 800 806 ./modules/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp\ 801 ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp\802 807 ./modules/ModelProcessorx/Control/CreateParametersControl.cpp\ 803 ./modules/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp\ 808 ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp\ 809 ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\ 804 810 ./modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp\ 805 811 ./modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp\ 806 ./modules/ModelProcessorx/ Thermal/CreateNodesThermal.cpp\807 ./modules/ModelProcessorx/Melting/Create ElementsNodesAndMaterialsMelting.cpp\812 ./modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp\ 813 ./modules/ModelProcessorx/Melting/CreateNodesMelting.cpp\ 808 814 ./modules/ModelProcessorx/Melting/CreateConstraintsMelting.cpp\ 809 815 ./modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp\ 810 ./modules/ModelProcessorx/ Melting/CreateNodesMelting.cpp\811 ./modules/ModelProcessorx/Prognostic/Create ElementsNodesAndMaterialsPrognostic.cpp\816 ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\ 817 ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\ 812 818 ./modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp\ 813 819 ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp\ 814 ./modules/ModelProcessorx/Prognostic /CreateNodesPrognostic.cpp\815 ./modules/ModelProcessorx/Prognostic2/Create ElementsNodesAndMaterialsPrognostic2.cpp\820 ./modules/ModelProcessorx/Prognostic2/UpdateElementsPrognostic2.cpp\ 821 ./modules/ModelProcessorx/Prognostic2/CreateNodesPrognostic2.cpp\ 816 822 ./modules/ModelProcessorx/Prognostic2/CreateConstraintsPrognostic2.cpp\ 817 823 ./modules/ModelProcessorx/Prognostic2/CreateLoadsPrognostic2.cpp\ 818 ./modules/ModelProcessorx/ Prognostic2/CreateNodesPrognostic2.cpp\819 ./modules/ModelProcessorx/Balancedthickness/Create ElementsNodesAndMaterialsBalancedthickness.cpp\824 ./modules/ModelProcessorx/Balancedthickness/UpdateElementsBalancedthickness.cpp\ 825 ./modules/ModelProcessorx/Balancedthickness/CreateNodesBalancedthickness.cpp\ 820 826 ./modules/ModelProcessorx/Balancedthickness/CreateConstraintsBalancedthickness.cpp\ 821 827 ./modules/ModelProcessorx/Balancedthickness/CreateLoadsBalancedthickness.cpp\ 822 ./modules/ModelProcessorx/Balancedthickness /CreateNodesBalancedthickness.cpp\823 ./modules/ModelProcessorx/Balancedthickness2/Create ElementsNodesAndMaterialsBalancedthickness2.cpp\828 ./modules/ModelProcessorx/Balancedthickness2/UpdateElementsBalancedthickness2.cpp\ 829 ./modules/ModelProcessorx/Balancedthickness2/CreateNodesBalancedthickness2.cpp\ 824 830 ./modules/ModelProcessorx/Balancedthickness2/CreateConstraintsBalancedthickness2.cpp\ 825 831 ./modules/ModelProcessorx/Balancedthickness2/CreateLoadsBalancedthickness2.cpp\ 826 ./modules/ModelProcessorx/Balanced thickness2/CreateNodesBalancedthickness2.cpp\827 ./modules/ModelProcessorx/Balancedvelocities/Create ElementsNodesAndMaterialsBalancedvelocities.cpp\832 ./modules/ModelProcessorx/Balancedvelocities/UpdateElementsBalancedvelocities.cpp\ 833 ./modules/ModelProcessorx/Balancedvelocities/CreateNodesBalancedvelocities.cpp\ 828 834 ./modules/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp\ 829 835 ./modules/ModelProcessorx/Balancedvelocities/CreateLoadsBalancedvelocities.cpp\ 830 ./modules/ModelProcessorx/Balancedvelocities/CreateNodesBalancedvelocities.cpp\831 836 ./modules/ModelProcessorx/Qmu/CreateParametersQmu.cpp\ 832 837 ./modules/VerticesDofx/VerticesDofx.h\ … … 838 843 ./modules/Dux/Dux.h\ 839 844 ./modules/Dux/Dux.cpp\ 845 ./modules/MinVelx/MinVelx.h\ 846 ./modules/MinVelx/MinVelx.cpp\ 847 ./modules/MaxVelx/MaxVelx.h\ 848 ./modules/MaxVelx/MaxVelx.cpp\ 840 849 ./modules/ControlConstrainx/ControlConstrainx.h\ 841 850 ./modules/ControlConstrainx/ControlConstrainx.cpp\ -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r4039 r4042 15 15 #include "../../objects/objects.h" 16 16 17 void OutputResults(FemModel* femmodel, char* filename){ 17 void OutputResults(DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters, char* filename){ 18 19 int i; 20 21 Patch* patch=NULL; 18 22 19 23 int solutiontype; 24 int count; 20 25 int numrows; 21 26 int numvertices; … … 23 28 int max_numvertices; 24 29 int max_numnodes; 30 int element_numvertices; 31 int element_numrows; 32 int element_numnodes; 25 33 26 34 /*First, configure elements*/ 27 femmodel->elements->Configure(elements,loads, nodes,vertices, materials,parameters);35 elements->Configure(elements,loads, nodes,vertices, materials,parameters); 28 36 29 37 //Recover solutiontype which will be output to disk: 30 femmodel->parameters->FindParam(&solutiontype,SolutionTypeEnum);38 parameters->FindParam(&solutiontype,SolutionTypeEnum); 31 39 32 40 //Process results to be output in the correct units 33 for(i=0;i< femmodel->elements->Size();i++){34 Element* element= femmodel->elements->GetObjectByOffset(i);41 for(i=0;i<elements->Size();i++){ 42 Element* element=(Element*)elements->GetObjectByOffset(i); 35 43 element->ProcessResultsUnits(); 36 44 } … … 58 66 numnodes=0; 59 67 60 for(i=0;i< femmodel->elements->Size();i++){61 Element* element= femmodel->elements->GetObjectByOffset(i);68 for(i=0;i<elements->Size();i++){ 69 Element* element=(Element*)elements->GetObjectByOffset(i); 62 70 element->PatchSize(&element_numrows,&element_numvertices,&element_numnodes); 63 71 … … 94 102 patch->WriteToDisk(solutiontype,filename); 95 103 104 /*Free ressources:*/ 105 delete patch; 106 96 107 } -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h
r4039 r4042 9 9 10 10 /* local prototypes: */ 11 void OutputResults( FemModel* femmodel, char* filename);11 void OutputResults(DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters, char* filename); 12 12 13 13 #endif /* _OUTPUTRESULTS_H */ -
issm/trunk/src/c/modules/Qmux/DakotaResponses.cpp
r3938 r4042 17 17 #include "../modules.h" 18 18 19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses, Model* model,Results* results,Results* processed_results,int analysis_type,int sub_analysis_type){19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel){ 20 20 21 int i,j; 22 int found=0; 21 int i; 22 extern int my_rank; 23 24 /*intermediary: */ 23 25 char* response_descriptor=NULL; 24 int numberofnodes; 25 extern int my_rank; 26 27 /*some data needed across the responses: */ 28 model->FindParam(&numberofnodes,NumberOfNodesEnum); 29 26 double femmodel_response; 27 30 28 31 29 for(i=0;i<numresponses;i++){ … … 33 31 response_descriptor=responses_descriptors[i]; 34 32 35 / /'min_vx' 'max_vx' 'max_abs_vx' 'min_vy' 'max_vy' 'max_abs_vy' 'min_vel' 'max_vel, mass_flux'33 /*Compute response for this response_descriptor:*/ 36 34 37 35 if(strcmp(response_descriptor,"min_vel")==0){ 38 double* vel=NULL; 39 double min_vel=0; 40 41 found=processed_results->FindResult((void*)&vel,"vel"); 42 if(!found)ISSMERROR(" could not find vel to compute min_vel"); 43 44 min_vel=vel[0]; 45 for(j=1;j<numberofnodes;j++){ 46 if (vel[j]<min_vel)min_vel=vel[j]; 47 } 48 49 if(my_rank==0)responses[i]=min_vel; 50 51 /*Free ressources:*/ 52 xfree((void**)&vel); 53 54 36 MinVelx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 55 37 } 56 38 else if(strcmp(response_descriptor,"max_vel")==0){ 57 double* vel=NULL; 58 double max_vel=0; 59 60 found=processed_results->FindResult((void*)&vel,"vel"); 61 if(!found)ISSMERROR(" could not find vel to compute max_vel"); 62 63 max_vel=vel[0]; 64 for(j=1;j<numberofnodes;j++){ 65 if (vel[j]>max_vel)max_vel=vel[j]; 66 } 67 if(my_rank==0)responses[i]=max_vel; 68 69 /*Free ressources:*/ 70 xfree((void**)&vel); 71 39 MaxVelx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 72 40 } 73 41 else if(strcmp(response_descriptor,"min_vx")==0){ 74 double* vx=NULL; 75 double min_vx=0; 76 77 found=processed_results->FindResult((void*)&vx,"vx"); 78 if(!found)ISSMERROR(" could not find vx to compute min_vx"); 79 80 min_vx=vx[0]; 81 for(j=1;j<numberofnodes;j++){ 82 if (vx[j]<min_vx)min_vx=vx[j]; 83 } 84 if(my_rank==0)responses[i]=min_vx; 85 86 /*Free ressources:*/ 87 xfree((void**)&vx); 88 42 MinVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 89 43 } 90 44 else if(strcmp(response_descriptor,"max_vx")==0){ 91 double* vx=NULL; 92 double max_vx=0; 93 94 found=processed_results->FindResult((void*)&vx,"vx"); 95 if(!found)ISSMERROR(" could not find vx to compute max_vx"); 96 97 max_vx=vx[0]; 98 for(j=1;j<numberofnodes;j++){ 99 if (vx[j]>max_vx)max_vx=vx[j]; 100 } 101 if(my_rank==0)responses[i]=max_vx; 102 103 /*Free ressources:*/ 104 xfree((void**)&vx); 105 45 MaxVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 106 46 } 107 47 else if(strcmp(response_descriptor,"max_abs_vx")==0){ 108 double* vx=NULL; 109 double max_abs_vx=0; 110 111 found=processed_results->FindResult((void*)&vx,"vx"); 112 if(!found)ISSMERROR(" could not find vx to compute max_abs_vx"); 113 114 max_abs_vx=fabs(vx[0]); 115 for(j=1;j<numberofnodes;j++){ 116 if (fabs(vx[j])>max_abs_vx)max_abs_vx=fabs(vx[j]); 117 } 118 if(my_rank==0)responses[i]=max_abs_vx; 119 120 /*Free ressources:*/ 121 xfree((void**)&vx); 122 48 MaxAbsVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 123 49 } 124 50 else if(strcmp(response_descriptor,"min_vy")==0){ 125 double* vy=NULL; 126 double min_vy=0; 127 128 found=processed_results->FindResult((void*)&vy,"vy"); 129 if(!found)ISSMERROR(" could not find vy to compute min_vy"); 130 131 min_vy=vy[0]; 132 for(j=1;j<numberofnodes;j++){ 133 if (vy[j]<min_vy)min_vy=vy[j]; 134 } 135 if(my_rank==0)responses[i]=min_vy; 136 137 /*Free ressources:*/ 138 xfree((void**)&vy); 139 51 MinVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 140 52 } 141 53 else if(strcmp(response_descriptor,"max_vy")==0){ 142 double* vy=NULL; 143 double max_vy=0; 144 145 found=processed_results->FindResult((void*)&vy,"vy"); 146 if(!found)ISSMERROR(" could not find vy to compute max_vy"); 147 148 max_vy=vy[0]; 149 for(j=1;j<numberofnodes;j++){ 150 if (vy[j]>max_vy)max_vy=vy[j]; 151 } 152 if(my_rank==0)responses[i]=max_vy; 153 154 /*Free ressources:*/ 155 xfree((void**)&vy); 156 54 MaxVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 157 55 } 158 56 else if(strcmp(response_descriptor,"max_abs_vy")==0){ 159 double* vy=NULL; 160 double max_abs_vy=0; 161 162 found=processed_results->FindResult((void*)&vy,"vy"); 163 if(!found)ISSMERROR(" could not find vy to compute max_abs_vy"); 164 165 max_abs_vy=fabs(vy[0]); 166 for(j=1;j<numberofnodes;j++){ 167 if (fabs(vy[j])>max_abs_vy)max_abs_vy=fabs(vy[j]); 168 } 169 if(my_rank==0)responses[i]=max_abs_vy; 170 171 /*Free ressources:*/ 172 xfree((void**)&vy); 173 57 MaxAbsVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 174 58 } 175 59 else if(strcmp(response_descriptor,"min_vz")==0){ 176 double* vz=NULL; 177 double min_vz=0; 178 179 found=processed_results->FindResult((void*)&vz,"vz"); 180 if(!found)ISSMERROR(" could not find vz to compute min_vz"); 181 182 min_vz=vz[0]; 183 for(j=1;j<numberofnodes;j++){ 184 if (vz[j]<min_vz)min_vz=vz[j]; 185 } 186 if(my_rank==0)responses[i]=min_vz; 187 188 /*Free ressources:*/ 189 xfree((void**)&vz); 190 60 MinVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 191 61 } 192 62 else if(strcmp(response_descriptor,"max_vz")==0){ 193 double* vz=NULL; 194 double max_vz=0; 195 196 found=processed_results->FindResult((void*)&vz,"vz"); 197 if(!found)ISSMERROR(" could not find vz to compute max_vz"); 198 199 max_vz=vz[0]; 200 for(j=1;j<numberofnodes;j++){ 201 if (vz[j]>max_vz)max_vz=vz[j]; 202 } 203 if(my_rank==0)responses[i]=max_vz; 204 205 /*Free ressources:*/ 206 xfree((void**)&vz); 207 63 MaxVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 208 64 } 209 65 else if(strcmp(response_descriptor,"max_abs_vz")==0){ 210 double* vz=NULL; 211 double max_abs_vz=0; 212 213 found=processed_results->FindResult((void*)&vz,"vz"); 214 if(!found)ISSMERROR(" could not find vz to compute max_abs_vz"); 215 216 max_abs_vz=fabs(vz[0]); 217 for(j=1;j<numberofnodes;j++){ 218 if (fabs(vz[j])>max_abs_vz)max_abs_vz=fabs(vz[j]); 219 } 220 if(my_rank==0)responses[i]=max_abs_vz; 221 222 /*Free ressources:*/ 223 xfree((void**)&vz); 66 MaxAbsVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 224 67 } 225 68 else if(strcmp(response_descriptor,"misfit")==0){ 226 227 int isstokes,ismacayealpattyn,ishutter; 228 FemModel* femmodel=NULL; 229 double J=0; 230 int numberofdofspernode,numberofnodes; 231 Vec u_g=NULL; 232 double* u_g_double=NULL; 233 double* vx=NULL; 234 double* vy=NULL; 235 double* vz=NULL; 236 double* fit=NULL; 237 238 /*retrieve active fem model: */ 239 model->FindParam(&isstokes,IsStokesEnum); 240 model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum); 241 model->FindParam(&ishutter,IsHutterEnum); 242 243 if(isstokes){ 244 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum); 245 } 246 if(ismacayealpattyn){ 247 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum); 248 } 249 if(ishutter){ 250 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum); 251 } 252 253 254 /*Recover some parameters: */ 255 femmodel->parameters->FindParam(&numberofdofspernode,NumberOfDofsPerNodeEnum); 256 femmodel->parameters->FindParam(&numberofnodes,NumberOfNodesEnum); 257 femmodel->parameters->FindParam(&fit,NULL,NULL,FitEnum); 258 259 /*Recover velocity: */ 260 found=results->FindResult(&u_g,"u_g"); 261 VecToMPISerial(&u_g_double,u_g); 262 if(!found)ISSMERROR(" could not find velocity to compute misfit"); 263 264 SplitSolutionVectorx(u_g,numberofnodes,numberofdofspernode,&vx,&vy,&vz); 265 266 /*Add to inputs: */ 267 femmodel->elements->UpdateInputsFromVector(vx,VxEnum,VertexEnum); 268 femmodel->elements->UpdateInputsFromVector(vy,VyEnum,VertexEnum); 269 femmodel->elements->UpdateInputsFromVector(vz,VzEnum,VertexEnum); 270 femmodel->elements->UpdateInputsFromVector(&fit[0],FitEnum,ConstantEnum); 271 272 /*Compute misfit: */ 273 Misfitx( &J, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,analysis_type,sub_analysis_type); 274 275 276 if(my_rank==0)responses[i]=J; 277 278 /*Some cleanup: */ 279 VecFree(&u_g); 280 xfree((void**)&u_g_double); 281 xfree((void**)&fit); 282 69 Misfitx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters); 283 70 } 284 71 else if(strcmp(response_descriptor,"mass_flux")==0){ 285 286 int isstokes,ismacayealpattyn,ishutter; 287 Vec ug=NULL; 288 double* ug_serial=NULL; 289 double mass_flux=0; 290 double* segments=NULL; 291 int num_segments; 292 DataSet* elements=NULL; 293 DataSet* nodes=NULL; 294 DataSet* materials=NULL; 295 DataSet* parameters=NULL; 296 FemModel* femmodel=NULL; 297 Param* param=NULL; 298 299 /*retrieve velocities: */ 300 found=results->FindResult(&ug,"u_g"); 301 if(!found)ISSMERROR(" could not find velocity to compute mass_flux"); 302 VecToMPISerial(&ug_serial,ug); 303 304 /*retrieve active fem model: */ 305 model->FindParam(&isstokes,IsStokesEnum); 306 model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum); 307 model->FindParam(&ishutter,IsHutterEnum); 308 309 if(isstokes){ 310 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum); 311 } 312 if(ismacayealpattyn){ 313 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum); 314 } 315 if(ishutter){ 316 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum); 317 } 318 319 /*retrieve qmu_mass_flux_segments: */ 320 femmodel->parameters->FindParam(&segments,&num_segments,QmuMassFluxSegmentsEnum); 321 322 /*call mass flux module: */ 323 MassFluxx(&mass_flux,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,segments,num_segments,ug_serial); 324 325 if(my_rank==0)responses[i]=mass_flux; 326 327 /*Free ressources:*/ 328 VecFree(&ug); 329 xfree((void**)&ug_serial); 330 xfree((void**)&segments); 72 MassFlux(&femmodel_response,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 331 73 } 332 74 else{ 333 if(my_rank==0)printf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!");334 75 ISSMERROR("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!"); 335 76 } 77 78 /*send response back to Dakota only on cpu 0: */ 79 if(my_rank==0)responses[i]=femmodel_response; 336 80 } 337 81 -
issm/trunk/src/c/modules/Qmux/Qmux.cpp
r3913 r4042 51 51 52 52 #ifdef _SERIAL_ 53 void Qmux(mxArray* model,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file){53 void Qmux(mxArray* femmodel,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file){ 54 54 #else 55 void Qmux( Model* model,int analysis_type,int sub_analysis_type){55 void Qmux(FemModel* femmodel){ 56 56 #endif 57 57 … … 111 111 112 112 // Serial case: plug in derived Interface object without an analysisComm 113 interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*) model,analysis_type,sub_analysis_type), false);113 interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)femmodel), false); 114 114 } 115 115 … … 120 120 #ifdef _PARALLEL_ 121 121 //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1: 122 SpawnCore(NULL,0, NULL,NULL,0, model,analysis_type,sub_analysis_type,-1);122 SpawnCore(NULL,0, NULL,NULL,0,femmodel,-1); 123 123 #endif 124 124 … … 128 128 129 129 for(;;){ 130 if(!SpawnCore(NULL,0, NULL,NULL,0, model,analysis_type,sub_analysis_type,0))break; //counter came in at -1 on cpu0, bail out.130 if(!SpawnCore(NULL,0, NULL,NULL,0,femmodel,0))break; //counter came in at -1 on cpu0, bail out. 131 131 } 132 132 } -
issm/trunk/src/c/modules/Qmux/Qmux.h
r3913 r4042 10 10 11 11 /* local prototypes: */ 12 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,int analysis_type,int sub_analysis_type,int counter);12 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int analysis_type,int sub_analysis_type,int counter); 13 13 #ifdef _SERIAL_ 14 void Qmux(mxArray* model,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file);15 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* model,int analysis_type,int sub_analysis_type,int counter);14 void Qmux(mxArray* femmodel,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file); 15 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int analysis_type,int sub_analysis_type,int counter); 16 16 #else 17 void Qmux( Model*model,int analysis_type,int sub_analysis_type);18 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model*model,int analysis_type,int sub_analysis_type,int counter);19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses, Model* model, DataSet* results,DataSet* processed_results,int analysis_type,int sub_analysis_type);17 void Qmux(FemModel* femmodel,int analysis_type,int sub_analysis_type); 18 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int analysis_type,int sub_analysis_type,int counter); 19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel,int analysis_type,int sub_analysis_type); 20 20 #endif 21 21 -
issm/trunk/src/c/modules/Qmux/SpawnCore.cpp
r3913 r4042 17 17 #include "../../include/include.h" 18 18 19 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,int analysis_type,int sub_analysis_type,int counter){19 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter){ 20 20 21 21 /*Branch into a serial SpawnCore and a parallel SpawnCore: */ 22 22 #ifdef _SERIAL_ 23 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*) model, analysis_type,sub_analysis_type,counter);23 SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter); 24 24 #else 25 25 /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */ 26 26 MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD); if(counter==-1)return 0; 27 27 28 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, ( Model*)model, analysis_type,sub_analysis_type,counter);28 SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel); 29 29 #endif 30 30 -
issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp
r3938 r4042 34 34 #include "../../solutions/solutions.h" 35 35 36 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model* model,int analysis_type,int sub_analysis_type,int counter){36 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter){ 37 37 38 38 int i; 39 extern int my_rank; 39 40 40 /*output from core solutions: */ 41 Results* results=NULL; 42 Results* processed_results=NULL; 41 char **responses_descriptors = NULL; 42 int num_responses_descriptors; 43 char *string = NULL; 44 int string_length; 45 double *qmu_part = NULL; 46 int qmu_npart; 47 int verbose = 0; 48 int dummy; 49 int solution_type; 43 50 44 char** responses_descriptors=NULL;45 int num_responses_descriptors;46 char* string=NULL;47 int string_length;48 double* qmu_part=NULL;49 int qmu_npart;50 int verbose=0;51 int dummy;52 53 extern int my_rank;54 51 55 52 … … 58 55 59 56 /*some parameters needed: */ 60 model->FindParam(&verbose,VerboseEnum); 57 femmodel->parameters->FindParam(&verbose,VerboseEnum); 58 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 61 59 62 /*First off, recover the response descriptors for the response functions: */63 model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum)->parameters->FindParam(&responses_descriptors,&num_responses_descriptors,ResponseDescriptorsEnum);64 65 60 /*Recover partitioning for dakota: */ 66 model->FindParam(&qmu_npart,QmuNPartEnum);67 model->FindParam(&qmu_part,&dummy,QmuPartEnum);61 femmodel->FindParam(&qmu_npart,QmuNPartEnum); 62 femmodel->FindParam(&qmu_part,&dummy,QmuPartEnum); 68 63 69 64 /*broadcast variables: only cpu 0 has correct values*/ … … 92 87 _printf_("qmu iteration: %i\n",counter); 93 88 94 /*Modify core inputs in objects contained in model, to reflect the dakota variables inputs: */95 model->UpdateFromDakota(variables,variables_descriptors,numvariables,model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum)->parameters,qmu_part,qmu_npart); //diagnostic horiz model is the one holding the parameters for Dakota.89 /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */ 90 UpdateFromDakota(variables,variables_descriptors,numvariables,femmodel,qmu_part,qmu_npart); 96 91 97 92 /*Run the analysis core solution sequence: */ 98 if( analysis_type==DiagnosticAnalysisEnum){93 if(solution_type==DiagnosticAnalysisEnum){ 99 94 100 95 if(verbose)_printf_("Starting diagnostic core\n"); 101 96 102 results=diagnostic_core(model);97 diagnostic_core(femmodel); 103 98 104 99 } 105 else if( analysis_type==ThermalAnalysisEnum){100 else if(solution_type==ThermalAnalysisEnum){ 106 101 107 102 if(verbose)_printf_("Starting thermal core\n"); 108 results=thermal_core(model);103 thermal_core(femmodel); 109 104 110 105 } 111 else if( analysis_type==PrognosticAnalysisEnum){106 else if(solution_type==PrognosticAnalysisEnum){ 112 107 113 108 if(verbose)_printf_("Starting prognostic core\n"); 114 results=prognostic_core(model);109 prognostic_core(femmodel); 115 110 116 111 } 117 else if( analysis_type==TransientAnalysisEnum){112 else if(solution_type==TransientAnalysisEnum){ 118 113 119 114 if(verbose)_printf_("Starting transient core\n"); 120 results=transient_core(model);115 transient_core(femmodel); 121 116 122 117 } 123 else ISSMERROR("%s% i%s%i%s"," analysis_type ",analysis_type," and sub_analysis_type ",sub_analysis_type,"not supported yet!");118 else ISSMERROR("%s%s%s"," solution_type: ",EnumAsString(solution_type),", not supported yet!"); 124 119 125 120 /*compute responses on cpu 0: dummy for now! */ 126 121 if(verbose)_printf_("compute dakota responses:\n"); 127 DakotaResponses(responses,responses_descriptors,numresponses, model,results,processed_results,analysis_type,sub_analysis_type);122 DakotaResponses(responses,responses_descriptors,numresponses,femmodel,results,processed_results); 128 123 129 124 /*Free ressources:*/ 130 delete results;131 delete processed_results;132 133 125 //variables only on cpu != 0 134 126 if(my_rank!=0){ … … 148 140 xfree((void**)&responses_descriptors); 149 141 xfree((void**)&qmu_part); 142 143 150 144 } 151 145 -
issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp
r4034 r4042 17 17 18 18 /*output: */ 19 Vec *yg=NULL;19 Vec yg=NULL; 20 20 21 21 /*First, recover number of dofs from nodes: */ … … 31 31 32 32 /*Specify numentries: */ 33 VecGetSize(yg ->vector,&gsize);33 VecGetSize(yg,&gsize); 34 34 } 35 35 -
issm/trunk/src/c/modules/UpdateInputsFromSolutionx/UpdateInputsFromSolutionx.cpp
r4037 r4042 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type ,int step=0){11 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type){ 12 12 13 13 double* serial_solution=NULL; … … 17 17 18 18 /*Call overloaded form of UpdateInputsFromSolutionx: */ 19 UpdateInputsFromSolutionx( elements, nodes, vertices, loads, materials, parameters,serial_solution, analysis_type, sub_analysis_type ,step);19 UpdateInputsFromSolutionx( elements, nodes, vertices, loads, materials, parameters,serial_solution, analysis_type, sub_analysis_type); 20 20 21 21 /*Free ressources:*/ … … 44 44 45 45 } 46 47 /*Same routines, with additional timestep argument: */48 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type,int timestep){49 50 51 double* serial_solution=NULL;52 53 /*Serialize solution, so that elements can index into it on every CPU: */54 VecToMPISerial(&serial_solution,solution);55 56 /*Call overloaded form of UpdateInputsFromSolutionx: */57 UpdateInputsFromSolutionx( elements, nodes, vertices, loads, materials, parameters,serial_solution, analysis_type, sub_analysis_type,int timestep);58 59 /*Free ressources:*/60 xfree((void**)&serial_solution);61 62 }63 64 65 66 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,double* solution, int analysis_type, int sub_analysis_type,int timestep){67 68 /*Intermediary*/69 int i;70 Element* element=NULL;71 72 /*First, get elements and loads configured: */73 elements-> Configure(elements,loads, nodes,vertices, materials,parameters);74 loads-> Configure(elements,loads, nodes,vertices, materials,parameters);75 nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);76 parameters->Configure(elements,loads, nodes,vertices, materials,parameters);77 78 /*Elements drive the update: */79 for (i=0;i<elements->Size();i++){80 element=(Element*)elements->GetObjectByOffset(i);81 element->UpdateInputsFromSolution(solution,analysis_type,sub_analysis_type,timestep);82 }83 84 } -
issm/trunk/src/c/modules/modules.h
r4002 r4042 66 66 #include "./GetSolutionFromInputsx/GetSolutionFromInputsx.h" 67 67 #include "./OutputResultsx/OutputResultsx.h" 68 #include "./MinVelx/MinVelx.h" 69 #include "./MaxVelx/MaxVelx.h" 68 70 #endif -
issm/trunk/src/c/objects/DakotaPlugin.cpp
r3913 r4042 44 44 45 45 //constructor 46 DakotaPlugin::DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_ model, int in_analysis_type, int in_sub_analysis_type):Dakota::DirectApplicInterface(problem_db){46 DakotaPlugin::DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_femmodel):Dakota::DirectApplicInterface(problem_db){ 47 47 48 48 49 model=in_model; 50 analysis_type=in_analysis_type; 51 sub_analysis_type=in_sub_analysis_type; 49 femmodel=in_femmodel; 52 50 counter=0; 53 51 } … … 89 87 90 88 /*run core solution: */ 91 SpawnCore(responses,numFns, variables,variable_descriptors,numACV,model, analysis_type,sub_analysis_type,counter);89 SpawnCore(responses,numFns, variables,variable_descriptors,numACV,model,counter); 92 90 93 91 /*populate responses: */ -
issm/trunk/src/c/objects/DakotaPlugin.h
r3673 r4042 24 24 public: 25 25 26 DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* model , int analysis_type, int sub_analysis_type);26 DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* model); 27 27 ~DakotaPlugin(); 28 28 29 29 /*these fields are used by core solutions: */ 30 void* model;30 void* femmodel; 31 31 32 int analysis_type;33 int sub_analysis_type;34 32 int counter; 35 33 -
issm/trunk/src/c/objects/Elements/Beam.cpp
r4039 r4042 626 626 void Beam::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){ 627 627 628 int i; 629 630 /*output: */ 631 int numrows = 0; 632 int numvertices = 0; 633 int numnodes = 0; 634 635 /*Go through all the results objects, and update the counters: */ 636 for (i=0;i<this->results->Size();i++){ 637 Result* result=(Result*)this->results->GetObjectByOffset(i); 638 /*first, we have one more result: */ 639 numrows++; 640 /*now, how many vertices and how many nodal values for this result? :*/ 641 numvertices=2; //this is a beam element, with 2 vertices 642 numnodes=result->NumberOfNodalValues(); //ask result object. 643 } 644 645 /*Assign output pointers:*/ 646 *pnumrows=numrows; 647 *pnumvertices=numvertices; 648 *pnumnodes=numnodes; 628 ISSMERROR(" not supported yet!"); 649 629 650 630 } … … 653 633 void Beam::PatchFill(int* pcount, Patch* patch){ 654 634 655 int i; 656 int count; 657 int vertices_ids[2]; 658 659 660 /*recover pointer: */ 661 count=*pcount; 662 663 /*will be needed later: */ 664 for(i=0;i<2;i++) vertices_ids[i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch. 665 666 for(i=0;i<this->results->Size();i++){ 667 Result* result=(Result*)this->results->GetObjectByOffset(i); 668 669 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand 670 *it to the result object, to fill the rest: */ 671 patch->fillelementinfo(count,this->id,vertices_ids,2); 672 result->PatchFill(count,patch); 673 674 /*increment counter: */ 675 count++; 635 ISSMERROR(" not supported yet!"); 636 } 637 /*}}}*/ 638 /*FUNCTION Beam::MinVel(double* pminvel, bool process_units);{{{1*/ 639 void Beam::MinVel(double* pminvel, bool process_units){ 640 641 const int numgrids=2; 642 double gaussgrids[numgrids][2]={{0,1},{1,0}}; 643 double vx_values[numgrids]; 644 double vy_values[numgrids]; 645 double vz_values[numgrids]; 646 double vel_values[numgrids]; 647 double minvel; 648 649 /*retrieve dim parameter: */ 650 parameters->FindParam(&dim,DimEnum); 651 652 /*retrive velocity values at nodes */ 653 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 654 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 655 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 656 657 /*now, compute minimum of velocity :*/ 658 if(dim==2){ 659 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 660 } 661 else{ 662 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 663 } 664 665 /*now, compute minimum:*/ 666 minvel=vel_values[0]; 667 for(i=1;i<numgrids;i++){ 668 if (vel_values[i]<minvel)minvel=vel_values[i]; 676 669 } 677 670 678 671 /*Assign output pointers:*/ 679 *pcount=count; 680 } 672 *pminvel=minvel; 673 674 } 675 /*}}}*/ 676 /*FUNCTION Beam::MaxVel(double* pmaxvel, bool process_units);{{{1*/ 677 void Beam::MaxVel(double* pmaxvel, bool process_units){ 678 679 const int numgrids=2; 680 double gaussgrids[numgrids][2]={{0,1},{1,0}}; 681 double vx_values[numgrids]; 682 double vy_values[numgrids]; 683 double vz_values[numgrids]; 684 double vel_values[numgrids]; 685 double maxvel; 686 687 /*retrieve dim parameter: */ 688 parameters->FindParam(&dim,DimEnum); 689 690 /*retrive velocity values at nodes */ 691 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 692 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 693 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 694 695 /*now, compute maximum of velocity :*/ 696 if(dim==2){ 697 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 698 } 699 else{ 700 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 701 } 702 703 /*now, compute maximum:*/ 704 maxvel=vel_values[0]; 705 for(i=1;i<numgrids;i++){ 706 if (vel_values[i]>maxvel)maxvel=vel_values[i]; 707 } 708 709 /*Assign output pointers:*/ 710 *pmaxvel=maxvel; 711 712 } 713 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Beam.h
r4039 r4042 83 83 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 84 84 void PatchFill(int* pcount, Patch* patch); 85 85 void MinVel(double* pminvel, bool process_units); 86 void MaxVel(double* pmaxvel, bool process_units); 86 87 /*}}}*/ 87 88 /*not implemented: {{{1*/ -
issm/trunk/src/c/objects/Elements/Element.h
r4039 r4042 53 53 virtual void InputToResult(int enum_type,int step,double time)=0; 54 54 virtual void ProcessResultsUnits(void)=0; 55 virtual void MinVel(double* pminvel, bool process_units)=0; 56 virtual void MaxVel(double* pmaxvel, bool process_units)=0; 55 57 56 58 /*Implementation: */ -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4039 r4042 504 504 Parameters *beam_parameters = NULL; 505 505 Inputs *beam_inputs = NULL; 506 Results *beam_results = NULL;507 506 508 507 indices[0]=g0; … … 511 510 beam_parameters=this->parameters; 512 511 beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices); 513 beam_results=(Results*)this->results->SpawnBeamResults(indices);514 512 515 513 beam=new Beam(); 516 514 beam->id=this->id; 517 515 beam->inputs=beam_inputs; 518 beam->results=beam_results;519 516 beam->parameters=beam_parameters; 520 517 … … 535 532 Parameters *sing_parameters = NULL; 536 533 Inputs *sing_inputs = NULL; 537 Results *sing_results = NULL;538 534 539 535 sing_parameters=this->parameters; 540 536 sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index); 541 sing_results=(Results*)this->results->SpawnSingResults(index);542 537 543 538 sing=new Sing(); 544 539 sing->id=this->id; 545 540 sing->inputs=sing_inputs; 546 sing->results=sing_results;547 541 sing->parameters=sing_parameters; 548 542 … … 612 606 /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result 613 607 * object out of the input, with the additional step and time information: */ 614 this->results->AddObject( input->SpawnResult(step,time));608 this->results->AddObject((Object*)input->SpawnResult(step,time)); 615 609 616 610 } … … 622 616 623 617 for(i=0;i<this->results->Size();i++){ 624 Result* result= this->results->GetObjectByOffset(i);618 Result* result=(Result*)this->results->GetObjectByOffset(i); 625 619 result->ProcessUnits(this->parameters); 626 620 } … … 3387 3381 3388 3382 Penta* penta=NULL; 3383 Input* this_input=NULL; 3389 3384 3390 3385 /*recover parameters: */ … … 3399 3394 3400 3395 penta=this; 3396 this_input=this->inputs->GetInput(enum_type); 3397 if(!this_input)ISSMERROR("%s%s"," could not find input with enum:",EnumAsString(enum_type)); 3401 3398 3402 3399 for(;;){ … … 3406 3403 3407 3404 /*Add input of the basal element*/ 3408 penta->inputs->AddInput(this ->inputs->GetInput(enum_type));3405 penta->inputs->AddInput(this_input); 3409 3406 3410 3407 /*Stop if we have reached the surface*/ … … 4953 4950 *pcount=count; 4954 4951 } 4952 /*FUNCTION Penta::MinVel(double* pminvel, bool process_units);{{{1*/ 4953 void Penta::MinVel(double* pminvel, bool process_units){ 4954 4955 const int numgrids=6; 4956 double gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4957 double vx_values[numgrids]; 4958 double vy_values[numgrids]; 4959 double vz_values[numgrids]; 4960 double vel_values[numgrids]; 4961 double minvel; 4962 4963 /*retrieve dim parameter: */ 4964 parameters->FindParam(&dim,DimEnum); 4965 4966 /*retrive velocity values at nodes */ 4967 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 4968 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 4969 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 4970 4971 /*now, compute minimum of velocity :*/ 4972 if(dim==2){ 4973 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 4974 } 4975 else{ 4976 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 4977 } 4978 4979 /*now, compute minimum:*/ 4980 minvel=vel_values[0]; 4981 for(i=1;i<numgrids;i++){ 4982 if (vel_values[i]<minvel)minvel=vel_values[i]; 4983 } 4984 4985 /*Assign output pointers:*/ 4986 *pminvel=minvel; 4987 4988 } 4989 /*}}}*/ 4990 /*FUNCTION Penta::MaxVel(double* pmaxvel, bool process_units);{{{1*/ 4991 void Penta::MaxVel(double* pmaxvel, bool process_units){ 4992 4993 const int numgrids=6; 4994 double gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4995 double vx_values[numgrids]; 4996 double vy_values[numgrids]; 4997 double vz_values[numgrids]; 4998 double vel_values[numgrids]; 4999 double maxvel; 5000 5001 /*retrieve dim parameter: */ 5002 parameters->FindParam(&dim,DimEnum); 5003 5004 /*retrive velocity values at nodes */ 5005 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 5006 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 5007 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 5008 5009 /*now, compute maximum of velocity :*/ 5010 if(dim==2){ 5011 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 5012 } 5013 else{ 5014 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 5015 } 5016 5017 /*now, compute maximum:*/ 5018 maxvel=vel_values[0]; 5019 for(i=1;i<numgrids;i++){ 5020 if (vel_values[i]>maxvel)maxvel=vel_values[i]; 5021 } 5022 5023 /*Assign output pointers:*/ 5024 *pmaxvel=maxvel; 5025 5026 } 5027 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r4039 r4042 152 152 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 153 153 void PatchFill(int* pcount, Patch* patch); 154 void MinVel(double* pminvel, bool process_units); 155 void MaxVel(double* pmaxvel, bool process_units); 154 156 155 157 /*updates: */ -
issm/trunk/src/c/objects/Elements/Sing.cpp
r4039 r4042 450 450 void Sing::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){ 451 451 452 int i; 453 454 /*output: */ 455 int numrows = 0; 456 int numvertices = 0; 457 int numnodes = 0; 458 459 /*Go through all the results objects, and update the counters: */ 460 for (i=0;i<this->results->Size();i++){ 461 Result* result=(Result*)this->results->GetObjectByOffset(i); 462 /*first, we have one more result: */ 463 numrows++; 464 /*now, how many vertices and how many nodal values for this result? :*/ 465 numvertices=1; //this is a sing element, with 1 vertex 466 numnodes=result->NumberOfNodalValues(); //ask result object. 467 } 468 469 /*Assign output pointers:*/ 470 *pnumrows=numrows; 471 *pnumvertices=numvertices; 472 *pnumnodes=numnodes; 452 ISSMERROR(" not supported yet!"); 473 453 474 454 } … … 476 456 /*FUNCTION Sing::PatchFill(int* pcount, Patch* patch){{{1*/ 477 457 void Sing::PatchFill(int* pcount, Patch* patch){ 478 479 int i; 480 int count; 481 int vertices_ids[1]; 482 483 484 /*recover pointer: */ 485 count=*pcount; 486 487 /*will be needed later: */ 488 for(i=0;i<1;i++) vertices_ids[i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch. 489 490 for(i=0;i<this->results->Size();i++){ 491 Result* result=(Result*)this->results->GetObjectByOffset(i); 492 493 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand 494 *it to the result object, to fill the rest: */ 495 patch->fillelementinfo(count,this->id,vertices_ids,1); 496 result->PatchFill(count,patch); 497 498 /*increment counter: */ 499 count++; 458 459 ISSMERROR(" not supported yet!"); 460 } 461 /*}}}*/ 462 /*FUNCTION Sing::MinVel(double* pminvel, bool process_units);{{{1*/ 463 void Sing::MinVel(double* pminvel, bool process_units){ 464 465 double vx; 466 double vy; 467 double vz; 468 double minvel; 469 470 /*retrive velocity values at nodes */ 471 inputs->GetParameterValue(&vx,VxEnum); 472 inputs->GetParameterValue(&vy,VyEnum); 473 if(dim==3)inputs->GetParameterValue(&vz,VzEnum); 474 475 /*now, compute minimum of velocity :*/ 476 if(dim==2){ 477 minvel=sqrt(pow(vx,2)+pow(vy,2)); 478 } 479 else{ 480 minvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 500 481 } 501 482 502 483 /*Assign output pointers:*/ 503 *pcount=count; 504 } 484 *pminvel=minvel; 485 486 } 487 /*}}}*/ 488 /*FUNCTION Sing::MaxVel(double* pmaxvel, bool process_units);{{{1*/ 489 void Sing::MaxVel(double* pmaxvel, bool process_units){ 490 491 double vx; 492 double vy; 493 double vz; 494 double maxvel; 495 496 /*retrive velocity values at nodes */ 497 inputs->GetParameterValue(&vx,VxEnum); 498 inputs->GetParameterValue(&vy,VyEnum); 499 if(dim==3)inputs->GetParameterValue(&vz,VzEnum); 500 501 /*now, compute maximum of velocity :*/ 502 if(dim==2){ 503 maxvel=sqrt(pow(vx,2)+pow(vy,2)); 504 } 505 else{ 506 maxvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 507 } 508 509 /*Assign output pointers:*/ 510 *pmaxvel=maxvel; 511 512 } 513 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Sing.h
r4039 r4042 82 82 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 83 83 void PatchFill(int* pcount, Patch* patch); 84 void MinVel(double* pminvel, bool process_units); 85 void MaxVel(double* pmaxvel, bool process_units); 84 86 85 87 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4039 r4042 438 438 Parameters *beam_parameters = NULL; 439 439 Inputs *beam_inputs = NULL; 440 Results *beam_results = NULL;441 440 442 441 indices[0]=g0; … … 445 444 beam_parameters=this->parameters; 446 445 beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices); 447 beam_results=(Results*)this->results->SpawnBeamResults(indices);448 446 449 447 beam=new Beam(); 450 448 beam->id=this->id; 451 449 beam->inputs=beam_inputs; 452 beam->results=beam_results;453 450 beam->parameters=beam_parameters; 454 451 … … 470 467 Parameters *sing_parameters = NULL; 471 468 Inputs *sing_inputs = NULL; 472 Results *sing_results = NULL;473 469 474 470 sing_parameters=this->parameters; 475 471 sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index); 476 sing_results=(Results*)this->results->SpawnSingResults(index);477 472 478 473 sing=new Sing(); 479 474 sing->id=this->id; 480 475 sing->inputs=sing_inputs; 481 sing->results=sing_results;482 476 sing->parameters=sing_parameters; 483 477 … … 508 502 /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result 509 503 * object out of the input, with the additional step and time information: */ 510 this->results->AddObject( input->SpawnResult(step,time));504 this->results->AddObject((Object*)input->SpawnResult(step,time)); 511 505 512 506 } … … 518 512 519 513 for(i=0;i<this->results->Size();i++){ 520 Result* result= this->results->GetObjectByOffset(i);514 Result* result=(Result*)this->results->GetObjectByOffset(i); 521 515 result->ProcessUnits(this->parameters); 522 516 } … … 4987 4981 /*copy input of enum_type*/ 4988 4982 oldinput=this->inputs->GetInput(enum_type); 4983 if(!oldinput)ISSMERROR("%s%s"," could not find old input with enum: ",EnumAsString(enum_type)); 4989 4984 newinput=(Input*)oldinput->copy(); 4990 4985 … … 5065 5060 *prow=row; 5066 5061 } 5062 /*FUNCTION Tria::MinVel(double* pminvel, bool process_units);{{{1*/ 5063 void Tria::MinVel(double* pminvel, bool process_units){ 5064 5065 const int numgrids=3; 5066 double gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}}; 5067 double vx_values[numgrids]; 5068 double vy_values[numgrids]; 5069 double vz_values[numgrids]; 5070 double vel_values[numgrids]; 5071 double minvel; 5072 5073 /*retrieve dim parameter: */ 5074 parameters->FindParam(&dim,DimEnum); 5075 5076 /*retrive velocity values at nodes */ 5077 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 5078 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 5079 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 5080 5081 /*now, compute minimum of velocity :*/ 5082 if(dim==2){ 5083 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 5084 } 5085 else{ 5086 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 5087 } 5088 5089 /*now, compute minimum:*/ 5090 minvel=vel_values[0]; 5091 for(i=1;i<numgrids;i++){ 5092 if (vel_values[i]<minvel)minvel=vel_values[i]; 5093 } 5094 5095 /*Assign output pointers:*/ 5096 *pminvel=minvel; 5097 5098 } 5099 /*}}}*/ 5100 /*FUNCTION Tria::MaxVel(double* pmaxvel, bool process_units);{{{1*/ 5101 void Tria::MaxVel(double* pmaxvel, bool process_units){ 5102 5103 const int numgrids=3; 5104 double gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}}; 5105 double vx_values[numgrids]; 5106 double vy_values[numgrids]; 5107 double vz_values[numgrids]; 5108 double vel_values[numgrids]; 5109 double maxvel; 5110 5111 /*retrieve dim parameter: */ 5112 parameters->FindParam(&dim,DimEnum); 5113 5114 /*retrive velocity values at nodes */ 5115 inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum); 5116 inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum); 5117 if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum); 5118 5119 /*now, compute maximum of velocity :*/ 5120 if(dim==2){ 5121 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)); 5122 } 5123 else{ 5124 for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2)); 5125 } 5126 5127 /*now, compute maximum:*/ 5128 maxvel=vel_values[0]; 5129 for(i=1;i<numgrids;i++){ 5130 if (vel_values[i]>maxvel)maxvel=vel_values[i]; 5131 } 5132 5133 /*Assign output pointers:*/ 5134 *pmaxvel=maxvel; 5135 5136 } 5137 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r4039 r4042 128 128 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 129 129 void PatchFill(int* pcount, Patch* patch); 130 void MinVel(double* pminvel, bool process_units); 131 void MaxVel(double* pmaxvel, bool process_units); 130 132 131 133 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp
r4039 r4042 227 227 } 228 228 /*}}}*/ 229 /*FUNCTION BeamVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 230 void BeamVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 231 232 int i; 233 const int numnodes=2; 234 double valuescopy[numnodes]; 235 double squaremin; 236 237 /*First, copy values, to process units if requested: */ 238 for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i]; 239 240 /*Process units if requested: */ 241 if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters); 242 243 /*Now, figure out minimum of valuescopy: */ 244 squaremin=pow(valuescopy[0],2); 245 for(i=1;i<numnodes;i++){ 246 if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2); 247 } 248 /*Assign output pointers:*/ 249 *psquaremin=squaremin; 250 } 251 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/BeamVertexInput.h
r4039 r4042 73 73 void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");}; 74 74 void ChangeEnum(int newenumtype); 75 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 75 76 /*}}}*/ 76 77 -
issm/trunk/src/c/objects/Inputs/BoolInput.cpp
r4039 r4042 177 177 Result* BoolInput::SpawnResult(int step, double time){ 178 178 179 return new BoolResult(this->enum_type,this->value,step,time);179 ISSMERROR(" not supported yet!"); 180 180 181 181 } … … 217 217 } 218 218 /*}}}*/ 219 /*FUNCTION BoolInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 220 void BoolInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 221 /*square of a bool is the bool itself: */ 222 *psquaremin=value; 223 } 224 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/BoolInput.h
r4039 r4042 73 73 void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");}; 74 74 void ChangeEnum(int newenumtype); 75 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 75 76 /*}}}*/ 76 77 -
issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
r4039 r4042 227 227 } 228 228 /*}}}*/ 229 /*FUNCTION DoubleInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 230 void DoubleInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 231 232 /*square min of a double is the square of the double itself: */ 233 *psquaremin=pow(value,2); 234 } 235 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r4039 r4042 74 74 void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");}; 75 75 void ChangeEnum(int newenumtype); 76 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 76 77 /*}}}*/ 77 78 -
issm/trunk/src/c/objects/Inputs/Input.h
r4039 r4042 50 50 virtual Input* SpawnTriaInput(int* indices)=0; 51 51 virtual Result* SpawnResult(int step, double time)=0; 52 53 52 virtual void SquareMin(double* psquaremin, bool process_units,Parameters* parameters)=0; 54 53 /*}}}*/ 55 54 -
issm/trunk/src/c/objects/Inputs/IntInput.cpp
r4039 r4042 173 173 /*FUNCTION IntInput::SpawnResult{{{1*/ 174 174 Result* IntInput::SpawnResult(int step, double time){ 175 176 return new IntResult(this->enum_type,this->value,step,time);175 176 ISSMERROR(" not supported yet!"); 177 177 178 178 } … … 214 214 } 215 215 /*}}}*/ 216 /*FUNCTION IntInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 217 void IntInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 218 219 /*square min of an integer is the square of the integer itself: */ 220 *psquaremin=pow(value,2); 221 } 222 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/IntInput.h
r4039 r4042 73 73 void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");}; 74 74 void ChangeEnum(int newenumtype); 75 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 75 76 /*}}}*/ 76 77 -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
r4039 r4042 876 876 } 877 877 /*}}}*/ 878 /*FUNCTION PentaVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 879 void PentaVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 880 881 int i; 882 const int numnodes=6; 883 double valuescopy[numnodes]; 884 double squaremin; 885 886 /*First, copy values, to process units if requested: */ 887 for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i]; 888 889 /*Process units if requested: */ 890 if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters); 891 892 /*Now, figure out minimum of valuescopy: */ 893 squaremin=pow(valuescopy[0],2); 894 for(i=1;i<numnodes;i++){ 895 if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2); 896 } 897 /*Assign output pointers:*/ 898 *psquaremin=squaremin; 899 } 900 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
r4039 r4042 82 82 void GetBPattyn(double* B, double* xyz_list, double* gauss_coord); 83 83 void GetBStokes(double* B, double* xyz_list, double* gauss_coord); 84 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 84 85 /*}}}*/ 85 86 -
issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp
r4039 r4042 205 205 } 206 206 /*}}}*/ 207 /*FUNCTION SingVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 208 void SingVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 209 210 double valuecopy; 211 double squaremin; 212 213 /*First, copy value, to process units if requested: */ 214 valuecopy=value; 215 216 /*Process units if requested: */ 217 if(process)NodalValuesUnitConversion(&valuecopy,1,enum_type,parameters); 218 219 /*Now, return square of value, because it is the minimum: */ 220 squaremin=pow(valuecopy,2); 221 222 /*Assign output pointers:*/ 223 *psquaremin=squaremin; 224 } 225 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/SingVertexInput.h
r4039 r4042 72 72 void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");}; 73 73 void ChangeEnum(int newenumtype); 74 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 74 75 /*}}}*/ 75 76 -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp
r4039 r4042 450 450 } 451 451 /*}}}*/ 452 /*FUNCTION TriaVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/ 453 void TriaVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 454 455 int i; 456 const int numnodes=3; 457 double valuescopy[numnodes]; 458 double squaremin; 459 460 /*First, copy values, to process units if requested: */ 461 for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i]; 462 463 /*Process units if requested: */ 464 if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters); 465 466 /*Now, figure out minimum of valuescopy: */ 467 squaremin=pow(valuescopy[0],2); 468 for(i=1;i<numnodes;i++){ 469 if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2); 470 } 471 /*Assign output pointers:*/ 472 *psquaremin=squaremin; 473 } 474 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
r4039 r4042 79 79 void GetJacobian(double* J, double* xyz_list,double* gauss); 80 80 void GetJacobianInvert(double* Jinv, double* xyz_list,double* gauss); 81 void SquareMin(double* psquaremin, bool process_units,Parameters* parameters); 81 82 /*}}}*/ 82 83 -
issm/trunk/src/c/objects/Patch.cpp
r4039 r4042 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION Patch::fillelementinfo(int row, int element_id, int vertices_ids, int num_vertices);{{{1*/62 void Patch::fillelementinfo(int count, int element_id, int vertices_ids, int num_vertices){61 /*FUNCTION Patch::fillelementinfo(int row, int element_id, int* vertices_ids, int num_vertices);{{{1*/ 62 void Patch::fillelementinfo(int count, int element_id, int* vertices_ids, int num_vertices){ 63 63 64 64 int i; -
issm/trunk/src/c/objects/Patch.h
r4039 r4042 40 40 Patch(int numrows, int maxvertices, int maxnodes); 41 41 ~Patch(); 42 void fillelementinfo(int row, int element_id, int vertices_ids, int num_vertices);42 void fillelementinfo(int row, int element_id, int* vertices_ids, int num_vertices); 43 43 void fillresultinfo(int row,int enum_type,int step, double time, int interpolation, double* nodal_values, int num_nodes); 44 44 void MPI_Gather(void); -
issm/trunk/src/c/objects/Results/BeamVertexResult.cpp
r4039 r4042 141 141 /*Result functions*/ 142 142 /*FUNCTION BeamVertexResult::ProcessUnits(Parameters* parameters){{{1*/ 143 Result*BeamVertexResult::ProcessUnits(Parameters* parameters){143 void BeamVertexResult::ProcessUnits(Parameters* parameters){ 144 144 145 145 NodalValuesUnitConversion(this->values,2,this->enum_type,parameters); -
issm/trunk/src/c/objects/Results/PentaVertexResult.cpp
r4039 r4042 206 206 /*}}}*/ 207 207 /*FUNCTION PentaVertexResult::ProcessUnits(Parameters* parameters){{{1*/ 208 Result*PentaVertexResult::ProcessUnits(Parameters* parameters){208 void PentaVertexResult::ProcessUnits(Parameters* parameters){ 209 209 210 210 NodalValuesUnitConversion(this->values,6,this->enum_type,parameters); -
issm/trunk/src/c/objects/Results/SingVertexResult.cpp
r4039 r4042 141 141 /*Result functions*/ 142 142 /*FUNCTION SingVertexResult::ProcessUnits(Parameters* parameters){{{1*/ 143 Result*SingVertexResult::ProcessUnits(Parameters* parameters){143 void SingVertexResult::ProcessUnits(Parameters* parameters){ 144 144 145 NodalValuesUnitConversion( this->value,1,this->enum_type,parameters);145 NodalValuesUnitConversion(&this->value,1,this->enum_type,parameters); 146 146 147 147 } … … 158 158 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values 159 159 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */ 160 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum, this->value,1);160 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,&this->value,1); 161 161 162 162 } -
issm/trunk/src/c/objects/Results/TriaVertexResult.cpp
r4039 r4042 195 195 /*}}}*/ 196 196 /*FUNCTION TriaVertexResult::ProcessUnits(Parameters* parameters){{{1*/ 197 Result*TriaVertexResult::ProcessUnits(Parameters* parameters){197 void TriaVertexResult::ProcessUnits(Parameters* parameters){ 198 198 199 199 NodalValuesUnitConversion(this->values,3,this->enum_type,parameters); -
issm/trunk/src/c/objects/objects.h
r4039 r4042 57 57 #include "./Results/SingVertexResult.h" 58 58 #include "./Results/BeamVertexResult.h" 59 #include "./Results/NodalValuesUnitConversion.h" 59 60 60 61 /*Materials: */ -
issm/trunk/src/c/solutions/diagnostic.cpp
r4039 r4042 94 94 95 95 _printf_("write results to disk:\n"); 96 OutputResults(femmodel ,outputfilename);96 OutputResults(femmodel->elements, femmodel->loads, femmodel->nodes, femmodel->vertices, femmodel->materials, femmodel->parameters, outputfilename); 97 97 } 98 98 else{ -
issm/trunk/src/c/solutions/thermal.cpp
r4039 r4042 85 85 86 86 _printf_("write results to disk:\n"); 87 OutputResults(femmodel ,outputfilename);87 OutputResults(femmodel->elements, femmodel->loads, femmodel->nodes, femmodel->vertices, femmodel->materials, femmodel->parameters, outputfilename); 88 88 89 89 }
Note:
See TracChangeset
for help on using the changeset viewer.