|
Bicameral Engine
GPU-resident engine for a magic-research open-world game
|
Classes | |
| struct | TermsResult |
Typedefs | |
| using | NameIndex = std::map<std::string, uint32_t, std::less<>> |
Functions | |
| uint64_t | HashName (std::string_view name) |
| ReactionTableDefinition | CanonicalOrder (const ReactionTableDefinition &definition) |
| std::expected< NameIndex, std::string > | IndexElements (const ReactionTableDefinition &definition, BakedReactionTable &baked) |
| int64_t | ZeroKelvinEnthalpy (const SpeciesDefinition &species) |
| std::expected< void, std::string > | BakeSpecies (const SpeciesDefinition &definition, const NameIndex &elements, const ReactionTableDefinition &table, BakedReactionTable &baked) |
| std::expected< NameIndex, std::string > | BakeAllSpecies (const ReactionTableDefinition &definition, const NameIndex &elements, BakedReactionTable &baked) |
| std::expected< TermsResult, std::string > | CopyTerms (const RuleDefinition &rule, std::span< const RuleTerm > terms, const NameIndex &species, std::span< uint32_t > ids, std::span< uint32_t > coefficients) |
| std::expected< void, std::string > | CheckElementBalance (const RuleDefinition &definition, const RxRule &rule, const BakedReactionTable &baked) |
| int64_t | ReactionEnthalpy (const RxRule &rule, const BakedReactionTable &baked) |
| std::expected< RxRule, std::string > | BakeRule (const RuleDefinition &definition, const NameIndex &species, const BakedReactionTable &baked) |
| std::optional< std::string > | CheckDeclaredEnthalpy (const RuleDefinition &rule, const ReactionTableDefinition &definition, const NameIndex &species) |
| std::expected< uint64_t, std::string > | BakeRate (const RuleDefinition &definition, int64_t lnConstantPart, uint32_t kelvin) |
| std::expected< void, std::string > | BakeRates (const RuleDefinition &definition, const RxRule &rule, BakedReactionTable &baked) |
| void | BuildRuleIndex (BakedReactionTable &baked) |
| template<typename Cell> | |
| Cell | FillReactionCell (const BakedReactionTable &table, Cell cell, std::span< const SpeciesAmount > amounts, int32_t temperatureMilliKelvin) |
| template<typename Cell> | |
| std::vector< uint64_t > | CountCellElements (const BakedReactionTable &table, const Cell &cell) |
| template<typename Cell> | |
| uint64_t | HashCell (const Cell &cell) |
Variables | |
| constexpr uint64_t | GAS_CONSTANT_NANOJOULES = 8314462618 |
| constexpr uint64_t | NANOJOULES_PER_JOULE = 1000000000 |
| constexpr uint64_t | MICROJOULES_PER_JOULE = 1000000 |
| constexpr int64_t | STANDARD_TEMPERATURE_MILLIKELVIN = 298150 |
| constexpr int32_t | RATE_EXPONENT_MIN = -4096 |
| constexpr int32_t | RATE_EXPONENT_MAX = 4096 |
| constexpr int64_t | CELL_VOLUME_LOG2 = -3 |
| constexpr uint64_t | FNV_OFFSET = 0xcbf29ce484222325ULL |
| constexpr uint64_t | FNV_PRIME = 0x100000001b3ULL |
| constexpr int64_t | DECLARED_ENTHALPY_TOLERANCE_JOULES = 1000 |
| using bicameral::sim::anonymous_namespace{reaction_table.cpp}::NameIndex = std::map<std::string, uint32_t, std::less<>> |
Definition at line 36 of file reaction_table.cpp.
| std::expected< NameIndex, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::BakeAllSpecies | ( | const ReactionTableDefinition & | definition, |
| const NameIndex & | elements, | ||
| BakedReactionTable & | baked ) |
Definition at line 122 of file reaction_table.cpp.
References BakeAllSpecies(), BakeSpecies(), bicameral::sim::BakedReactionTable::molarMasses, bicameral::sim::SpeciesDefinition::name, bicameral::sim::BakedReactionTable::species, bicameral::sim::ReactionTableDefinition::species, bicameral::sim::BakedReactionTable::speciesElements, and bicameral::sim::BakedReactionTable::speciesNames.
Referenced by BakeAllSpecies().
| std::expected< uint64_t, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::BakeRate | ( | const RuleDefinition & | definition, |
| int64_t | lnConstantPart, | ||
| uint32_t | kelvin ) |
Definition at line 282 of file reaction_table.cpp.
References bicameral::sim::ArrheniusRate::activationEnergy, BakeRate(), GAS_CONSTANT_NANOJOULES, bicameral::sim::RuleDefinition::name, NANOJOULES_PER_JOULE, bicameral::sim::RuleDefinition::rate, RATE_EXPONENT_MAX, and RATE_EXPONENT_MIN.
Referenced by BakeRate(), and BakeRates().
| std::expected< void, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::BakeRates | ( | const RuleDefinition & | definition, |
| const RxRule & | rule, | ||
| BakedReactionTable & | baked ) |
Definition at line 309 of file reaction_table.cpp.
References bicameral::sim::ArrheniusRate::activationEnergy, BakeRate(), BakeRates(), CELL_VOLUME_LOG2, bicameral::sim::RuleDefinition::name, bicameral::sim::ArrheniusRate::preExponentialExponent10, bicameral::sim::ArrheniusRate::preExponentialMantissa, bicameral::sim::RuleDefinition::rate, and bicameral::sim::BakedReactionTable::rates.
Referenced by BakeRates().
| std::expected< RxRule, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::BakeRule | ( | const RuleDefinition & | definition, |
| const NameIndex & | species, | ||
| const BakedReactionTable & | baked ) |
Definition at line 217 of file reaction_table.cpp.
References BakeRule(), CheckElementBalance(), CopyTerms(), HashName(), bicameral::sim::RuleDefinition::name, bicameral::sim::RuleDefinition::products, bicameral::sim::RuleDefinition::reactants, and ReactionEnthalpy().
Referenced by BakeRule().
| std::expected< void, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::BakeSpecies | ( | const SpeciesDefinition & | definition, |
| const NameIndex & | elements, | ||
| const ReactionTableDefinition & | table, | ||
| BakedReactionTable & | baked ) |
Definition at line 93 of file reaction_table.cpp.
References BakeSpecies(), bicameral::sim::SpeciesDefinition::composition, bicameral::sim::ElementCount::count, bicameral::sim::ElementCount::element, bicameral::sim::ReactionTableDefinition::elements, bicameral::sim::SpeciesDefinition::heatCapacity, bicameral::sim::BakedReactionTable::molarMasses, bicameral::sim::SpeciesDefinition::name, bicameral::sim::BakedReactionTable::species, bicameral::sim::BakedReactionTable::speciesElements, bicameral::sim::BakedReactionTable::speciesNames, bicameral::sim::SpeciesDefinition::thermalConductivity, and ZeroKelvinEnthalpy().
Referenced by BakeAllSpecies(), and BakeSpecies().
| void bicameral::sim::anonymous_namespace{reaction_table.cpp}::BuildRuleIndex | ( | BakedReactionTable & | baked | ) |
Definition at line 345 of file reaction_table.cpp.
References BuildRuleIndex(), bicameral::sim::BakedReactionTable::ruleIndex, bicameral::sim::BakedReactionTable::rules, and bicameral::sim::BakedReactionTable::species.
Referenced by BuildRuleIndex().
| ReactionTableDefinition bicameral::sim::anonymous_namespace{reaction_table.cpp}::CanonicalOrder | ( | const ReactionTableDefinition & | definition | ) |
Definition at line 52 of file reaction_table.cpp.
References CanonicalOrder(), bicameral::sim::ReactionTableDefinition::elements, bicameral::sim::RuleDefinition::products, bicameral::sim::RuleDefinition::reactants, bicameral::sim::ReactionTableDefinition::rules, bicameral::sim::ReactionTableDefinition::species, and bicameral::sim::RuleTerm::species.
Referenced by CanonicalOrder().
| std::optional< std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::CheckDeclaredEnthalpy | ( | const RuleDefinition & | rule, |
| const ReactionTableDefinition & | definition, | ||
| const NameIndex & | species ) |
Definition at line 248 of file reaction_table.cpp.
References CheckDeclaredEnthalpy(), DECLARED_ENTHALPY_TOLERANCE_JOULES, bicameral::sim::RuleDefinition::declaredReactionEnthalpy, bicameral::sim::SpeciesDefinition::formationEnthalpy, bicameral::sim::RuleDefinition::name, bicameral::sim::RuleDefinition::products, bicameral::sim::RuleDefinition::reactants, and bicameral::sim::ReactionTableDefinition::species.
Referenced by CheckDeclaredEnthalpy().
| std::expected< void, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::CheckElementBalance | ( | const RuleDefinition & | definition, |
| const RxRule & | rule, | ||
| const BakedReactionTable & | baked ) |
Definition at line 181 of file reaction_table.cpp.
References CheckElementBalance(), bicameral::sim::BakedReactionTable::elementNames, bicameral::sim::RuleDefinition::name, and bicameral::sim::BakedReactionTable::speciesElements.
Referenced by BakeRule(), and CheckElementBalance().
| std::expected< TermsResult, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::CopyTerms | ( | const RuleDefinition & | rule, |
| std::span< const RuleTerm > | terms, | ||
| const NameIndex & | species, | ||
| std::span< uint32_t > | ids, | ||
| std::span< uint32_t > | coefficients ) |
Definition at line 151 of file reaction_table.cpp.
References CopyTerms(), bicameral::sim::anonymous_namespace{reaction_table.cpp}::TermsResult::count, bicameral::sim::anonymous_namespace{reaction_table.cpp}::TermsResult::firstOrderMask, and bicameral::sim::RuleDefinition::name.
Referenced by BakeRule(), and CopyTerms().
| std::vector< uint64_t > bicameral::sim::anonymous_namespace{reaction_table.cpp}::CountCellElements | ( | const BakedReactionTable & | table, |
| const Cell & | cell ) |
Definition at line 434 of file reaction_table.cpp.
References CountCellElements(), bicameral::sim::BakedReactionTable::elementNames, and bicameral::sim::BakedReactionTable::speciesElements.
Referenced by CountCellElements().
| Cell bicameral::sim::anonymous_namespace{reaction_table.cpp}::FillReactionCell | ( | const BakedReactionTable & | table, |
| Cell | cell, | ||
| std::span< const SpeciesAmount > | amounts, | ||
| int32_t | temperatureMilliKelvin ) |
Definition at line 414 of file reaction_table.cpp.
References FillReactionCell(), and bicameral::sim::BakedReactionTable::View().
Referenced by FillReactionCell().
| uint64_t bicameral::sim::anonymous_namespace{reaction_table.cpp}::HashCell | ( | const Cell & | cell | ) |
Definition at line 448 of file reaction_table.cpp.
References HashCell().
Referenced by HashCell().
| uint64_t bicameral::sim::anonymous_namespace{reaction_table.cpp}::HashName | ( | std::string_view | name | ) |
Definition at line 38 of file reaction_table.cpp.
References FNV_OFFSET, FNV_PRIME, and HashName().
Referenced by BakeRule(), and HashName().
| std::expected< NameIndex, std::string > bicameral::sim::anonymous_namespace{reaction_table.cpp}::IndexElements | ( | const ReactionTableDefinition & | definition, |
| BakedReactionTable & | baked ) |
Definition at line 71 of file reaction_table.cpp.
References bicameral::sim::BakedReactionTable::elementNames, bicameral::sim::ReactionTableDefinition::elements, IndexElements(), and bicameral::sim::ElementDefinition::name.
Referenced by IndexElements().
| int64_t bicameral::sim::anonymous_namespace{reaction_table.cpp}::ReactionEnthalpy | ( | const RxRule & | rule, |
| const BakedReactionTable & | baked ) |
Definition at line 206 of file reaction_table.cpp.
References ReactionEnthalpy(), and bicameral::sim::BakedReactionTable::species.
Referenced by BakeRule(), and ReactionEnthalpy().
| int64_t bicameral::sim::anonymous_namespace{reaction_table.cpp}::ZeroKelvinEnthalpy | ( | const SpeciesDefinition & | species | ) |
Definition at line 85 of file reaction_table.cpp.
References bicameral::sim::SpeciesDefinition::formationEnthalpy, bicameral::sim::SpeciesDefinition::heatCapacity, MICROJOULES_PER_JOULE, STANDARD_TEMPERATURE_MILLIKELVIN, and ZeroKelvinEnthalpy().
Referenced by BakeSpecies(), and ZeroKelvinEnthalpy().
|
constexpr |
Definition at line 30 of file reaction_table.cpp.
Referenced by BakeRates().
|
constexpr |
Definition at line 34 of file reaction_table.cpp.
Referenced by CheckDeclaredEnthalpy().
|
constexpr |
Definition at line 31 of file reaction_table.cpp.
Referenced by HashName().
|
constexpr |
Definition at line 32 of file reaction_table.cpp.
Referenced by HashName().
|
constexpr |
Definition at line 21 of file reaction_table.cpp.
Referenced by BakeRate().
|
constexpr |
Definition at line 23 of file reaction_table.cpp.
Referenced by ZeroKelvinEnthalpy().
|
constexpr |
Definition at line 22 of file reaction_table.cpp.
Referenced by BakeRate().
|
constexpr |
Definition at line 28 of file reaction_table.cpp.
Referenced by BakeRate().
|
constexpr |
Definition at line 27 of file reaction_table.cpp.
Referenced by BakeRate().
|
constexpr |
Definition at line 25 of file reaction_table.cpp.
Referenced by ZeroKelvinEnthalpy().