Rodin/Variational/DenseProblem.h file

Dense matrix problem specialization.

This file defines the DenseProblem class, a specialization of the Problem class that uses dense matrix storage. While less memory-efficient than sparse storage, dense matrices can be advantageous for small problems or when matrix structure doesn't favor sparsity.

Dense Matrix Storage

Dense storage stores all $ N^2 $ matrix entries regardless of zeros:

  • Memory: $ O(N^2) $
  • Access: $ O(1) $ for any entry
  • Operations: Cache-friendly for small matrices

When to Use Dense Storage

  • Small problems (few hundred DOFs)
  • Nearly full matrices (rare in standard FEM)
  • Prototyping and testing
  • Spectral methods with global basis functions
  • Problems with dense blocks (e.g., boundary elements)

Performance Considerations

For typical FEM problems:

  • Sparse: scales to millions of DOFs
  • Dense: practical only for ~1000 DOFs or less

Usage Example

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

// Use dense storage
DenseProblem 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 LinearSystem, class U, class V>
class Rodin::Variational::DenseProblem<LinearSystem, U, V>
General class to assemble linear systems with Math::Matrix and Math::Vector types in a serial context.