Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
gas_reference.cpp File Reference
#include "sim/gas_reference.h"
#include <algorithm>
#include <cassert>
#include <limits>
#include "common/fixed.hlsli"
Include dependency graph for gas_reference.cpp:

Go to the source code of this file.

Classes

struct  bicameral::sim::anonymous_namespace{gas_reference.cpp}::FaceSide
struct  bicameral::sim::anonymous_namespace{gas_reference.cpp}::GasFace

Namespaces

namespace  bicameral
namespace  bicameral::sim
namespace  bicameral::sim::anonymous_namespace{gas_reference.cpp}

Enumerations

enum class  bicameral::sim::anonymous_namespace{gas_reference.cpp}::SideKind : uint8_t { bicameral::sim::anonymous_namespace{gas_reference.cpp}::Cell , bicameral::sim::anonymous_namespace{gas_reference.cpp}::Ghost , bicameral::sim::anonymous_namespace{gas_reference.cpp}::Wall }

Functions

uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::MulShiftU64 (uint64_t a, uint64_t b, uint32_t shift)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::TotalAmount (const GasConfig &config, const GasCell &cell)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::HeatCapacity (const GasConfig &config, const GasCell &cell)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::ChemicalEnergy (const GasConfig &config, const GasCell &cell)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::CellMass (const GasConfig &config, const GasCoefficients &coefficients, const GasCell &cell)
uint32_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::CellTemperature (const GasConfig &config, const GasCell &cell)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::CellPressure (const GasConfig &config, const GasCell &cell, uint32_t temperature)
GasDerived bicameral::sim::anonymous_namespace{gas_reference.cpp}::DeriveRaw (const GasConfig &config, const GasCoefficients &coefficients, const GasCell &cell)
uint32_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::AxisSize (const GasConfig &config, uint32_t axis)
FaceSide bicameral::sim::anonymous_namespace{gas_reference.cpp}::BoundarySide (GasBoundary boundary, uint32_t z)
std::array< uint32_t, GAS_AXES > bicameral::sim::anonymous_namespace{gas_reference.cpp}::CellCoordinate (const GasBox &box, uint32_t index)
FaceSide bicameral::sim::anonymous_namespace{gas_reference.cpp}::SideAt (const GasBox &box, std::array< uint32_t, GAS_AXES > cell, uint32_t axis, int64_t coordinate)
GasFace bicameral::sim::anonymous_namespace{gas_reference.cpp}::MakeFace (const GasBox &box, std::array< uint32_t, GAS_AXES > cell, uint32_t axis, bool high)
std::vector< GasFace > bicameral::sim::anonymous_namespace{gas_reference.cpp}::EnumerateFaces (const GasBox &box)
uint32_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::CellLayer (const GasBox &box, uint32_t index)
const GasCell & bicameral::sim::anonymous_namespace{gas_reference.cpp}::SideCell (const GasBox &box, const std::vector< GasCell > &cells, FaceSide side)
const GasDerived & bicameral::sim::anonymous_namespace{gas_reference.cpp}::SideDerived (const GasBox &box, const std::vector< GasDerived > &derived, FaceSide side)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::Excess (const GasBox &box, const std::vector< GasDerived > &derived, FaceSide side)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::HalfHydrostatic (int64_t excess)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::DrivingPressure (const GasBox &box, const std::vector< GasDerived > &derived, const GasFace &face)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::ComputeFaceWeight (const GasBox &box, const std::vector< GasDerived > &derived, GasFace &face)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::ComputeFaceForce (const GasBox &box, const std::vector< GasDerived > &derived, GasFace &face)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::ComputeFaceFlow (const GasBox &box, const std::vector< GasDerived > &derived, const std::vector< GasCell > &forced, GasFace &face)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::RawFraction (const GasBox &box, const std::vector< GasDerived > &derived, const GasFace &face)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::DivideNearest (int64_t a, uint64_t b)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::MovedEnergy (const GasConfig &config, const GasCell &source, const GasCell &moved)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::Transfer (GasBox &box, const std::vector< GasCell > &forced, std::vector< GasCell > &next, const GasFace &face)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::ApplyImpulse (GasBox &box, std::vector< GasCell > &next, const GasFace &face)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::LimitOutflow (const GasBox &box, const std::vector< GasDerived > &derived, std::vector< GasFace > &faces)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::LimitedSlope (GasReconstruction reconstruction, int64_t a, int64_t b)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::SpeciesRatio (const GasBox &box, const std::vector< GasCell > &cells, const std::vector< GasDerived > &derived, FaceSide side, uint32_t s)
int64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::HalfSlope (const GasBox &box, const std::vector< GasCell > &cells, const std::vector< GasDerived > &derived, const GasFace &face, uint32_t s)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::MovedAmountQ32 (const GasBox &box, const std::vector< GasCell > &cells, const std::vector< GasDerived > &derived, const GasFace &face, uint32_t s)
uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::RoundAmount (const GasBox &box, uint64_t amountQ32, uint64_t hash)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::ComputeMovedAmounts (const GasBox &box, const std::vector< GasCell > &cells, const std::vector< GasDerived > &derived, uint64_t roundingTick, std::vector< GasFace > &faces)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::LimitMovedAmounts (const GasBox &box, const std::vector< GasCell > &cells, std::vector< GasFace > &faces)
std::vector< GasDerived > bicameral::sim::anonymous_namespace{gas_reference.cpp}::DeriveAll (const GasBox &box)
void bicameral::sim::anonymous_namespace{gas_reference.cpp}::Substep (GasBox &box, const std::vector< GasFace > &layout, uint64_t roundingTick)
GasCoefficients bicameral::sim::MakeGasCoefficients (const GasConfig &config)
GasCell bicameral::sim::MakeGasCell (const GasConfig &config, std::span< const uint64_t > amounts, uint32_t temperatureMilliKelvin)
std::vector< GasCell > bicameral::sim::MakeHydrostaticReference (const GasConfig &config, std::span< const uint32_t > fractionsQ32, uint32_t temperatureMilliKelvin, uint64_t surfacePressureMicroPascal)
GasBox bicameral::sim::MakeGasBox (const GasConfig &config, std::vector< GasCell > reference)
GasDerived bicameral::sim::DeriveGasCell (const GasBox &box, const GasCell &cell, uint32_t z)
int64_t bicameral::sim::GasVelocity (const GasBox &box, const GasCell &cell, uint32_t axis)
void bicameral::sim::StepGas (GasBox &box)
GasTotals bicameral::sim::SumGas (const GasBox &box)
uint64_t bicameral::sim::HashGas (const GasBox &box)

Variables

constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::PRESSURE_PER_AMOUNT_TEMPERATURE_Q32 = 285682760
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::HYDROSTATIC_MICROPASCAL_PER_MASS_X10000 = 392266
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::GRAVITY_MICROMETER_PER_SECOND2 = 9806650
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::MICRO = 1000000
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::ONE_Q32 = (uint64_t)1 << 32
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::LOW_32_BITS = ONE_Q32 - 1
constexpr uint64_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::MAX_CELL_AMOUNT = (uint64_t)1 << 31
constexpr uint32_t bicameral::sim::anonymous_namespace{gas_reference.cpp}::GAS_ROUNDING_PURPOSE = 0x47610001u