U
    }N€_X  ã                   @   s`   d dl mZ d dlT d dlZd dlmZmZ d dlm	Z	 ddl
mZ ejZG dd	„ d	ejƒZdS )
é    )Úprint_function)Ú*N)ÚplatformÚexit)Úpathé   )Úthermoc                       s:   e Zd ZdZ‡ fdd„Zddd„Zdd„ Zd	d
„ Z‡  ZS )Úpcsaftz
    Interface to cubic
    c                    sT   t t| ƒ ¡  t| j|  dd¡ƒ| _t| j|  dd¡ƒ| _t| j|  dd¡ƒ| _dS )z=
        Initialize cubic specific function pointers
        Ú
eoslibinitZinit_pcsaftÚsaft_interfaceZpc_saft_get_kijZpc_saft_set_kij_asymN)	Úsuperr	   Ú__init__ÚgetattrÚtpÚget_export_nameÚeoslibinit_init_pcsaftÚ	s_get_kijÚ	s_set_kij)Úself©Ú	__class__© ú ../pycThermopack/pyctp/pcsaft.pyr      s    zpcsaft.__init__ÚDefaultc                 C   s€   t | d¡ƒ}tt|ƒƒ}t | d¡ƒ}tt|ƒƒ}t t ttg| j_d| j_|  ||||¡ tt| d¡ƒt| d¡ƒƒ| _	dS )záInitialize PC-SAFT model in thermopack

        Args:
            comps (str): Comma separated list of component names
            parameter_reference (str, optional): Which parameters to use?. Defaults to "Default".
        ÚasciiNú ú,)
Úc_char_pÚencodeÚ
c_len_typeÚlenr   ÚargtypesÚrestypeÚmaxÚsplitÚnc)r   ÚcompsÚparameter_referenceÚcomp_string_cÚcomp_string_lenÚref_string_cÚref_string_lenr   r   r   Úinit%   s     ýýzpcsaft.initc                 C   sZ   t |ƒ}t |ƒ}tdƒ}tt ƒtt ƒttƒg| j_d| j_|  t|ƒt|ƒt|ƒ¡ |jS )z×Get binary well depth interaction parameter

        Args:
            c1 (int): Component one
            c2 (int): Component two

        Returns:
            kij (float): Well depth interaction parameter
        g        N)Úc_intÚc_doubleÚPOINTERr   r!   r"   ÚbyrefÚvalue)r   Úc1Úc2Úc1_cÚc2_cÚkij_cr   r   r   Úget_kij>   s    
þ
þzpcsaft.get_kijc                 C   sX   t |ƒ}t |ƒ}t|ƒ}tt ƒtt ƒttƒg| j_d| j_|  t|ƒt|ƒt|ƒ¡ dS )zÅSet binary well depth interaction parameter

        Args:
            c1 (int): Component one
            c2 (int): Component two
            kij (float): Well depth interaction parameter
        N)r-   r.   r/   r   r!   r"   r0   )r   r2   r3   Úkijr4   r5   r6   r   r   r   Úset_kijV   s    þ
þzpcsaft.set_kij)r   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r,   r7   r9   Ú__classcell__r   r   r   r   r	      s
   
r	   )Ú
__future__r   ÚctypesÚnumpyÚnpÚsysr   r   Úosr   Ú r   r   Ú
thermopackr	   r   r   r   r   Ú<module>   s   