Struct SaltWaterPropertyPackage

Source
pub(crate) struct SaltWaterPropertyPackage {
Show 28 fields name: String, description: String, material: Option<CapeThermoMaterial>, constant_property_map: CapeOpenMap<[CapeValueContent; 2]>, material_compound_indices: Vec<usize>, material_nacl_index: Option<usize>, mat_comp_ids: CapeArrayStringVec, mat_formulae: CapeArrayStringVec, mat_comp_names: CapeArrayStringVec, mat_boil_temps: CapeArrayRealVec, mat_molecular_weights: CapeArrayRealVec, mat_cas_registry_numbers: CapeArrayStringVec, phase_list: CapeArrayStringVec, phase_status: CapeArrayEnumerationVec<CapePhaseStatus>, property_value: CapeArrayRealVec, scalar_property_value: CapeArrayRealScalar, fraction: CapeStringImpl, temperature: CapeStringImpl, pressure: CapeStringImpl, phase_fraction: CapeStringImpl, mole: CapeStringImpl, enthalpy: CapeStringImpl, entropy: CapeStringImpl, empty_string: CapeStringImpl, h2o: CapeStringConstNoCase, nacl: CapeStringConstNoCase, liquid: CapeStringConstNoCase, cobia_object_data: SaltWaterPropertyPackageCobiaObjectData,
}
Expand description

The SaltWaterPropertyPackage is an example of a property package that implements the CAPE-OPEN 1.2 standard.

The salt water calculations are implemented in salt_water_calculator.rs.

The package defines a single liquid phase, and two compounds: water and sodium chloride.

A CAPE-OPEN 1.2 property package must implemented the following interfaces:

  • ICapeIdentification
  • ICapeUtilities
  • ICapeThermoMaterialContext
  • ICapeThermoCompounds
  • ICapeThermoPhases
  • ICapeThermoPropertyRoutine
  • ICapeThermoEquilibriumRoutine
  • ICapeThermoUniversalConstant (optional)

The package is creatable; the public CAPE-OPEN class factory is implemented in lib.rs; to facilitate the registration of this object into the COBIA registry, the object implements the PMCRegisterationInfo trait.

Once registered, the package can be instantiated and created in all CAPE-OPEN compliant simulators.

Fields§

§name: String

The name of the components, which for a primary CAPE-OPEN PMC object must be modifiable

§description: String

The description of the component, which for a primary CAPE-OPEN PMC object should be modifiable

§material: Option<CapeThermoMaterial>

The interface to the active material which contains calculation properties, and on which calculation results are stored

§constant_property_map: CapeOpenMap<[CapeValueContent; 2]>

Map of the constant properties by identifier, to the values for the two compounds. Filled on first use.

§material_compound_indices: Vec<usize>

The indices of the compounds in the active material object. Water has index 0, NaCl has index 1.

§material_nacl_index: Option<usize>

The index of the NaCl compound in the active material object. If not present, pure water is assumed.

§mat_comp_ids: CapeArrayStringVec

Compound IDs on the active material object

§mat_formulae: CapeArrayStringVec

Compound formulae on the active material object

§mat_comp_names: CapeArrayStringVec

Compound names on the active material object

§mat_boil_temps: CapeArrayRealVec

Compound boiling points on the active material object

§mat_molecular_weights: CapeArrayRealVec

Compound molecular weights on the active material object

§mat_cas_registry_numbers: CapeArrayStringVec

Compound CAS registry numbers on the active material object

§phase_list: CapeArrayStringVec

List of phases resulting from a flash calculation (contains only liquid)

§phase_status: CapeArrayEnumerationVec<CapePhaseStatus>

Phase status of the phases resulting from a flash calculation (at equilibrium)

§property_value: CapeArrayRealVec

Buffer for obtaining property values from the active material object

§scalar_property_value: CapeArrayRealScalar

Buffer for scalar properties for obtaining property values from the active material object

§fraction: CapeStringImpl

The string “fraction” used for the mole fraction property

§temperature: CapeStringImpl

The string “temperature” used for the temperature property

§pressure: CapeStringImpl

The string “pressure” used for the pressure property

§phase_fraction: CapeStringImpl

The string “phaseFraction” used for the phase fraction property

§mole: CapeStringImpl

The string “mole” used for the basis of getting and setting properties

§enthalpy: CapeStringImpl

The string “enthalpy” used for the enthalpy property

