G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
precomputed_expr.h
Go to the documentation of this file.
1 
15 namespace gismo
16 {
17 
18 namespace expr
19 {
20 
21 //template<class E>
22 template<class T>
23 class precomputed_expr : public _expr<precomputed_expr<T> >
24 {
25 public:
26  typedef T Scalar;
27 
28  enum{Space = 1, ScalarValued=0, ColBlocks=0};
29 
30  //friend class gismo::gsExprHelper<Scalar>;
31 protected:
32 
33  const gsFeSpace<Scalar> m_rowvar, m_colvar;
34  std::vector<gsMatrix<T> > m_data; // per element
35  size_t m_curId;
36 
37 public:
38 
39  // used by FeSpace, FeVariable, ..
40  void parse(gsExprHelper<Scalar> & evList) const
41  {
42  evList.add(*this);
43  }
44 
45  index_t cardinality_impl() const
46  {
47  return 0;
48  }
49 
50 private:
51  void clear() { m_data.clear(); }
52 
53 protected:
54 
55  template <typename E>
56  explicit precomputed_expr(_expr<E> const& u) :
57  m_rowvar(u.rowVar()), m_colvar(u.colVar())
58  { }
59 
60 public:
61  //bool isValid() const { return NULL!=m_fd && NULL!=m_fs; }
62 
63  gsMatrix<T> elementValues(size_t id)
64  {
65  return m_data[id];
66  }
67 
68  MatExprType eval(const index_t k) const
69  { return m_data[m_curId]; }
70 
71  const gsFeSpace<Scalar> & rowVar() const {return m_rowvar;}
72  const gsFeSpace<Scalar> & colVar() const {return m_colvar;}
73 
74  index_t rows() const
75  {
76  return 0;
77  }
78 
79  index_t cols() const { return 0; }
80 
81  void print(std::ostream &os) const { os << "u"; }
82 };
83 
84 
85 } //namespace expr
86 } //namespace gismo
87 
#define MatExprType
[Include namespace]
Definition: gsThinShellUtils.h:32
Definition: gsExpressions.h:96
#define index_t
Definition: gsConfig.h:32
EIGEN_STRONG_INLINE idMat_expr id(const index_t dim)
The identity matrix of dimension dim.
Definition: gsExpressions.h:4472