ground_motion_lib/lib.rs
1//! # `ground_motion_lib`
2//!
3//! **A performant, modular Rust library for computing and analyzing ground motion predictions
4//! using GMPE (Ground Motion Prediction Equation) models.**
5//!
6//! This crate provides data structures, model implementations, vectorized parallel computation routines,
7//! and file I/O utilities for earthquake ground motion prediction workflows.
8//!
9//! ## Features
10//!
11//! - Modular ground motion model interface via the [`GroundMotionModeling`](crate::gmm::GroundMotionModeling) trait.
12//! - Full implementation of the **Morikawa & Fujiwara (2013)** GMPE models via the [`mf2013`](crate::mf2013) module.
13//! - Parallelized ground motion calculations with Rayon for efficient batch processing ([`vectorized`](crate::vectorized)).
14//! - CSV-based readers and writers for site-specific input points and GMPE output values.
15//! - Config management for model presets ([`configs`](crate::configs)).
16//!
17//! ## Module Overview
18//!
19//! - [`auxilary`](crate::auxilary) — Supporting utility functions (internal use).
20//! - [`configs`](crate::configs) — Predefined model configuration loader.
21//! - [`gmm`](crate::gmm) — Core data types and GMPE trait definitions.
22//! - [`mf2013`](crate::mf2013) — Implementation of the Morikawa & Fujiwara (2013) GMPE models.
23//! - [`readers`](crate::readers) — CSV-based input data loaders for site points.
24//! - [`vectorized`](crate::vectorized) — Parallel ground motion calculation and statistics routines.
25//! - [`writers`](crate::writers) — CSV-based output writers for GMPE prediction results.
26//!
27//! ## Example
28//!
29//! ```rust
30//! use ground_motion_lib::configs::get_mf2013_lib_configs;
31//! use ground_motion_lib::gmm::{Earthquake, Magnitude, Vs30Point};
32//! use ground_motion_lib::vectorized::calc_gmpe_vec;
33//!
34//! let points = vec![
35//! Vs30Point::new(142.5, 50.0, 400., Some(200.), Some(0)),
36//! Vs30Point::new(142.6, 50.1, 350., Some(150.), Some(1)),
37//! ];
38//!
39//! let eq = Earthquake {
40//! lon: 142.4,
41//! lat: 50.0,
42//! depth: 10.0,
43//! magnitude: 6.5,
44//! magnitude_kind: Magnitude::Mw,
45//! };
46//!
47//! let gmpe_ref = get_mf2013_lib_configs().get("config_mf2013_crustal_pga").unwrap();
48//!
49//! let results = calc_gmpe_vec(&points, gmpe_ref, &eq);
50//! println!("{results:?}");
51//! ```
52//!
53//! ## Parallelism
54//!
55//! This crate uses [`Rayon`](https://docs.rs/rayon/latest/rayon/) for data-parallel ground motion
56//! calculations and statistical summaries, with sensible defaults for thread pool management.
57//!
58//! ## Future Work
59//!
60//! Planned extensions include:
61//!
62//! - Additional GMPE model families
63//! - Spatial interpolation utilities
64//! - Uncertainty propagation routines
65//! - Integrated hazard curve calculators
66//!
67//! ## License
68//!
69//! Licensed under the Apache License, Version 2.0 ([Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0))
70//!
71//! ---
72//!
73//! ```text
74//! Copyright 2025 Andrey Stepnov, GEOPHYSTECH LLC
75//!
76//! Licensed under the Apache License, Version 2.0 (the "License");
77//! you may not use this file except in compliance with the License.
78//! You may obtain a copy of the License at
79//!
80//! http://www.apache.org/licenses/LICENSE-2.0
81//!
82//! Unless required by applicable law or agreed to in writing, software
83//! distributed under the License is distributed on an "AS IS" BASIS,
84//! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85//! See the License for the specific language governing permissions and
86//! limitations under the License.
87//! ```
88//! ---
89
90pub mod auxilary;
91pub mod configs;
92pub mod gmm;
93pub mod mf2013;
94pub mod readers;
95pub mod vectorized;
96pub mod writers;