G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsStaticComposite.hpp
Go to the documentation of this file.
1 
14 #include <typeinfo>
15 #pragma once
16 
17 namespace gismo
18 {
19 
20 template <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  m_numIterations += m_solvers[k]->iterations();
38  m_U = m_solvers[k]->solution();
39  m_DeltaU = m_solvers[k]->update();
40  }
41  return m_status;
42 };
43 
44 template <class T>
46 {
47  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
48  (*solver)->initialize();
49 };
50 
51 template <class T>
53 {
54  // Commented because it is assumed that options are handled in each individual solver
55  // for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
56  // (*solver)->defaultOptions();
57 
58  m_options.addInt("verbose","Verbose output",0);
59 };
60 
61 template <class T>
63 {
64  // Commented because it is assumed that options are handled in each individual solver
65  // for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
66  // (*solver)->getOptions();
67 
68  m_verbose = m_options.getInt("verbose");
69 };
70 
71 template <class T>
73 {
74  gsWarn<<"setOptions cannot be used on a gsStaticComposite solver. Call setOptions on each solver individually\n";
75 };
76 
77 template <class T>
79 {
80  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
81  (*solver)->setDisplacement(displacement);
82 };
83 
84 template <class T>
86 {
87  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
88  (*solver)->setLoad(L);
89 };
90 
91 template <class T>
92 void gsStaticComposite<T>::setSolution(const gsVector<T> & displacement, const T L)
93 {
94  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
95  (*solver)->setSolution(displacement,L);
96 };
97 
98 template <class T>
100 {
101  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
102  (*solver)->setUpdate(update);
103 };
104 
105 template <class T>
107 {
108  for (typename std::vector<gsStaticBase<T> *>::iterator solver = m_solvers.begin(); solver!=m_solvers.end(); solver++)
109  (*solver)->reset();
110 };
111 
112 
113 } // namespace gismo
void setLoad(const T L) override
See gsStaticBase.
Definition: gsStaticComposite.hpp:85
gsStatus solve() override
See gsStaticBase.
Definition: gsStaticComposite.hpp:21
void getOptions() override
See gsStaticBase.
Definition: gsStaticComposite.hpp:62
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
void setSolution(const gsVector< T > &displacement, const T L) override
See gsStaticBase.
Definition: gsStaticComposite.hpp:92
void setUpdate(const gsVector< T > &update) override
See gsStaticBase.
Definition: gsStaticComposite.hpp:99
void defaultOptions() override
See gsStaticBase.
Definition: gsStaticComposite.hpp:52
#define gsWarn
Definition: gsDebug.h:50
void reset() override
See gsStaticBase.
Definition: gsStaticComposite.hpp:106
#define gsInfo
Definition: gsDebug.h:43
void setOptions(gsOptionList &options) override
See gsStaticBase.
Definition: gsStaticComposite.hpp:72
void setDisplacement(const gsVector< T > &displacement) override
See gsStaticBase.
Definition: gsStaticComposite.hpp:78
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
void initialize() override
See gsStaticBase.
Definition: gsStaticComposite.hpp:45
Base class for static solvers.
Definition: gsStaticBase.h:37