Changeset 16149
- Timestamp:
- 09/17/13 13:51:02 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/DakotaSpawnCore.cpp
r15849 r16149 41 41 char **responses_descriptors = NULL; //these are our! there are only numresponsedescriptors of them, not d_numresponses!!! 42 42 int numresponsedescriptors; 43 char *string = NULL;44 43 int solution_type; 45 44 bool control_analysis = false; -
issm/trunk-jpl/src/c/analyses/ResetBoundaryConditions.cpp
r15849 r16149 18 18 femmodel->SetCurrentConfiguration(analysis_type); 19 19 20 /*recover nodes: */21 nodes=femmodel->nodes;22 23 20 /*retrieve boundary conditions from element inputs :*/ 24 21 GetSolutionFromInputsx(&yg,femmodel); -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16145 r16149 8220 8220 8221 8221 /*Intermediaries */ 8222 int i,j ,approximation;8222 int i,j; 8223 8223 IssmDouble Jdet,viscosity,FSreconditioning,diameter,rigidity; 8224 8224 IssmDouble xyz_list[NUMVERTICES][3]; 8225 8225 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 8226 IssmDouble B[8][24];8227 IssmDouble B_prime[8][24];8228 IssmDouble B_stab[3][NUMVERTICES];8229 IssmDouble D_scalar,D_scalar_stab;8230 IssmDouble D[8][8]={0.0};8231 IssmDouble D_stab[3][3]={0.0};8232 IssmDouble Ke_temp[24][24]={0.0}; //for the six nodes8233 IssmDouble Ke_temp_stab[6][6]={0.0}; //for the six nodes8234 8226 GaussPenta *gauss=NULL; 8235 8227 8236 8228 /*Stabilization*/ 8237 bool stabilization = true;8229 IssmDouble D_scalar; 8238 8230 IssmDouble dbasis[3][6]; 8239 8231 IssmDouble dmu[3]; … … 8331 8323 8332 8324 /*Intermediaries */ 8333 int i, j,approximation;8325 int i,approximation; 8334 8326 IssmDouble Jdet,viscosity,FSreconditioning,D_scalar; 8335 8327 IssmDouble xyz_list[NUMVERTICES][3]; … … 10940 10932 int* pdoflist=NULL; 10941 10933 IssmDouble FSreconditioning; 10942 GaussPenta *gauss;10943 10934 10944 10935 /*Fetch number of nodes and dof for this finite element*/ … … 11276 11267 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES]; 11277 11268 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES]; 11278 bool grounded[NUMVERTICES],floating[NUMVERTICES];11279 11269 11280 11270 if(!IsOnBed()) return; … … 11301 11291 b[i] = r[i]; 11302 11292 s[i] = b[i]+h[i]; 11303 floating[i] = false;11304 grounded[i] = true;11305 11293 } 11306 11294 } … … 11314 11302 s[i] = (1-density)*h[i]; 11315 11303 b[i] = -density*h[i]; 11316 floating[i] = true;11317 grounded[i] = false;11318 11304 } 11319 11305 else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Pid()]<0.){ 11320 11306 s[i] = (1-density)*h[i]; 11321 11307 b[i] = -density*h[i]; 11322 floating[i] = true;11323 grounded[i] = false;11324 11308 } 11325 11309 else{ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16148 r16149 1777 1777 switch(type){ 1778 1778 case VertexPIdEnum: 1779 for (int i=0;i<NUMVERTICES;i++){ 1779 values = xNew<IssmDouble>(NUMVERTICES); 1780 for(int i=0;i<NUMVERTICES;i++){ 1780 1781 values[i]=vector[this->vertices[i]->Pid()]; 1781 1782 } … … 1787 1788 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1788 1789 } 1789 return;1790 1790 1791 1791 case VertexSIdEnum: 1792 for (int i=0;i<NUMVERTICES;i++){ 1792 values = xNew<IssmDouble>(NUMVERTICES); 1793 for(int i=0;i<NUMVERTICES;i++){ 1793 1794 values[i]=vector[this->vertices[i]->Sid()]; 1794 1795 } 1795 1796 /*update input*/ 1796 if 1797 if(name==MaterialsRheologyBbarEnum || name==MaterialsRheologyBEnum || name==MaterialsDamageDEnum || name==MaterialsDamageDbarEnum){ 1797 1798 material->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1798 1799 } … … 1800 1801 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1801 1802 } 1802 return;1803 1803 1804 1804 case NodesEnum: … … 1809 1809 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 1810 1810 1811 /*Use the dof list to index into the vector: */1812 1811 for(int i=0;i<numnodes;i++){ 1813 1812 values[i]=vector[doflist[i]]; 1814 1813 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector"); 1815 1814 } 1816 1817 /*Add input to the element: */1818 1815 this->inputs->AddInput(new TriaInput(name,values,this->element_type)); 1819 1820 /*Free ressources:*/1821 xDelete<int>(doflist);1822 return;1823 1816 1824 1817 case NodeSIdEnum: … … 1832 1825 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector"); 1833 1826 } 1834 /*Add input to the element: */1835 1827 this->inputs->AddInput(new TriaInput(name,values,this->element_type)); 1836 return;1837 1828 1838 1829 default: … … 7618 7609 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];; 7619 7610 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES]; 7620 bool grounded[NUMVERTICES],floating[NUMVERTICES];7621 7611 7622 7612 /*Recover info at the vertices: */ … … 7641 7631 b[i] = r[i]; 7642 7632 s[i] = b[i]+h[i]; 7643 floating[i] = false;7644 grounded[i] = true;7645 7633 } 7646 7634 } … … 7654 7642 s[i] = (1-density)*h[i]; 7655 7643 b[i] = -density*h[i]; 7656 floating[i] = true;7657 grounded[i] = false;7658 7644 } 7659 7645 else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Pid()]<0.){ 7660 7646 s[i] = (1-density)*h[i]; 7661 7647 b[i] = -density*h[i]; 7662 floating[i] = true;7663 grounded[i] = false;7664 7648 } 7665 7649 else{ -
issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
r15104 r16149 22 22 23 23 private: 24 int id;25 int enum_type;24 int id; 25 int enum_type; 26 26 ResultType value; 27 int M;28 int N;29 int step;27 int M; 28 int N; 29 int step; 30 30 IssmDouble time; 31 31 … … 60 60 /*GenericExternalResult constructors and destructors*/ 61 61 GenericExternalResult(){ /*{{{*/ 62 id = 0;62 id = 0; 63 63 enum_type = NoneEnum; 64 M =0;65 N =0;66 step =0;67 time =0;64 M = 0; 65 N = 0; 66 step = 0; 67 time = 0; 68 68 } /*}}}*/ 69 69 GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/ 70 id = 0; 71 enum_type = NoneEnum; 72 M = 0; 73 N = 0; 74 step = 0; 75 time = 0; 70 76 _error_("template GenericExternalResult(int in_id, int in_enum_type,double* in_values, int in_M,int in_N,int in_step,IssmDouble in_time) not implemented for this ResultType\n"); 71 77 } 72 78 /*}}}*/ 73 79 GenericExternalResult(int in_id, int in_enum_type,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/ 74 id =in_id;75 enum_type =in_enum_type;76 value =in_value;77 step =in_step;78 time =in_time;80 id = in_id; 81 enum_type = in_enum_type; 82 value = in_value; 83 step = in_step; 84 time = in_time; 79 85 } 80 86 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
r15737 r16149 396 396 /*}}}*/ 397 397 /*FUNCTION Inputs::AXPY{{{*/ 398 void Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){398 void Inputs::AXPY(int inputy_enum, IssmDouble scalar, int inputx_enum){ 399 399 400 400 /*Find x and y inputs: */ 401 Input* xinput=dynamic_cast<Input*>(this->GetInput( MeshXEnum));402 Input* yinput=dynamic_cast<Input*>(this->GetInput( MeshYEnum));401 Input* xinput=dynamic_cast<Input*>(this->GetInput(inputx_enum)); 402 Input* yinput=dynamic_cast<Input*>(this->GetInput(inputy_enum)); 403 403 404 404 /*some checks: */ 405 if(!xinput) _error_("input " << EnumToStringx( MeshXEnum) << " could not be found!");406 if(!yinput) _error_("input " << EnumToStringx( MeshYEnum) << " could not be found!");405 if(!xinput) _error_("input " << EnumToStringx(inputx_enum) << " could not be found!"); 406 if(!yinput) _error_("input " << EnumToStringx(inputy_enum) << " could not be found!"); 407 407 408 408 /*Apply AXPY: */ -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.h
r15737 r16149 22 22 23 23 /*numerics*/ 24 int AddInput(Input* in_input);25 void ChangeEnum(int enumtype,int new_enumtype);26 void ConstrainMin(int constrain_enum, IssmDouble minimum);27 int DeleteInput(int enum_type);28 void DuplicateInput(int original_enum,int new_enum);29 Input* GetInput(int enum_name);30 Inputs* SpawnTriaInputs(int position);31 void AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum);24 int AddInput(Input* in_input); 25 void ChangeEnum(int enumtype,int new_enumtype); 26 void ConstrainMin(int constrain_enum, IssmDouble minimum); 27 int DeleteInput(int enum_type); 28 void DuplicateInput(int original_enum,int new_enum); 29 Input* GetInput(int enum_name); 30 Inputs* SpawnTriaInputs(int position); 31 void AXPY(int inputy_enum, IssmDouble scalar, int inputx_enum); 32 32 IssmDouble InfinityNorm(int enumtype); 33 33 IssmDouble Max(int enumtype); … … 35 35 IssmDouble Min(int enumtype); 36 36 IssmDouble MinAbs(int enumtype); 37 void GetInputAverage(IssmDouble* pvalue, int enum_type);38 void GetInputValue(bool* pvalue,int enum_type);39 void GetInputValue(int* pvalue,int enum_type);40 void GetInputValue(IssmDouble* pvalue,int enum_type);41 void Configure(Parameters* parameters);37 void GetInputAverage(IssmDouble* pvalue, int enum_type); 38 void GetInputValue(bool* pvalue,int enum_type); 39 void GetInputValue(int* pvalue,int enum_type); 40 void GetInputValue(IssmDouble* pvalue,int enum_type); 41 void Configure(Parameters* parameters); 42 42 43 43 }; -
issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.cpp
r15128 r16149 58 58 _printf_(" matrix size: " << this->M << "x" << this->N << "\n"); 59 59 for(i=0;i<this->M;i++){ 60 for( i=0;i<this->N;i++){60 for(j=0;j<this->N;j++){ 61 61 _printf_(i << " " << j << " " << *(this->value+N*i+j) << "\n"); 62 62 } -
issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp
r15128 r16149 58 58 _printf_(" matrix size: " << this->M << "x" << this->N << "\n"); 59 59 for(i=0;i<this->M;i++){ 60 for( i=0;i<this->N;i++){60 for(j=0;j<this->N;j++){ 61 61 _printf_("(" << i << "," << j << ") " << *(this->value+N*i+j) << "\n"); 62 62 } -
issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp
r15164 r16149 12 12 #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. 13 13 14 return(Shp2Expx(filshp,filexp, 15 0)); 14 return(Shp2Expx(filshp,filexp,0)); 16 15 17 16 #else //ifdef _HAVE_SHAPELIB_ … … 20 19 } 21 20 22 int Shp2Expx(char* filshp,char* filexp, 23 int sgn){ 21 int Shp2Expx(char* filshp,char* filexp,int sgn){ 24 22 25 23 #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. 26 24 27 25 double cm,sp; 28 29 if (sgn) 30 Xy2lldef(&cm,&sp,sgn); 31 32 return(Shp2Expx(filshp,filexp, 33 sgn,cm,sp)); 26 Xy2lldef(&cm,&sp,sgn); 27 28 return(Shp2Expx(filshp,filexp,sgn,cm,sp)); 34 29 35 30 #else //ifdef _HAVE_SHAPELIB_ … … 38 33 } 39 34 40 int Shp2Expx(char* filshp,char* filexp, 41 int sgn,double cm,double sp){ 35 int Shp2Expx(char* filshp,char* filexp,int sgn,double cm,double sp){ 42 36 43 37 #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. -
issm/trunk-jpl/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp
r15164 r16149 8 8 #include "../../kml/kmlobjects.h" 9 9 10 int Shp2Kmlx(char* filshp,char* filkml, 11 int sgn){ 10 int Shp2Kmlx(char* filshp,char* filkml,int sgn){ 12 11 13 12 #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. 14 13 15 14 double cm,sp; 16 17 if (sgn) 18 Xy2lldef(&cm,&sp,sgn); 19 20 return(Shp2Kmlx(filshp,filkml, 21 sgn,cm,sp)); 15 Xy2lldef(&cm,&sp,sgn); 16 17 return(Shp2Kmlx(filshp,filkml,sgn,cm,sp)); 22 18 23 19 #else //ifdef _HAVE_SHAPELIB_ … … 26 22 } 27 23 28 int Shp2Kmlx(char* filshp,char* filkml, 29 int sgn,double cm,double sp){ 24 int Shp2Kmlx(char* filshp,char* filkml,int sgn,double cm,double sp){ 30 25 31 26 #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. … … 103 98 pshapm=xNew<double*>(nshape); 104 99 105 /* loop over the list of shapes */ 106 107 for( i = 0; i < nEntities; i++ ) 108 { 109 // int j; 100 /* loop over the list of shapes */ 101 for(i=0;i<nEntities;i++ ){ 110 102 SHPObject *psShape; 111 103 -
issm/trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp
r16132 r16149 3 3 */ 4 4 5 /*Header files: {{{*/5 /*Header files: */ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 21 21 22 22 /*Mumps header files: */ 23 #include "dmumps_c.h" 24 /*}}}*/ 25 26 void MumpsInit(DMUMPS_STRUC_C &theMumpsStruc) { 23 #include <dmumps_c.h> 24 25 void MumpsInit(DMUMPS_STRUC_C &theMumpsStruc){ 27 26 theMumpsStruc.par = 1; 28 27 theMumpsStruc.sym = 0; … … 71 70 } 72 71 73 void MumpsSolve(int n, 74 int nnz, 75 int local_nnz, 76 int* irn_loc, 77 int* jcn_loc, 78 IssmPDouble *a_loc, 79 IssmPDouble *rhs, 80 Parameters* parameters=0 /*unused here*/) { 81 /*Initialize mumps: {{{*/ 72 void MumpsSolve(int n,int nnz,int local_nnz,int* irn_loc,int* jcn_loc, IssmPDouble *a_loc, IssmPDouble *rhs, Parameters* parameters=0 /*unused here*/){ 73 /*Initialize mumps*/ 82 74 DMUMPS_STRUC_C theMumpsStruc; 83 75 MumpsInit(theMumpsStruc); 84 76 MumpsSettings(theMumpsStruc); 85 /*}}}*/ 86 / / now setup the rest of theMumpsStruc77 78 /*now setup the rest of theMumpsStruc */ 87 79 theMumpsStruc.n=n; 88 80 theMumpsStruc.nz=nnz; … … 94 86 theMumpsStruc.nrhs=1; 95 87 theMumpsStruc.lrhs=1; 96 /*Solve system: {{{*/ 88 89 /*Solve system*/ 97 90 MumpsAnalyze(theMumpsStruc); 98 91 MumpsFactorize(theMumpsStruc); 99 92 MumpsBacksubstitute(theMumpsStruc); 100 /*}}}*/101 93 MumpsFinalize(theMumpsStruc); 102 94 } … … 116 108 void MpiDenseMumpsSolve( /*output: */ IssmDouble* uf, int uf_M, int uf_m, /*matrix input: */ IssmDouble* Kff, int Kff_M, int Kff_N, int Kff_m, /*right hand side vector: */ IssmDouble* pf, int pf_M, int pf_m, Parameters* parameters){ /*{{{*/ 117 109 118 /*Variables: {{{*/ 119 120 ISSM_MPI_Comm comm; 121 int my_rank; 122 int num_procs; 123 int i; 124 int j; 125 int nnz ,local_nnz; 126 int *irn_loc = NULL; 127 int *jcn_loc = NULL; 128 IssmDouble *a_loc = NULL; 129 int count; 130 int lower_row; 131 int upper_row; 132 IssmDouble* rhs=NULL; 133 int* recvcounts=NULL; 134 int* displs=NULL; 135 /*}}}*/ 136 /*Communicator info:{{{ */ 137 my_rank=IssmComm::GetRank(); 138 num_procs=IssmComm::GetSize(); 139 comm=IssmComm::GetComm(); 140 /*}}}*/ 141 /*First, some checks:{{{ */ 110 /*Variables*/ 111 ISSM_MPI_Comm comm; 112 int my_rank; 113 int num_procs; 114 int i,j; 115 int nnz,local_nnz; 116 int *irn_loc = NULL; 117 int *jcn_loc = NULL; 118 IssmDouble *a_loc = NULL; 119 int count; 120 int lower_row; 121 int upper_row; 122 IssmDouble *rhs = NULL; 123 int *recvcounts = NULL; 124 int *displs = NULL; 125 126 /*Communicator info */ 127 my_rank = IssmComm::GetRank(); 128 num_procs = IssmComm::GetSize(); 129 comm = IssmComm::GetComm(); 130 131 /*First, some checks*/ 142 132 if (Kff_M!=Kff_N)_error_("stiffness matrix Kff should be square"); 143 133 if (uf_M!=Kff_M | uf_M!=pf_M)_error_("solution vector should be the same size as stiffness matrix Kff and load vector pf"); 144 134 if (uf_m!=Kff_m | uf_m!=pf_m)_error_("solution vector should be locally the same size as stiffness matrix Kff and load vector pf"); 145 /*}}}*/ 146 /*Initialize matrix:{{{ */ 147 135 136 /*Initialize matrix */ 148 137 /*figure out number of non-zero entries: */ 149 138 local_nnz=0; … … 192 181 ISSM_MPI_Gatherv(pf, pf_m, ISSM_MPI_DOUBLE, rhs, recvcounts, displs, ISSM_MPI_DOUBLE,0,comm); 193 182 194 MumpsSolve(Kff_M, 195 nnz, 196 local_nnz, 197 irn_loc, 198 jcn_loc, 199 a_loc, 200 rhs, 201 parameters); 202 203 /*Now scatter from cpu 0 to all other cpus: {{{*/ 183 MumpsSolve(Kff_M,nnz,local_nnz,irn_loc,jcn_loc,a_loc,rhs,parameters); 184 185 /*Now scatter from cpu 0 to all other cpus*/ 204 186 ISSM_MPI_Scatterv( rhs, recvcounts, displs, ISSM_MPI_DOUBLE, uf, uf_m, ISSM_MPI_DOUBLE, 0, comm); 205 187 206 /*}}}*/ 207 /*Cleanup: {{{*/ 188 /*Cleanup*/ 208 189 xDelete<int>(irn_loc); 209 190 xDelete<int>(jcn_loc); … … 212 193 xDelete<int>(recvcounts); 213 194 xDelete<int>(displs); 214 /*}}}*/215 195 } /*}}}*/ 216 196 … … 245 225 } 246 226 247 void MumpsSolve(int n, 248 int nnz, 249 int local_nnz, 250 int* irn_loc, 251 int* jcn_loc, 252 IssmDouble *a_loc, 253 IssmDouble *rhs, 254 Parameters* parameters) { 227 void MumpsSolve(int n,int nnz,int local_nnz,int* irn_loc,int* jcn_loc,IssmDouble *a_loc,IssmDouble *rhs,Parameters* parameters){ 255 228 int packedDimsSparseArrLength=1+1+1+local_nnz+local_nnz; 256 229 int *packedDimsSparseArr=xNew<int>(packedDimsSparseArrLength); -
issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp
r15839 r16149 170 170 IssmDouble* df_local=NULL; 171 171 int df_local_size; 172 int i;173 172 174 173 int* pressure_indices=NULL; … … 188 187 pressure_num=0; 189 188 velocity_num=0; 190 for(i =0;i<df_local_size;i++){189 for(int i=0;i<df_local_size;i++){ 191 190 if (df_local[i]==PressureEnum)pressure_num++; 192 191 else velocity_num++; … … 199 198 pressure_count=0; 200 199 velocity_count=0; 201 for(i =0;i<df_local_size;i++){200 for(int i=0;i<df_local_size;i++){ 202 201 if (df_local[i]==PressureEnum){ 203 202 pressure_indices[pressure_count]=start+i;
Note:
See TracChangeset
for help on using the changeset viewer.