[4013] | 1 | /*!\file: ResetBoundaryConditions.cpp
|
---|
| 2 | * \brief: change boundary conditions of a model, using a solution vector from another analysis
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | #include "../objects/objects.h"
|
---|
| 6 | #include "../modules/modules.h"
|
---|
| 7 | #include "../EnumDefinitions/EnumDefinitions.h"
|
---|
| 8 |
|
---|
[4015] | 9 | void ResetBoundaryConditions(FemModel* femmodel, int analysis_type, int sub_analysis_type){
|
---|
[4013] | 10 |
|
---|
| 11 | int verbose=0;
|
---|
[4015] | 12 | Vec ug=NULL;
|
---|
[4013] | 13 |
|
---|
| 14 | femmodel->parameters->FindParam(&verbose,VerboseEnum);
|
---|
| 15 | if(verbose)_printf_("%s\n"," updating boundary conditions...");
|
---|
[4015] | 16 |
|
---|
| 17 | GetSolutionFromInputsx( &ug, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters, analysis_type,sub_analysis_type);
|
---|
[4013] | 18 |
|
---|
[4015] | 19 | /*set current analysis: */
|
---|
[4013] | 20 | femmodel->SetCurrentAnalysis(analysis_type);
|
---|
| 21 |
|
---|
[4015] | 22 | /*For this analysis_type, free existing boundary condition vectors: */
|
---|
[4013] | 23 |
|
---|
| 24 | //global dof set
|
---|
| 25 | VecFree(&femmodel->yg[femmodel->analysis_counter]->vector);
|
---|
| 26 | //in the s-set
|
---|
| 27 | VecFree(&femmodel->ys[analysis_counter]);
|
---|
| 28 |
|
---|
| 29 | //Now, duplicate ug (the solution vector) into the boundary conditions vector on the g-set
|
---|
| 30 | VecDuplicatePatch(&femmodel->yg[analysis_counter]->vector,ug);
|
---|
| 31 |
|
---|
| 32 | //Reduce from g to s set
|
---|
| 33 | Reducevectorgtosx(&femmodel->ys[analysis_counter],femmodel->yg[analysis_counter]->vector,femmodel->nodesets[analysis_counter]);
|
---|
| 34 |
|
---|
[4015] | 35 | /*Free ressources:*/
|
---|
| 36 | VecFree(&ug);
|
---|
| 37 |
|
---|
[4013] | 38 | }
|
---|