§entropy: CapeStringImpl

The string “entropy” used for the entropy property

§empty_string: CapeStringImpl

The empty string used for the basis of getting and setting properties

§h2o: CapeStringConstNoCase

The string “H2O” used to check against the active material object compound list

§nacl: CapeStringConstNoCase

The string “NaCl” used to check against the active material object compound list

§liquid: CapeStringConstNoCase

The string “Liquid” used to check against the specified phase in property calculations

§cobia_object_data: SaltWaterPropertyPackageCobiaObjectData

Cobia object data for this object, which contains generated code to provide the native COBIA interfaces

Implementations§

Source§

impl SaltWaterPropertyPackage

Source

pub(crate) fn create<T: CapeSmartPointer>() -> T

Create a new instance of the object and return a smart pointer to it

This function panics if the created object does not implement the interface corresponding to the smart pointer to be returned. For a non-panic version, use the try_create() function.

Source

pub(crate) fn try_create<T: CapeSmartPointer>() -> Result<T, COBIAError>

Create a new instance of the object and return a smart pointer to it

This function returns an error if the created object does not implement the interface corresponding to the smart pointer to be returned.

Source

pub(crate) unsafe fn borrow<T: CapeSmartPointer>(smart_pointer: &T) -> &Self

Get a reference to the object

Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows

§Safety

The user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.

Source

pub(crate) unsafe fn borrow_mut<T: CapeSmartPointer>( smart_pointer: &mut T, ) -> &mut Self

Get a mutable reference to the object

Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows

§Safety

This function is unsafe because it allows mutable access to the object. Also the user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.

Source§

impl SaltWaterPropertyPackage

Source

const NAME: &'static str = "Salt Water"

The default name for new packages, and the object name as it appears in the COBIA registy

Source

const DESCRIPTION: &'static str = "Salt water property package"

The default description for new packages, and the object description as it appears in the COBIA registy

Source

const PROGID: &'static str = "SaltWater.SaltWater"

The ProgID of the package, as it appears in the COBIA registry

Source

