struct SimulationParams_std140_0
{
@align(16) gravity_0 : vec3<f32>,
@align(4) dt_0 : f32,
};
@binding(0) @group(0) var<uniform> entryPointParams_params_0 : SimulationParams_std140_0;
struct GridGeneric_std430_0
{
@align(4) num_active_blocks_0 : u32,
@align(4) cell_width_0 : f32,
@align(4) hmap_capacity_0 : u32,
@align(4) capacity_0 : u32,
};
@binding(1) @group(0) var<storage, read> entryPointParams_grid_0 : array<GridGeneric_std430_0>;
struct BlockVirtualId_std430_0
{
@align(16) id_0 : vec3<i32>,
};
struct BlockHeaderId_std430_0
{
@align(4) id_1 : u32,
};
struct GridHashMapEntryGeneric_std430_0
{
@align(16) state_0 : u32,
@align(16) key_0 : BlockVirtualId_std430_0,
@align(16) value_0 : BlockHeaderId_std430_0,
};
@binding(2) @group(0) var<storage, read> entryPointParams_hmap_entries_0 : array<GridHashMapEntryGeneric_std430_0>;
struct ActiveBlockHeaderGeneric_std430_0
{
@align(16) virtual_id_0 : BlockVirtualId_std430_0,
@align(16) first_particle_0 : u32,
@align(4) num_particles_0 : u32,
};
@binding(3) @group(0) var<storage, read> entryPointParams_active_blocks_0 : array<ActiveBlockHeaderGeneric_std430_0>;
struct NodeCdf_std430_0
{
@align(4) distance_0 : f32,
@align(4) affinities_0 : u32,
@align(4) closest_id_0 : u32,
};
struct Node_std430_0
{
@align(16) momentum_velocity_mass_0 : vec4<f32>,
@align(16) cdf_0 : NodeCdf_std430_0,
};
@binding(4) @group(0) var<storage, read> entryPointParams_nodes_0 : array<Node_std430_0>;
@binding(5) @group(0) var<storage, read> entryPointParams_sorted_particle_ids_0 : array<u32>;
struct Position_std430_0
{
@align(16) pt_0 : vec3<f32>,
};
@binding(6) @group(0) var<storage, read> entryPointParams_particles_pos_0 : array<Position_std430_0>;
struct _MatrixStorage_float3x3std430_0
{
@align(16) data_0 : array<vec3<f32>, i32(3)>,
};
struct Cdf_std430_0
{
@align(16) normal_0 : vec3<f32>,
@align(16) rigid_vel_0 : vec3<f32>,
@align(4) signed_distance_0 : f32,
@align(16) affinity_0 : u32,
};
struct Dynamics_std430_0
{
@align(16) velocity_0 : vec3<f32>,
@align(16) def_grad_0 : _MatrixStorage_float3x3std430_0,
@align(16) affine_0 : _MatrixStorage_float3x3std430_0,
@align(16) cdf_1 : Cdf_std430_0,
@align(16) init_volume_0 : f32,
@align(4) init_radius_0 : f32,
@align(8) mass_0 : f32,
};
@binding(7) @group(0) var<storage, read_write> entryPointParams_particles_dyn_0 : array<Dynamics_std430_0>;
struct BodyVelocity_std430_0
{
@align(16) linear_0 : vec3<f32>,
@align(16) angular_0 : vec3<f32>,
};
@binding(8) @group(0) var<storage, read> entryPointParams_body_vels_0 : array<BodyVelocity_std430_0>;
struct BodyMassProperties_std430_0
{
@align(16) inv_inertia_0 : _MatrixStorage_float3x3std430_0,
@align(16) inv_mass_0 : vec3<f32>,
@align(16) com_0 : vec3<f32>,
};
@binding(9) @group(0) var<storage, read> entryPointParams_body_mprops_0 : array<BodyMassProperties_std430_0>;
struct BlockVirtualId_0
{
@align(16) id_0 : vec3<i32>,
};
fn BlockVirtualId_x24init_0( i_0 : vec3<i32>) -> BlockVirtualId_0
{
var _S1 : BlockVirtualId_0;
_S1.id_0 = i_0;
return _S1;
}
fn pack_key_0( key_1 : BlockVirtualId_0) -> u32
{
return (((((bitcast<u32>(key_1.id_0.x + i32(1023)) & (u32(2047)))) | (((((bitcast<u32>(key_1.id_0.y + i32(511)) & (u32(1023)))) << (u32(11))))))) | (((((bitcast<u32>(key_1.id_0.z + i32(1023)) & (u32(2047)))) << (u32(21))))));
}
fn hash_0( packed_key_0 : u32) -> u32
{
var key_2 : u32 = packed_key_0 * u32(3432918353);
return ((((key_2 << (u32(15)))) | (((key_2 >> (u32(17))))))) * u32(461845907);
}
struct BlockHeaderId_0
{
@align(4) id_1 : u32,
};
fn BlockHeaderId_x24init_0( i_1 : u32) -> BlockHeaderId_0
{
var _S2 : BlockHeaderId_0;
_S2.id_1 = i_1;
return _S2;
}
fn flatten_shared_index_0( x_0 : u32, y_0 : u32, z_0 : u32) -> u32
{
return x_0 + y_0 * u32(6) + z_0 * u32(6) * u32(6);
}
struct BlockPhysicalId_0
{
id_2 : u32,
};
fn BlockPhysicalId_x24init_0( i_2 : u32) -> BlockPhysicalId_0
{
var _S3 : BlockPhysicalId_0;
_S3.id_2 = i_2;
return _S3;
}
fn block_header_id_to_physical_id_0( hid_0 : BlockHeaderId_0) -> BlockPhysicalId_0
{
return BlockPhysicalId_x24init_0(hid_0.id_1 * u32(64));
}
struct NodePhysicalId_0
{
id_3 : u32,
};
fn NodePhysicalId_x24init_0( i_3 : u32) -> NodePhysicalId_0
{
var _S4 : NodePhysicalId_0;
_S4.id_3 = i_3;
return _S4;
}
fn node_id_0( pid_0 : BlockPhysicalId_0, shift_in_block_0 : vec3<u32>) -> NodePhysicalId_0
{
return NodePhysicalId_x24init_0(pid_0.id_2 + shift_in_block_0.x + shift_in_block_0.y * u32(4) + shift_in_block_0.z * u32(4) * u32(4));
}
var<workgroup> shared_nodes_vel_mass_0 : array<vec4<f32>, i32(216)>;
struct NodeCdf_0
{
@align(4) distance_0 : f32,
@align(4) affinities_0 : u32,
@align(4) closest_id_0 : u32,
};
var<workgroup> shared_nodes_cdf_0 : array<NodeCdf_0, i32(216)>;
fn NodeCdf_x24init_0( distance_1 : f32, affinities_1 : u32, closest_id_1 : u32) -> NodeCdf_0
{
var _S5 : NodeCdf_0;
_S5.distance_0 = distance_1;
_S5.affinities_0 = affinities_1;
_S5.closest_id_0 = closest_id_1;
return _S5;
}
fn QuadraticKernel_inv_d_0( cell_width_1 : f32) -> f32
{
return 4.0f / (cell_width_1 * cell_width_1);
}
struct Position_0
{
@align(16) pt_0 : vec3<f32>,
};
fn associated_grid_pos_0( part_pos_0 : Position_0, cell_width_2 : f32) -> vec3<f32>
{
var _S6 : vec3<f32> = vec3<f32>(cell_width_2);
return (round(part_pos_0.pt_0 / _S6) - vec3<f32>(1.0f)) * _S6;
}
fn dir_to_associated_grid_node_0( part_pos_1 : Position_0, cell_width_3 : f32) -> vec3<f32>
{
return associated_grid_pos_0(part_pos_1, cell_width_3) - part_pos_1.pt_0;
}
fn QuadraticKernel_eval_all_0( x_1 : f32) -> vec3<f32>
{
var _S7 : f32 = 1.5f - x_1;
var _S8 : f32 = x_1 - 1.0f;
var _S9 : f32 = x_1 - 0.5f;
return vec3<f32>(0.5f * _S7 * _S7, 0.75f - _S8 * _S8, 0.5f * _S9 * _S9);
}
fn QuadraticKernel_precompute_weights_0( ref_elt_pos_minus_particle_pos_0 : vec3<f32>, h_0 : f32) -> mat3x3<f32>
{
return mat3x3<f32>(QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.x / h_0), QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.y / h_0), QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.z / h_0));
}
fn associated_cell_index_in_block_off_by_one_0( part_pos_2 : Position_0, cell_width_4 : f32) -> vec3<u32>
{
var _S10 : vec3<f32> = round(part_pos_2.pt_0 / vec3<f32>(cell_width_4)) - vec3<f32>(1.0f);
var _S11 : vec3<f32> = vec3<f32>(4.0f);
return vec3<u32>(_S10 - floor(_S10 / _S11) * _S11);
}
fn affinities_are_compatible_0( affinity1_0 : u32, affinity2_0 : u32) -> bool
{
var _S12 : u32 = (((affinity1_0 & (affinity2_0))) & (u32(65535)));
return ((((affinity1_0 >> (u32(16)))) & (_S12))) == ((((affinity2_0 >> (u32(16)))) & (_S12)));
}
struct BodyVelocity_0
{
@align(16) linear_0 : vec3<f32>,
@align(16) angular_0 : vec3<f32>,
};
fn body_velocity_at_point_0( com_1 : vec3<f32>, vels_0 : BodyVelocity_0, point_0 : vec3<f32>) -> vec3<f32>
{
return vels_0.linear_0 + cross(vels_0.angular_0, point_0 - com_1);
}
fn project_velocity_0( vel_0 : vec3<f32>, n_0 : vec3<f32>) -> vec3<f32>
{
var _S13 : f32 = dot(vel_0, n_0);
if(_S13 < 0.0f)
{
var _S14 : vec3<f32> = vel_0 - n_0 * vec3<f32>(_S13);
var _S15 : f32 = length(_S14);
return select(vec3<f32>(0.0f), _S14 / vec3<f32>(_S15), _S15 > 9.99999993922529029e-09f) * vec3<f32>(max(0.0f, _S15 + 20.0f * _S13));
}
else
{
return vel_0;
}
}
fn outer_product_0( a_0 : vec3<f32>, b_0 : vec3<f32>) -> mat3x3<f32>
{
return mat3x3<f32>(a_0 * vec3<f32>(b_0.x), a_0 * vec3<f32>(b_0.y), a_0 * vec3<f32>(b_0.z));
}
fn affinity_bit_0( i_collider_0 : u32, affinity_1 : u32) -> bool
{
return ((affinity_1 & (((u32(1) << (i_collider_0)))))) != u32(0);
}
fn find_block_header_id_0( _S16 : BlockVirtualId_0) -> BlockHeaderId_0
{
var _S17 : u32 = pack_key_0(_S16);
var slot_0 : u32 = ((hash_0(_S17)) & ((entryPointParams_grid_0[i32(0)].hmap_capacity_0 - u32(1))));
for(;;)
{
var _S18 : u32 = entryPointParams_hmap_entries_0[slot_0].state_0;
if((entryPointParams_hmap_entries_0[slot_0].state_0) == _S17)
{
var _S19 : BlockHeaderId_0 = BlockHeaderId_0( entryPointParams_hmap_entries_0[slot_0].value_0.id_1 );
return _S19;
}
else
{
if(_S18 == u32(4294967295))
{
break;
}
}
slot_0 = ((slot_0 + u32(1)) & ((entryPointParams_grid_0[i32(0)].hmap_capacity_0 - u32(1))));
}
return BlockHeaderId_x24init_0(u32(4294967295));
}
fn global_shared_memory_transfers_0( _S20 : vec3<u32>, _S21 : BlockVirtualId_0)
{
var i_4 : u32 = u32(0);
for(;;)
{
if(i_4 <= u32(1))
{
}
else
{
break;
}
var j_0 : u32 = u32(0);
for(;;)
{
if(j_0 <= u32(1))
{
}
else
{
break;
}
var k_0 : u32 = u32(0);
for(;;)
{
if(k_0 <= u32(1))
{
}
else
{
break;
}
var _S22 : bool;
if(i_4 == u32(1))
{
_S22 = (_S20.x) > u32(1);
}
else
{
_S22 = false;
}
var _S23 : bool;
if(_S22)
{
_S23 = true;
}
else
{
if(j_0 == u32(1))
{
_S23 = (_S20.y) > u32(1);
}
else
{
_S23 = false;
}
}
var _S24 : bool;
if(_S23)
{
_S24 = true;
}
else
{
if(k_0 == u32(1))
{
_S24 = (_S20.z) > u32(1);
}
else
{
_S24 = false;
}
}
if(_S24)
{
k_0 = k_0 + u32(1);
continue;
}
var _S25 : vec3<u32> = vec3<u32>(i_4, j_0, k_0);
var _S26 : BlockHeaderId_0 = find_block_header_id_0(BlockVirtualId_x24init_0(_S21.id_0 + vec3<i32>(_S25)));
var _S27 : vec3<u32> = _S25 * vec3<u32>(u32(4)) + _S20;
var _S28 : u32 = flatten_shared_index_0(_S27.x, _S27.y, _S27.z);
if((_S26.id_1) != u32(4294967295))
{
var _S29 : NodePhysicalId_0 = node_id_0(block_header_id_to_physical_id_0(_S26), _S20);
shared_nodes_vel_mass_0[_S28] = entryPointParams_nodes_0[_S29.id_3].momentum_velocity_mass_0;
var _S30 : u32 = entryPointParams_nodes_0[_S29.id_3].cdf_0.affinities_0;
var _S31 : u32 = entryPointParams_nodes_0[_S29.id_3].cdf_0.closest_id_0;
shared_nodes_cdf_0[_S28].distance_0 = entryPointParams_nodes_0[_S29.id_3].cdf_0.distance_0;
shared_nodes_cdf_0[_S28].affinities_0 = _S30;
shared_nodes_cdf_0[_S28].closest_id_0 = _S31;
}
else
{
shared_nodes_vel_mass_0[_S28] = vec4<f32>(0.0f);
shared_nodes_cdf_0[_S28] = NodeCdf_x24init_0(0.0f, u32(0), u32(4294967295));
}
k_0 = k_0 + u32(1);
}
j_0 = j_0 + u32(1);
}
i_4 = i_4 + u32(1);
}
return;
}
fn particle_g2p_0( _S32 : u32, _S33 : f32, _S34 : f32)
{
var _S35 : vec3<f32> = vec3<f32>(0.0f);
var _S36 : Position_0 = Position_0( entryPointParams_particles_pos_0[_S32].pt_0 );
var _S37 : vec3<f32> = entryPointParams_particles_dyn_0[_S32].velocity_0;
var _S38 : vec3<f32> = entryPointParams_particles_dyn_0[_S32].cdf_1.normal_0;
var _S39 : u32 = entryPointParams_particles_dyn_0[_S32].cdf_1.affinity_0;
var _S40 : f32 = QuadraticKernel_inv_d_0(_S33);
var _S41 : vec3<f32> = dir_to_associated_grid_node_0(_S36, _S33);
var _S42 : mat3x3<f32> = QuadraticKernel_precompute_weights_0(_S41, _S33);
var _S43 : vec3<u32> = associated_cell_index_in_block_off_by_one_0(_S36, _S33);
var _S44 : u32 = flatten_shared_index_0(_S43.x, _S43.y, _S43.z);
var _S45 : u32 = _S44 + u32(86);
var _S46 : vec4<f32> = shared_nodes_vel_mass_0[_S45];
var _S47 : NodeCdf_0 = shared_nodes_cdf_0[_S45];
var _S48 : vec3<f32> = vec3<f32>(_S33);
var _S49 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(2))) * _S48;
var cpic_cell_data_0 : vec4<f32>;
if(!affinities_are_compatible_0(entryPointParams_particles_dyn_0[_S32].cdf_1.affinity_0, shared_nodes_cdf_0[_S45].affinities_0))
{
if((_S47.closest_id_0) != u32(4294967295))
{
var _S50 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S47.closest_id_0].linear_0, entryPointParams_body_vels_0[_S47.closest_id_0].angular_0 );
var _S51 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S47.closest_id_0].com_0, _S50, _S49 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S51 + project_velocity_0(_S37 - _S51, _S38), _S46.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S46.w);
}
}
else
{
cpic_cell_data_0 = _S46;
}
var _S52 : f32 = _S42[i32(0)][u32(2)] * _S42[i32(1)][u32(2)];
var _S53 : f32 = _S52 * _S42[i32(2)][u32(2)];
var _S54 : vec4<f32> = cpic_cell_data_0 * vec4<f32>(_S53);
var _S55 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S49);
var _S56 : mat3x3<f32> = mat3x3<f32>(_S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40, _S53 * _S40);
var _S57 : mat3x3<f32> = mat3x3<f32>(_S56[0] * _S55[0], _S56[1] * _S55[1], _S56[2] * _S55[2]);
var _S58 : u32 = _S44 + u32(74);
var _S59 : vec4<f32> = shared_nodes_vel_mass_0[_S58];
var _S60 : NodeCdf_0 = shared_nodes_cdf_0[_S58];
var _S61 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S58].affinities_0))
{
if((_S60.closest_id_0) != u32(4294967295))
{
var _S62 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S60.closest_id_0].linear_0, entryPointParams_body_vels_0[_S60.closest_id_0].angular_0 );
var _S63 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S60.closest_id_0].com_0, _S62, _S61 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S63 + project_velocity_0(_S37 - _S63, _S38), _S59.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S59.w);
}
}
else
{
cpic_cell_data_0 = _S59;
}
var _S64 : f32 = _S42[i32(0)][u32(2)] * _S42[i32(1)][u32(0)];
var _S65 : f32 = _S64 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_1 : vec4<f32> = _S54 + cpic_cell_data_0 * vec4<f32>(_S65);
var _S66 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S61);
var _S67 : mat3x3<f32> = mat3x3<f32>(_S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40, _S65 * _S40);
var velocity_gradient_0 : mat3x3<f32> = _S57 + mat3x3<f32>(_S67[0] * _S66[0], _S67[1] * _S66[1], _S67[2] * _S66[2]);
var _S68 : u32 = _S44 + u32(80);
var _S69 : vec4<f32> = shared_nodes_vel_mass_0[_S68];
var _S70 : NodeCdf_0 = shared_nodes_cdf_0[_S68];
var _S71 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S68].affinities_0))
{
if((_S70.closest_id_0) != u32(4294967295))
{
var _S72 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S70.closest_id_0].linear_0, entryPointParams_body_vels_0[_S70.closest_id_0].angular_0 );
var _S73 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S70.closest_id_0].com_0, _S72, _S71 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S73 + project_velocity_0(_S37 - _S73, _S38), _S69.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S69.w);
}
}
else
{
cpic_cell_data_0 = _S69;
}
var _S74 : f32 = _S42[i32(0)][u32(2)] * _S42[i32(1)][u32(1)];
var _S75 : f32 = _S74 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_2 : vec4<f32> = momentum_velocity_mass_1 + cpic_cell_data_0 * vec4<f32>(_S75);
var _S76 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S71);
var _S77 : mat3x3<f32> = mat3x3<f32>(_S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40, _S75 * _S40);
var velocity_gradient_1 : mat3x3<f32> = velocity_gradient_0 + mat3x3<f32>(_S77[0] * _S76[0], _S77[1] * _S76[1], _S77[2] * _S76[2]);
var _S78 : u32 = _S44 + u32(84);
var _S79 : vec4<f32> = shared_nodes_vel_mass_0[_S78];
var _S80 : NodeCdf_0 = shared_nodes_cdf_0[_S78];
var _S81 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S78].affinities_0))
{
if((_S80.closest_id_0) != u32(4294967295))
{
var _S82 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S80.closest_id_0].linear_0, entryPointParams_body_vels_0[_S80.closest_id_0].angular_0 );
var _S83 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S80.closest_id_0].com_0, _S82, _S81 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S83 + project_velocity_0(_S37 - _S83, _S38), _S79.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S79.w);
}
}
else
{
cpic_cell_data_0 = _S79;
}
var _S84 : f32 = _S42[i32(0)][u32(0)] * _S42[i32(1)][u32(2)];
var _S85 : f32 = _S84 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_3 : vec4<f32> = momentum_velocity_mass_2 + cpic_cell_data_0 * vec4<f32>(_S85);
var _S86 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S81);
var _S87 : mat3x3<f32> = mat3x3<f32>(_S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40, _S85 * _S40);
var velocity_gradient_2 : mat3x3<f32> = velocity_gradient_1 + mat3x3<f32>(_S87[0] * _S86[0], _S87[1] * _S86[1], _S87[2] * _S86[2]);
var _S88 : u32 = _S44 + u32(72);
var _S89 : vec4<f32> = shared_nodes_vel_mass_0[_S88];
var _S90 : NodeCdf_0 = shared_nodes_cdf_0[_S88];
var _S91 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S88].affinities_0))
{
if((_S90.closest_id_0) != u32(4294967295))
{
var _S92 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S90.closest_id_0].linear_0, entryPointParams_body_vels_0[_S90.closest_id_0].angular_0 );
var _S93 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S90.closest_id_0].com_0, _S92, _S91 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S93 + project_velocity_0(_S37 - _S93, _S38), _S89.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S89.w);
}
}
else
{
cpic_cell_data_0 = _S89;
}
var _S94 : f32 = _S42[i32(0)][u32(0)] * _S42[i32(1)][u32(0)];
var _S95 : f32 = _S94 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_4 : vec4<f32> = momentum_velocity_mass_3 + cpic_cell_data_0 * vec4<f32>(_S95);
var _S96 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S91);
var _S97 : mat3x3<f32> = mat3x3<f32>(_S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40, _S95 * _S40);
var velocity_gradient_3 : mat3x3<f32> = velocity_gradient_2 + mat3x3<f32>(_S97[0] * _S96[0], _S97[1] * _S96[1], _S97[2] * _S96[2]);
var _S98 : u32 = _S44 + u32(78);
var _S99 : vec4<f32> = shared_nodes_vel_mass_0[_S98];
var _S100 : NodeCdf_0 = shared_nodes_cdf_0[_S98];
var _S101 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S98].affinities_0))
{
if((_S100.closest_id_0) != u32(4294967295))
{
var _S102 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S100.closest_id_0].linear_0, entryPointParams_body_vels_0[_S100.closest_id_0].angular_0 );
var _S103 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S100.closest_id_0].com_0, _S102, _S101 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S103 + project_velocity_0(_S37 - _S103, _S38), _S99.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S99.w);
}
}
else
{
cpic_cell_data_0 = _S99;
}
var _S104 : f32 = _S42[i32(0)][u32(0)] * _S42[i32(1)][u32(1)];
var _S105 : f32 = _S104 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_5 : vec4<f32> = momentum_velocity_mass_4 + cpic_cell_data_0 * vec4<f32>(_S105);
var _S106 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S101);
var _S107 : mat3x3<f32> = mat3x3<f32>(_S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40, _S105 * _S40);
var velocity_gradient_4 : mat3x3<f32> = velocity_gradient_3 + mat3x3<f32>(_S107[0] * _S106[0], _S107[1] * _S106[1], _S107[2] * _S106[2]);
var _S108 : u32 = _S44 + u32(85);
var _S109 : vec4<f32> = shared_nodes_vel_mass_0[_S108];
var _S110 : NodeCdf_0 = shared_nodes_cdf_0[_S108];
var _S111 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S108].affinities_0))
{
if((_S110.closest_id_0) != u32(4294967295))
{
var _S112 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S110.closest_id_0].linear_0, entryPointParams_body_vels_0[_S110.closest_id_0].angular_0 );
var _S113 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S110.closest_id_0].com_0, _S112, _S111 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S113 + project_velocity_0(_S37 - _S113, _S38), _S109.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S109.w);
}
}
else
{
cpic_cell_data_0 = _S109;
}
var _S114 : f32 = _S42[i32(0)][u32(1)] * _S42[i32(1)][u32(2)];
var _S115 : f32 = _S114 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_6 : vec4<f32> = momentum_velocity_mass_5 + cpic_cell_data_0 * vec4<f32>(_S115);
var _S116 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S111);
var _S117 : mat3x3<f32> = mat3x3<f32>(_S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40, _S115 * _S40);
var velocity_gradient_5 : mat3x3<f32> = velocity_gradient_4 + mat3x3<f32>(_S117[0] * _S116[0], _S117[1] * _S116[1], _S117[2] * _S116[2]);
var _S118 : u32 = _S44 + u32(73);
var _S119 : vec4<f32> = shared_nodes_vel_mass_0[_S118];
var _S120 : NodeCdf_0 = shared_nodes_cdf_0[_S118];
var _S121 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S118].affinities_0))
{
if((_S120.closest_id_0) != u32(4294967295))
{
var _S122 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S120.closest_id_0].linear_0, entryPointParams_body_vels_0[_S120.closest_id_0].angular_0 );
var _S123 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S120.closest_id_0].com_0, _S122, _S121 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S123 + project_velocity_0(_S37 - _S123, _S38), _S119.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S119.w);
}
}
else
{
cpic_cell_data_0 = _S119;
}
var _S124 : f32 = _S42[i32(0)][u32(1)] * _S42[i32(1)][u32(0)];
var _S125 : f32 = _S124 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_7 : vec4<f32> = momentum_velocity_mass_6 + cpic_cell_data_0 * vec4<f32>(_S125);
var _S126 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S121);
var _S127 : mat3x3<f32> = mat3x3<f32>(_S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40, _S125 * _S40);
var velocity_gradient_6 : mat3x3<f32> = velocity_gradient_5 + mat3x3<f32>(_S127[0] * _S126[0], _S127[1] * _S126[1], _S127[2] * _S126[2]);
var _S128 : u32 = _S44 + u32(79);
var _S129 : vec4<f32> = shared_nodes_vel_mass_0[_S128];
var _S130 : NodeCdf_0 = shared_nodes_cdf_0[_S128];
var _S131 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(1), u32(2))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S128].affinities_0))
{
if((_S130.closest_id_0) != u32(4294967295))
{
var _S132 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S130.closest_id_0].linear_0, entryPointParams_body_vels_0[_S130.closest_id_0].angular_0 );
var _S133 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S130.closest_id_0].com_0, _S132, _S131 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S133 + project_velocity_0(_S37 - _S133, _S38), _S129.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S129.w);
}
}
else
{
cpic_cell_data_0 = _S129;
}
var _S134 : f32 = _S42[i32(0)][u32(1)] * _S42[i32(1)][u32(1)];
var _S135 : f32 = _S134 * _S42[i32(2)][u32(2)];
var momentum_velocity_mass_8 : vec4<f32> = momentum_velocity_mass_7 + cpic_cell_data_0 * vec4<f32>(_S135);
var _S136 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S131);
var _S137 : mat3x3<f32> = mat3x3<f32>(_S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40, _S135 * _S40);
var velocity_gradient_7 : mat3x3<f32> = velocity_gradient_6 + mat3x3<f32>(_S137[0] * _S136[0], _S137[1] * _S136[1], _S137[2] * _S136[2]);
var _S138 : u32 = _S44 + u32(14);
var _S139 : vec4<f32> = shared_nodes_vel_mass_0[_S138];
var _S140 : NodeCdf_0 = shared_nodes_cdf_0[_S138];
var _S141 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S138].affinities_0))
{
if((_S140.closest_id_0) != u32(4294967295))
{
var _S142 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S140.closest_id_0].linear_0, entryPointParams_body_vels_0[_S140.closest_id_0].angular_0 );
var _S143 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S140.closest_id_0].com_0, _S142, _S141 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S143 + project_velocity_0(_S37 - _S143, _S38), _S139.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S139.w);
}
}
else
{
cpic_cell_data_0 = _S139;
}
var _S144 : f32 = _S52 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_9 : vec4<f32> = momentum_velocity_mass_8 + cpic_cell_data_0 * vec4<f32>(_S144);
var _S145 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S141);
var _S146 : mat3x3<f32> = mat3x3<f32>(_S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40, _S144 * _S40);
var velocity_gradient_8 : mat3x3<f32> = velocity_gradient_7 + mat3x3<f32>(_S146[0] * _S145[0], _S146[1] * _S145[1], _S146[2] * _S145[2]);
var _S147 : u32 = _S44 + u32(2);
var _S148 : vec4<f32> = shared_nodes_vel_mass_0[_S147];
var _S149 : NodeCdf_0 = shared_nodes_cdf_0[_S147];
var _S150 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S147].affinities_0))
{
if((_S149.closest_id_0) != u32(4294967295))
{
var _S151 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S149.closest_id_0].linear_0, entryPointParams_body_vels_0[_S149.closest_id_0].angular_0 );
var _S152 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S149.closest_id_0].com_0, _S151, _S150 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S152 + project_velocity_0(_S37 - _S152, _S38), _S148.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S148.w);
}
}
else
{
cpic_cell_data_0 = _S148;
}
var _S153 : f32 = _S64 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_10 : vec4<f32> = momentum_velocity_mass_9 + cpic_cell_data_0 * vec4<f32>(_S153);
var _S154 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S150);
var _S155 : mat3x3<f32> = mat3x3<f32>(_S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40, _S153 * _S40);
var velocity_gradient_9 : mat3x3<f32> = velocity_gradient_8 + mat3x3<f32>(_S155[0] * _S154[0], _S155[1] * _S154[1], _S155[2] * _S154[2]);
var _S156 : u32 = _S44 + u32(8);
var _S157 : vec4<f32> = shared_nodes_vel_mass_0[_S156];
var _S158 : NodeCdf_0 = shared_nodes_cdf_0[_S156];
var _S159 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S156].affinities_0))
{
if((_S158.closest_id_0) != u32(4294967295))
{
var _S160 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S158.closest_id_0].linear_0, entryPointParams_body_vels_0[_S158.closest_id_0].angular_0 );
var _S161 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S158.closest_id_0].com_0, _S160, _S159 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S161 + project_velocity_0(_S37 - _S161, _S38), _S157.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S157.w);
}
}
else
{
cpic_cell_data_0 = _S157;
}
var _S162 : f32 = _S74 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_11 : vec4<f32> = momentum_velocity_mass_10 + cpic_cell_data_0 * vec4<f32>(_S162);
var _S163 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S159);
var _S164 : mat3x3<f32> = mat3x3<f32>(_S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40, _S162 * _S40);
var velocity_gradient_10 : mat3x3<f32> = velocity_gradient_9 + mat3x3<f32>(_S164[0] * _S163[0], _S164[1] * _S163[1], _S164[2] * _S163[2]);
var _S165 : u32 = _S44 + u32(12);
var _S166 : vec4<f32> = shared_nodes_vel_mass_0[_S165];
var _S167 : NodeCdf_0 = shared_nodes_cdf_0[_S165];
var _S168 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S165].affinities_0))
{
if((_S167.closest_id_0) != u32(4294967295))
{
var _S169 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S167.closest_id_0].linear_0, entryPointParams_body_vels_0[_S167.closest_id_0].angular_0 );
var _S170 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S167.closest_id_0].com_0, _S169, _S168 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S170 + project_velocity_0(_S37 - _S170, _S38), _S166.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S166.w);
}
}
else
{
cpic_cell_data_0 = _S166;
}
var _S171 : f32 = _S84 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_12 : vec4<f32> = momentum_velocity_mass_11 + cpic_cell_data_0 * vec4<f32>(_S171);
var _S172 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S168);
var _S173 : mat3x3<f32> = mat3x3<f32>(_S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40, _S171 * _S40);
var velocity_gradient_11 : mat3x3<f32> = velocity_gradient_10 + mat3x3<f32>(_S173[0] * _S172[0], _S173[1] * _S172[1], _S173[2] * _S172[2]);
var _S174 : vec4<f32> = shared_nodes_vel_mass_0[_S44];
var _S175 : NodeCdf_0 = shared_nodes_cdf_0[_S44];
var _S176 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S44].affinities_0))
{
if((_S175.closest_id_0) != u32(4294967295))
{
var _S177 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S175.closest_id_0].linear_0, entryPointParams_body_vels_0[_S175.closest_id_0].angular_0 );
var _S178 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S175.closest_id_0].com_0, _S177, _S176 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S178 + project_velocity_0(_S37 - _S178, _S38), _S174.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S174.w);
}
}
else
{
cpic_cell_data_0 = _S174;
}
var _S179 : f32 = _S94 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_13 : vec4<f32> = momentum_velocity_mass_12 + cpic_cell_data_0 * vec4<f32>(_S179);
var _S180 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S176);
var _S181 : mat3x3<f32> = mat3x3<f32>(_S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40, _S179 * _S40);
var velocity_gradient_12 : mat3x3<f32> = velocity_gradient_11 + mat3x3<f32>(_S181[0] * _S180[0], _S181[1] * _S180[1], _S181[2] * _S180[2]);
var _S182 : u32 = _S44 + u32(6);
var _S183 : vec4<f32> = shared_nodes_vel_mass_0[_S182];
var _S184 : NodeCdf_0 = shared_nodes_cdf_0[_S182];
var _S185 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S182].affinities_0))
{
if((_S184.closest_id_0) != u32(4294967295))
{
var _S186 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S184.closest_id_0].linear_0, entryPointParams_body_vels_0[_S184.closest_id_0].angular_0 );
var _S187 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S184.closest_id_0].com_0, _S186, _S185 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S187 + project_velocity_0(_S37 - _S187, _S38), _S183.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S183.w);
}
}
else
{
cpic_cell_data_0 = _S183;
}
var _S188 : f32 = _S104 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_14 : vec4<f32> = momentum_velocity_mass_13 + cpic_cell_data_0 * vec4<f32>(_S188);
var _S189 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S185);
var _S190 : mat3x3<f32> = mat3x3<f32>(_S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40, _S188 * _S40);
var velocity_gradient_13 : mat3x3<f32> = velocity_gradient_12 + mat3x3<f32>(_S190[0] * _S189[0], _S190[1] * _S189[1], _S190[2] * _S189[2]);
var _S191 : u32 = _S44 + u32(13);
var _S192 : vec4<f32> = shared_nodes_vel_mass_0[_S191];
var _S193 : NodeCdf_0 = shared_nodes_cdf_0[_S191];
var _S194 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S191].affinities_0))
{
if((_S193.closest_id_0) != u32(4294967295))
{
var _S195 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S193.closest_id_0].linear_0, entryPointParams_body_vels_0[_S193.closest_id_0].angular_0 );
var _S196 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S193.closest_id_0].com_0, _S195, _S194 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S196 + project_velocity_0(_S37 - _S196, _S38), _S192.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S192.w);
}
}
else
{
cpic_cell_data_0 = _S192;
}
var _S197 : f32 = _S114 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_15 : vec4<f32> = momentum_velocity_mass_14 + cpic_cell_data_0 * vec4<f32>(_S197);
var _S198 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S194);
var _S199 : mat3x3<f32> = mat3x3<f32>(_S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40, _S197 * _S40);
var velocity_gradient_14 : mat3x3<f32> = velocity_gradient_13 + mat3x3<f32>(_S199[0] * _S198[0], _S199[1] * _S198[1], _S199[2] * _S198[2]);
var _S200 : u32 = _S44 + u32(1);
var _S201 : vec4<f32> = shared_nodes_vel_mass_0[_S200];
var _S202 : NodeCdf_0 = shared_nodes_cdf_0[_S200];
var _S203 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S200].affinities_0))
{
if((_S202.closest_id_0) != u32(4294967295))
{
var _S204 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S202.closest_id_0].linear_0, entryPointParams_body_vels_0[_S202.closest_id_0].angular_0 );
var _S205 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S202.closest_id_0].com_0, _S204, _S203 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S205 + project_velocity_0(_S37 - _S205, _S38), _S201.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S201.w);
}
}
else
{
cpic_cell_data_0 = _S201;
}
var _S206 : f32 = _S124 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_16 : vec4<f32> = momentum_velocity_mass_15 + cpic_cell_data_0 * vec4<f32>(_S206);
var _S207 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S203);
var _S208 : mat3x3<f32> = mat3x3<f32>(_S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40, _S206 * _S40);
var velocity_gradient_15 : mat3x3<f32> = velocity_gradient_14 + mat3x3<f32>(_S208[0] * _S207[0], _S208[1] * _S207[1], _S208[2] * _S207[2]);
var _S209 : u32 = _S44 + u32(7);
var _S210 : vec4<f32> = shared_nodes_vel_mass_0[_S209];
var _S211 : NodeCdf_0 = shared_nodes_cdf_0[_S209];
var _S212 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(1), u32(0))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S209].affinities_0))
{
if((_S211.closest_id_0) != u32(4294967295))
{
var _S213 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S211.closest_id_0].linear_0, entryPointParams_body_vels_0[_S211.closest_id_0].angular_0 );
var _S214 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S211.closest_id_0].com_0, _S213, _S212 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S214 + project_velocity_0(_S37 - _S214, _S38), _S210.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S210.w);
}
}
else
{
cpic_cell_data_0 = _S210;
}
var _S215 : f32 = _S134 * _S42[i32(2)][u32(0)];
var momentum_velocity_mass_17 : vec4<f32> = momentum_velocity_mass_16 + cpic_cell_data_0 * vec4<f32>(_S215);
var _S216 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S212);
var _S217 : mat3x3<f32> = mat3x3<f32>(_S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40, _S215 * _S40);
var velocity_gradient_16 : mat3x3<f32> = velocity_gradient_15 + mat3x3<f32>(_S217[0] * _S216[0], _S217[1] * _S216[1], _S217[2] * _S216[2]);
var _S218 : u32 = _S44 + u32(50);
var _S219 : vec4<f32> = shared_nodes_vel_mass_0[_S218];
var _S220 : NodeCdf_0 = shared_nodes_cdf_0[_S218];
var _S221 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S218].affinities_0))
{
if((_S220.closest_id_0) != u32(4294967295))
{
var _S222 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S220.closest_id_0].linear_0, entryPointParams_body_vels_0[_S220.closest_id_0].angular_0 );
var _S223 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S220.closest_id_0].com_0, _S222, _S221 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S223 + project_velocity_0(_S37 - _S223, _S38), _S219.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S219.w);
}
}
else
{
cpic_cell_data_0 = _S219;
}
var _S224 : f32 = _S52 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_18 : vec4<f32> = momentum_velocity_mass_17 + cpic_cell_data_0 * vec4<f32>(_S224);
var _S225 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S221);
var _S226 : mat3x3<f32> = mat3x3<f32>(_S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40, _S224 * _S40);
var velocity_gradient_17 : mat3x3<f32> = velocity_gradient_16 + mat3x3<f32>(_S226[0] * _S225[0], _S226[1] * _S225[1], _S226[2] * _S225[2]);
var _S227 : u32 = _S44 + u32(38);
var _S228 : vec4<f32> = shared_nodes_vel_mass_0[_S227];
var _S229 : NodeCdf_0 = shared_nodes_cdf_0[_S227];
var _S230 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S227].affinities_0))
{
if((_S229.closest_id_0) != u32(4294967295))
{
var _S231 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S229.closest_id_0].linear_0, entryPointParams_body_vels_0[_S229.closest_id_0].angular_0 );
var _S232 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S229.closest_id_0].com_0, _S231, _S230 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S232 + project_velocity_0(_S37 - _S232, _S38), _S228.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S228.w);
}
}
else
{
cpic_cell_data_0 = _S228;
}
var _S233 : f32 = _S64 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_19 : vec4<f32> = momentum_velocity_mass_18 + cpic_cell_data_0 * vec4<f32>(_S233);
var _S234 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S230);
var _S235 : mat3x3<f32> = mat3x3<f32>(_S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40, _S233 * _S40);
var velocity_gradient_18 : mat3x3<f32> = velocity_gradient_17 + mat3x3<f32>(_S235[0] * _S234[0], _S235[1] * _S234[1], _S235[2] * _S234[2]);
var _S236 : u32 = _S44 + u32(44);
var _S237 : vec4<f32> = shared_nodes_vel_mass_0[_S236];
var _S238 : NodeCdf_0 = shared_nodes_cdf_0[_S236];
var _S239 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S236].affinities_0))
{
if((_S238.closest_id_0) != u32(4294967295))
{
var _S240 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S238.closest_id_0].linear_0, entryPointParams_body_vels_0[_S238.closest_id_0].angular_0 );
var _S241 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S238.closest_id_0].com_0, _S240, _S239 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S241 + project_velocity_0(_S37 - _S241, _S38), _S237.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S237.w);
}
}
else
{
cpic_cell_data_0 = _S237;
}
var _S242 : f32 = _S74 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_20 : vec4<f32> = momentum_velocity_mass_19 + cpic_cell_data_0 * vec4<f32>(_S242);
var _S243 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S239);
var _S244 : mat3x3<f32> = mat3x3<f32>(_S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40, _S242 * _S40);
var velocity_gradient_19 : mat3x3<f32> = velocity_gradient_18 + mat3x3<f32>(_S244[0] * _S243[0], _S244[1] * _S243[1], _S244[2] * _S243[2]);
var _S245 : u32 = _S44 + u32(48);
var _S246 : vec4<f32> = shared_nodes_vel_mass_0[_S245];
var _S247 : NodeCdf_0 = shared_nodes_cdf_0[_S245];
var _S248 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S245].affinities_0))
{
if((_S247.closest_id_0) != u32(4294967295))
{
var _S249 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S247.closest_id_0].linear_0, entryPointParams_body_vels_0[_S247.closest_id_0].angular_0 );
var _S250 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S247.closest_id_0].com_0, _S249, _S248 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S250 + project_velocity_0(_S37 - _S250, _S38), _S246.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S246.w);
}
}
else
{
cpic_cell_data_0 = _S246;
}
var _S251 : f32 = _S84 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_21 : vec4<f32> = momentum_velocity_mass_20 + cpic_cell_data_0 * vec4<f32>(_S251);
var _S252 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S248);
var _S253 : mat3x3<f32> = mat3x3<f32>(_S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40, _S251 * _S40);
var velocity_gradient_20 : mat3x3<f32> = velocity_gradient_19 + mat3x3<f32>(_S253[0] * _S252[0], _S253[1] * _S252[1], _S253[2] * _S252[2]);
var _S254 : u32 = _S44 + u32(36);
var _S255 : vec4<f32> = shared_nodes_vel_mass_0[_S254];
var _S256 : NodeCdf_0 = shared_nodes_cdf_0[_S254];
var _S257 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S254].affinities_0))
{
if((_S256.closest_id_0) != u32(4294967295))
{
var _S258 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S256.closest_id_0].linear_0, entryPointParams_body_vels_0[_S256.closest_id_0].angular_0 );
var _S259 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S256.closest_id_0].com_0, _S258, _S257 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S259 + project_velocity_0(_S37 - _S259, _S38), _S255.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S255.w);
}
}
else
{
cpic_cell_data_0 = _S255;
}
var _S260 : f32 = _S94 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_22 : vec4<f32> = momentum_velocity_mass_21 + cpic_cell_data_0 * vec4<f32>(_S260);
var _S261 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S257);
var _S262 : mat3x3<f32> = mat3x3<f32>(_S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40, _S260 * _S40);
var velocity_gradient_21 : mat3x3<f32> = velocity_gradient_20 + mat3x3<f32>(_S262[0] * _S261[0], _S262[1] * _S261[1], _S262[2] * _S261[2]);
var _S263 : u32 = _S44 + u32(42);
var _S264 : vec4<f32> = shared_nodes_vel_mass_0[_S263];
var _S265 : NodeCdf_0 = shared_nodes_cdf_0[_S263];
var _S266 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S263].affinities_0))
{
if((_S265.closest_id_0) != u32(4294967295))
{
var _S267 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S265.closest_id_0].linear_0, entryPointParams_body_vels_0[_S265.closest_id_0].angular_0 );
var _S268 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S265.closest_id_0].com_0, _S267, _S266 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S268 + project_velocity_0(_S37 - _S268, _S38), _S264.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S264.w);
}
}
else
{
cpic_cell_data_0 = _S264;
}
var _S269 : f32 = _S104 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_23 : vec4<f32> = momentum_velocity_mass_22 + cpic_cell_data_0 * vec4<f32>(_S269);
var _S270 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S266);
var _S271 : mat3x3<f32> = mat3x3<f32>(_S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40, _S269 * _S40);
var velocity_gradient_22 : mat3x3<f32> = velocity_gradient_21 + mat3x3<f32>(_S271[0] * _S270[0], _S271[1] * _S270[1], _S271[2] * _S270[2]);
var _S272 : u32 = _S44 + u32(49);
var _S273 : vec4<f32> = shared_nodes_vel_mass_0[_S272];
var _S274 : NodeCdf_0 = shared_nodes_cdf_0[_S272];
var _S275 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S272].affinities_0))
{
if((_S274.closest_id_0) != u32(4294967295))
{
var _S276 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S274.closest_id_0].linear_0, entryPointParams_body_vels_0[_S274.closest_id_0].angular_0 );
var _S277 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S274.closest_id_0].com_0, _S276, _S275 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S277 + project_velocity_0(_S37 - _S277, _S38), _S273.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S273.w);
}
}
else
{
cpic_cell_data_0 = _S273;
}
var _S278 : f32 = _S114 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_24 : vec4<f32> = momentum_velocity_mass_23 + cpic_cell_data_0 * vec4<f32>(_S278);
var _S279 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S275);
var _S280 : mat3x3<f32> = mat3x3<f32>(_S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40, _S278 * _S40);
var velocity_gradient_23 : mat3x3<f32> = velocity_gradient_22 + mat3x3<f32>(_S280[0] * _S279[0], _S280[1] * _S279[1], _S280[2] * _S279[2]);
var _S281 : u32 = _S44 + u32(37);
var _S282 : vec4<f32> = shared_nodes_vel_mass_0[_S281];
var _S283 : NodeCdf_0 = shared_nodes_cdf_0[_S281];
var _S284 : vec3<f32> = _S41 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(1))) * _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S281].affinities_0))
{
if((_S283.closest_id_0) != u32(4294967295))
{
var _S285 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S283.closest_id_0].linear_0, entryPointParams_body_vels_0[_S283.closest_id_0].angular_0 );
var _S286 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S283.closest_id_0].com_0, _S285, _S284 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S286 + project_velocity_0(_S37 - _S286, _S38), _S282.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S282.w);
}
}
else
{
cpic_cell_data_0 = _S282;
}
var _S287 : f32 = _S124 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_25 : vec4<f32> = momentum_velocity_mass_24 + cpic_cell_data_0 * vec4<f32>(_S287);
var _S288 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S284);
var _S289 : mat3x3<f32> = mat3x3<f32>(_S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40, _S287 * _S40);
var velocity_gradient_24 : mat3x3<f32> = velocity_gradient_23 + mat3x3<f32>(_S289[0] * _S288[0], _S289[1] * _S288[1], _S289[2] * _S288[2]);
var _S290 : u32 = _S44 + u32(43);
var _S291 : vec4<f32> = shared_nodes_vel_mass_0[_S290];
var _S292 : NodeCdf_0 = shared_nodes_cdf_0[_S290];
var _S293 : vec3<f32> = _S41 + _S48;
if(!affinities_are_compatible_0(_S39, shared_nodes_cdf_0[_S290].affinities_0))
{
if((_S292.closest_id_0) != u32(4294967295))
{
var _S294 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[_S292.closest_id_0].linear_0, entryPointParams_body_vels_0[_S292.closest_id_0].angular_0 );
var _S295 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S292.closest_id_0].com_0, _S294, _S293 + entryPointParams_particles_pos_0[_S32].pt_0);
cpic_cell_data_0 = vec4<f32>(_S295 + project_velocity_0(_S37 - _S295, _S38), _S291.w);
}
else
{
cpic_cell_data_0 = vec4<f32>(_S37, _S291.w);
}
}
else
{
cpic_cell_data_0 = _S291;
}
var _S296 : f32 = _S134 * _S42[i32(2)][u32(1)];
var momentum_velocity_mass_26 : vec4<f32> = momentum_velocity_mass_25 + cpic_cell_data_0 * vec4<f32>(_S296);
var _S297 : mat3x3<f32> = outer_product_0(cpic_cell_data_0.xyz, _S293);
var _S298 : mat3x3<f32> = mat3x3<f32>(_S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40, _S296 * _S40);
var velocity_gradient_25 : mat3x3<f32> = velocity_gradient_24 + mat3x3<f32>(_S298[0] * _S297[0], _S298[1] * _S297[1], _S298[2] * _S297[2]);
var i_5 : u32 = u32(0);
var rigid_vel_1 : vec3<f32> = _S35;
for(;;)
{
if(i_5 < u32(16))
{
}
else
{
break;
}
if(affinity_bit_0(i_5, _S39))
{
var _S299 : BodyVelocity_0 = BodyVelocity_0( entryPointParams_body_vels_0[i_5].linear_0, entryPointParams_body_vels_0[i_5].angular_0 );
rigid_vel_1 = rigid_vel_1 + body_velocity_at_point_0(entryPointParams_body_mprops_0[i_5].com_0, _S299, entryPointParams_particles_pos_0[_S32].pt_0);
}
i_5 = i_5 + u32(1);
}
entryPointParams_particles_dyn_0[_S32].cdf_1.rigid_vel_0 = rigid_vel_1;
var _S300 : array<vec3<f32>, i32(3)> = array<vec3<f32>, i32(3)>( vec3<f32>(velocity_gradient_25[i32(0)][i32(0)], velocity_gradient_25[i32(0)][i32(1)], velocity_gradient_25[i32(0)][i32(2)]), vec3<f32>(velocity_gradient_25[i32(1)][i32(0)], velocity_gradient_25[i32(1)][i32(1)], velocity_gradient_25[i32(1)][i32(2)]), vec3<f32>(velocity_gradient_25[i32(2)][i32(0)], velocity_gradient_25[i32(2)][i32(1)], velocity_gradient_25[i32(2)][i32(2)]) );
entryPointParams_particles_dyn_0[_S32].affine_0.data_0 = _S300;
entryPointParams_particles_dyn_0[_S32].velocity_0 = momentum_velocity_mass_26.xyz;
return;
}
@compute
@workgroup_size(4, 4, 4)
fn g2p(@builtin(workgroup_id) block_id_0 : vec3<u32>, @builtin(local_invocation_id) tid_0 : vec3<u32>, @builtin(local_invocation_index) tid_flat_0 : u32)
{
var _S301 : u32 = block_id_0.x;
var _S302 : BlockVirtualId_0 = BlockVirtualId_0( entryPointParams_active_blocks_0[_S301].virtual_id_0.id_0 );
global_shared_memory_transfers_0(tid_0, _S302);
workgroupBarrier();
var _S303 : u32 = entryPointParams_active_blocks_0[_S301].first_particle_0 + entryPointParams_active_blocks_0[_S301].num_particles_0;
var sorted_particle_id_0 : u32 = entryPointParams_active_blocks_0[_S301].first_particle_0 + tid_flat_0;
for(;;)
{
if(sorted_particle_id_0 < _S303)
{
}
else
{
break;
}
particle_g2p_0(entryPointParams_sorted_particle_ids_0[sorted_particle_id_0], entryPointParams_grid_0[i32(0)].cell_width_0, entryPointParams_params_0.dt_0);
sorted_particle_id_0 = sorted_particle_id_0 + u32(64);
}
return;
}