use crate::Thermodynamics::ChemEquilibrium::equilibrium_activity::PhaseActivityModel;
use crate::Thermodynamics::ChemEquilibrium::equilibrium_ids::PhaseIndex;
use crate::Thermodynamics::User_PhaseOrSolution::PhaseModel;
use crate::Thermodynamics::phase_layout::{PhaseComponentId, PhaseId};
use crate::Thermodynamics::physical_state::PhysicalState;
use std::ops::Range;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EquilibriumComponentDescriptor {
id: PhaseComponentId,
physical_state: PhysicalState,
phase_model: PhaseModel,
activity_model: PhaseActivityModel,
}
impl EquilibriumComponentDescriptor {
pub fn new(
id: PhaseComponentId,
physical_state: PhysicalState,
phase_model: PhaseModel,
activity_model: PhaseActivityModel,
) -> Self {
Self {
id,
physical_state,
phase_model,
activity_model,
}
}
pub fn id(&self) -> &PhaseComponentId {
&self.id
}
pub fn substance(&self) -> &str {
&self.id.substance
}
pub fn label(&self) -> String {
self.id.label()
}
pub fn physical_state(&self) -> PhysicalState {
self.physical_state
}
pub fn phase_model(&self) -> PhaseModel {
self.phase_model
}
pub fn activity_model(&self) -> PhaseActivityModel {
self.activity_model
}
}
impl From<String> for EquilibriumComponentDescriptor {
fn from(substance: String) -> Self {
Self::new(
PhaseComponentId::new(PhaseId::new(None), substance),
PhysicalState::Gas,
PhaseModel::IdealGas,
PhaseActivityModel::IdealGas,
)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EquilibriumPhaseDescriptor {
id: PhaseId,
index: PhaseIndex,
physical_state: PhysicalState,
phase_model: PhaseModel,
activity_model: PhaseActivityModel,
component_range: Range<usize>,
}
impl EquilibriumPhaseDescriptor {
pub fn new(
id: PhaseId,
index: PhaseIndex,
physical_state: PhysicalState,
phase_model: PhaseModel,
activity_model: PhaseActivityModel,
component_range: Range<usize>,
) -> Self {
Self {
id,
index,
physical_state,
phase_model,
activity_model,
component_range,
}
}
pub fn id(&self) -> &PhaseId {
&self.id
}
pub fn index(&self) -> PhaseIndex {
self.index
}
pub fn physical_state(&self) -> PhysicalState {
self.physical_state
}
pub fn phase_model(&self) -> PhaseModel {
self.phase_model
}
pub fn activity_model(&self) -> PhaseActivityModel {
self.activity_model
}
pub fn component_range(&self) -> Range<usize> {
self.component_range.clone()
}
}