#![cfg_attr(not(feature = "solve"), allow(dead_code, unused_imports))]
#![allow(rustdoc::private_intra_doc_links)]
#[doc(hidden)]
pub mod adapter_support;
pub(crate) mod analysis;
pub(crate) mod broad_phase;
pub(crate) mod cadence;
pub(crate) mod canonicalize;
pub(crate) mod classification;
#[doc(hidden)]
pub mod compiled_rhs_adapter;
#[doc(hidden)]
pub mod compiler_agreement_adapter;
pub(crate) mod coupling;
pub(crate) mod coupling_imports;
pub(crate) mod dae;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) mod data_fed;
pub(crate) mod data_output;
pub(crate) mod data_source_urls;
pub(crate) mod diagnostic;
pub(crate) mod display;
pub(crate) mod edit;
pub(crate) mod error;
pub(crate) mod faq;
pub(crate) mod expression;
pub mod extension;
pub(crate) mod flatten;
pub(crate) mod geometry;
pub(crate) mod graph;
pub(crate) mod inline_test_checks;
pub mod intern;
pub(crate) mod join;
pub(crate) mod json_visit;
pub(crate) mod lower_enums;
pub(crate) mod lower_expression_templates;
pub(crate) mod lower_table_lookup;
pub(crate) mod migration;
pub(crate) mod op_registry;
pub(crate) mod parse;
pub(crate) mod parse_expression;
pub mod precision;
pub mod precision_infer;
pub mod provider;
pub(crate) mod reactions;
pub(crate) mod ref_loading;
pub(crate) mod reference_resolution;
pub(crate) mod registered_functions;
pub(crate) mod relational;
pub(crate) mod serialize;
pub(crate) mod solver;
pub(crate) mod structural;
pub(crate) mod substitute;
pub(crate) mod template_imports;
#[cfg(test)]
pub(crate) mod test_support;
pub(crate) mod types;
pub(crate) mod unit_conversion;
pub(crate) mod units;
pub(crate) mod validate;
#[cfg(feature = "wasm")]
pub mod wasm;
pub mod performance;
pub(crate) mod compile_error;
pub(crate) mod simulate;
pub mod simulate_array;
#[cfg(feature = "solve")]
pub(crate) mod inline_tests;
#[cfg(all(not(target_arch = "wasm32"), feature = "solve"))]
#[doc(hidden)]
pub mod inline_tests_adapter;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) mod area_faq;
pub(crate) mod value_invention;
pub(crate) mod pushdown_rewrite;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) mod prepare;
pub(crate) mod problem;
#[cfg(feature = "esio")]
pub mod esio_provider;
#[cfg(feature = "xla")]
pub mod xla_runtime;
pub use cadence::{
Cadence, CadenceError, ClassSummary, MaterializationPoint, Partition, classify, compute_fold,
partition_model,
};
pub use canonicalize::{CanonicalizeError, canonical_json, canonicalize, format_canonical_float};
pub use classification::{
Classification, LhsForm, SystemKind, algebraic_unknowns, brownian_parameters,
constant_parameters, discrete_parameters, is_ode_state, observed_definition_json,
observed_definitions, observed_unknowns, ode_states, sampled_parameters, system_kind,
};
pub use coupling_imports::{
CouplingImportOptions, expand_coupling_imports, has_coupling_import, is_coupling_library_doc,
};
pub use dae::{DaeError, DiscretizeOptions, apply_dae_contract, default_dae_support, discretize};
pub use data_output::{
CoordPlan, GridPlan, OutputError, OutputMeta, OutputPlan, VarGridding, VarPlan,
derive_output_gridding, derive_output_meta, derive_output_plan, group_gridding_by_grid,
parse_cell_key, plan_dimension_coordinates,
};
pub use display::{to_ascii, to_latex, to_unicode};
#[cfg(not(target_arch = "wasm32"))]
pub use expression::evaluate;
pub use expression::{contains, free_parameters, free_variables, simplify};
pub use flatten::{
Contribution, DimensionPromotionRecord, FlattenError, FlattenMetadata, FlattenedSystem,
LoaderField, TermOrigin, capture_coupling_diagnostics, flatten, flatten_model,
flatten_with_options,
};
pub use geometry::{
GeometryError, Manifold, SLIVER_ATOL_FACTOR, area_tolerance_ok, intersect_polygon,
polygon_area, shoelace_area, shoelace_signed_area, sliver_atol,
};
pub use graph::{
ComponentGraph, ComponentMetadata, ComponentNode, ComponentType, CouplingEdge, DependencyEdge,
DependencyRelationship, ExpressionGraph, ExpressionGraphInput, ExpressionGraphOptions, Graph,
VariableKind, VariableNode, component_exists, component_graph, expression_graph,
expression_graph_with_options, get_component_type, to_dot, to_json_graph, to_mermaid,
};
pub use parse::{
LoadOptions, load_document, load_document_with_options, load_path, load_path_with_options,
load_string, load_string_with_options,
};
pub use parse_expression::{ExpressionParseError, parse_equation, parse_expression};
pub use reactions::{
DeriveError, derive_odes, lower_reactions_to_equations, stoichiometric_matrix,
};
pub use ref_loading::{
resolve_subsystem_refs, resolve_subsystem_refs_raw, resolve_subsystem_refs_with_metaparameters,
};
pub use reference_resolution::{
EdgeKind, ReferenceEdge, ReferenceGraph, ReferenceResolutionError, ReferenceVertex, VertexKind,
build_reference_graph, resolve_references,
};
#[allow(deprecated)]
pub use reference_resolution::build_reference_graph_with_index_sets;
#[allow(deprecated)]
pub use reference_resolution::ReferenceError;
pub use registered_functions::{
ClosedArg, ClosedFunctionError, ClosedValue, closed_function_names, evaluate_closed_function,
};
pub use relational::{
FloatKeyError, Key, Num, Ranking, SemiringOp, canonical_index_set_json, distinct,
group_aggregate, rank, rank_with_base, serialize_keys, serialize_pairs, skolem, skolem_edge,
};
pub use serialize::{to_json, to_json_compact, write_path};
pub use substitute::{
ScopedContext, substitute, substitute_in_model, substitute_in_model_with_context,
substitute_in_reaction_system, substitute_in_reaction_system_with_context,
substitute_with_context,
};
pub use template_imports::{
apply_scope_injections, is_template_library_doc, reject_template_imports_pre_v08,
resolve_template_machinery,
};
pub use solver::{
reject_solver_external_pre_v13, reject_solver_pre_v11, reject_solver_time_span_pre_v13,
resolve_time_span, resolve_tolerances, solver_external_location,
};
pub use types::{
AffectEquation, AutoRecords, ContinuousEvent, Coordinate, CouplingEntry, CouplingRole,
CovarianceMatrix, DaeInfo, DataSource, DataSourceBinding, DataSourceDeterminism,
DataSourceKind, DataSourceLocation, DataSourceMetadata, DataSourceTemporal, DiscreteEvent,
DiscreteEventTrigger, DiscretizedFrom, Distribution, DistributionParam, Domain, Equation,
EsmFile, Expr, ExpressionNode, FunctionalUpdate, InlineValue, Metadata, Model, ModelAnalysis,
ModelTest, ModelTestAssertion, ModelVariable, Operator, ParameterSweep, ParameterUpdate,
ParameterUpdateSpec, Plot, PlotAxis, PlotSeries, PlotValue, PlotY, Reaction, ReactionSystem,
RecordsPerFile, RegionBound, Solver, SolverTimeSpan, Species, StoichiometricEntry,
SweepDimension, SweepRange, TimePoint, TimeSpan, Tolerance, UnitConversion, UpdateValue,
VariableMapTransform, VariableType,
};
pub use validate::{
SchemaError, StructuralError, StructuralErrorCode, UnitWarning, ValidationResult, validate,
validate_text,
};
#[allow(deprecated)]
pub use validate::validate_complete;
pub use value_invention::{
BoundaryKind, ValueInventionError, ValueInventionResult, apply_value_invention,
materialize_value_invention,
};
pub use pushdown_rewrite::{
GateAxis, ProviderGate, PushdownRewriteError, desugar_pushdown, pushdown_coupling_pairs,
pushdown_provider_gates, pushdown_record,
};
#[cfg(not(target_arch = "wasm32"))]
pub use prepare::{
AxisSel, PrepareError, PreparePhase, PrepareProgress, PrepareProgressFn, PrepareProvider,
};
pub use edit::{
EditError, add_coupling, add_equation, add_model, add_reaction, add_reaction_system,
add_species, add_variable, remove_coupling, remove_equation, remove_model, remove_reaction,
remove_species, remove_variable, replace_coupling, replace_equation, update_model_metadata,
};
pub use error::EsmError;
pub use diagnostic::{ERROR_CODES, error_code_names};
pub use lower_enums::{EnumLoweringError, lower_enums, lower_enums_mut, lower_enums_raw};
pub use migration::{MigrationError, can_migrate, migrate, supported_migration_targets};
#[allow(deprecated)]
pub use migration::get_supported_migration_targets;
pub use compile_error::CompileError;
#[cfg(feature = "solve")]
pub use inline_tests::{
AssertionResult, BuildProviderFactory, InlineTestOptions, check_assertion,
ephemeral_injected_file, evaluate_cellwise, field_reduce, resolve_tolerance, run_inline_tests,
run_inline_tests_filtered, run_inline_tests_paths, run_inline_tests_with_base_dir,
run_inline_tests_with_options, run_inline_tests_with_providers, state_cells,
};
pub use performance::{CompactExpr, PerformanceError};
#[cfg(feature = "parallel")]
pub use reactions::stoichiometric_matrix_parallel;
pub use simulate::{
Alg, DEFAULT_ABSTOL, DEFAULT_RELTOL, Flow, Progress, ProgressFn, ReturnCode, SimulateError,
Solution, SolutionMetadata, SolveOptions, compile_array,
};
#[allow(deprecated)]
pub use problem::Compile;
pub use problem::{
CallbackFn, CallbackSet, Compiler, CompilerReport, CompilerRuleReport, EnsembleProblem,
EsmProblem, ProblemInput, ProblemOptions, Remake, Rhs, callbacks, compose, esm_problem,
observed_field, remake,
};
#[cfg(feature = "solve")]
pub use problem::{
Integrator, StepStatus, init, observed_trajectories, observed_trajectory, solve,
solve_ensemble, solve_to_completion, step,
};
pub use simulate_array::range::{
AxisCut, Decomposition, ForcingSet, ForcingSlot, HaloReport, LaneBlock, LaneInputs, LaneKind,
LaneLayout, LaneProgram, ParamSlot, RhsError, RhsProgram, RhsSelection, RhsWorkspace, SlotKind,
StateBlock, TileBlock, TileBox, TileLayout, TileProgram, rhs_program,
};
pub use units::{
Dimension, EquationDimensionVerdict, ExactScale, Rational, ScaleFactor, UNIT_FINDING_ANALYSIS,
UNIT_FINDING_DIMENSIONAL_MISMATCH, UNIT_FINDING_UNPARSEABLE, Unit, UnitError, UnitFinding,
UnitParseFailure, UnitSeverity, build_unit_env, check_dimensional_consistency,
check_equation_dimensions, check_expression_dimensions, convert_units,
equation_dimension_verdict, model_unit_env, parse_unit, validate_equation_dimensions,
};
#[cfg(feature = "parallel")]
pub use performance::ParallelEvaluator;
#[cfg(feature = "custom_alloc")]
pub use performance::ModelAllocator;
pub const LIBRARY_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const SCHEMA_VERSION: &str = "1.3.0";
#[cfg(test)]
mod version_tests {
#[test]
fn schema_version_matches_bundled_schema() {
let schema: serde_json::Value =
serde_json::from_str(include_str!("esm-schema.json")).expect("bundled schema parses");
let id = schema["$id"].as_str().expect("schema has an $id");
assert!(
id.contains(&format!("/{}/", crate::SCHEMA_VERSION)),
"SCHEMA_VERSION {} does not match schema $id {}",
crate::SCHEMA_VERSION,
id
);
}
}