-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Start migrating C API to its own sources + headers. Write C API …
…as ciapws.
- Loading branch information
1 parent
3a8b73e
commit 7ff5502
Showing
15 changed files
with
277 additions
and
268 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
/** | ||
* @file iapws.h | ||
* @brief Main C header for the IAPWS library. | ||
*/ | ||
#ifndef IAPWS_H | ||
#define IAPWS_H | ||
#include "iapws_version.h" | ||
#include "iapws_g704.h" | ||
#include "iapws_r283.h" | ||
#ifndef CIAPWS_H | ||
#define CIAPWS_H | ||
#include "ciapws_version.h" | ||
#include "ciapws_g704.h" | ||
#include "ciapws_r283.h" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
/** | ||
* @file iapws_g704.h | ||
* @brief C header for the module iapws_g704. | ||
*/ | ||
#ifndef CIAPWS_G704_H | ||
#define CIAPWS_G704_H | ||
|
||
#ifndef IAPWS_G704_H | ||
#define IAPWS_G704_H | ||
|
||
extern void iapws_g704_capi_kh(double *T, char *gas, int heavywater, double *k, int size_gas, size_t size_T); | ||
extern void iapws_g704_capi_kd(double *T, char *gas, int heavywater, double *k, int size_gas, size_t size_T); | ||
extern int iapws_g704_capi_ngases(int heavywater); | ||
extern char **iapws_g704_capi_gases(int heavywater); | ||
extern char *iapws_g704_capi_gases2(int heavywater); | ||
extern void ciapws_g704_capi_kh(double *T, char *gas, int heavywater, double *k, int size_gas, size_t size_T); | ||
extern void ciapws_g704_capi_kd(double *T, char *gas, int heavywater, double *k, int size_gas, size_t size_T); | ||
extern int ciapws_g704_capi_ngases(int heavywater); | ||
extern char **ciapws_g704_capi_gases(int heavywater); | ||
extern char *ciapws_g704_capi_gases2(int heavywater); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
/** | ||
* @file iapws_r283.h | ||
* @brief C header for the module iapws_r283. | ||
*/ | ||
|
||
#ifndef IAPWS_R283_H | ||
#define IAPWS_R283_H | ||
#ifndef CIAPWS_R283_H | ||
#define CIAPWS_R283_H | ||
|
||
#if _MSC_VER | ||
#define ADD_IMPORT __declspec(dllimport) | ||
#else | ||
#define ADD_IMPORT | ||
#endif | ||
|
||
ADD_IMPORT extern const double iapws_Tc_H2O; | ||
ADD_IMPORT extern const double iapws_Tc_D2O; | ||
ADD_IMPORT extern const double ciapws_Tc_H2O; | ||
ADD_IMPORT extern const double ciapws_Tc_D2O; | ||
|
||
ADD_IMPORT extern const double iapws_pc_H2O; | ||
ADD_IMPORT extern const double iapws_pc_D2O; | ||
ADD_IMPORT extern const double ciapws_pc_H2O; | ||
ADD_IMPORT extern const double ciapws_pc_D2O; | ||
|
||
ADD_IMPORT extern const double iapws_rhoc_H2O; | ||
ADD_IMPORT extern const double iapws_rhoc_D2O; | ||
ADD_IMPORT extern const double ciapws_rhoc_H2O; | ||
ADD_IMPORT extern const double ciapws_rhoc_D2O; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
/** | ||
* @file | ||
* @brief Version | ||
*/ | ||
|
||
#ifndef iapws_VERSION_H | ||
#define iapws_VERSION_H | ||
extern char* iapws_get_version(void); | ||
#ifndef CIAPWS_VERSION_H | ||
#define CIAPWS_VERSION_H | ||
extern char* ciapws_get_version(void); | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ciapws | ||
!! Main module for the IAPWS library. | ||
use ciapws__version | ||
use ciapws__r783 | ||
use ciapws__g704 | ||
end module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module ciapws__r783 | ||
!! Module for IAPWS R283 | ||
use iso_c_binding, only: c_double | ||
use iapws__r283 | ||
implicit none | ||
private | ||
|
||
real(c_double), protected, bind(C) :: ciapws_r283_Tc_H2O = Tc_H2O !! Critical temperature for H2O in K | ||
real(c_double), protected, bind(C) :: ciapws_r283_Tc_D2O = Tc_D2O !! Critical temperature for D2O in K | ||
|
||
real(c_double), protected, bind(C) :: ciapws_r283_pc_H2O = pc_H2O !! Critical pressure for H2O in MPa | ||
real(c_double), protected, bind(C) :: ciapws_r283_pc_D2O = pc_D2O !! Critical pressure for D2O in MPa | ||
|
||
real(c_double), protected, bind(C) :: ciapws_r283_rhoc_H2O = rhoc_H2O !! Critical density for H2O in kg.m-3 | ||
real(c_double), protected, bind(C) :: ciapws_r283_rhoc_D2O = rhoc_D2O !! Critical density for D2O in kg.m-3 | ||
|
||
public :: ciapws_r283_Tc_H2O, & | ||
ciapws_r283_Tc_D2O, & | ||
ciapws_r283_pc_H2O, & | ||
ciapws_r283_pc_D2O, & | ||
ciapws_r283_rhoc_H2O, & | ||
ciapws_r283_rhoc_D2O | ||
|
||
end module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module ciapws__version | ||
!! Version | ||
use iso_c_binding, only: c_null_char, c_ptr, c_loc | ||
use iapws__version | ||
implicit none | ||
private | ||
|
||
character(len=:), allocatable, target :: version_c | ||
|
||
public :: ciapws_get_version | ||
|
||
contains | ||
|
||
function ciapws_get_version()bind(c)result(cptr) | ||
!! Get the version. | ||
implicit none | ||
|
||
! Returns | ||
type(c_ptr) :: cptr | ||
!! Pointer to version string. | ||
|
||
character(len=:), pointer :: fptr | ||
fptr => get_version() | ||
|
||
if(allocated(version_c))then | ||
deallocate(version_c) | ||
endif | ||
allocate(character(len=len(fptr)+1) :: version_c) | ||
|
||
version_c = fptr // c_null_char | ||
cptr = c_loc(version_c) | ||
end function | ||
|
||
end module ciapws__version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.