Rodin/Variational/SparseProblem.h file

Sparse matrix problem specialization.

This file defines the SparseProblem class, a specialization of the Problem class that uses sparse matrix storage for efficient handling of large-scale finite element systems. Sparse storage is the standard choice for most FEM problems as system matrices are typically very sparse.

Sparse Matrix Storage

For a typical FEM problem with $ N $ degrees of freedom:

  • Dense storage: $ O(N^2) $ memory
  • Sparse storage: $ O(N) $ memory (for 2D/3D problems)

Sparsity Pattern

The sparsity pattern is determined by the mesh connectivity:

\[ A_{ij} \neq 0 \iff \text{DOFs } i \text{ and } j \text{ share an element} \]

Advantages

  • Memory efficient for large problems
  • Faster matrix-vector products
  • Enables iterative solvers (CG, GMRES, etc.)
  • Essential for 3D problems

Usage Example

P1 Vh(mesh);
TrialFunction u(Vh);
TestFunction v(Vh);

// Automatically uses sparse storage
SparseProblem problem(u, v);
problem = Integral(Grad(u), Grad(v)) - Integral(f, v);
problem.solve(solver);

Namespaces

namespace Rodin
The Rodin library for Shape and Topology Optimization.
namespace Rodin::Variational
Module which provides the necessary tools for constructing variational problems.

Classes

template<class TrialFES, class TestFES>
class Rodin::Variational::SparseProblem<TrialFES, TestFES, Math::Matrix<typename FormLanguage::Mult<typename FormLanguage::Traits<TrialFES>::ScalarType, typename FormLanguage::Traits<TestFES>::ScalarType>::Type>, Math::Vector<typename FormLanguage::Traits<TestFES>::ScalarType>>
General class to assemble linear systems with Math::SparseMatrix and Math::Vector types in a serial context.