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 |
|
---|
14 | femmodel->parameters->FindParam(&verbose,VerboseEnum);
|
---|
15 | if(verbose)_printf_("%s\n"," updating boundary conditions...");
|
---|
16 |
|
---|
17 | GetSolutionFromInputsx( &ug, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters, analysis_type,sub_analysis_type);
|
---|
18 |
|
---|
19 | /*set current analysis: */
|
---|
20 | femmodel->SetCurrentAnalysis(analysis_type);
|
---|
21 |
|
---|
22 | /*For this analysis_type, free existing boundary condition vectors: */
|
---|
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 |
|
---|
35 | /*Free ressources:*/
|
---|
36 | VecFree(&ug);
|
---|
37 |
|
---|
38 | }
|
---|