G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsContainerBasisBase.h
Go to the documentation of this file.
1 
14 /*
15  TO DO
16 */
17 
18 #pragma once
19 
20 #include<gsIO/gsOptionList.h>
22 
23 namespace gismo
24 {
25 
26  template<short_t d,class T>
27  class gsContainerBasisBase
28  {
29 
30  private:
31  typedef gsContainerBasis<d,T> basis;
32  typedef typename std::vector<basis> basisContainer;
33 
35  typedef memory::shared_ptr< gsContainerBasisBase > Ptr;
36 
38  typedef memory::unique_ptr< gsContainerBasisBase > uPtr;
39 
40  public:
41 
42  virtual ~gsContainerBasisBase() {};
43 
44  gsContainerBasisBase(gsMultiPatch<T> & mp, gsMultiBasis<T> & mb)
45  : m_patches(mp), m_multiBasis(mb)
46  {
47 
48  }
49 
50  public:
51 
52  virtual gsOptionList & options() { return m_options; }
53  virtual void defaultOptions() { };
54 
55  virtual void setOptions(gsOptionList opt) {m_options.update(opt, gsOptionList::addIfUnknown); };
56 
57  virtual void init() = 0;
58  virtual void compute() = 0;
59 
60 
61  void getMultiBasis(gsMultiBasis<T> & multiBasis_result)
62  {
63  multiBasis_result.clear();
64 
65  std::vector<gsBasis<T> *> basis_temp = std::vector<gsBasis<T> *>(m_patches.nPatches());
66  for (size_t np = 0; np < m_patches.nPatches(); np++) {
67  gsContainerBasis<2, real_t>::uPtr basis = gsContainerBasis<d, T>::make(m_bases[np]);
68  basis_temp[np] = static_cast<gsBasis<T> *>(basis.release());
69  }
70 
71  multiBasis_result = gsMultiBasis<T>(basis_temp, m_patches.topology());
72  };
73 
74  gsSparseMatrix<T> & getSystem() { return m_matrix; };
75  void setSystem(gsSparseMatrix<T> & system) { m_matrix = system; };
76 
77  private:
78  // Helper functions
79 
80  protected:
81  // Data members
82 
83  // Put here the members of the shared functions
85  gsMultiPatch<T> & m_patches;
86  gsMultiBasis<T> & m_multiBasis;
87 
89  gsOptionList m_options;
90 
92  basisContainer m_bases;
93 
95  gsSparseMatrix<T> m_matrix;
96  };
97 
98 }
Provides a list of labeled parameters/options that can be set and accessed easily.
Provides declaration of Basis abstract interface. Similar to gsMultiBasis, but without topology...