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