const COMP_FORMULAS: [&'static str; 2]

The list of compound IDs for the two compounds in the package

Source

const COMP_NAMES: [&'static str; 2]

The list of compound names for the two compounds in the package

Source

const COMP_BOIL_TEMPS: [f64; 2]

The list of compound boiling points for the two compounds in the package

Source

const COMP_MELT_TEMPS: [f64; 2]

The list of compound melting points for the two compounds in the package

Source

pub(crate) const COMP_MOLWTS: [f64; 2]

The list of compound molecular weights for the two compounds in the package

Source

const COMP_CASNOS: [&'static str; 2]

The list of compound CAS registry numbers for the two compounds in the package

Source

const COMP_SMILES: [&'static str; 2]

The list of compound SMILES strings for the two compounds in the package

Source

const COMP_IUPAC_NAMES: [&'static str; 2]

The list of compound IUPAC names for the two compounds in the package

Source

fn check_context_material(&mut self) -> Result<(), COBIAError>

This function is called at the start of any function that requires the context material to be set. It checks whether a active material object is present, and if so, it check which compounds are present on the active material object

It is possible for the PME to select a subset of the compounds supported by the package. For this particular package, not having NaCl is acceptable, as this allows for calculations at zero salinity. Not having water is not acceptable, and returns and error.

Some other common errors, such as an empty list, multiple appearances of the same compound in the list, or unknown compounds, are also checked here

Trait Implementations§

Source§

impl CapeCreateInstance for SaltWaterPropertyPackage

Source§

fn create_instance( _salt_water_property_package_boxed_ptr: *mut *mut ICapeInterface, ) -> CapeResult

Source§

impl Default for SaltWaterPropertyPackage

Implementation of the Default trait is required for creatable CAPE-OPEN objects as the class factory does not allow for constructor parameters.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for SaltWaterPropertyPackage

The Display trait is required; it is used by the COBIA package to format the object that is the source of an error, when a CAPE-OPEN error is returned.

The returned string should include the name and the type of the object so that it can be identified in the environment by which the error is processed.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ICapeIdentification for SaltWaterPropertyPackage

The ICapeIdentification interface is used to identify any CAPE-OPEN object. It consists of a name and description. For primary PMC objects (creatable objects), the name must be read/write and the description should be read/write. Also, for primary PMC objects, the initial name and description should match the information in the COBIA registry.

Source§

fn get_component_name( &mut self, name: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>

Obtain the name of the object

§Arguments
  • name - The name of the object, which is returned through a CapeStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_component_description( &mut self, description: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>

Obtain the description of the object

§Arguments
  • description - The description of the object, which is returned through a CapeStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn set_component_name( &mut self, name: &CapeStringIn<'_>, ) -> Result<(), COBIAError>

Set the name of the object

§Arguments
  • name - The name of the object, which is specified through a CapeStringIn object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn set_component_description( &mut self, desc: &CapeStringIn<'_>, ) -> Result<(), COBIAError>

Set the description of the object

§Arguments
  • desc - The description of the object, which is specified through a CapeStringIn object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeIdentificationImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeIdentification interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeIdentificationImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_get_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32

§

extern "C" fn raw_set_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32

§

extern "C" fn raw_get_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32

§

extern "C" fn raw_set_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeIdentification_VTable = _

Source§

impl ICapeInterfaceImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn get_object_data(&mut self) -> &mut CapeObjectData

Returns a mutable reference to the internal CapeObjectData structure.
Source§

fn get_self(&mut self) -> *mut SaltWaterPropertyPackage

Returns a pointer to the implementing object.
§

const CAPEINTERFACE_VTABLE: ICapeInterface_VTable = _

the V-table for the ICapeInterface implementation.
§

fn init(&mut self) -> *mut _ICapeInterface

Initializes the object, setting up the interface pointer and adding it to the interface map.
§

fn create_object_data<Timpl>() -> CapeObjectData
where Timpl: ICapeInterfaceImpl,

Utility function for internal object setup
§

extern "C" fn raw_add_reference(me: *mut c_void)

§

extern "C" fn raw_release(me: *mut c_void)

§

extern "C" fn raw_query_interface( me: *mut c_void, uuid: *const _CapeUUID, interface: *mut *mut _ICapeInterface, ) -> u32

§

extern "C" fn raw_get_last_error( me: *mut c_void, error: *mut *mut _ICapeError, ) -> u32

§

fn add_interface( &mut self, uuid: *const _CapeUUID, interface: *mut _ICapeInterface, )

Utility function to add an interface to the interface map. Read more
§

fn set_last_error(&mut self, error: COBIAError, scope: &str) -> u32

Utility function to set the last error and scope. Read more
§

fn clear_last_error(&mut self)

Utility function to clear the last error and scope.
§

fn as_icapeinterface(&mut self) -> *mut _ICapeInterface

Returns a unique pointer to the ICapeInterface implementation of the object.
Source§

impl ICapeThermoCompounds for SaltWaterPropertyPackage

The ICapeThermoCompounds interface must be implemented by a property package to expose the supported list of compounds. The active list of compounds is that on the active material object

Source§

fn get_compound_constant( &mut self, props: &CapeArrayStringIn<'_>, comp_ids: &CapeArrayStringIn<'_>, contains_missing_values: &mut CapeBoolean, prop_vals: &mut CapeArrayValueOut<'_>, ) -> Result<(), COBIAError>

Get one or more compound constant values for one or more compounds

§Arguments
  • props - The list of compound properties to be obtained, which is specified through a CapeArrayStringIn object
  • comp_ids - The list of compound IDs, which is specified through a CapeArrayStringIn object; if empty, values are to be returned for all compounds
  • contains_missing_values - A boolean value that indicates whether the result contains missing values, which is returned through a CapeBoolean object
  • prop_vals - The list of compound property values, which is returned through a CapeArrayValueOut object; for each property, the values for all compounds are returned
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_compound_list( &mut self, comp_ids: &mut CapeArrayStringOut<'_>, formulae: &mut CapeArrayStringOut<'_>, names: &mut CapeArrayStringOut<'_>, boil_temps: &mut CapeArrayRealOut<'_>, molwts: &mut CapeArrayRealOut<'_>, casnos: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get the list of compounds supported by the package; water and sodium chloride for this package

§Arguments
  • comp_ids - The list of compound IDs, which is returned through a CapeArrayStringOut object
  • formulae - The list of compound formulae, which is returned through a CapeArrayStringOut object
  • names - The list of compound names, which is returned through a CapeArrayStringOut object
  • boil_temps - The list of compound boiling points, which is returned through a CapeArrayRealOut object
  • molwts - The list of compound molecular weights, which is returned through a CapeArrayRealOut object
  • casnos - The list of compound CAS registry numbers, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_const_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get a list of supported compound constants

§Arguments
  • props - The list of compound properties, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_num_compounds(&mut self) -> Result<CapeInteger, COBIAError>

Get the number of compounds supported by this package

§Returns
  • Result - A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§

fn get_pdependent_property( &mut self, _: &CapeArrayStringIn<'_>, _: CapeReal, _: &CapeArrayStringIn<'_>, _: &mut CapeBoolean, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>

Calculate pressure dependent properties at specified pressure

This package does not support pressure dependent properties, and the method always fails.

§Returns
  • Result - A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§

fn get_pdependent_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get the list of pressure dependent properties supported by this package

This package does not support pressure dependent properties, so returns an empty list.

§Arguments
  • compounds - The list of compound IDs, which is specified through a CapeArrayStringIn object
  • props - The list of pressure dependent properties, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_tdependent_property( &mut self, _: &CapeArrayStringIn<'_>, _: CapeReal, _: &CapeArrayStringIn<'_>, _: &mut CapeBoolean, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>

Calculate temperature dependent properties at specified temperature

This package does not support temperature dependent properties, and the method always fails.

§Returns
  • Result - A result object that indicates whether the operation was successful or not, containing the number of compounds in case of success
Source§

fn get_tdependent_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get the list of temperature dependent properties supported by this package

This package does not support temperature dependent properties, so returns an empty list.

§Arguments
  • props - The list of temperature dependent properties, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeThermoCompoundsImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoCompounds interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoCompoundsImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_get_compound_constant( me: *mut c_void, props: *mut ICapeArrayString, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayValue, ) -> u32

§

extern "C" fn raw_get_compound_list( me: *mut c_void, comp_ids: *mut ICapeArrayString, formulae: *mut ICapeArrayString, names: *mut ICapeArrayString, boil_temps: *mut ICapeArrayReal, molwts: *mut ICapeArrayReal, casnos: *mut ICapeArrayString, ) -> u32

§

extern "C" fn raw_get_const_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32

§

extern "C" fn raw_get_num_compounds( me: *mut c_void, num: *mut i32, ) -> u32

§

extern "C" fn raw_get_p_dependent_property( me: *mut c_void, props: *mut ICapeArrayString, pressure: f64, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayReal, ) -> u32

§

extern "C" fn raw_get_p_dependent_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32

§

extern "C" fn raw_get_t_dependent_property( me: *mut c_void, props: *mut ICapeArrayString, temperature: f64, comp_ids: *mut ICapeArrayString, contains_missing_values: *mut u32, prop_vals: *mut ICapeArrayReal, ) -> u32

§

extern "C" fn raw_get_t_dependent_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoCompounds_VTable = _

Source§

impl ICapeThermoEquilibriumRoutine for SaltWaterPropertyPackage

The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow a client to calculate phase equilibria.

Source§

fn calc_equilibrium( &mut self, specification1: &CapeArrayStringIn<'_>, specification2: &CapeArrayStringIn<'_>, solution_type: &CapeStringIn<'_>, ) -> Result<(), COBIAError>

Calculate the phase equilibrium at specified conditions.

Given the specified conditions and overall composition, return the phase equilibrium that matches those conditions. As this package only supports one phase, the resulting phase equilibrium is always a liquid phase at the specified conditions.

The underlying calculations are performed by the salt_water_calculator module.

§Arguments
  • specification1 - The first specification for the phase equilibrium, which is specified through a CapeStringIn object
  • specification2 - The second specification for the phase equilibrium, which is specified through a CapeStringIn object
  • solution_type - The type of solution to be used for the phase equilibrium calculation, which is specified through a CapeStringIn object; only the “Unspecified” solution type is supported.
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn check_equilibrium_spec( &mut self, specification1: &CapeArrayStringIn<'_>, specification2: &CapeArrayStringIn<'_>, solution_type: &CapeStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>

Check whether a particular phase equilibrium calculation is supported.

§Arguments
  • specification1 - The first specification for the phase equilibrium, which is specified through a CapeStringIn object
  • specification2 - The second specification for the phase equilibrium, which is specified through a CapeStringIn object
  • solution_type - The type of solution to be used for the phase equilibrium calculation, which is specified through a CapeStringIn object; only the “Unspecified” solution type is supported.
§Returns
  • Result - A result object that indicates whether the operation was successful or not, and if successful, whether the phase equilibrium calculation is supported.
Source§

impl ICapeThermoEquilibriumRoutineImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoEquilibriumRoutine interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoEquilibriumRoutineImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_calc_equilibrium( me: *mut c_void, specification1: *mut ICapeArrayString, specification2: *mut ICapeArrayString, solution_type: *mut _ICapeString, ) -> u32

§

extern "C" fn raw_check_equilibrium_spec( me: *mut c_void, specification1: *mut ICapeArrayString, specification2: *mut ICapeArrayString, solution_type: *mut _ICapeString, is_supported: *mut u32, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoEquilibriumRoutine_VTable = _

Source§

impl ICapeThermoMaterialContext for SaltWaterPropertyPackage

The ICapeThermoMaterialContext interface must be implemented by a property package to allow setting the active material object on which all calculations are to be done. Calculation conditions are obtained from the active material object, and calculation results are written to the active material object.

Source§

fn set_material( &mut self, material: CapeThermoMaterial, ) -> Result<(), COBIAError>

Set the active material object

§Arguments
  • material - The active material object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn unset_material(&mut self) -> Result<(), COBIAError>

Clear the active material object

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeThermoMaterialContextImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoMaterialContext interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoMaterialContextImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_set_material( me: *mut c_void, material: *mut _CAPEOPEN_1_2_ICapeThermoMaterial, ) -> u32

§

extern "C" fn raw_unset_material(me: *mut c_void) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoMaterialContext_VTable = _

Source§

impl ICapeThermoPhases for SaltWaterPropertyPackage

The ICapeThermoPhases interface must be implemented by a property package to expose the supported list of phases.

Source§

fn get_num_phases(&mut self) -> Result<CapeInteger, COBIAError>

Get the number of phases supported by this package.

This package supports 1 phase.

§Returns
  • Result - A result object that indicates whether the operation was successful or not, and in case of success returns the number of phases supported by the package.
Source§

fn get_phase_info( &mut self, phase_label: &CapeStringIn<'_>, phase_attribute: &CapeStringIn<'_>, value: &mut CapeValueOut<'_>, ) -> Result<(), COBIAError>

Get information on a phase.

§Arguments
  • phase_label - The label of the phase, which is specified through a CapeStringIn object
  • phase_attribute - The attribute of the phase, which is specified through a CapeStringIn object
  • value - The value of the phase attribute, which is returned through a CapeValueOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_phase_list( &mut self, phase_labels: &mut CapeArrayStringOut<'_>, state_of_aggregation: &mut CapeArrayStringOut<'_>, key_compound_id: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get the list of phases supported by this package

This package supports only one phase: liquid. The liquid phase exposes water as its key compound. As there is only one liquid phase, this is not really necessary, but it is obvious in this context that the liquid phase is always and acquous phase.

§Arguments
  • phase_labels - The list of phase labels, which is returned through a CapeArrayStringOut object
  • state_of_aggregation - The list of state of aggregation, which is returned through a CapeArrayStringOut object
  • key_compound_id - The list of key compound IDs, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeThermoPhasesImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoPhases interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoPhasesImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_get_num_phases( me: *mut c_void, num: *mut i32, ) -> u32

§

extern "C" fn raw_get_phase_info( me: *mut c_void, phase_label: *mut _ICapeString, phase_attribute: *mut _ICapeString, value: *mut ICapeValue, ) -> u32

§

extern "C" fn raw_get_phase_list( me: *mut c_void, phase_labels: *mut ICapeArrayString, state_of_aggregation: *mut ICapeArrayString, key_compound_id: *mut ICapeArrayString, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoPhases_VTable = _

Source§

impl ICapeThermoPropertyRoutine for SaltWaterPropertyPackage

The ICapeThermoPropertyRoutine interface must be implemented by a property package to allow a client to calculate single-phase and two-phase properties.

Source§

fn calc_and_get_ln_phi( &mut self, _: &CapeStringIn<'_>, _: CapeReal, _: CapeReal, _: &CapeArrayRealIn<'_>, _: CapeInteger, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, _: &mut CapeArrayRealOut<'_>, ) -> Result<(), COBIAError>

Calculate the fugacity coefficient of a compound in a phase

Not supported by this package.

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn calc_single_phase_prop( &mut self, props: &CapeArrayStringIn<'_>, phase_label: &CapeStringIn<'_>, ) -> Result<(), COBIAError>

Calculate one or more single-phase properties for the specified phase

Obtains the calculation inputs from the active material object, and sets the calculation results on the active material object.

The underlying property calculations are performed by the salt_water_calculator module.

§Arguments
  • props - The list of properties to be calculated, which is specified through a CapeArrayStringIn object
  • phase_label - The label of the phase, which is specified through a CapeStringIn object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn calc_two_phase_prop( &mut self, _: &CapeArrayStringIn<'_>, _: &CapeArrayStringIn<'_>, ) -> Result<(), COBIAError>

Calculate two-phase properties for the specified phase pair.

This package does not support two-phase properties, and the method always fails.

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn check_single_phase_prop_spec( &mut self, property: &CapeStringIn<'_>, phase_label: &CapeStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>

Check whether a single-phase property calculation is supported for the specified phase.

This package supports a number of single-phase properties, which are defined in the property_tables module.

§Arguments
  • property - The property to be checked, which is specified through a CapeStringIn object
  • phase_label - The label of the phase, which is specified through a CapeStringIn object
§Returns
  • Result - A result object that indicates whether the operation was successful or not, and if succesful, whether the property is supported.
Source§

fn check_two_phase_prop_spec( &mut self, _: &CapeStringIn<'_>, _: &CapeArrayStringIn<'_>, ) -> Result<CapeBoolean, COBIAError>

Check whether a two-phase property calculation is supported for the specified phase pair.

This package does not support two-phase properties, and the method always returns false.

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_single_phase_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get a list of supported single-phase properties.

This package supports a number of single-phase properties, which are defined in the property_tables module. The list of supported properties is returned through the props argument.

§Arguments
  • props - The list of supported single-phase properties, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_two_phase_prop_list( &mut self, props: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get a list of supported two-phase properties.

This package does not support two-phase properties, and the method always returns an empty list.

§Arguments
  • props - The list of supported two-phase properties, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeThermoPropertyRoutineImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoPropertyRoutine interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoPropertyRoutineImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_calc_and_get_ln_phi( me: *mut c_void, phase_label: *mut _ICapeString, temperature: f64, pressure: f64, mole_fraction: *mut ICapeArrayReal, f_flags: i32, ln_phi: *mut ICapeArrayReal, ln_phi_dt: *mut ICapeArrayReal, ln_phi_dp: *mut ICapeArrayReal, ln_phi_dn: *mut ICapeArrayReal, ) -> u32

§

extern "C" fn raw_calc_single_phase_prop( me: *mut c_void, props: *mut ICapeArrayString, phase_label: *mut _ICapeString, ) -> u32

§

extern "C" fn raw_calc_two_phase_prop( me: *mut c_void, props: *mut ICapeArrayString, phase_labels: *mut ICapeArrayString, ) -> u32

§

extern "C" fn raw_check_single_phase_prop_spec( me: *mut c_void, property: *mut _ICapeString, phase_label: *mut _ICapeString, valid: *mut u32, ) -> u32

§

extern "C" fn raw_check_two_phase_prop_spec( me: *mut c_void, property: *mut _ICapeString, phase_labels: *mut ICapeArrayString, valid: *mut u32, ) -> u32

§

extern "C" fn raw_get_single_phase_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32

§

extern "C" fn raw_get_two_phase_prop_list( me: *mut c_void, props: *mut ICapeArrayString, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoPropertyRoutine_VTable = _

Source§

impl ICapeThermoUniversalConstant for SaltWaterPropertyPackage

The ICapeThermoPropertyRoutine interface can optionally be implemented by a property package to allow a client to obtain values for universal constants

Source§

fn get_universal_constant( &mut self, constant_id: &CapeStringIn<'_>, constant_value: &mut CapeValueOut<'_>, ) -> Result<(), COBIAError>

Get the value of a universal constant.

for get_universal_constant, performance is not critical. If performance is critical, one should not convert to string, but compare the CapeConstString directly, which is pre-encoded, or build a HashMap using CapeConstString as key.

§Arguments
  • constant_id - The ID of the universal constant to be retrieved, which is specified through a CapeStringIn object
  • constant_value - The value of the universal constant, which is returned through a CapeValueOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn get_universal_constant_list( &mut self, constant_id_list: &mut CapeArrayStringOut<'_>, ) -> Result<(), COBIAError>

Get the list of universal constants supported by the property package.

§Arguments
  • constant_id_list - The list of supported universal constants, which is returned through a CapeArrayStringOut object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

impl ICapeThermoUniversalConstantImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeThermoUniversalConstant interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeThermoUniversalConstantImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_get_universal_constant( me: *mut c_void, constant_id: *mut _ICapeString, constant_value: *mut ICapeValue, ) -> u32

§

extern "C" fn raw_get_universal_constant_list( me: *mut c_void, constant_id_list: *mut ICapeArrayString, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeThermoUniversalConstant_VTable = _

Source§

impl ICapeUtilities for SaltWaterPropertyPackage

The ICapeUtilities interface must be implemented by all CAPE-OPEN Primary PMC (creatable) objects.

Source§

fn get_parameters( &mut self, ) -> Result<CapeCollection<CapeParameter>, COBIAError>

Obtain the parameter collection of the object

This object has no parameters, and the method always returns a not implemented error.

§Arguments
  • params - The parameter collection of the object, which is returned through a CapeCollection object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn set_simulation_context( &mut self, _: CapeSimulationContext, ) -> Result<(), COBIAError>

Set the simulation context of the object

The Simulation Context object provides a number of services implemented by the PMC, including the ability to log messages. It is not used by this object.

§Arguments
  • context - The simulation context of the object, which is specified through a CapeSimulationContext object
§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn initialize(&mut self) -> Result<(), COBIAError>

Initialize the object

This object does not need any initialization, and the method always returns success. Initialization must be called by the PME on any CAPE-OPEN Primary PMC Object, after persistence (if the object is depersist) but before any other method is called (except setting the simulation context).

Any object that is successfully initialized must be terminated before it can be destroyed. If Initialize returns an error, Terminate must not be called.

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn terminate(&mut self) -> Result<(), COBIAError>

Terminate the object

During termination, and object must release all external references. For this object, the only extenal reference is the active material object.

§Returns
  • Result - A result object that indicates whether the operation was successful or not
Source§

fn edit(&mut self, _: CapeWindowId) -> Result<CapeEditResult, COBIAError>

Edit the object; this is the only time the object may show a modal dialog.

Editing may be invoked to alter the state of the object, or just to inspect the object. Therefore the edit function must indicate whether the object has changed so that the PME may re-obtain the information exposed by the object (supported compounds, phases, …) and invalidate any solution that involves calculations by the object

§Arguments
  • window_id - The window ID of the parent window
§Returns
  • Result - A result object that indicates whether the operation was successful or not; contains modification state for a successful operation
Source§

impl ICapeUtilitiesImpl for SaltWaterPropertyPackage

Source§

type T = SaltWaterPropertyPackage

Source§

fn as_interface_pointer(&mut self) -> *mut ICapeInterface

§

fn init_interface() -> _ICapeInterface

prepare CAPEOPEN_1_2_ICapeUtilities interface and return as generic ICapeInterface pointer
§

fn init<Timpl>(u: &mut Timpl)
where Timpl: ICapeUtilitiesImpl + ICapeInterfaceImpl,

§

extern "C" fn raw_get_parameters( me: *mut c_void, parameters: *mut *mut _CAPEOPEN_1_2_ICapeCollection, ) -> u32

§

extern "C" fn raw_set_simulation_context( me: *mut c_void, context: *mut _CAPEOPEN_1_2_ICapeSimulationContext, ) -> u32

§

extern "C" fn raw_initialize(me: *mut c_void) -> u32

§

extern "C" fn raw_terminate(me: *mut c_void) -> u32

§

extern "C" fn raw_edit( me: *mut c_void, parent: *mut HWND__, result: *mut i32, ) -> u32

§

const VTABLE: CAPEOPEN_1_2_ICapeUtilities_VTable = _

Source§

impl PMCRegisterationInfo for SaltWaterPropertyPackage

The registration information is needed for PMC objects that can be created by extenal applicaitons, and therefore need to be in the COBIA registry. This defines the unique identifier for the object, but also how the object is visible to the end-user.

Source§

fn get_uuid() -> CapeUUID

The UUID of the package, which is used to identify the package in the COBIA registry

Source§

fn registration_details(registrar: &CapeRegistrar) -> Result<(), COBIAError>

The registration details of the package, which are used to register the package in the COBIA registry

§Arguments
  • registrar - The registrar object that is used to register the package in the COBIA registry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.