SOFA plugin: DiffusionSolver  master
Open source framework for multi-physics simuation
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
DiffusionSolver< _Real > Struct Template Reference

#include <DiffusionSolver.h>

Detailed Description

template<typename _Real>
struct DiffusionSolver< _Real >

Solving diffusion on 3D regular grids (stored as CImg)

Parameters
size(in) the size of the regular domain in the 3 directions.
img(in-out) the image to diffuse. It contains the Dirichlet boundary values and contains warm-start values (must be set to 0 for no warm-start).
mask(in) represents the type of each voxel. A negative value represents the exterior of the domain, a positive value for the interior and 0 for Dirichlet boundary conditions. The boundary exterior/interior implicitly represents a Neumann boundary condition imposing null gradients along normals.
Warning
the material map must be normalized between [0,1]
at least a one pixel outside border
Author
: matth.nosp@m.ieu..nosp@m.nesme.nosp@m.@inr.nosp@m.ia.fr

Static Public Attributes

static const char OUTSIDE = -1
 voxel type More...
 
static const char INSIDE = 1
 
static const char DIRICHLET = 0
 

Static Public Member Functions

static void setNbThreads (unsigned nb)
 for multi-threaded implementations More...
 
static void setDefaultNbThreads ()
 
static void setMaxNbThreads ()
 
static int getMaxNbThreads ()
 
static void solveGS (ImageType &img, const MaskType &mask, Real spacingX, Real spacingY, Real spacingZ, unsigned iterations, Real threshold, Real sor=1, const ImageType *material=NULL, Real minValueThreshold=0)
 
static void solveJacobi (ImageType &img, const MaskType &mask, Real spacingX, Real spacingY, Real spacingZ, unsigned iterations, Real threshold, const ImageType *material=NULL, Real minValueThreshold=0)
 Jacobi implementation. More...
 
static void solveCG (ImageType &img, const MaskType &mask, Real spacingX, Real spacingY, Real spacingZ, unsigned iterations, Real threshold, const ImageType *material=NULL)
 Conjugate Gradient implementation (matrix-free) More...
 

Attribute details

◆ DIRICHLET

template<typename Real >
const char DiffusionSolver< Real >::DIRICHLET = 0
static

◆ INSIDE

template<typename Real >
const char DiffusionSolver< Real >::INSIDE = 1
static

◆ OUTSIDE

template<typename Real >
const char DiffusionSolver< Real >::OUTSIDE = -1
static

voxel type

Function details

◆ getMaxNbThreads()

template<typename Real >
int DiffusionSolver< Real >::getMaxNbThreads
static

◆ setDefaultNbThreads()

template<typename Real >
void DiffusionSolver< Real >::setDefaultNbThreads
static

◆ setMaxNbThreads()

template<typename Real >
void DiffusionSolver< Real >::setMaxNbThreads
static

◆ setNbThreads()

template<typename Real >
void DiffusionSolver< Real >::setNbThreads ( unsigned  nb)
static

for multi-threaded implementations

◆ solveCG()

template<typename Real >
void DiffusionSolver< Real >::solveCG ( ImageType img,
const MaskType mask,
Real  spacingX,
Real  spacingY,
Real  spacingZ,
unsigned  iterations,
Real  threshold,
const ImageType material = NULL 
)
static

Conjugate Gradient implementation (matrix-free)

◆ solveGS()

template<typename Real >
void DiffusionSolver< Real >::solveGS ( ImageType img,
const MaskType mask,
Real  spacingX,
Real  spacingY,
Real  spacingZ,
unsigned  iterations,
Real  threshold,
Real  sor = 1,
const ImageType material = NULL,
Real  minValueThreshold = 0 
)
static

Gauss-Seidel implementation

Parameters
sor(Successive Over Relaxation coef) 0<sor<2 should converge, 1<sor<2 can converge faster than pure GS (sor=1)

◆ solveJacobi()

template<typename Real >
void DiffusionSolver< Real >::solveJacobi ( ImageType img,
const MaskType mask,
Real  spacingX,
Real  spacingY,
Real  spacingZ,
unsigned  iterations,
Real  threshold,
const ImageType material = NULL,
Real  minValueThreshold = 0 
)
static

Jacobi implementation.