# usnistgov/refprop-wrappers architecture

> Architecture diagram of the GitHub repository usnistgov/refprop-wrappers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/usnistgov/refprop-wrappers
- Repository: https://github.com/usnistgov/refprop-wrappers

## Overview

This repository provides language-specific interfaces for calling NIST REFPROP, a compiled thermophysical-property library. The typical workflow is to provide fluid and state inputs through a host-language wrapper, invoke REFPROP calculations, and receive property values or errors. The sampled SWIG and Mathcad sources show setup and calculation calls; the Python ctypes wrapper shows native-library loading and argument conversion. The README documents additional language wrappers, but their runtime wiring is not established by the sampled files, so those connections are omitted.

Main entry points: [`wrappers/LabWindows/REFPROP_lib.h`](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/LabWindows/REFPROP_lib.h) (Native function ABI), [`wrappers/python/ctypes/ctREFPROP/ctREFPROP.py`](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/python/ctypes/ctREFPROP/ctREFPROP.py) (ctypes wrapper), [`wrappers/swig/REFPROP.h`](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.h) (SWIG API), [`wrappers/swig/REFPROP.cpp`](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.cpp) (SWIG implementation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python interface"]
  node_python_ctypes["ctypes wrapper<br/>[ctREFPROP.py]"]
end

subgraph group_native["Native interfaces"]
  node_swig_api["SWIG API<br/>[REFPROP.h]"]
  node_swig_impl["SWIG implementation<br/>[REFPROP.cpp]"]
  node_native_abi["Native function ABI<br/>[REFPROP_lib.h]"]
  node_labwindows_app["LabWindows interface<br/>[REFPROP_Main.c]"]
  node_csharp_api["C&#35; interface<br/>[IRefProp64.cs]"]
  node_csharp_example["C&#35; example app<br/>[Program.cs]"]
  node_fortran_wrappers["Fortran wrappers"]
end

subgraph group_scientific["Scientific clients"]
  node_mathcad_api["Mathcad functions<br/>[rp_REFPROP.h]"]
  node_mathcad_runtime["Mathcad add-in<br/>[Refprop.cpp]"]
  node_matlab_abi["MATLAB declarations<br/>[REFPROP.h]"]
  node_excel_wrappers["Excel wrappers"]
  node_labview_wrappers["LabVIEW wrappers"]
  node_other_wrappers["Other documented wrappers"]
end

subgraph group_runtime["REFPROP runtime"]
  node_manager_lib["Manager library"]
  node_refprop_lib["REFPROP library"]
end

node_user(("Application user"))

node_user -->|"supplies inputs"| node_python_ctypes
node_python_ctypes -->|"loads library"| node_manager_lib
node_manager_lib -->|"dispatches calls"| node_refprop_lib
node_user -->|"calls API"| node_swig_api
node_swig_api -->|"defines interface"| node_swig_impl
node_swig_impl -->|"calls functions"| node_native_abi
node_native_abi -->|"dispatches calls"| node_refprop_lib
node_user -->|"uses interface"| node_labwindows_app
node_labwindows_app -->|"uses declarations"| node_native_abi
node_user -->|"uses example"| node_csharp_example
node_csharp_example -->|"starts interface"| node_csharp_api
node_user -->|"uses add-in"| node_mathcad_runtime
node_mathcad_runtime -->|"exposes functions"| node_mathcad_api
node_mathcad_api -->|"calls functions"| node_refprop_lib
node_user -->|"calls declarations"| node_matlab_abi
node_user -.->|"uses wrapper"| node_fortran_wrappers
node_user -.->|"uses wrapper"| node_excel_wrappers
node_user -.->|"uses wrapper"| node_labview_wrappers
node_user -.->|"uses wrapper"| node_other_wrappers

click node_python_ctypes "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/python/ctypes/ctREFPROP/ctREFPROP.py"
click node_swig_api "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.h"
click node_swig_impl "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.cpp"
click node_native_abi "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/LabWindows/REFPROP_lib.h"
click node_labwindows_app "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/LabWindows/REFPROP_Main.c"
click node_csharp_api "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Csharp/IRefProp/IRefProp64.cs"
click node_csharp_example "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Csharp/RefProp_cs_Examples/Program.cs"
click node_mathcad_api "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Mathcad/includes/rp_REFPROP.h"
click node_mathcad_runtime "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Mathcad/src/Refprop.cpp"
click node_matlab_abi "https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/MATLAB/legacy/REFPROP.h"
click node_fortran_wrappers "https://github.com/usnistgov/refprop-wrappers/tree/master/wrappers/FORTRAN/shared"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_python_ctypes,node_user toneBlue
class node_swig_api,node_swig_impl,node_native_abi,node_labwindows_app,node_csharp_api,node_csharp_example,node_fortran_wrappers toneAmber
class node_mathcad_api,node_mathcad_runtime,node_matlab_abi,node_excel_wrappers,node_labview_wrappers,node_other_wrappers toneMint
class node_manager_lib,node_refprop_lib toneRose
```

## Components

### Python interface

- [ctypes wrapper](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/python/ctypes/ctREFPROP/ctREFPROP.py): `wrappers/python/ctypes/ctREFPROP/ctREFPROP.py`

### Native interfaces

- [SWIG API](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.h): `wrappers/swig/REFPROP.h`
- [SWIG implementation](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/swig/REFPROP.cpp): `wrappers/swig/REFPROP.cpp`
- [Native function ABI](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/LabWindows/REFPROP_lib.h): `wrappers/LabWindows/REFPROP_lib.h`
- [LabWindows interface](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/LabWindows/REFPROP_Main.c): `wrappers/LabWindows/REFPROP_Main.c`
- [C# interface](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Csharp/IRefProp/IRefProp64.cs): `wrappers/Csharp/IRefProp/IRefProp64.cs`
- [C# example app](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Csharp/RefProp_cs_Examples/Program.cs): `wrappers/Csharp/RefProp_cs_Examples/Program.cs`
- [Fortran wrappers](https://github.com/usnistgov/refprop-wrappers/tree/master/wrappers/FORTRAN/shared): `wrappers/FORTRAN/shared`

### Scientific clients

- [Mathcad functions](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Mathcad/includes/rp_REFPROP.h): `wrappers/Mathcad/includes/rp_REFPROP.h`
- [Mathcad add-in](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/Mathcad/src/Refprop.cpp): `wrappers/Mathcad/src/Refprop.cpp`
- [MATLAB declarations](https://github.com/usnistgov/refprop-wrappers/blob/master/wrappers/MATLAB/legacy/REFPROP.h): `wrappers/MATLAB/legacy/REFPROP.h`
- **Excel wrappers**
- **LabVIEW wrappers**
- **Other documented wrappers**

### REFPROP runtime

- **Manager library**
- **REFPROP library**

### Other components

- **Application user**

## Connections

- Application user → ctypes wrapper: supplies inputs
- ctypes wrapper → Manager library: loads library
- Manager library → REFPROP library: dispatches calls
- Application user → SWIG API: calls API
- SWIG API → SWIG implementation: defines interface
- SWIG implementation → Native function ABI: calls functions
- Native function ABI → REFPROP library: dispatches calls
- Application user → LabWindows interface: uses interface
- LabWindows interface → Native function ABI: uses declarations
- Application user → C# example app: uses example
- C# example app → C# interface: starts interface
- Application user → Mathcad add-in: uses add-in
- Mathcad add-in → Mathcad functions: exposes functions
- Mathcad functions → REFPROP library: calls functions
- Application user → MATLAB declarations: calls declarations
- Application user → Fortran wrappers: uses wrapper
- Application user → Excel wrappers: uses wrapper
- Application user → LabVIEW wrappers: uses wrapper
- Application user → Other documented wrappers: uses wrapper
