Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca_predator_prey_multifield_example.cc File Reference

Phase 14 example: a 2-field Lotka–Volterra CA in SoA layout. More...

#include <charconv>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
#include <tuple>
#include <ca-traits.H>
#include <tpl_ca_multi_field_engine.H>
#include <tpl_ca_multi_field_lattice.H>
#include <tpl_ca_neighborhood.H>
Include dependency graph for ca_predator_prey_multifield_example.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Phase 14 example: a 2-field Lotka–Volterra CA in SoA layout.

Each cell carries two coupled real fields, prey x and predator y, evolving under a discretised Lotka–Volterra system with spatial diffusion:

dx/dt = α x − β x y + Du · ∇²x dy/dt = δ x y − γ y + Dv · ∇²y

The example uses Multi_Field_Lattice<Layout_SoA, ...> so each field owns its own contiguous buffer (vectorisable, the natural layout for large grids), prints periodic ASCII frames, and reports the global prey/predator population every snapshot so the oscillation is visible at a glance.

Run: ./ca_predator_prey_multifield_example [steps] [side]

Definition in file ca_predator_prey_multifield_example.cc.

Function Documentation

◆ main()