pub trait Parameterwhere
Self: Sized,{
type Pure: Clone + DeserializeOwned;
type Binary: Clone + DeserializeOwned + Default;
// Required methods
fn from_records(
pure_records: Vec<PureRecord<Self::Pure>>,
binary_records: Option<Array2<Self::Binary>>,
) -> Result<Self, ParameterError>;
fn records(
&self,
) -> (&[PureRecord<Self::Pure>], Option<&Array2<Self::Binary>>);
// Provided methods
fn new_pure(
pure_record: PureRecord<Self::Pure>,
) -> Result<Self, ParameterError> { ... }
fn new_binary(
pure_records: Vec<PureRecord<Self::Pure>>,
binary_record: Option<Self::Binary>,
) -> Result<Self, ParameterError> { ... }
fn from_model_records(
model_records: Vec<Self::Pure>,
) -> Result<Self, ParameterError> { ... }
fn binary_matrix_from_records(
pure_records: &[PureRecord<Self::Pure>],
binary_records: &[BinaryRecord<Identifier, Self::Binary>],
identifier_option: IdentifierOption,
) -> Option<Array2<Self::Binary>> { ... }
fn from_json<P>(
substances: Vec<&str>,
file_pure: P,
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
where P: AsRef<Path> { ... }
fn from_multiple_json<P>(
input: &[(Vec<&str>, P)],
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
where P: AsRef<Path> { ... }
fn from_segments<C: SegmentCount>(
chemical_records: Vec<C>,
segment_records: Vec<SegmentRecord<Self::Pure>>,
binary_segment_records: Option<Vec<BinaryRecord<String, f64>>>,
) -> Result<Self, ParameterError>
where Self::Pure: FromSegments<C::Count>,
Self::Binary: FromSegmentsBinary<C::Count> { ... }
fn from_json_segments<P>(
substances: &[&str],
file_pure: P,
file_segments: P,
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
where P: AsRef<Path>,
Self::Pure: FromSegments<usize>,
Self::Binary: FromSegmentsBinary<usize> { ... }
fn subset(&self, component_list: &[usize]) -> Self { ... }
}
Expand description
Constructor methods for parameters.
By implementing Parameter
for a type, you define how parameters
of an equation of state can be constructed from a sequence of
single substance records and possibly binary interaction parameters.
Required Associated Types§
type Pure: Clone + DeserializeOwned
type Binary: Clone + DeserializeOwned + Default
Required Methods§
Sourcefn from_records(
pure_records: Vec<PureRecord<Self::Pure>>,
binary_records: Option<Array2<Self::Binary>>,
) -> Result<Self, ParameterError>
fn from_records( pure_records: Vec<PureRecord<Self::Pure>>, binary_records: Option<Array2<Self::Binary>>, ) -> Result<Self, ParameterError>
Creates parameters from records for pure substances and possibly binary parameters.
Provided Methods§
Sourcefn new_pure(pure_record: PureRecord<Self::Pure>) -> Result<Self, ParameterError>
fn new_pure(pure_record: PureRecord<Self::Pure>) -> Result<Self, ParameterError>
Creates parameters for a pure component from a pure record.
Sourcefn new_binary(
pure_records: Vec<PureRecord<Self::Pure>>,
binary_record: Option<Self::Binary>,
) -> Result<Self, ParameterError>
fn new_binary( pure_records: Vec<PureRecord<Self::Pure>>, binary_record: Option<Self::Binary>, ) -> Result<Self, ParameterError>
Creates parameters for a binary system from pure records and an optional binary interaction parameter.
Sourcefn from_model_records(
model_records: Vec<Self::Pure>,
) -> Result<Self, ParameterError>
fn from_model_records( model_records: Vec<Self::Pure>, ) -> Result<Self, ParameterError>
Creates parameters from model records with default values for the molar weight, identifiers, and binary interaction parameters.
Sourcefn binary_matrix_from_records(
pure_records: &[PureRecord<Self::Pure>],
binary_records: &[BinaryRecord<Identifier, Self::Binary>],
identifier_option: IdentifierOption,
) -> Option<Array2<Self::Binary>>
fn binary_matrix_from_records( pure_records: &[PureRecord<Self::Pure>], binary_records: &[BinaryRecord<Identifier, Self::Binary>], identifier_option: IdentifierOption, ) -> Option<Array2<Self::Binary>>
Helper function to build matrix from list of records in correct order.
If the identifiers in binary_records
are not a subset of those in
pure_records
, the Default
implementation of Self::Binary is used.
Sourcefn from_json<P>(
substances: Vec<&str>,
file_pure: P,
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
fn from_json<P>( substances: Vec<&str>, file_pure: P, file_binary: Option<P>, identifier_option: IdentifierOption, ) -> Result<Self, ParameterError>
Creates parameters from substance information stored in json files.
Sourcefn from_multiple_json<P>(
input: &[(Vec<&str>, P)],
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
fn from_multiple_json<P>( input: &[(Vec<&str>, P)], file_binary: Option<P>, identifier_option: IdentifierOption, ) -> Result<Self, ParameterError>
Creates parameters from substance information stored in multiple json files.
Sourcefn from_segments<C: SegmentCount>(
chemical_records: Vec<C>,
segment_records: Vec<SegmentRecord<Self::Pure>>,
binary_segment_records: Option<Vec<BinaryRecord<String, f64>>>,
) -> Result<Self, ParameterError>
fn from_segments<C: SegmentCount>( chemical_records: Vec<C>, segment_records: Vec<SegmentRecord<Self::Pure>>, binary_segment_records: Option<Vec<BinaryRecord<String, f64>>>, ) -> Result<Self, ParameterError>
Creates parameters from the molecular structure and segment information.
The FromSegments trait needs to be implemented for both the model record and the ideal gas record.
Sourcefn from_json_segments<P>(
substances: &[&str],
file_pure: P,
file_segments: P,
file_binary: Option<P>,
identifier_option: IdentifierOption,
) -> Result<Self, ParameterError>
fn from_json_segments<P>( substances: &[&str], file_pure: P, file_segments: P, file_binary: Option<P>, identifier_option: IdentifierOption, ) -> Result<Self, ParameterError>
Creates parameters from segment information stored in json files.
The FromSegments trait needs to be implemented for both the model record and the ideal gas record.
Sourcefn subset(&self, component_list: &[usize]) -> Self
fn subset(&self, component_list: &[usize]) -> Self
Return a parameter set containing the subset of components specified in component_list
.
§Panics
Panics if index in component_list
is out of bounds or if
Parameter::from_records fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.