G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
precomputed_expr.h
Go to the documentation of this file.
1
15namespace gismo
16{
17
18namespace expr
19{
20
21//template<class E>
22template<class T>
23class precomputed_expr : public _expr<precomputed_expr<T> >
24{
25public:
26 typedef T Scalar;
27
28 enum{Space = 1, ScalarValued=0, ColBlocks=0};
29
30 //friend class gismo::gsExprHelper<Scalar>;
31protected:
32
33 const gsFeSpace<Scalar> m_rowvar, m_colvar;
34 std::vector<gsMatrix<T> > m_data; // per element
35 size_t m_curId;
36
37public:
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
50private:
51 void clear() { m_data.clear(); }
52
53protected:
54
55 template <typename E>
56 explicit precomputed_expr(_expr<E> const& u) :
57 m_rowvar(u.rowVar()), m_colvar(u.colVar())
58 { }
59
60public:
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
Definition gsExpressions.h:973
Definition gsExprHelper.h:27
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
#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:4470
The G+Smo namespace, containing all definitions for the library.