// CelerisLab – core/obs.cuh
// Compile-time packed ``obs`` layout: force + torque + sensor segments (config_obs.h).
// ============================================================================

#ifndef CELERIS_CORE_OBS_CUH
#define CELERIS_CORE_OBS_CUH

/// Flat index into *obs* for Bouzidi force accumulation for object *id_obj*, component *d*.
__device__ __forceinline__ int obs_force_index(int id_obj, int d)
{
    return OBS_FORCE0_FLOATS + id_obj * DIM + d;
}

/// Flat index into *obs* for torque accumulation for object *id_obj*, component *d*.
__device__ __forceinline__ int obs_torque_index(int id_obj, int d)
{
#if DIM == 2
    (void)d;
    return OBS_TORQUE0_FLOATS + id_obj;
#elif DIM == 3
    return OBS_TORQUE0_FLOATS + id_obj * DIM + d;
#endif
}

/// Flat index into *obs* for sensor readout for object *id_obj*, component *d*.
__device__ __forceinline__ int obs_sensor_index(int id_obj, int d)
{
    return OBS_SENSOR0_FLOATS + id_obj * DIM + d;
}

#endif // CELERIS_CORE_OBS_CUH
