13class VolumeSurfaceProcessor;
14class SDFMeshProcessor;
16class VolumeGridBuffer;
18class BuoyancyProcessor;
20class DivergenceProcessor;
21class DiffuseProcessor;
22class PressureProcessor;
23class SolenoidalProcessor;
45 std::weak_ptr<VolumeGridBuffer>
owner;
47 static constexpr size_t stride =
sizeof(float);
49 operator const std::string&()
const {
return name; }
57 auto o =
owner.lock();
58 return o && o.get() == volume;
71 std::weak_ptr<VolumeGridBuffer>
owner;
73 static constexpr size_t stride =
sizeof(glm::vec4);
75 operator const std::string&()
const {
return name; }
83 auto o =
owner.lock();
84 return o && o.get() == volume;
154 bool double_buffered =
true;
193 float dissipation { 1.0F };
203 glm::vec3 direction { 0.0F, 1.0F, 0.0F };
215 float viscosity { 0.0F };
216 uint32_t jacobi_iterations { 32 };
240 std::vector<std::shared_ptr<AdvectProcessor>>
carriers;
252 std::initializer_list<FieldDecl> fields,
253 std::optional<SurfaceConfig> surface = std::nullopt);
263 std::vector<FieldDecl> fields,
264 std::optional<SurfaceConfig> surface = std::nullopt);
278 std::optional<SurfaceConfig> surface = std::nullopt);
343 std::shared_ptr<InfluxProcessor> influx(
344 const std::string& field,
346 const std::string& shader =
"volume_influx_blob.comp.spv");
349 [[nodiscard]] std::shared_ptr<VolumeSurfaceProcessor>
surface_processor()
const {
return m_surface_processor; }
352 [[nodiscard]] std::shared_ptr<SDFMeshProcessor>
mesh_processor()
const {
return m_mesh_processor; }
361 [[nodiscard]] std::optional<uint32_t> get_live_vertex_count()
const;
367 [[nodiscard]] uint32_t
get_width()
const {
return m_lattice.resolution.x; }
370 [[nodiscard]] uint32_t
get_height()
const {
return m_lattice.resolution.y; }
373 [[nodiscard]] uint32_t
get_depth()
const {
return m_lattice.resolution.z; }
376 [[nodiscard]] uint32_t
get_cell_count()
const {
return static_cast<uint32_t
>(m_lattice.cell_count()); }
382 [[nodiscard]] glm::vec3
get_cell_size()
const {
return m_lattice.cell_size(); }
385 [[nodiscard]]
bool has_field(
const std::string&
name)
const;
388 [[nodiscard]]
size_t get_field_bytes(
const std::string&
name)
const;
391 [[nodiscard]]
size_t get_field_stride(
const std::string&
name)
const;
406 [[nodiscard]] std::vector<std::string> get_field_names()
const;
413 [[nodiscard]] vk::Buffer read_handle(
const std::string&
name)
const;
422 [[nodiscard]] vk::Buffer write_handle(
const std::string&
name)
const;
433 void swap_field(
const std::string&
name);
469 VectorRef declare_vector(std::string
name, Kinesis::LatticeSemantics semantics = {});
500 std::vector<std::string> ensure_fields(
const std::vector<FieldDecl>& decls);
507 void seed(
const std::string&
name,
const Kinesis::SpatialField& field);
527 void seed_raw(
const std::string&
name,
const void* data,
size_t size);
559 void read_field(
const std::string&
name,
void* data,
size_t size);
578 const std::vector<std::string>& names,
579 const std::vector<std::pair<void*, size_t>>& dsts);
594 void allocate_fields(
const std::vector<FieldDecl>& decls);
611 [[nodiscard]]
const Field* find_field(
const std::string&
name,
const char* context)
const;
631 static size_t surface_storage_bytes(
const std::optional<SurfaceConfig>& surface);
642 const std::string&
name,
644 bool double_buffered,
Vulkan-backed buffer wrapper used in processing chains.
uint32_t get_width() const
Cell count along X.
const Kinesis::Lattice3D & get_lattice() const
The lattice every field is discretized over.
std::unordered_map< std::string, Field > m_fields
void accumulate(const std::string &name, const Kinesis::VectorField &field)
Add sampled values into a vector field.
TransferHandle m_pending_transfer
In-flight seed upload, resolved before the next transfer.
uint32_t get_cell_count() const
Total cell count.
uint32_t get_depth() const
Cell count along Z.
const Kinesis::AABB3D & get_bounds() const
World-space extent the lattice covers.
Kinesis::Lattice3D m_lattice
glm::vec3 get_cell_size() const
World-space size of one cell along each axis.
std::optional< SurfaceConfig > m_surface
std::shared_ptr< SDFMeshProcessor > mesh_processor() const
The marching cubes stage, valid after setup_rendering.
std::shared_ptr< VolumeSurfaceProcessor > surface_processor() const
The surface extraction stage, valid after setup_rendering.
std::shared_ptr< VKBuffer > m_transfer_staging
Reused across seed and read calls.
std::shared_ptr< VolumeSurfaceProcessor > m_surface_processor
std::vector< std::string > m_field_order
void seed(const std::string &name, const Kinesis::VectorField &field)
Write initial values into a vector field from a Kinesis field.
bool allocate_field(const std::string &name, size_t stride_bytes, bool double_buffered)
Allocate one field's slots and register it.
std::shared_ptr< VKBuffer > m_counter_buf
Atomic vertex counter for the extraction stage.
std::shared_ptr< SDFMeshProcessor > m_mesh_processor
uint32_t get_height() const
Cell count along Y.
GPU-resident state for multi-field simulations evaluated over a fixed 3D topology: incompressible flu...
std::shared_ptr< void > TransferHandle
Opaque handle to an in-flight transfer.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
Where and how an influx adds, in one aggregate, for configure().
std::weak_ptr< VolumeGridBuffer > owner
static constexpr size_t stride
bool issued_by(const VolumeGridBuffer *volume) const
Whether this ref was issued by the given volume.
A scalar field's name, issued by the volume that owns it.
static constexpr size_t stride
bool issued_by(const VolumeGridBuffer *volume) const
Whether this ref was issued by the given volume.
std::weak_ptr< VolumeGridBuffer > owner
A vector field's name, issued by the volume that owns it.
std::string name
Lookup key, unique within the volume.
size_t stride_bytes
Bytes per cell.
One field's declaration within a volume.
Kinesis::LatticeSemantics semantics
ScalarRef density
Drives motion against it.
ScalarRef temperature
Drives motion along direction.
Body force accumulated into velocity from two scalars.
ScalarRef field
Field advected.
A scalar transported by the velocity field.
ScalarRef pressure
Required.
VectorRef velocity
Required.
VectorRef scratch
Required only when viscosity is above zero.
std::optional< Buoyancy > buoyancy
std::vector< Carried > carried
ScalarRef divergence
Required. Single-slot is correct.
Parameters for the incompressible flow stage arrangement.
std::shared_ptr< AdvectProcessor > self_advect
std::shared_ptr< PressureProcessor > pressure
std::shared_ptr< WallProcessor > wall_projected
std::vector< std::shared_ptr< AdvectProcessor > > carriers
Parallel to config.carried.
std::shared_ptr< DiffuseProcessor > diffuse
std::shared_ptr< DivergenceProcessor > divergence
std::shared_ptr< SolenoidalProcessor > solenoidal
std::shared_ptr< BuoyancyProcessor > buoyancy
std::shared_ptr< WallProcessor > wall_advected
Every stage setup_flow built, in no particular order.
std::string field_name
Scalar field surfaced. Stride must be sizeof(float).
glm::uvec3 resolution
Extraction cell count per axis, over the volume's own bounds.
float threshold
Field value the surface is placed at.
Isosurface extraction parameters for a scalar field.
Axis-aligned bounding box in 3D world space.
A regular subdivision of an AABB3D into a cell count per axis.
Interpretation attached to one named quantity sampled over a lattice.
Typed, composable, stateless callable from domain D to range R.
Unified rendering configuration for graphics buffers.