feat(python): Repaired python bindings
Python bindings have now been brought back up to feature pairity with C++. Further, stubs have been added for all python features so that code completion will work
This commit is contained in:
@@ -179,4 +179,5 @@
|
||||
|
||||
#include "gridfire/engine/views/engine_views.h"
|
||||
#include "gridfire/engine/procedures/engine_procedures.h"
|
||||
#include "gridfire/engine/types/engine_types.h"
|
||||
#include "gridfire/engine/types/engine_types.h"
|
||||
#include "gridfire/engine/diagnostics/dynamic_engine_diagnostics.h"
|
||||
@@ -24,23 +24,21 @@ namespace gridfire::engine {
|
||||
enum class NetworkConstructionFlags : uint32_t {
|
||||
NONE = 0,
|
||||
|
||||
STRONG = 1 << 0, // 1
|
||||
REACLIB_STRONG = 1 << 0, // 1
|
||||
|
||||
BETA_MINUS = 1 << 1, // 2
|
||||
BETA_PLUS = 1 << 2, // 4
|
||||
ELECTRON_CAPTURE = 1 << 3, // 8
|
||||
POSITRON_CAPTURE = 1 << 4, // 16
|
||||
WRL_BETA_MINUS = 1 << 1, // 2
|
||||
WRL_BETA_PLUS = 1 << 2, // 4
|
||||
WRL_ELECTRON_CAPTURE = 1 << 3, // 8
|
||||
WRL_POSITRON_CAPTURE = 1 << 4, // 16
|
||||
|
||||
REACLIB_WEAK = 1 << 5,
|
||||
|
||||
WRL_WEAK = BETA_MINUS | BETA_PLUS | ELECTRON_CAPTURE | POSITRON_CAPTURE,
|
||||
WRL_WEAK = WRL_BETA_MINUS | WRL_BETA_PLUS | WRL_ELECTRON_CAPTURE | WRL_POSITRON_CAPTURE,
|
||||
|
||||
REACLIB = STRONG | REACLIB_WEAK,
|
||||
REACLIB = REACLIB_STRONG | REACLIB_WEAK,
|
||||
|
||||
// Currently we default to just reaclib reactions but include both their strong and weak set
|
||||
DEFAULT = REACLIB,
|
||||
|
||||
ALL = STRONG | WRL_WEAK
|
||||
};
|
||||
|
||||
/** @brief Helper function to convert NetworkConstructionFlags to their underlying integer type.
|
||||
@@ -103,20 +101,20 @@ namespace gridfire::engine {
|
||||
inline std::string NetworkConstructionFlagsToString(NetworkConstructionFlags flags) {
|
||||
std::stringstream ss;
|
||||
constexpr std::array<NetworkConstructionFlags, 6> bases_flags_array = {
|
||||
NetworkConstructionFlags::STRONG,
|
||||
NetworkConstructionFlags::BETA_MINUS,
|
||||
NetworkConstructionFlags::BETA_PLUS,
|
||||
NetworkConstructionFlags::ELECTRON_CAPTURE,
|
||||
NetworkConstructionFlags::POSITRON_CAPTURE,
|
||||
NetworkConstructionFlags::REACLIB_STRONG,
|
||||
NetworkConstructionFlags::WRL_BETA_MINUS,
|
||||
NetworkConstructionFlags::WRL_BETA_PLUS,
|
||||
NetworkConstructionFlags::WRL_ELECTRON_CAPTURE,
|
||||
NetworkConstructionFlags::WRL_POSITRON_CAPTURE,
|
||||
NetworkConstructionFlags::REACLIB_WEAK
|
||||
};
|
||||
|
||||
const std::unordered_map<NetworkConstructionFlags, std::string> bases_string_map = {
|
||||
{NetworkConstructionFlags::STRONG, "Strong"},
|
||||
{NetworkConstructionFlags::BETA_MINUS, "BetaMinus"},
|
||||
{NetworkConstructionFlags::BETA_PLUS, "BetaPlus"},
|
||||
{NetworkConstructionFlags::ELECTRON_CAPTURE, "ElectronCapture"},
|
||||
{NetworkConstructionFlags::POSITRON_CAPTURE, "PositronCapture"},
|
||||
{NetworkConstructionFlags::REACLIB_STRONG, "Strong"},
|
||||
{NetworkConstructionFlags::WRL_BETA_MINUS, "BetaMinus"},
|
||||
{NetworkConstructionFlags::WRL_BETA_PLUS, "BetaPlus"},
|
||||
{NetworkConstructionFlags::WRL_ELECTRON_CAPTURE, "ElectronCapture"},
|
||||
{NetworkConstructionFlags::WRL_POSITRON_CAPTURE, "PositronCapture"},
|
||||
{NetworkConstructionFlags::REACLIB_WEAK, "ReaclibWeak"}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,54 +31,4 @@ namespace gridfire::engine {
|
||||
GraphEngine& engine,
|
||||
const std::optional<std::vector<reaction::ReactionType>>& ignoredReactionTypes
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Computes the destruction rate constant for a specific species.
|
||||
*
|
||||
* Calculates the sum of molar reaction flows for all reactions where the species
|
||||
* is a reactant (negative stoichiometry) after scaling its abundance to unity.
|
||||
*
|
||||
* @param engine Engine providing the current set of network reactions and flow calculations.
|
||||
* @param species The atomic species whose destruction rate is computed.
|
||||
* @param composition Current composition providing abundances for all species.
|
||||
* @param T9 Temperature in units of 10^9 K.
|
||||
* @param rho Density of the medium.
|
||||
* @param reactionTypesToIgnore types of reactions to ignore during calculation.
|
||||
* @pre Y.size() matches engine.getNetworkReactions().size() mapping species order.
|
||||
* @post Returned rate constant is non-negative.
|
||||
* @return Sum of absolute stoichiometry-weighted destruction flows for the species.
|
||||
*/
|
||||
double calculateDestructionRateConstant(
|
||||
const DynamicEngine& engine,
|
||||
const fourdst::atomic::Species& species,
|
||||
const fourdst::composition::Composition& composition,
|
||||
double T9,
|
||||
double rho,
|
||||
const std::optional<std::vector<reaction::ReactionType>> &reactionTypesToIgnore
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Computes the creation rate for a specific species.
|
||||
*
|
||||
* Sums molar reaction flows for all reactions where the species
|
||||
* appears as a product (positive stoichiometry).
|
||||
*
|
||||
* @param engine Engine providing the current set of network reactions and flow calculations.
|
||||
* @param species The atomic species whose creation rate is computed.
|
||||
* @param composition Composition object containing current abundances.
|
||||
* @param T9 Temperature in units of 10^9 K.
|
||||
* @param rho Density of the medium.
|
||||
* @param reactionTypesToIgnore types of reactions to ignore during calculation.
|
||||
* @pre Y.size() matches engine.getNetworkReactions().size() mapping species order.
|
||||
* @post Returned creation rate is non-negative.
|
||||
* @return Sum of stoichiometry-weighted creation flows for the species.
|
||||
*/
|
||||
double calculateCreationRate(
|
||||
const DynamicEngine& engine,
|
||||
const fourdst::atomic::Species& species,
|
||||
const fourdst::composition::Composition& composition,
|
||||
double T9,
|
||||
double rho,
|
||||
const std::optional<std::vector<reaction::ReactionType>> &reactionTypesToIgnore
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace gridfire::engine {
|
||||
/**
|
||||
* @enum EngineTypes
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace gridfire::policy {
|
||||
* if (s != NetworkPolicyStatus::INITIALIZED_VERIFIED) { // handle error }
|
||||
* @endcode
|
||||
*/
|
||||
[[nodiscard]] virtual NetworkPolicyStatus getStatus() const = 0;
|
||||
[[nodiscard]] virtual NetworkPolicyStatus get_status() const = 0;
|
||||
|
||||
[[nodiscard]] virtual const std::vector<std::unique_ptr<engine::DynamicEngine>> &get_engine_stack() const = 0;
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace gridfire::policy {
|
||||
* @brief Gets the current status of the policy.
|
||||
* @return NetworkPolicyStatus The construction and verification status.
|
||||
*/
|
||||
[[nodiscard]] NetworkPolicyStatus getStatus() const override;
|
||||
[[nodiscard]] NetworkPolicyStatus get_status() const override;
|
||||
|
||||
[[nodiscard]] const std::vector<std::unique_ptr<engine::DynamicEngine>> &get_engine_stack() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user