Changeset 13797
- Timestamp:
- 10/22/12 14:33:45 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Constraints.h
r13623 r13797 20 20 public: 21 21 22 /*constructors, destructors : {{{*/22 /*constructors, destructors*/ 23 23 Constraints(); 24 24 ~Constraints(); 25 /*}}}*/ 26 /*numerics : {{{*/25 26 /*numerics*/ 27 27 int NumberOfConstraints(void); 28 /*}}}*/29 28 30 29 }; -
issm/trunk-jpl/src/c/Container/DataSet.h
r13623 r13797 38 38 int* id_offsets; 39 39 40 /*constructors, destructors : {{{*/40 /*constructors, destructors*/ 41 41 DataSet(); 42 42 DataSet(int enum_type); 43 43 ~DataSet(); 44 /*}}}*/ 45 /*management: {{{*/ 46 int GetEnum(); 47 int GetEnum(int offset); 48 void Echo(); 49 void DeepEcho(); 50 int AddObject(Object* object); 51 int DeleteObject(int id); 52 int Size(); 53 void clear(); 54 Object* GetObjectByOffset(int offset); 55 Object* GetObjectById(int* poffset,int eid); 56 void Presort(); 57 void SetSorting(int* in_sorted_ids,int* in_id_offsets); 58 void Sort(); 59 DataSet* Copy(void); 60 int DeleteObject(Object* object); 61 Results* SpawnTriaResults(int* indices); 62 /*}}}*/ 44 45 /*management*/ 46 int GetEnum(); 47 int GetEnum(int offset); 48 void Echo(); 49 void DeepEcho(); 50 int AddObject(Object *object); 51 int DeleteObject(int id); 52 int Size(); 53 void clear(); 54 Object *GetObjectByOffset(int offset); 55 Object *GetObjectById(int *poffset,int eid); 56 void Presort(); 57 void SetSorting(int *in_sorted_ids,int*in_id_offsets); 58 void Sort(); 59 DataSet *Copy(void); 60 int DeleteObject(Object *object); 61 Results *SpawnTriaResults(int *indices); 63 62 64 63 }; -
issm/trunk-jpl/src/c/Container/Elements.h
r12419 r13797 20 20 public: 21 21 22 /*constructors, destructors : {{{*/22 /*constructors, destructors*/ 23 23 Elements(); 24 24 ~Elements(); 25 /*}}}*/ 26 /*numerics : {{{*/27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);28 void DeleteResults(void);29 void ProcessResultsUnits(void);30 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);31 void ToResults(Results* results,Parameters* parameters);25 26 /*numerics*/ 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 28 void DeleteResults(void); 29 void ProcessResultsUnits(void); 30 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 31 void ToResults(Results* results,Parameters* parameters); 32 32 Patch* ResultsToPatch(void); 33 int NumberOfElements(void); 34 void InputDuplicate(int input_enum,int output_enum); 35 /*}}}*/ 33 int NumberOfElements(void); 34 void InputDuplicate(int input_enum,int output_enum); 36 35 37 36 }; -
issm/trunk-jpl/src/c/Container/Inputs.cpp
r13622 r13797 47 47 for ( object=objects.begin() ; object < objects.end(); object++ ){ 48 48 49 input= (Input*)(*object);49 input=dynamic_cast<Input*>(*object); 50 50 if (input->InstanceEnum()==enum_type){ 51 51 found=true; … … 75 75 for ( object=objects.begin() ; object < objects.end(); object++ ){ 76 76 77 input= (Input*)(*object);77 input=dynamic_cast<Input*>(*object); 78 78 if (input->InstanceEnum()==enum_type){ 79 79 found=true; … … 103 103 for ( object=objects.begin() ; object < objects.end(); object++ ){ 104 104 105 input= (Input*)(*object);105 input=dynamic_cast<Input*>(*object); 106 106 if (input->InstanceEnum()==enum_type){ 107 107 found=true; … … 131 131 for ( object=objects.begin() ; object < objects.end(); object++ ){ 132 132 133 input= (Input*)(*object);133 input=dynamic_cast<Input*>(*object); 134 134 if (input->InstanceEnum()==enum_type){ 135 135 found=true; … … 163 163 for ( object=objects.begin() ; object < objects.end(); object++ ){ 164 164 165 input= (Input*)(*object);165 input=dynamic_cast<Input*>(*object); 166 166 167 167 if (input->InstanceEnum()==in_input->InstanceEnum()){ … … 185 185 /*Delete existing input of newenumtype if it exists*/ 186 186 for ( object=objects.begin() ; object < objects.end(); object++ ){ 187 input= (Input*)(*object);187 input=dynamic_cast<Input*>(*object); 188 188 189 189 if (input->InstanceEnum()==newenumtype){ … … 196 196 for ( object=objects.begin() ; object < objects.end(); object++ ){ 197 197 198 input= (Input*)(*object);198 input=dynamic_cast<Input*>(*object); 199 199 200 200 if (input->InstanceEnum()==oldenumtype){ … … 210 210 Input* constrain_input=NULL; 211 211 /*Find x and y inputs: */ 212 constrain_input= (Input*)this->GetInput(constrain_enum);212 constrain_input=dynamic_cast<Input*>(this->GetInput(constrain_enum)); 213 213 214 214 /*some checks: */ … … 226 226 227 227 /*Get input*/ 228 Input* input= (Input*)this->GetInput(enumtype);228 Input* input=dynamic_cast<Input*>(this->GetInput(enumtype)); 229 229 230 230 /*Apply ContrainMin: */ … … 247 247 248 248 /*Get input*/ 249 Input* input= (Input*)this->GetInput(enumtype);249 Input* input=dynamic_cast<Input*>(this->GetInput(enumtype)); 250 250 251 251 /*Apply ContrainMin: */ … … 268 268 269 269 /*Get input*/ 270 Input* input= (Input*)this->GetInput(enumtype);270 Input* input=dynamic_cast<Input*>(this->GetInput(enumtype)); 271 271 272 272 /*Apply ContrainMin: */ … … 289 289 290 290 /*Get input*/ 291 Input* input= (Input*)this->GetInput(enumtype);291 Input* input=dynamic_cast<Input*>(this->GetInput(enumtype)); 292 292 293 293 /*Apply ContrainMin: */ … … 310 310 311 311 /*Get input*/ 312 Input* input= (Input*)this->GetInput(enumtype);312 Input* input=dynamic_cast<Input*>(this->GetInput(enumtype)); 313 313 314 314 /*Apply ContrainMin: */ … … 332 332 for ( object=objects.begin() ; object < objects.end(); object++ ){ 333 333 334 input= (Input*)(*object);334 input=dynamic_cast<Input*>(*object); 335 335 336 336 if (input->InstanceEnum()==enum_name){ … … 349 349 for ( object=objects.begin() ; object < objects.end(); object++ ){ 350 350 351 input= (Input*)(*object);351 input=dynamic_cast<Input*>(*object); 352 352 353 353 if (input->InstanceEnum()==enum_type){ … … 368 368 369 369 /*Make a copy of the original input: */ 370 original= (Input*)this->GetInput(original_enum);370 original=dynamic_cast<Input*>(this->GetInput(original_enum)); 371 371 if(!original)_error_("could not find input with enum: " << EnumToStringx(original_enum)); 372 copy= (Input*)original->copy();372 copy=dynamic_cast<Input*>(original->copy()); 373 373 374 374 /*Change copy enum to reinitialized_enum: */ … … 376 376 377 377 /*Add copy into inputs, it will wipe off the one already there: */ 378 this->AddInput( (Input*)copy);378 this->AddInput(dynamic_cast<Input*>(copy)); 379 379 } 380 380 /*}}}*/ … … 394 394 395 395 /*Create new input*/ 396 inputin= (Input*)(*object);396 inputin=dynamic_cast<Input*>(*object); 397 397 inputout=inputin->SpawnTriaInput(indices); 398 398 … … 412 412 413 413 /*Find x and y inputs: */ 414 xinput= (Input*)this->GetInput(MeshXEnum);415 yinput= (Input*)this->GetInput(MeshYEnum);414 xinput=dynamic_cast<Input*>(this->GetInput(MeshXEnum)); 415 yinput=dynamic_cast<Input*>(this->GetInput(MeshYEnum)); 416 416 417 417 /*some checks: */ … … 431 431 for ( object=objects.begin() ; object < objects.end(); object++ ){ 432 432 433 input= (Input*)(*object);433 input=dynamic_cast<Input*>(*object); 434 434 input->Configure(parameters); 435 435 -
issm/trunk-jpl/src/c/Container/Inputs.h
r13623 r13797 23 23 public: 24 24 25 /*constructors, destructors : {{{*/25 /*constructors, destructors*/ 26 26 Inputs(); 27 27 ~Inputs(); 28 28 29 /*}}}*/ 30 /*numerics: {{{*/ 31 int AddInput(Input* in_input); 32 void ChangeEnum(int enumtype,int new_enumtype); 33 void ConstrainMin(int constrain_enum, IssmDouble minimum); 34 int DeleteInput(int enum_type); 35 void DuplicateInput(int original_enum,int new_enum); 36 Input* GetInput(int enum_name); 37 Inputs* SpawnTriaInputs(int* indices); 38 void AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum); 29 /*numerics*/ 30 int AddInput(Input* in_input); 31 void ChangeEnum(int enumtype,int new_enumtype); 32 void ConstrainMin(int constrain_enum, IssmDouble minimum); 33 int DeleteInput(int enum_type); 34 void DuplicateInput(int original_enum,int new_enum); 35 Input* GetInput(int enum_name); 36 Inputs* SpawnTriaInputs(int* indices); 37 void AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum); 39 38 IssmDouble InfinityNorm(int enumtype); 40 39 IssmDouble Max(int enumtype); … … 42 41 IssmDouble Min(int enumtype); 43 42 IssmDouble MinAbs(int enumtype); 44 45 43 void GetInputAverage(IssmDouble* pvalue, int enum_type); 46 44 void GetInputValue(bool* pvalue,int enum_type); 47 45 void GetInputValue(int* pvalue,int enum_type); 48 46 void GetInputValue(IssmDouble* pvalue,int enum_type); 49 50 47 void Configure(Parameters* parameters); 51 /*}}}*/52 48 53 49 }; -
issm/trunk-jpl/src/c/Container/Loads.cpp
r13780 r13797 46 46 for ( object=objects.begin() ; object < objects.end(); object++ ){ 47 47 48 load= (Load*)(*object);48 load=dynamic_cast<Load*>(*object); 49 49 load->Configure(elements,loads,nodes,vertices,materials,parameters); 50 50 … … 81 81 for ( object=objects.begin() ; object < objects.end(); object++ ){ 82 82 83 load= (Load*)(*object);83 load=dynamic_cast<Load*>(*object); 84 84 load->SetCurrentConfiguration(elements,loads,nodes,vertices,materials,parameters); 85 85 -
issm/trunk-jpl/src/c/Container/Loads.h
r12365 r13797 20 20 public: 21 21 22 /*constructors, destructors : {{{*/22 /*constructors, destructors*/ 23 23 Loads(); 24 24 ~Loads(); 25 /*}}}*/ 26 /*numerics : {{{*/25 26 /*numerics*/ 27 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 28 28 int NumberOfLoads(void); 29 29 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 30 /*}}}*/31 30 32 31 }; -
issm/trunk-jpl/src/c/Container/Materials.cpp
r12365 r13797 46 46 for ( object=objects.begin() ; object < objects.end(); object++ ){ 47 47 48 material= (Material*)(*object);48 material=dynamic_cast<Material*>(*object); 49 49 material->Configure(elements); 50 50 -
issm/trunk-jpl/src/c/Container/Materials.h
r12365 r13797 19 19 public: 20 20 21 /*constructors, destructors : {{{*/21 /*constructors, destructors*/ 22 22 Materials(); 23 23 ~Materials(); 24 /*}}}*/ 25 /*numerics : {{{*/24 25 /*numerics*/ 26 26 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 27 /*}}}*/28 27 29 28 }; -
issm/trunk-jpl/src/c/Container/Nodes.h
r12365 r13797 13 13 public: 14 14 15 /*constructors, destructors : {{{*/15 /*constructors, destructors*/ 16 16 Nodes(); 17 17 ~Nodes(); 18 /*}}}*/ 19 /*numerics : {{{*/18 19 /*numerics*/ 20 20 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 21 21 void DistributeDofs(int analysis_type,int SETENUM); … … 27 27 void Ranks(int* ranks,int analysis_type); 28 28 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 29 /*}}}*/30 29 31 30 }; -
issm/trunk-jpl/src/c/Container/Observations.cpp
r13780 r13797 88 88 this->quadtree->ClosestObs(&index,x[i],y[i]); 89 89 if(index>=0){ 90 observation= (Observation*)this->GetObjectByOffset(index);90 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index)); 91 91 if(pow(observation->x-x[i],2)+pow(observation->y-y[i],2) < minspacing) continue; 92 92 } … … 135 135 this->quadtree->RangeSearch(&indices,&nobs,x_interp,y_interp,radius); 136 136 for (i=0;i<nobs;i++){ 137 observation= (Observation*)this->GetObjectByOffset(indices[i]);137 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i])); 138 138 h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 139 139 … … 157 157 } 158 158 else{ 159 observation= (Observation*)this->GetObjectByOffset(indices[index]);159 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[index])); 160 160 *px=observation->x; 161 161 *py=observation->y; … … 194 194 nobs = 0; 195 195 for (i=0;i<tempnobs;i++){ 196 observation= (Observation*)this->GetObjectByOffset(tempindices[i]);196 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(tempindices[i])); 197 197 h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 198 198 … … 236 236 /*Loop over all observations and fill in x, y and obs*/ 237 237 for (i=0;i<nobs;i++){ 238 observation= (Observation*)this->GetObjectByOffset(indices[i]);238 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i])); 239 239 observation->WriteXYObs(&x[i],&y[i],&obs[i]); 240 240 } … … 265 265 obs = xNew<IssmPDouble>(nobs); 266 266 for(int i=0;i<this->Size();i++){ 267 observation= (Observation*)this->GetObjectByOffset(i);267 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(i)); 268 268 observation->WriteXYObs(&x[i],&y[i],&obs[i]); 269 269 } … … 450 450 451 451 for(i=0;i<this->Size();i++){ 452 observation1= (Observation*)this->GetObjectByOffset(i);452 observation1=dynamic_cast<Observation*>(this->GetObjectByOffset(i)); 453 453 454 454 for(j=i+1;j<this->Size();j++){ 455 observation2= (Observation*)this->GetObjectByOffset(j);455 observation2=dynamic_cast<Observation*>(this->GetObjectByOffset(j)); 456 456 457 457 distance=sqrt(pow(observation1->x - observation2->x,2.) + pow(observation1->y - observation2->y,2.)); -
issm/trunk-jpl/src/c/Container/Options.cpp
r13622 r13797 60 60 for(object=objects.begin();object<objects.end();object++){ 61 61 62 option= (Option*)(*object);62 option=dynamic_cast<Option*>(*object); 63 63 if (!strcmp(option->Name(),name)){ 64 64 _error_("Options \"" << name << "\" found multiple times"); … … 82 82 for ( object=objects.begin() ; object < objects.end(); object++ ){ 83 83 84 option= (Option*)(*object);84 option=dynamic_cast<Option*>(*object); 85 85 if (!strncmp(name,option->Name(),strlen(option->Name()))){ 86 86 -
issm/trunk-jpl/src/c/Container/Options.h
r13790 r13797 26 26 27 27 /*Get option*/ 28 GenericOption<OptionType>* genericoption= (GenericOption<OptionType>*)GetOption(name);28 GenericOption<OptionType>* genericoption=dynamic_cast<GenericOption<OptionType>*>(GetOption(name)); 29 29 30 30 /*If the pointer is not NULL, the option has been found*/ … … 41 41 42 42 /*Get option*/ 43 GenericOption<OptionType>* genericoption= (GenericOption<OptionType>*)GetOption(name);43 GenericOption<OptionType>* genericoption=dynamic_cast<GenericOption<OptionType>*>(GetOption(name)); 44 44 45 45 /*If the pointer is not NULL, the option has been found*/ … … 57 57 58 58 /*Get option*/ 59 GenericOption<OptionType>* genericoption= (GenericOption<OptionType>*)GetOption(name);59 GenericOption<OptionType>* genericoption=dynamic_cast<GenericOption<OptionType>*>(GetOption(name)); 60 60 61 61 /*If the pointer is not NULL, the option has been found*/ … … 71 71 72 72 /*Get option*/ 73 GenericOption<OptionType>* genericoption= (GenericOption<OptionType>*)GetOption(name);73 GenericOption<OptionType>* genericoption=dynamic_cast<GenericOption<OptionType>*>(GetOption(name)); 74 74 75 75 /*If the pointer is not NULL, the option has been found*/ … … 91 91 92 92 /*Get option*/ 93 GenericOption<char*>* genericoption= (GenericOption<char*>*)GetOption(name);93 GenericOption<char*>* genericoption=dynamic_cast<GenericOption<char*>*>(GetOption(name)); 94 94 95 95 /*If the pointer is not NULL, the option has been found*/ -
issm/trunk-jpl/src/c/Container/Parameters.cpp
r13622 r13797 45 45 46 46 for ( object=objects.begin() ; object < objects.end(); object++ ){ 47 param= (Param*)(*object);47 param=dynamic_cast<Param*>(*object); 48 48 if(param->InstanceEnum()==enum_type) return true; 49 49 } … … 59 59 for ( object=objects.begin() ; object < objects.end(); object++ ){ 60 60 61 param= (Param*)(*object);61 param=dynamic_cast<Param*>(*object); 62 62 if(param->InstanceEnum()==enum_type){ 63 63 param->GetParameterValue(pbool); … … 76 76 for ( object=objects.begin() ; object < objects.end(); object++ ){ 77 77 78 param= (Param*)(*object);78 param=dynamic_cast<Param*>(*object); 79 79 if(param->InstanceEnum()==enum_type){ 80 80 param->GetParameterValue(pinteger); … … 93 93 for ( object=objects.begin() ; object < objects.end(); object++ ){ 94 94 95 param= (Param*)(*object);95 param=dynamic_cast<Param*>(*object); 96 96 if(param->InstanceEnum()==enum_type){ 97 97 param->GetParameterValue(pscalar); … … 110 110 for ( object=objects.begin() ; object < objects.end(); object++ ){ 111 111 112 param= (Param*)(*object);112 param=dynamic_cast<Param*>(*object); 113 113 if(param->InstanceEnum()==enum_type){ 114 114 param->GetParameterValue(pscalar,time); … … 127 127 for ( object=objects.begin() ; object < objects.end(); object++ ){ 128 128 129 param= (Param*)(*object);129 param=dynamic_cast<Param*>(*object); 130 130 if(param->InstanceEnum()==enum_type){ 131 131 param->GetParameterValue(pstring); … … 145 145 for ( object=objects.begin() ; object < objects.end(); object++ ){ 146 146 147 param= (Param*)(*object);147 param=dynamic_cast<Param*>(*object); 148 148 if(param->InstanceEnum()==enum_type){ 149 149 param->GetParameterValue(pstringarray,pM); … … 163 163 for ( object=objects.begin() ; object < objects.end(); object++ ){ 164 164 165 param= (Param*)(*object);165 param=dynamic_cast<Param*>(*object); 166 166 if(param->InstanceEnum()==enum_type){ 167 167 param->GetParameterValue(pintarray,pM); … … 181 181 for ( object=objects.begin() ; object < objects.end(); object++ ){ 182 182 183 param= (Param*)(*object);183 param=dynamic_cast<Param*>(*object); 184 184 if(param->InstanceEnum()==enum_type){ 185 185 param->GetParameterValue(pintarray,pM,pN); … … 199 199 for ( object=objects.begin() ; object < objects.end(); object++ ){ 200 200 201 param= (Param*)(*object);201 param=dynamic_cast<Param*>(*object); 202 202 if(param->InstanceEnum()==enum_type){ 203 203 param->GetParameterValue(pIssmDoublearray,pM); … … 217 217 for ( object=objects.begin() ; object < objects.end(); object++ ){ 218 218 219 param= (Param*)(*object);219 param=dynamic_cast<Param*>(*object); 220 220 if(param->InstanceEnum()==enum_type){ 221 221 param->GetParameterValue(pIssmDoublearray,pM,pN); … … 235 235 for ( object=objects.begin() ; object < objects.end(); object++ ){ 236 236 237 param= (Param*)(*object);237 param=dynamic_cast<Param*>(*object); 238 238 if(param->InstanceEnum()==enum_type){ 239 239 param->GetParameterValue(parray,pM,pmdims_array,pndims_array); … … 252 252 for ( object=objects.begin() ; object < objects.end(); object++ ){ 253 253 254 param= (Param*)(*object);254 param=dynamic_cast<Param*>(*object); 255 255 if(param->InstanceEnum()==enum_type){ 256 256 param->GetParameterValue(pvec); … … 270 270 for ( object=objects.begin() ; object < objects.end(); object++ ){ 271 271 272 param= (Param*)(*object);272 param=dynamic_cast<Param*>(*object); 273 273 if(param->InstanceEnum()==enum_type){ 274 274 param->GetParameterValue(pmat); … … 288 288 for ( object=objects.begin() ; object < objects.end(); object++ ){ 289 289 290 param= (Param*)(*object);290 param=dynamic_cast<Param*>(*object); 291 291 if(param->InstanceEnum()==enum_type){ 292 292 param->GetParameterValue(pfid); … … 306 306 for ( object=objects.begin() ; object < objects.end(); object++ ){ 307 307 308 param= (Param*)(*object);308 param=dynamic_cast<Param*>(*object); 309 309 if(param->InstanceEnum()==enum_type){ 310 310 param->GetParameterValue(pdataset); … … 322 322 323 323 /*first, figure out if the param has already been created: */ 324 param= (Param*)this->FindParamObject(enum_type);324 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 325 325 326 326 if(param) param->SetValue(boolean); //already exists, just set it. … … 334 334 335 335 /*first, figure out if the param has already been created: */ 336 param= (Param*)this->FindParamObject(enum_type);336 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 337 337 338 338 if(param) param->SetValue(integer); //already exists, just set it. … … 346 346 347 347 /*first, figure out if the param has already been created: */ 348 param= (Param*)this->FindParamObject(enum_type);348 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 349 349 350 350 if(param) param->SetValue(scalar); //already exists, just set it. … … 358 358 359 359 /*first, figure out if the param has already been created: */ 360 param= (Param*)this->FindParamObject(enum_type);360 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 361 361 362 362 if(param) param->SetValue(string); //already exists, just set it. … … 370 370 371 371 /*first, figure out if the param has already been created: */ 372 param= (Param*)this->FindParamObject(enum_type);372 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 373 373 374 374 if(param) param->SetValue(stringarray,M); //already exists, just set it. … … 382 382 383 383 /*first, figure out if the param has already been created: */ 384 param= (Param*)this->FindParamObject(enum_type);384 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 385 385 386 386 if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. … … 394 394 395 395 /*first, figure out if the param has already been created: */ 396 param= (Param*)this->FindParamObject(enum_type);396 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 397 397 398 398 if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it. … … 406 406 407 407 /*first, figure out if the param has already been created: */ 408 param= (Param*)this->FindParamObject(enum_type);408 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 409 409 410 410 if(param) param->SetValue(intarray,M); //already exists, just set it. … … 418 418 419 419 /*first, figure out if the param has already been created: */ 420 param= (Param*)this->FindParamObject(enum_type);420 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 421 421 422 422 if(param) param->SetValue(intarray,M,N); //already exists, just set it. … … 430 430 431 431 /*first, figure out if the param has already been created: */ 432 param= (Param*)this->FindParamObject(enum_type);432 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 433 433 434 434 if(param) param->SetValue(vector); //already exists, just set it. … … 442 442 443 443 /*first, figure out if the param has already been created: */ 444 param= (Param*)this->FindParamObject(enum_type);444 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 445 445 446 446 if(param) param->SetValue(matrix); //already exists, just set it. … … 454 454 455 455 /*first, figure out if the param has already been created: */ 456 param= (Param*)this->FindParamObject(enum_type);456 param=dynamic_cast<Param*>(this->FindParamObject(enum_type)); 457 457 458 458 if(param) param->SetValue(fid); //already exists, just set it. … … 467 467 468 468 for ( object=objects.begin() ; object < objects.end(); object++ ){ 469 param= (Param*)(*object);469 param=dynamic_cast<Param*>(*object); 470 470 param->UnitConversion(direction_enum); 471 471 } … … 482 482 for ( object=objects.begin() ; object < objects.end(); object++ ){ 483 483 484 param= (Param*)(*object);484 param=dynamic_cast<Param*>(*object); 485 485 if(param->InstanceEnum()==enum_type){ 486 486 return (*object); -
issm/trunk-jpl/src/c/Container/Results.cpp
r13622 r13797 76 76 77 77 for(i=0;i<this->Size();i++){ 78 ExternalResult* result= (ExternalResult*)this->GetObjectByOffset(i);78 ExternalResult* result=dynamic_cast<ExternalResult*>(this->GetObjectByOffset(i)); 79 79 80 80 /*write result to disk: */ -
issm/trunk-jpl/src/c/Container/Results.h
r13623 r13797 20 20 public: 21 21 22 /*constructors, destructors : {{{*/22 /*constructors, destructors*/ 23 23 Results(); 24 24 ~Results(); 25 /*}}}*/ 26 /*numerics : {{{*/25 26 /*numerics*/ 27 27 Results* SpawnTriaResults(int* indices); 28 void Write(Parameters* parameters); 29 /*}}}*/ 28 void Write(Parameters* parameters); 30 29 }; 31 30 #endif //ifndef _RESULTS_H_ -
issm/trunk-jpl/src/c/Container/Vertices.cpp
r13622 r13797 56 56 /*Go through objects, and distribute pids locally, from 0 to numberofpidsperobject*/ 57 57 for (i=0;i<this->Size();i++){ 58 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);58 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 59 59 vertex->DistributePids(&pidcount); 60 60 } … … 80 80 } 81 81 for (i=0;i<this->Size();i++){ 82 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);82 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 83 83 vertex->OffsetPids(pidcount); 84 84 } … … 90 90 alltruepids=xNewZeroInit<int>(numberofobjects); 91 91 for (i=0;i<this->Size();i++){ 92 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);92 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 93 93 vertex->ShowTruePids(truepids); 94 94 } … … 101 101 /* Now every cpu knows the true pids of everyone else that is not a clone*/ 102 102 for(i=0;i<this->Size();i++){ 103 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);103 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 104 104 vertex->UpdateClonePids(alltruepids); 105 105 } … … 145 145 for(i=0;i<this->Size();i++){ 146 146 /*For this object, decide whether it is a clone: */ 147 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);147 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 148 148 vertex->SetClone(minranks); 149 149 } … … 163 163 164 164 for(i=0;i<this->Size();i++){ 165 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);165 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 166 166 sid=vertex->Sid(); 167 167 if (sid>max_sid)max_sid=sid; … … 193 193 for(int i=0;i<this->Size();i++){ 194 194 /*Plug rank into ranks, according to id: */ 195 Vertex* vertex= (Vertex*)this->GetObjectByOffset(i);195 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 196 196 sid=vertex->Sid(); 197 197 ranks[sid]=my_rank; -
issm/trunk-jpl/src/c/solutions/EnvironmentFinalize.cpp
r13736 r13797 13 13 void EnvironmentFinalize(void){ 14 14 15 int my_rank=0;16 15 #ifdef _HAVE_MPI_ 17 /*Make sure we are all here!)*/ 16 17 /*Make sure we are all here*/ 18 18 MPI_Barrier(MPI_COMM_WORLD); 19 19 20 /*Print closing statement :*/21 #ifdef _HAVE_MPI_20 /*Print closing statement*/ 21 int my_rank; 22 22 MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); 23 #endif24 23 if(!my_rank) printf("closing MPI\n"); 25 24 26 25 /*Finalize: */ 27 26 MPI_Finalize(); 27 28 28 #endif 29 29 }
Note:
See TracChangeset
for help on using the changeset viewer.