G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsStaticComposite.hpp
Go to the documentation of this file.
1
14#include <typeinfo>
15#pragma once
16
17namespace gismo
18{
19
20template <class T>
22{
23 this->getOptions();
24 m_numIterations = 0;
25 m_status = gsStatus::Success;
26 for (size_t k=0; k!=m_solvers.size() && m_status==gsStatus::Success; k++)
27 {
28 if (m_verbose > 0)
29 gsInfo<<"Solver "<<k<<" out of "<<m_solvers.size()<<"\n";
30
31 if (k>0)
32 {
33 m_solvers[k]->setUpdate(m_solvers[k-1]->update());
34 }
35
36 m_status = m_solvers[k]->solve();
37 if (m_status==gsStatus::Success)
38 {
39 m_numIterations += m_solvers[k]->iterations();
40 m_U = m_solvers[k]->solution();
41 m_DeltaU = m_solvers[k]->update();
42 }
43 else if (m_verbose > 0)
44 gsInfo<<"Solver "<<k<<" failed \n";
45 }
46 return m_status;
47};
48
49template <class T>
51{
52 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
53 (*solver)->initialize();
54};
55
56template <class T>
58{
59 // Commented because it is assumed that options are handled in each individual solver
60 // for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
61 // (*solver)->defaultOptions();
62
63 m_options.addInt("verbose","Verbose output",0);
64};
65
66template <class T>
68{
69 // Commented because it is assumed that options are handled in each individual solver
70 // for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
71 // (*solver)->getOptions();
72
73 m_verbose = m_options.getInt("verbose");
74};
75
76template <class T>
78{
79 gsWarn<<"setOptions cannot be used on a gsStaticComposite solver. Call setOptions on each solver individually\n";
80};
81
82template <class T>
84{
85 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
86 (*solver)->setDisplacement(displacement);
87};
88
89template <class T>
91{
92 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
93 (*solver)->setLoad(L);
94};
95
96template <class T>
97void gsStaticComposite<T>::setSolution(const gsVector<T> & displacement, const T L)
98{
99 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
100 (*solver)->setSolution(displacement,L);
101};
102
103template <class T>
105{
106 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
107 (*solver)->setUpdate(update);
108};
109
110template <class T>
112{
113 for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
114 (*solver)->reset();
115};
116
117
118} // namespace gismo
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Base class for static solvers.
Definition gsStaticBase.h:38
void setLoad(const T L) override
See gsStaticBase.
Definition gsStaticComposite.hpp:90
void setOptions(gsOptionList &options) override
See gsStaticBase.
Definition gsStaticComposite.hpp:77
void initialize() override
See gsStaticBase.
Definition gsStaticComposite.hpp:50
void defaultOptions() override
See gsStaticBase.
Definition gsStaticComposite.hpp:57
void getOptions() override
See gsStaticBase.
Definition gsStaticComposite.hpp:67
void setDisplacement(const gsVector< T > &displacement) override
See gsStaticBase.
Definition gsStaticComposite.hpp:83
gsStatus solve() override
See gsStaticBase.
Definition gsStaticComposite.hpp:21
void setSolution(const gsVector< T > &displacement, const T L) override
See gsStaticBase.
Definition gsStaticComposite.hpp:97
void setUpdate(const gsVector< T > &update) override
See gsStaticBase.
Definition gsStaticComposite.hpp:104
void reset() override
See gsStaticBase.
Definition gsStaticComposite.hpp:111
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define gsWarn
Definition gsDebug.h:50
#define gsInfo
Definition gsDebug.h:43
The G+Smo namespace, containing all definitions for the library.
gsStatus
Definition gsStructuralAnalysisTypes.h:21
@ Success
Successful.