Rodin/Variational/GridFunction.h file

Grid function class for representing FEM solutions.

This file defines the GridFunction class, which represents functions defined on a finite element mesh by their degrees of freedom. Grid functions are the discrete representation of solutions in finite element analysis.

Mathematical Foundation

A grid function represents a function $ u_h \in V_h $ by its coefficients:

\[ u_h(x) = \sum_{i=1}^N u_i \phi_i(x) \]

where:

  • $ u_i $ are the degrees of freedom (stored in the grid function)
  • $ \phi_i $ are the basis functions from the finite element space
  • $ N $ is the number of DOFs

Features

  • Storage: Manages coefficient vector for FEM solutions
  • Evaluation: Point-wise evaluation using basis function interpolation
  • I/O: Export to visualization formats (XDMF, HDF5, MEDIT, etc.)
  • Operations: Arithmetic operations, norms, projections
  • Assignment: Can be set from functions or expressions

Usage Examples

P1 Vh(mesh);
GridFunction<P1> u(Vh);  // Create grid function

// Set from analytical function
u = [](const Point& p) { return sin(p.x()) * cos(p.y()); };

// Evaluate at a point
Real value = u(point);

// Export for visualization
u.save("solution.vtu");

Namespaces

namespace Rodin
The Rodin library for finite element methods and shape optimization.
namespace Rodin::FormLanguage
Namespace Rodin::FormLanguage.
namespace Rodin::Variational
Namespace Rodin::Variational.

Classes

template<class Derived, class FES, class Data>
struct Rodin::FormLanguage::Traits<Variational::GridFunctionBase<Derived, FES, Data>>
Traits for GridFunctionBase: exposes the space and data types.
template<class FES, class Data>
struct Rodin::FormLanguage::Traits<Variational::GridFunction<FES, Data>>
Traits for GridFunction: exposes the space and data types.
template<class Derived>
class Rodin::Variational::GridFunctionBaseReference
Base class for discrete finite element functions.
template<class Derived, class FES = typename FormLanguage::Traits<Derived>::FESType, class Data = typename FormLanguage::Traits<Derived>::DataType>
class Rodin::Variational::GridFunctionBase
Base class for grid function objects.
template<class FES>
class Rodin::Variational::GridFunction<FES, Math::Vector<typename FormLanguage::Traits<FES>::ScalarType>>
Grid function storing its degrees of freedom in a dense Math::Vector over the space's scalar type (the standard local backend).