lcdm/lib.rs
1//! lcdm/src/lib.rs
2//!
3//! ΛCDM-Rust Main Facade
4//!
5//! # ΛCDM-Rust
6//!
7//! A high-precision, high-performance cosmology engine written in Rust.
8//! This crate (`lcdm`) acts as a single entry point (facade) that re-exports the
9//! most commonly used components and provides a convenient `prelude`.
10//!
11//! ## Usage
12//!
13//! ```rust
14//! use lcdm::prelude::*;
15//!
16//! // 1) Build a cosmology using the builder API.
17//! let cosmo = CosmoBuilder::new()
18//! .flat()
19//! .h(0.7)
20//! .Omega_m(0.3)
21//! .neutrino_effective(3.046, vec![0.0])
22//! .build()
23//! .unwrap();
24//!
25//! // Create the background cosmology model from the built parameter set.
26//! let model = Cosmology::new(cosmo);
27//!
28//! // 2) Compute a distance observable (luminosity distance) at z = 1.
29//! let d_L = model.luminosity_distance(Redshift(1.0)).unwrap();
30//! println!("Luminosity Distance at z=1: {} Mpc", d_L.0);
31//! ```
32
33// Re-export sub-crates as public modules for ergonomic access.
34pub use lcdm_core as core;
35pub use lcdm_background as background;
36pub use lcdm_lss as lss;
37pub use lcdm_boltzmann as boltzmann;
38// Neutrino functionality is hosted in core
39pub use lcdm_core::neutrino;
40
41/// Commonly used types and traits for typical crate usage.
42///
43/// Importing `lcdm::prelude::*` provides the main builder/model types,
44/// common units/newtypes, LSS helpers, and selected physical constants.
45pub mod prelude {
46 // --- Core (building, parameter sets, and specifications) ---
47 pub use lcdm_core::{
48 CanonicalParams,
49 CosmoBuilder,
50 DerivedParams,
51 ScientificParams,
52 spec::{AccuracyPreset, NeutrinoSpec},
53 units::{KmPerSecMpc, Mpc, Redshift},
54 };
55
56 // --- Background (expansion and distance calculations) ---
57 pub use lcdm_background::Cosmology;
58
59 // --- LSS (growth and power spectrum utilities) ---
60 pub use lcdm_lss::{
61 growth::Growth,
62 power::{sigma_r, PkProvider},
63 };
64
65 // --- Physical constants (convenience re-exports) ---
66 pub use lcdm_core::constants::{C, EV, G, H0_UNITS_TO_INV_SEC, SIGMA_SB};
67}