Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Gray_Scott_Rule< Real, Kernel > Class Template Reference

Gray-Scott reaction-diffusion rule. More...

#include <tpl_ca_continuous_rules.H>

Collaboration diagram for Aleph::CA::Gray_Scott_Rule< Real, Kernel >:
[legend]

Public Types

using state_type = Reaction_Diffusion_Cell< Real >
 Cell state consumed and produced by the rule.
 
using kernel_type = Kernel
 Laplacian kernel type.
 

Public Member Functions

 Gray_Scott_Rule (Real feed, Real kill, Real du, Real dv, Real dt=Real{1}, Kernel laplacian=laplacian_5p_kernel< Real >())
 Build a Gray-Scott rule.
 
Real feed () const noexcept
 
Real kill () const noexcept
 
Real Du () const noexcept
 
Real Dv () const noexcept
 
Real dt () const noexcept
 
const Kernel & laplacian () const noexcept
 
state_type operator() (const state_type &current, Neighbor_View< state_type > neighbours) const
 Compute the next Gray-Scott state.
 

Private Member Functions

Real laplace_u (Neighbor_View< state_type > neighbours, const state_type &current) const
 
Real laplace_v (Neighbor_View< state_type > neighbours, const state_type &current) const
 

Private Attributes

Real feed_
 
Real kill_
 
Real du_
 
Real dv_
 
Real dt_
 
Kernel lap_
 

Detailed Description

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
class Aleph::CA::Gray_Scott_Rule< Real, Kernel >

Gray-Scott reaction-diffusion rule.

Explicit Euler update:

du/dt = Du * Lap(u) - u*v*v + F*(1 - u)
dv/dt = Dv * Lap(v) + u*v*v - (F + K)*v
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Definition Blossom.H:466

The default 5-point Laplacian expects a Moore<2, 1> neighbourhood; diagonal neighbour weights are zero. Concentrations are contracted to [0, 1] for documented stable parameters. The constructor enforces 0 < dt <= 1.0, which covers the standard Gray-Scott presets with dx = 1 used by CA examples.

Template Parameters
Realfloating-point field type.
KernelLaplacian kernel type.

Definition at line 317 of file tpl_ca_continuous_rules.H.

Member Typedef Documentation

◆ kernel_type

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
using Aleph::CA::Gray_Scott_Rule< Real, Kernel >::kernel_type = Kernel

Laplacian kernel type.

Definition at line 323 of file tpl_ca_continuous_rules.H.

◆ state_type

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
using Aleph::CA::Gray_Scott_Rule< Real, Kernel >::state_type = Reaction_Diffusion_Cell<Real>

Cell state consumed and produced by the rule.

Definition at line 321 of file tpl_ca_continuous_rules.H.

Constructor & Destructor Documentation

◆ Gray_Scott_Rule()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Aleph::CA::Gray_Scott_Rule< Real, Kernel >::Gray_Scott_Rule ( Real  feed,
Real  kill,
Real  du,
Real  dv,
Real  dt = Real{1},
Kernel  laplacian = laplacian_5p_kernel<Real>() 
)
inline

Build a Gray-Scott rule.

Parameters
[in]feedfeed rate F, usually in [0, 0.1].
[in]killkill rate K, usually in [0, 0.1].
[in]dudiffusion coefficient for u.
[in]dvdiffusion coefficient for v.
[in]dtexplicit Euler time step; stable contract: 0 < dt <= 1.0.
[in]laplacianconvolution kernel; defaults to 5-point Laplacian.
Exceptions
std::domain_errorif any parameter is outside its documented range.

Definition at line 363 of file tpl_ca_continuous_rules.H.

Member Function Documentation

◆ dt()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Real Aleph::CA::Gray_Scott_Rule< Real, Kernel >::dt ( ) const
inlinenoexcept
Returns
explicit Euler time step.

Definition at line 405 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::dt_.

◆ Du()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Real Aleph::CA::Gray_Scott_Rule< Real, Kernel >::Du ( ) const
inlinenoexcept
Returns
u diffusion coefficient.

Definition at line 393 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::du_.

◆ Dv()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Real Aleph::CA::Gray_Scott_Rule< Real, Kernel >::Dv ( ) const
inlinenoexcept
Returns
v diffusion coefficient.

Definition at line 399 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::dv_.

◆ feed()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Real Aleph::CA::Gray_Scott_Rule< Real, Kernel >::feed ( ) const
inlinenoexcept
Returns
feed rate F.

Definition at line 381 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::feed_.

◆ kill()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
Real Aleph::CA::Gray_Scott_Rule< Real, Kernel >::kill ( ) const
inlinenoexcept
Returns
kill rate K.

Definition at line 387 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::kill_.

◆ laplace_u()

◆ laplace_v()

◆ laplacian()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
const Kernel & Aleph::CA::Gray_Scott_Rule< Real, Kernel >::laplacian ( ) const
inlinenoexcept
Returns
Laplacian kernel.

Definition at line 411 of file tpl_ca_continuous_rules.H.

References Aleph::CA::Gray_Scott_Rule< Real, Kernel >::lap_.

◆ operator()()

template<typename Real = double, typename Kernel = Kernel2D<Real, 3, 3>>
state_type Aleph::CA::Gray_Scott_Rule< Real, Kernel >::operator() ( const state_type &  current,
Neighbor_View< state_type >  neighbours 
) const
inline

Compute the next Gray-Scott state.

Parameters
[in]currentcurrent (u, v) concentration.
[in]neighboursneighbour cells in Moore<2, Kernel::radius_v> order.
Returns
next concentration pair.
Exceptions
std::length_errorif neighbour count does not match the kernel.
std::runtime_errorif the update leaves the stable [0, 1] concentration interval beyond roundoff tolerance.

Definition at line 426 of file tpl_ca_continuous_rules.H.

References ah_length_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::ca_continuous_detail::clamp_unit_after_check(), Aleph::CA::Gray_Scott_Rule< Real, Kernel >::dt_, Aleph::CA::Gray_Scott_Rule< Real, Kernel >::du_, Aleph::CA::Gray_Scott_Rule< Real, Kernel >::dv_, Aleph::CA::Gray_Scott_Rule< Real, Kernel >::feed_, Aleph::CA::Gray_Scott_Rule< Real, Kernel >::kill_, Aleph::CA::Gray_Scott_Rule< Real, Kernel >::laplace_u(), Aleph::CA::Gray_Scott_Rule< Real, Kernel >::laplace_v(), Aleph::CA::Reaction_Diffusion_Cell< Real >::u, and Aleph::CA::Reaction_Diffusion_Cell< Real >::v.

Member Data Documentation

◆ dt_

◆ du_

◆ dv_

◆ feed_

◆ kill_

◆ lap_


The documentation for this class was generated from the following file: