Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changes according to review, added SAFTVRQMie
  • Loading branch information
g-bauer committed Apr 12, 2024
commit e98410a3018eda40944348420f284007c1612f36
1 change: 1 addition & 0 deletions feos-core/src/equation_of_state/ideal_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::Components;
use crate::StateHD;
use ndarray::Array1;
use num_dual::DualNum;
use std::fmt::Display;

/// Ideal gas Helmholtz energy contribution.
pub trait IdealGas: Components + Sync + Send {
Expand Down
6 changes: 6 additions & 0 deletions feos-core/src/equation_of_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ impl<I: IdealGas> EquationOfState<I, NoResidual> {
}
}

impl<I: IdealGas, R> Display for EquationOfState<I, R> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.ideal_gas)
}
}

impl<I: Components, R: Components> Components for EquationOfState<I, R> {
fn components(&self) -> usize {
assert_eq!(
Expand Down
6 changes: 6 additions & 0 deletions feos-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ mod tests {
// Only to be able to instantiate an `EquationOfState`
struct NoIdealGas;

impl Display for NoIdealGas {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "NoIdealGas")
}
}

impl Components for NoIdealGas {
fn components(&self) -> usize {
1
Expand Down
2 changes: 2 additions & 0 deletions feos-derive/src/ideal_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ pub(crate) fn expand_ideal_gas(input: DeriveInput) -> syn::Result<proc_macro2::T
};

let ideal_gas = impl_ideal_gas(variants);
let display = impl_display(variants);
Ok(quote! {
#ideal_gas
#display
})
}

Expand Down