Changeset 23481
- Timestamp:
- 11/29/18 11:21:09 (6 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r23473 r23481 183 183 if(nodes)delete nodes; 184 184 if(vertices)delete vertices; 185 if(constraints)delete constraints; 185 if(this->constraints_list && this->nummodels){ 186 for(int i=0;i<this->nummodels;i++) delete this->constraints_list[i]; 187 xDelete<Constraints*>(constraints_list); 188 } 186 189 if(loads)delete loads; 187 190 if(materials)delete materials; … … 202 205 203 206 /*Object management*/ 207 int FemModel::AnalysisIndex(int analysis_enum){/*{{{*/ 208 209 int found=-1; 210 _assert_(this->analysis_type_list); 211 for(int i=0;i<this->nummodels;i++){ 212 if(this->analysis_type_list[i]==analysis_enum){ 213 found=i; 214 break; 215 } 216 } 217 if(found!=-1) return found; 218 else _error_("Could not find index of analysis " << EnumToStringx(analysis_enum) << " in list of FemModel analyses"); 219 220 221 }/*}}}*/ 204 222 void FemModel::CheckPoint(void){/*{{{*/ 205 223 … … 300 318 xMemCpy<int>(output->analysis_type_list,this->analysis_type_list,this->nummodels); 301 319 320 /*Analysis dependent arrays*/ 321 output->constraints_list=xNew<Constraints*>(this->nummodels); 322 302 323 output->profiler=static_cast<Profiler*>(this->profiler->copy()); 303 324 … … 305 326 output->materials=static_cast<Materials*>(this->materials->Copy()); 306 327 output->parameters=static_cast<Parameters*>(this->parameters->Copy()); 307 output->constraints=static_cast<Constraints*>(this->constraints->Copy());308 328 output->results=static_cast<Results*>(this->results->Copy()); 309 329 … … 319 339 /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */ 320 340 for(i=0;i<nummodels;i++){ 341 output->constraints_list[i] = static_cast<Constraints*>(this->constraints_list[i]->Copy()); 321 342 analysis_type=output->analysis_type_list[i]; 322 343 output->SetCurrentConfiguration(analysis_type); 323 344 if(i==0) VerticesDofx(output->vertices,output->parameters); //only call once, we only have one set of vertices 324 SpcNodesx(output->nodes,output->constraints ,output->parameters,analysis_type);345 SpcNodesx(output->nodes,output->constraints_list[i],output->parameters,analysis_type); 325 346 NodesDofx(output->nodes,output->parameters,analysis_type); 326 347 ConfigureObjectsx(output->elements,output->loads,output->nodes,output->vertices,output->materials,output->parameters); … … 398 419 399 420 /*create datasets for all analyses*/ 400 ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints ,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list);421 ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints_list,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list); 401 422 402 423 /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */ … … 418 439 419 440 if(VerboseMProcessor()) _printf0_(" resolving node constraints\n"); 420 SpcNodesx(nodes, constraints,parameters,analysis_type_list[i]);441 SpcNodesx(nodes,this->constraints,parameters,analysis_type_list[i]); 421 442 422 443 if(VerboseMProcessor()) _printf0_(" creating nodal degrees of freedom\n"); … … 436 457 delete this->materials; 437 458 delete this->parameters; 438 delete this->constraints; 459 if(this->constraints_list && this->nummodels){ 460 for(i=0;i<this->nummodels;i++) delete this->constraints_list[i]; 461 xDelete<Constraints*>(constraints_list); 462 } 439 463 delete this->results; 440 464 delete this->nodes; … … 446 470 this->materials = new Materials(); 447 471 this->parameters = new Parameters(); 448 this->constraints = new Constraints();449 472 this->results = new Results(); 450 473 this->nodes = new Nodes(); … … 463 486 this->materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 464 487 this->parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 465 this->constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);466 488 this->results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 467 489 this->nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 468 490 this->vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 469 491 this->elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 492 493 if(marshall_direction==MARSHALLING_BACKWARD){ 494 this->constraints_list = xNew<Constraints*>(this->nummodels); 495 for(i=0;i<nummodels;i++) this->constraints_list[i] = new Constraints(); 496 } 497 498 for(i=0;i<nummodels;i++){ 499 this->constraints_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 500 } 470 501 471 502 if(marshall_direction==MARSHALLING_BACKWARD){ … … 480 511 SetCurrentConfiguration(analysis_type); 481 512 if(i==0) VerticesDofx(this->vertices,this->parameters); //only call once, we only have one set of vertices 482 SpcNodesx(this->nodes,this->constraints ,this->parameters,analysis_type);513 SpcNodesx(this->nodes,this->constraints_list[i],this->parameters,analysis_type); 483 514 NodesDofx(this->nodes,this->parameters,analysis_type); 484 515 ConfigureObjectsx(this->elements,this->loads,this->nodes,this->vertices,this->materials,this->parameters); … … 489 520 SetCurrentConfiguration(analysis_type); 490 521 } 491 492 522 } 493 523 /*}}}*/ … … 559 589 } 560 590 } 561 if(found!=-1) analysis_counter=found;591 if(found!=-1) this->analysis_counter=found; 562 592 else _error_("Could not find alias for analysis_type " << EnumToStringx(configuration_type) << " in list of FemModel analyses"); 563 593 … … 570 600 this->elements->SetCurrentConfiguration(elements,loads, nodes,vertices, materials,parameters); 571 601 this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters); 602 this->constraints = this->constraints_list[this->analysis_counter]; 572 603 573 604 /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/ … … 2488 2519 parameters->FindParam(&time,TimeEnum); 2489 2520 2521 int index=AnalysisIndex(analysis_type); 2522 2490 2523 /*start module: */ 2491 2524 if(VerboseModule()) _printf0_(" Updating constraints and active domain of analysis " << EnumToStringx(analysis_type) << " for time: " << time << "\n"); … … 2596 2629 /*Creating nodes and constraints*/ 2597 2630 /*Just SSA (2D) and P1 in this version*/ 2598 Nodes* new_nodes 2599 Constraints* new_constraints = new Constraints();2631 Nodes* new_nodes = new Nodes(); 2632 Constraints** new_constraints_list = xNew<Constraints*>(this->nummodels); 2600 2633 2601 2634 int nodecounter =0; … … 2603 2636 for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list 2604 2637 2638 new_constraints_list[i] = new Constraints(); 2639 2605 2640 int analysis_enum = this->analysis_type_list[i]; 2606 2641 … … 2609 2644 2610 2645 this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes); 2611 this->CreateConstraints(new_vertices,nodecounter,constraintcounter,analysis_enum,new_constraints );2612 this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);2646 this->CreateConstraints(new_vertices,nodecounter,constraintcounter,analysis_enum,new_constraints_list[i]); 2647 //this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements); 2613 2648 2614 2649 if(new_nodes->Size()) nodecounter=new_nodes->MaximumId(); 2615 constraintcounter = new_constraints ->NumberOfConstraints();2650 constraintcounter = new_constraints_list[i]->NumberOfConstraints(); 2616 2651 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/ 2617 2652 _assert_(nodecounter>=0); 2653 2654 new_constraints_list[i]->Presort(); 2618 2655 } 2619 2656 … … 2623 2660 this->loads->Presort(); 2624 2661 new_materials->Presort(); 2625 new_constraints->Presort();2626 2662 2627 2663 /*reset hooks for elements, loads and nodes: */ … … 2634 2670 for(int i=0;i<this->nummodels;i++){ 2635 2671 analysis_type=this->analysis_type_list[i]; 2636 //SetCurrentConfiguration(analysis_type);2672 SetCurrentConfiguration(analysis_type); 2637 2673 2638 2674 this->analysis_counter=i; … … 2656 2692 VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices 2657 2693 } 2658 SpcNodesx(new_nodes,new_constraints ,this->parameters,analysis_type);2694 SpcNodesx(new_nodes,new_constraints_list[i],this->parameters,analysis_type); 2659 2695 NodesDofx(new_nodes,this->parameters,analysis_type); 2660 2696 } … … 2667 2703 delete this->elements; this->elements = new_elements; 2668 2704 delete this->nodes; this->nodes = new_nodes; 2669 delete this->constraints; this->constraints = new_constraints;2670 2705 delete this->materials; this->materials = new_materials; 2706 2707 if(this->constraints_list && this->nummodels){ 2708 for(int i=0;i<this->nummodels;i++) delete this->constraints_list[i]; 2709 xDelete<Constraints*>(this->constraints_list); 2710 } 2711 this->constraints_list = new_constraints_list; 2671 2712 2672 2713 GetMaskOfIceVerticesLSMx0(this); … … 3393 3434 /*OTHERS CONSTRAINTS MUST BE IMPLEMENTED*/ 3394 3435 if(analysis_enum!=StressbalanceAnalysisEnum) return; 3436 int analysis_index = AnalysisIndex(analysis_enum); 3395 3437 3396 3438 int numberofnodes_analysistype= this->nodes->NumberOfNodes(analysis_enum); … … 3426 3468 3427 3469 /*Get spcvx and spcvy of old mesh*/ 3428 for(int i=0;i<this->constraints ->Size();i++){3429 3430 Constraint* constraint=(Constraint*) constraints->GetObjectByOffset(i);3470 for(int i=0;i<this->constraints_list[analysis_index]->Size();i++){ 3471 3472 Constraint* constraint=(Constraint*)this->constraints_list[analysis_index]->GetObjectByOffset(i); 3431 3473 if(!constraint->InAnalysis(analysis_enum)) _error_("AMR create constraints for "<<EnumToStringx(analysis_enum)<<" not supported yet!\n"); 3432 3474 -
issm/trunk-jpl/src/c/classes/FemModel.h
r23254 r23481 41 41 Profiler* profiler; //keep time, cpu and mem statistics while we are running. 42 42 43 Constraints *constraints; //one set of constraints. each constraint knows which analysis_type it handles44 43 Elements *elements; //elements (one set for all analyses) 45 44 Loads *loads; //one set of constraints. each constraint knows which analysis_type it handles … … 50 49 Vertices *vertices; //one set of vertices 51 50 51 /*Analysis dependent datasets*/ 52 Constraints *constraints; 53 Constraints **constraints_list; 54 52 55 //FIXME: do we want only one class and have virtual functions? or keep 2 classes, at least rename AdaptiveMeshRefinement -> AmrNeopz 53 56 #if defined(_HAVE_NEOPZ_) && !defined(_HAVE_AD_) … … 65 68 66 69 /*Methods:*/ 70 int AnalysisIndex(int); 67 71 void CheckPoint(void); 68 72 void CleanUp(void); -
issm/trunk-jpl/src/c/cores/ResetBoundaryConditions.cpp
r16158 r23481 13 13 14 14 if(VerboseSolution()) _printf0_(" updating boundary conditions...\n"); 15 _assert_(femmodel->analysis_type_list[femmodel->analysis_counter]==analysis_type); 15 16 16 17 /*set current analysis: */ 17 18 femmodel->SetCurrentConfiguration(analysis_type); 19 int index = femmodel->AnalysisIndex(analysis_type); 18 20 19 21 /*retrieve boundary conditions from element inputs :*/ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r23399 r23481 13 13 #include "./ModelProcessorx.h" 14 14 15 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){15 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints*** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){ 16 16 17 17 /*Set Verbosity once for all*/ … … 28 28 Vertices *vertices = new Vertices(); 29 29 Materials *materials = new Materials(); 30 Constraints *constraints = new Constraints();31 30 Loads *loads = new Loads(); 32 31 Parameters *parameters = new Parameters(); 32 33 Constraints **constraints = xNew<Constraints*>(nummodels); 34 for(int i=0;i<nummodels;i++) constraints[i] = new Constraints(); 33 35 34 36 … … 53 55 analysis->UpdateParameters(parameters,iomodel,solution_enum,analysis_enum); 54 56 analysis->CreateNodes(nodes,iomodel); 55 analysis->CreateConstraints(constraints ,iomodel);57 analysis->CreateConstraints(constraints[i],iomodel); 56 58 analysis->CreateLoads(loads,iomodel); 57 59 analysis->UpdateElements(elements,iomodel,i,analysis_enum); … … 63 65 if(nodes->Size()) iomodel->nodecounter = nodes->MaximumId(); 64 66 iomodel->loadcounter = loads->NumberOfLoads(); 65 iomodel->constraintcounter = constraints ->NumberOfConstraints();67 iomodel->constraintcounter = constraints[i]->NumberOfConstraints(); 66 68 67 69 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/ 68 70 _assert_(iomodel->nodecounter>=0); 71 72 /*Tell constraints that Ids are already sorted*/ 73 constraints[i]->Presort(); 69 74 } 70 75 … … 91 96 loads->Presort(); 92 97 materials->Presort(); 93 constraints->Presort();94 98 95 99 /*Assign output pointers:*/ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
r23399 r23481 9 9 #include "../../analyses/analyses.h" 10 10 11 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_type,const int nummodels,const int* analysis_type_listh);11 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints*** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_type,const int nummodels,const int* analysis_type_listh); 12 12 13 13 /*Creation of fem datasets: general drivers*/
Note:
See TracChangeset
for help on using the changeset viewer.