MayaFlux
0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
WallProcessor.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
VolumeFieldProcessor.hpp
"
4
5
namespace
MayaFlux::Buffers
{
6
7
/**
8
* @class WallProcessor
9
* @brief VolumeFieldProcessor zeroing the wall-normal component of a
10
* vector field on the six lattice faces.
11
*
12
* Free-slip: the component normal to each face is set to zero on that
13
* face's cells, tangential components pass through unchanged. Edge and
14
* corner cells belong to two or three faces and lose that many
15
* components. Interior cells are copied verbatim.
16
*
17
* Without this the lattice leaks. Semi-Lagrangian advection writes each
18
* cell from a backtraced source, so material whose forward trajectory
19
* exits the lattice is written nowhere and its mass is gone. With no net
20
* flow through a wall the error averages out; with a sustained normal
21
* velocity there, as buoyancy produces, the loss is one-directional and
22
* compounds. The pressure solve cannot correct it: zero-gradient pressure
23
* at the wall means the solenoidal correction's normal component vanishes
24
* there by construction, so the solve is structurally unable to touch the
25
* velocity that is doing the leaking.
26
*
27
* Runs after every stage that writes velocity. In a stable-fluids chain
28
* that is twice: once after self-advection, once after the projection.
29
* Use two instances; the stage carries no per-cycle state but a processor
30
* appears once in a chain.
31
*
32
* The condition is geometric, not physical. It says material cannot cross
33
* the lattice boundary. It does not model a surface, and nothing about it
34
* assumes which axis is up.
35
*/
36
class
MAYAFLUX_API
WallProcessor
:
public
VolumeFieldProcessor
{
37
public
:
38
/**
39
* @brief Construct a free-slip wall stage.
40
* @param velocity_field Name of the field constrained. Must have
41
* stride sizeof(glm::vec4) and be double-buffered.
42
* @param shader_path Path to the compute shader.
43
*/
44
WallProcessor
(std::string velocity_field,
const
std::string& shader_path);
45
46
/**
47
* @brief Construct a free-slip wall stage from a generated ShaderSpec.
48
* @param velocity_field Name of the field constrained.
49
* @param spec ShaderSpec implementing the condition.
50
*/
51
WallProcessor
(std::string velocity_field,
const
Portal::Graphics::ShaderSpec
& spec);
52
53
/** @brief Name of the constrained field. */
54
[[nodiscard]]
const
std::string&
get_velocity_field
()
const
{
return
m_velocity_field; }
55
56
private
:
57
/**
58
* @brief Build the binding table for the field name.
59
* @param velocity_field Field bound in both slots.
60
* @return Table binding the read slot and the write slot.
61
*/
62
static
std::vector<FieldBinding> make_bindings(
const
std::string& velocity_field);
63
64
std::string
m_velocity_field
;
65
};
66
67
}
// namespace MayaFlux::Buffers
VolumeFieldProcessor.hpp
MayaFlux::Buffers::VolumeFieldProcessor
ComputeProcessor operating on named fields of a VolumeGridBuffer.
Definition
VolumeFieldProcessor.hpp:44
MayaFlux::Buffers::WallProcessor::get_velocity_field
const std::string & get_velocity_field() const
Name of the constrained field.
Definition
WallProcessor.hpp:54
MayaFlux::Buffers::WallProcessor::m_velocity_field
std::string m_velocity_field
Definition
WallProcessor.hpp:64
MayaFlux::Buffers::WallProcessor
VolumeFieldProcessor zeroing the wall-normal component of a vector field on the six lattice faces.
Definition
WallProcessor.hpp:36
MayaFlux::Buffers
Definition
Depot.hpp:35
MayaFlux::Portal::Graphics::ShaderSpec
Complete declarative description of a generated compute shader.
Definition
ShaderSpec.hpp:344
src
MayaFlux
Buffers
State
WallProcessor.hpp
Generated by
1.9.8