[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;
|
---|
[4057] | 13 | int analysis_counter;
|
---|
[4013] | 14 |
|
---|
| 15 | femmodel->parameters->FindParam(&verbose,VerboseEnum);
|
---|
| 16 | if(verbose)_printf_("%s\n"," updating boundary conditions...");
|
---|
[4015] | 17 |
|
---|
[4057] | 18 | GetSolutionFromInputsx( &ug, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters);
|
---|
[4013] | 19 |
|
---|
[4015] | 20 | /*set current analysis: */
|
---|
[4013] | 21 | femmodel->SetCurrentAnalysis(analysis_type);
|
---|
| 22 |
|
---|
[4015] | 23 | /*For this analysis_type, free existing boundary condition vectors: */
|
---|
[4057] | 24 | analysis_counter=femmodel->analysis_counter;
|
---|
[4013] | 25 |
|
---|
| 26 | //global dof set
|
---|
[4057] | 27 | VecFree(&femmodel->m_yg[analysis_counter]);
|
---|
[4013] | 28 | //in the s-set
|
---|
[4057] | 29 | VecFree(&femmodel->m_ys[analysis_counter]);
|
---|
[4013] | 30 |
|
---|
| 31 | //Now, duplicate ug (the solution vector) into the boundary conditions vector on the g-set
|
---|
[4057] | 32 | VecDuplicatePatch(&femmodel->m_yg[analysis_counter],ug);
|
---|
[4013] | 33 |
|
---|
| 34 | //Reduce from g to s set
|
---|
[4057] | 35 | Reducevectorgtosx(&femmodel->m_ys[analysis_counter],femmodel->m_yg[analysis_counter],femmodel->m_nodesets[analysis_counter]);
|
---|
[4013] | 36 |
|
---|
[4015] | 37 | /*Free ressources:*/
|
---|
| 38 | VecFree(&ug);
|
---|
| 39 |
|
---|
[4013] | 40 | }
|
---|