@@ -111,6 +111,52 @@ namespace Rodin::Variational
111111 return m_ref.get ().getValue (p);
112112 }
113113
114+ constexpr
115+ decltype (auto ) x() const
116+ {
117+ return m_ref.get ().x ();
118+ }
119+
120+ constexpr
121+ decltype (auto ) y() const
122+ {
123+ return m_ref.get ().y ();
124+ }
125+
126+ constexpr
127+ decltype (auto ) z() const
128+ {
129+ return m_ref.get ().z ();
130+ }
131+
132+ template <class DataType >
133+ constexpr
134+ decltype (auto ) setData(const DataType& data, size_t offset = 0 )
135+ {
136+ return m_ref.get ().setData (data, offset);
137+ }
138+
139+ /* *
140+ * @brief Returns a constant reference to the GridFunction data.
141+ */
142+ constexpr
143+ auto & getData ()
144+ {
145+ return m_ref.get ().getData ();
146+ }
147+
148+ constexpr
149+ const auto & getFiniteElementSpace () const
150+ {
151+ return m_ref.get ().getFiniteElementSpace ();
152+ }
153+
154+ constexpr
155+ size_t getSize () const
156+ {
157+ return m_ref.get ().getSize ();
158+ }
159+
114160 GridFunctionBaseReference* copy () const noexcept final override
115161 {
116162 return new GridFunctionBaseReference (*this );
@@ -192,23 +238,23 @@ namespace Rodin::Variational
192238 {
193239 static_assert (std::is_same_v<RangeType, Math::Vector<ScalarType>>);
194240 assert (m_fes.get ().getVectorDimension () >= 1 );
195- return Component (static_cast <Derived&>(*this ), 0 );
241+ return Component (static_cast <const Derived&>(*this ), 0 );
196242 }
197243
198244 constexpr
199245 auto y () const
200246 {
201247 static_assert (std::is_same_v<RangeType, Math::Vector<ScalarType>>);
202248 assert (m_fes.get ().getVectorDimension () >= 2 );
203- return Component (static_cast <Derived&>(*this ), 1 );
249+ return Component (static_cast <const Derived&>(*this ), 1 );
204250 }
205251
206252 constexpr
207253 auto z () const
208254 {
209255 static_assert (std::is_same_v<RangeType, Math::Vector<ScalarType>>);
210256 assert (m_fes.get ().getVectorDimension () >= 3 );
211- return Component (static_cast <Derived&>(*this ), 2 );
257+ return Component (static_cast <const Derived&>(*this ), 2 );
212258 }
213259
214260 constexpr
@@ -682,14 +728,14 @@ namespace Rodin::Variational
682728 GridFunction& operator +=(const ScalarType& rhs)
683729 {
684730 static_assert (std::is_same_v<RangeType, ScalarType>);
685- this ->getData () += rhs;
731+ this ->getData (). array () += rhs;
686732 return *this ;
687733 }
688734
689735 GridFunction& operator -=(const ScalarType& rhs)
690736 {
691737 static_assert (std::is_same_v<RangeType, ScalarType>);
692- this ->getData () -= rhs;
738+ this ->getData (). array () -= rhs;
693739 return *this ;
694740 }
695741
0 commit comments