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

Path-pattern sink that writes one SVG file per accepted frame. More...

#include <ca-svg.H>

Collaboration diagram for Aleph::CA::Svg_Frame_Sink< Palette >:
[legend]

Public Member Functions

 Svg_Frame_Sink (std::filesystem::path path_pattern, Palette palette, SVG_Render_Options opts={}, const std::size_t zero_pad=6)
 Build an SVG frame sink.
 
template<typename Lattice >
void accept (const std::size_t step, const Lattice &frame)
 Write one SVG frame using the default dead state.
 
template<typename Lattice >
void accept (const std::size_t step, const Lattice &frame, const typename Lattice::state_type &dead_state)
 Write one SVG frame, threading the lattice-specific dead state.
 

Static Public Member Functions

static void flush ()
 SVG frames are written eagerly; this is a no-op.
 

Private Attributes

std::filesystem::path pattern_
 
Palette palette_
 
SVG_Render_Options opts_ {}
 
std::size_t zero_pad_ = 6
 

Detailed Description

template<typename Palette>
class Aleph::CA::Svg_Frame_Sink< Palette >

Path-pattern sink that writes one SVG file per accepted frame.

Template Parameters
Paletteinvocable state_type -> RGB8.

Definition at line 364 of file ca-svg.H.

Constructor & Destructor Documentation

◆ Svg_Frame_Sink()

template<typename Palette >
Aleph::CA::Svg_Frame_Sink< Palette >::Svg_Frame_Sink ( std::filesystem::path  path_pattern,
Palette  palette,
SVG_Render_Options  opts = {},
const std::size_t  zero_pad = 6 
)
inline

Build an SVG frame sink.

Parameters
[in]path_patternoutput path pattern.
[in]palettestate-to-colour mapper.
[in]optsrendering options.
[in]zero_padminimum width for {step}.

Definition at line 378 of file ca-svg.H.

Member Function Documentation

◆ accept() [1/2]

template<typename Palette >
template<typename Lattice >
void Aleph::CA::Svg_Frame_Sink< Palette >::accept ( const std::size_t  step,
const Lattice &  frame 
)
inline

Write one SVG frame using the default dead state.

Equivalent to calling the (step, frame, dead_state) overload with typename Lattice::state_type{}. Use the explicit overload when opts.omit_dead_cells is true and the lattice's dead state is not the default-constructed value.

Template Parameters
Lattice2D lattice type.
Parameters
[in]stepsimulation step.
[in]frameframe to write.
Exceptions
std::runtime_erroron file open or stream write failure.
std::filesystem::filesystem_errorif the parent directory cannot be created.

Definition at line 401 of file ca-svg.H.

References Aleph::CA::Svg_Frame_Sink< Palette >::accept().

Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept(), and TEST().

◆ accept() [2/2]

template<typename Palette >
template<typename Lattice >
void Aleph::CA::Svg_Frame_Sink< Palette >::accept ( const std::size_t  step,
const Lattice &  frame,
const typename Lattice::state_type &  dead_state 
)
inline

Write one SVG frame, threading the lattice-specific dead state.

Use this overload to ensure opts.omit_dead_cells skips the intended state value rather than the default-constructed one.

Template Parameters
Lattice2D lattice type.
Parameters
[in]stepsimulation step.
[in]frameframe to write.
[in]dead_statestate skipped when opts.omit_dead_cells is true.
Exceptions
std::runtime_erroron file open or stream write failure.
std::filesystem::filesystem_errorif the parent directory cannot be created.

Definition at line 420 of file ca-svg.H.

References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::format_step_path(), Aleph::CA::Svg_Frame_Sink< Palette >::opts_, out, Aleph::CA::Svg_Frame_Sink< Palette >::palette_, Aleph::CA::Svg_Frame_Sink< Palette >::pattern_, Aleph::CA::render_lattice_svg(), and Aleph::CA::Svg_Frame_Sink< Palette >::zero_pad_.

◆ flush()

template<typename Palette >
static void Aleph::CA::Svg_Frame_Sink< Palette >::flush ( )
inlinestatic

SVG frames are written eagerly; this is a no-op.

Definition at line 433 of file ca-svg.H.

Member Data Documentation

◆ opts_

Definition at line 368 of file ca-svg.H.

Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept().

◆ palette_

template<typename Palette >
Palette Aleph::CA::Svg_Frame_Sink< Palette >::palette_
private

Definition at line 367 of file ca-svg.H.

Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept().

◆ pattern_

template<typename Palette >
std::filesystem::path Aleph::CA::Svg_Frame_Sink< Palette >::pattern_
private

Definition at line 366 of file ca-svg.H.

Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept().

◆ zero_pad_

template<typename Palette >
std::size_t Aleph::CA::Svg_Frame_Sink< Palette >::zero_pad_ = 6
private

Definition at line 369 of file ca-svg.H.

Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept().


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