Changeset 13813
- Timestamp:
- 10/23/12 13:52:13 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Elements.cpp
r13790 r13813 169 169 int num_procs; 170 170 171 Patch *patch= NULL;172 int *resultsenums= NULL;173 int *resultssizes= NULL;174 int *resultssteps= NULL;175 IssmDouble *resultstimes= NULL;176 IssmDouble *vector_serial= NULL;177 Vector<IssmDouble> * vector= NULL;178 bool io_gather;179 bool results_as_patches;180 int numberofvertices,numberofelements;181 int numberofresults,vectorsize;182 int rank;183 int minrank;171 Patch *patch = NULL; 172 int *resultsenums = NULL; 173 int *resultssizes = NULL; 174 int *resultssteps = NULL; 175 IssmDouble *resultstimes = NULL; 176 IssmDouble *vector_serial = NULL; 177 Vector<IssmDouble> *vector = NULL; 178 bool io_gather; 179 bool results_as_patches; 180 int numberofvertices ,numberofelements; 181 int numberofresults ,vectorsize; 182 int rank; 183 int minrank; 184 184 185 185 /*recover my_rank:*/ -
issm/trunk-jpl/src/c/Container/Inputs.cpp
r13798 r13813 363 363 void Inputs::DuplicateInput(int original_enum,int new_enum){ 364 364 365 Input* original=NULL;366 Input* copy=NULL;367 368 365 /*Make a copy of the original input: */ 369 original=dynamic_cast<Input*>(this->GetInput(original_enum));366 Input* original=dynamic_cast<Input*>(this->GetInput(original_enum)); 370 367 if(!original)_error_("could not find input with enum: " << EnumToStringx(original_enum)); 371 copy=dynamic_cast<Input*>(original->copy());368 Input* copy=dynamic_cast<Input*>(original->copy()); 372 369 373 370 /*Change copy enum to reinitialized_enum: */ … … 407 404 void Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){ 408 405 409 Input* xinput=NULL;410 Input* yinput=NULL;411 412 406 /*Find x and y inputs: */ 413 xinput=dynamic_cast<Input*>(this->GetInput(MeshXEnum));414 yinput=dynamic_cast<Input*>(this->GetInput(MeshYEnum));407 Input* xinput=dynamic_cast<Input*>(this->GetInput(MeshXEnum)); 408 Input* yinput=dynamic_cast<Input*>(this->GetInput(MeshYEnum)); 415 409 416 410 /*some checks: */ -
issm/trunk-jpl/src/c/Container/Nodes.cpp
r13798 r13813 153 153 int i; 154 154 int num_procs; 155 156 int numnodes; 155 int numnodes; 157 156 158 157 /*recover num_procs: */ -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r13798 r13813 827 827 828 828 /*Intermediary*/ 829 int i;830 829 int num_responses; 831 830 Element *element = NULL; -
issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp
r13787 r13813 4565 4565 ElementMatrix* Penta::CreateKMatrixAdjointPattyn(void){ 4566 4566 4567 /*Constants*/4568 const int numdof=NDOF2*NUMVERTICES;4569 4570 4567 /*Intermediaries */ 4571 4568 int i,j; … … 6781 6778 6782 6779 /*Intermediaries */ 6783 int i, j,approximation;6780 int i,approximation; 6784 6781 IssmDouble Jdet,viscosity,stokesreconditioning; 6785 6782 IssmDouble xyz_list[NUMVERTICES][3]; … … 6932 6929 6933 6930 /*Intermediaries */ 6934 int i,j;6935 6931 IssmDouble Jdet; 6936 6932 IssmDouble xyz_list[NUMVERTICES][3]; … … 7188 7184 7189 7185 /*Intermediaries */ 7190 int i ,j;7186 int i; 7191 7187 int approximation; 7192 7188 IssmDouble viscosity,Jdet; … … 7397 7393 ElementVector* Penta::CreatePVectorDiagnosticHutter(void){ 7398 7394 7399 /*Constants*/7400 const int numdofs=NDOF2*NUMVERTICES;7401 7402 7395 /*Intermediaries*/ 7403 7396 int i,j; -
issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp
r13787 r13813 405 405 406 406 /*Intermediaries */ 407 int i,j,dim;407 int dim; 408 408 IssmDouble xyz_list[NUMVERTICES][3]; 409 409 IssmDouble Jdettria,dt,vx,vy; … … 593 593 594 594 /*Intermediaries */ 595 int i,j;596 595 IssmDouble Jdettria,dt; 597 596 IssmDouble surface_mass_balance_g,basal_melting_g,basal_melting_correction_g,thickness_g; … … 629 628 basal_melting_correction_g=0.; 630 629 631 for(i =0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g-basal_melting_correction_g))*L[i];630 for(int i=0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g-basal_melting_correction_g))*L[i]; 632 631 } 633 632 … … 644 643 645 644 /*Intermediaries */ 646 int i,j;647 645 IssmDouble Jdettria,dt; 648 646 IssmDouble surface_mass_balance_g,basal_melting_g,thickness_g; … … 674 672 thickness_input->GetInputValue(&thickness_g,gauss); 675 673 676 for(i =0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g))*L[i];674 for(int i=0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g))*L[i]; 677 675 } 678 676 … … 689 687 690 688 /*Intermediaries */ 691 int i ,j;689 int i; 692 690 int analysis_type; 693 691 IssmDouble Jdet; … … 1375 1373 void Tria::InputToResult(int enum_type,int step,IssmDouble time){ 1376 1374 1377 int i;1378 1375 Input *input = NULL; 1379 1376 1380 1377 /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */ 1381 if (enum_type==MaterialsRheologyBbarEnum || enum_type==MaterialsRheologyZbarEnum) input=this->material->inputs->GetInput(enum_type); 1382 else input=this->inputs->GetInput(enum_type); 1378 if (enum_type==MaterialsRheologyBbarEnum || enum_type==MaterialsRheologyZbarEnum) 1379 input=this->material->inputs->GetInput(enum_type); 1380 else 1381 input=this->inputs->GetInput(enum_type); 1383 1382 //if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found in tria->inputs"); 1384 1383 if(!input)return; … … 2564 2563 IssmDouble Tria::MassFlux( IssmDouble* segment,bool process_units){ 2565 2564 2566 const int numdofs=2; 2567 2568 int i,dim; 2569 IssmDouble mass_flux=0; 2570 IssmDouble xyz_list[NUMVERTICES][3]; 2571 IssmDouble normal[2]; 2572 IssmDouble length,rho_ice; 2573 IssmDouble x1,y1,x2,y2,h1,h2; 2574 IssmDouble vx1,vx2,vy1,vy2; 2565 const int numdofs=2; 2566 int dim; 2567 IssmDouble mass_flux=0; 2568 IssmDouble xyz_list[NUMVERTICES][3]; 2569 IssmDouble normal[2]; 2570 IssmDouble length,rho_ice; 2571 IssmDouble x1,y1,x2,y2,h1,h2; 2572 IssmDouble vx1,vx2,vy1,vy2; 2575 2573 GaussTria* gauss_1=NULL; 2576 2574 GaussTria* gauss_2=NULL; … … 3987 3985 3988 3986 /* Intermediaries */ 3989 int ig; 3990 IssmDouble Jelem = 0; 3991 IssmDouble weight; 3992 IssmDouble Jdet; 3993 IssmDouble xyz_list[NUMVERTICES][3]; 3994 IssmDouble dp[NDOF2]; 3987 IssmDouble Jelem = 0; 3988 IssmDouble weight; 3989 IssmDouble Jdet; 3990 IssmDouble xyz_list[NUMVERTICES][3]; 3991 IssmDouble dp[NDOF2]; 3995 3992 GaussTria *gauss = NULL; 3996 3993 … … 4030 4027 IssmDouble Tria::SurfaceAverageVelMisfit(bool process_units,int weight_index){ 4031 4028 4032 const int numdof=2*NUMVERTICES;4033 4034 int i;4035 4029 IssmDouble Jelem=0,S,Jdet; 4036 4030 IssmDouble misfit; … … 4091 4085 IssmDouble Tria::SurfaceLogVelMisfit(bool process_units,int weight_index){ 4092 4086 4093 const int numdof=NDOF2*NUMVERTICES;4094 4095 int i;4096 4087 IssmDouble Jelem=0; 4097 4088 IssmDouble misfit,Jdet; … … 4156 4147 IssmDouble Tria::SurfaceLogVxVyMisfit(bool process_units,int weight_index){ 4157 4148 4158 const int numdof=NDOF2*NUMVERTICES;4159 4160 int i;4161 4149 int fit=-1; 4162 4150 IssmDouble Jelem=0, S=0; … … 4222 4210 IssmDouble Tria::SurfaceAbsVelMisfit(bool process_units,int weight_index){ 4223 4211 4224 const int numdof=NDOF2*NUMVERTICES;4225 4226 4212 IssmDouble Jelem=0; 4227 4213 IssmDouble misfit,Jdet; … … 4281 4267 /*FUNCTION Tria::SurfaceRelVelMisfit {{{*/ 4282 4268 IssmDouble Tria::SurfaceRelVelMisfit(bool process_units,int weight_index){ 4283 const int numdof=2*NUMVERTICES;4284 4269 4285 4270 IssmDouble Jelem=0; … … 4346 4331 4347 4332 /* Intermediaries */ 4348 int ig; 4349 IssmDouble Jelem = 0; 4350 IssmDouble weight; 4351 IssmDouble Jdet; 4352 IssmDouble xyz_list[NUMVERTICES][3]; 4353 IssmDouble dp[NDOF2]; 4333 IssmDouble Jelem = 0; 4334 IssmDouble weight; 4335 IssmDouble Jdet; 4336 IssmDouble xyz_list[NUMVERTICES][3]; 4337 IssmDouble dp[NDOF2]; 4354 4338 GaussTria *gauss = NULL; 4355 4339 … … 4390 4374 4391 4375 /* Intermediaries */ 4392 int ig;4393 4376 IssmDouble Jelem = 0; 4394 4377 IssmDouble weight; … … 4442 4425 4443 4426 /* Intermediaries */ 4444 int ig;4445 4427 IssmDouble Jelem = 0; 4446 4428 IssmDouble weight; … … 4494 4476 4495 4477 /*Intermediaries*/ 4496 int i;4497 4478 IssmDouble thickness,thicknessobs,weight; 4498 4479 IssmDouble Jdet; … … 4994 4975 4995 4976 /* Intermediaries */ 4996 int ig; 4997 IssmDouble Jelem = 0; 4998 IssmDouble weight; 4999 IssmDouble Jdet; 5000 IssmDouble xyz_list[NUMVERTICES][3]; 5001 IssmDouble dp[NDOF2]; 4977 IssmDouble Jelem = 0; 4978 IssmDouble weight; 4979 IssmDouble Jdet; 4980 IssmDouble xyz_list[NUMVERTICES][3]; 4981 IssmDouble dp[NDOF2]; 5002 4982 GaussTria *gauss = NULL; 5003 4983 … … 5316 5296 /*Intermediaries */ 5317 5297 IssmDouble diffusivity; 5318 int i,j;5319 5298 IssmDouble Jdettria,DL_scalar,dt,h; 5320 5299 IssmDouble vx,vy,vel,dvxdx,dvydy; -
issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.cpp
r13622 r13813 100 100 output->control_id=this->control_id; 101 101 102 if(values) output->values =(Input*)this->values->copy();103 if(savedvalues) output->savedvalues =(Input*)this->savedvalues->copy();104 if(minvalues) output->minvalues =(Input*)this->minvalues->copy();105 if(maxvalues) output->maxvalues =(Input*)this->maxvalues->copy();106 if(gradient) output->gradient =(Input*)this->gradient->copy();102 if(values) output->values = dynamic_cast<Input*>(this->values->copy()); 103 if(savedvalues) output->savedvalues = dynamic_cast<Input*>(this->savedvalues->copy()); 104 if(minvalues) output->minvalues = dynamic_cast<Input*>(this->minvalues->copy()); 105 if(maxvalues) output->maxvalues = dynamic_cast<Input*>(this->maxvalues->copy()); 106 if(gradient) output->gradient = dynamic_cast<Input*>(this->gradient->copy()); 107 107 108 108 return output; … … 255 255 256 256 if(savedvalues) delete this->savedvalues; 257 this->savedvalues= (Input*)this->values->copy();257 this->savedvalues=dynamic_cast<Input*>(this->values->copy()); 258 258 }/*}}}*/ 259 259 /*FUNCTION ControlInput::UpdateValue{{{*/ … … 263 263 264 264 if(values) delete this->values; 265 this->values= (Input*)this->savedvalues->copy();265 this->values=dynamic_cast<Input*>(this->savedvalues->copy()); 266 266 this->values->AXPY(gradient,scalar); 267 267 }/*}}}*/ -
issm/trunk-jpl/src/c/classes/objects/Inputs/DatasetInput.cpp
r13622 r13813 83 83 outinput=new DatasetInput(); 84 84 outinput->enum_type=this->enum_type; 85 outinput->inputs= (Inputs*)this->inputs->SpawnTriaInputs(indices);85 outinput->inputs=dynamic_cast<Inputs*>(this->inputs->SpawnTriaInputs(indices)); 86 86 87 87 /*Assign output*/ … … 110 110 /*Get requested input within dataset*/ 111 111 if(index<0 || index > inputs->Size()-1) _error_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")"); 112 Input* input= (Input*)this->inputs->GetObjectByOffset(index);112 Input* input=dynamic_cast<Input*>(this->inputs->GetObjectByOffset(index)); 113 113 114 114 input->GetInputValue(pvalue,gauss); -
issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp
r13761 r13813 472 472 ElementVector* Icefront::CreatePVectorDiagnosticMacAyeal3d(void){ 473 473 474 Icefront* icefront=NULL; 475 Penta* penta=NULL; 476 Tria* tria=NULL; 477 bool onbed; 474 Icefront *icefront = NULL; 475 Penta *penta = NULL; 476 Tria *tria = NULL; 478 477 479 478 /*Cast element onto Penta*/ -
issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp
r13787 r13813 13 13 double* xc=NULL; 14 14 double* yc=NULL; 15 double value;16 15 17 16 /*output: */ … … 33 32 /*Assign output pointers: */ 34 33 *pflags=flags; 35 36 34 return 1; 37 35 } -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp
r13622 r13813 16 16 17 17 /*variable declarations: {{{*/ 18 int i,j,k; 19 18 int i; 20 19 Parameters* parameters = NULL; 21 int second_count;22 20 23 21 int* part=NULL; … … 39 37 char tag[50]; 40 38 41 int M;42 int m,n;43 39 bool dakota_analysis=false; 44 40 char* name=NULL; -
issm/trunk-jpl/src/c/modules/Solverx/SolverxPetsc.cpp
r13762 r13813 58 58 59 59 /*Display message*/ 60 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 61 PetscSynchronizedFlush(MPI_COMM_WORLD); 60 62 if(VerboseModule()) _pprintLine_(" Solving"); 61 63 #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2) … … 71 73 *puf=NewVec(0,IssmComm::GetComm()); return; 72 74 } 75 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 76 PetscSynchronizedFlush(MPI_COMM_WORLD); 73 77 74 78 /*Initial guess */ … … 85 89 } 86 90 else{ 91 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 92 PetscSynchronizedFlush(MPI_COMM_WORLD); 87 93 MatGetLocalSize(Kff,&local_m,&local_n);uf=NewVec(local_n,IssmComm::GetComm(),fromlocalsize); 88 94 } … … 104 110 KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN); 105 111 KSPSetFromOptions(ksp); 112 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 113 PetscSynchronizedFlush(MPI_COMM_WORLD); 106 114 107 115 #if _PETSC_MAJOR_==3 … … 115 123 #endif 116 124 } 125 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 126 PetscSynchronizedFlush(MPI_COMM_WORLD); 117 127 118 128 /*Stokes: */ … … 146 156 /*Solve: */ 147 157 if(VerboseSolver())KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD); 158 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 159 PetscSynchronizedFlush(MPI_COMM_WORLD); 148 160 KSPSolve(ksp,pf,uf); 161 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 162 PetscSynchronizedFlush(MPI_COMM_WORLD); 149 163 150 164 /*Check convergence*/ … … 153 167 154 168 /*Free resources:*/ 169 PetscSynchronizedPrintf(MPI_COMM_WORLD,"-------------- file: SolverxPetsc.cpp line: %i\n",__LINE__); 170 PetscSynchronizedFlush(MPI_COMM_WORLD); 155 171 KSPFree(&ksp); 156 172 -
issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp
r13530 r13813 24 24 #ifdef _HAVE_GSL_ 25 25 /*Intermediary: */ 26 int M,N,N2 ,s;26 int M,N,N2; 27 27 SeqVec<IssmDouble> *uf = NULL; 28 28 -
issm/trunk-jpl/src/c/shared/Exp/exp.h
r13758 r13813 170 170 doubletype **pprofx = NULL; 171 171 doubletype **pprofy = NULL; 172 Contour<doubletype> *contour = NULL;173 172 174 173 /*output: */ -
issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp
r13799 r13813 43 43 int DakotaSpawnCore(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, void* void_femmodel,int counter){ 44 44 45 int i; 46 47 char **responses_descriptors = NULL; //these are our! there are only numresponsedescriptors of them, not d_numresponses!!! 48 int numresponsedescriptors; 49 char *string = NULL; 50 int string_length; 51 int solution_type; 52 bool control_analysis = false; 53 void (*solutioncore)(FemModel*) = NULL; 54 FemModel* femmodel = NULL; 55 bool nodakotacore = true; 45 char **responses_descriptors = NULL; //these are our! there are only numresponsedescriptors of them, not d_numresponses!!! 46 int numresponsedescriptors; 47 char *string = NULL; 48 int solution_type; 49 bool control_analysis = false; 50 void (*solutioncore)(FemModel*) = NULL; 51 FemModel *femmodel = NULL; 52 bool nodakotacore = true; 56 53 57 54 /*If counter==-1 on cpu0, it means that the dakota runs are done. In which case, bail out and return 0: */ -
issm/trunk-jpl/src/c/solutions/issm.cpp
r13621 r13813 21 21 /*Output results: */ 22 22 femmodel->OutputResults(); 23 _error_("STOP HERE"); 23 24 24 25 /*Wrap up: */ … … 26 27 27 28 /*Finalize environment:*/ 28 EnvironmentFinalize();29 //EnvironmentFinalize(); 29 30 30 31 /*Finalize exception trapping: */
Note:
See TracChangeset
for help on using the changeset viewer.