libtrixi
Typedefs | Functions
C API

Typedefs

typedef struct t8_forest * t8_forest_t
 

Functions

void trixi_initialize (const char *project_directory, const char *depot_path)
 Initialize Julia runtime environment. More...
 
void trixi_finalize ()
 Finalize Julia runtime environment. More...
 
int trixi_version_library_major ()
 Return major version number of libtrixi. More...
 
int trixi_version_library_minor ()
 Return minor version number of libtrixi. More...
 
int trixi_version_library_patch ()
 Return patch version number of libtrixi. More...
 
const char * trixi_version_library ()
 Return full version string of libtrixi. More...
 
const char * trixi_version_julia ()
 Return name and version of loaded Julia packages LibTrixi directly depends on. More...
 
const char * trixi_version_julia_extended ()
 Return name and version of all loaded Julia packages. More...
 
int trixi_initialize_simulation (const char *libelixir)
 Set up Trixi simulation. More...
 
void trixi_finalize_simulation (int handle)
 Finalize simulation. More...
 
int trixi_is_finished (int handle)
 Check if simulation is finished. More...
 
void trixi_step (int handle)
 Perform next simulation step. More...
 
int trixi_ndims (int handle)
 Return number of spatial dimensions. More...
 
int trixi_nelements (int handle)
 Return number of local elements (cells). More...
 
int trixi_nelements_global (int handle)
 Return number of global elements (cells). More...
 
int trixi_nvariables (int handle)
 Return number of (conservative) variables. More...
 
double trixi_calculate_dt (int handle)
 Get time step length. More...
 
void trixi_load_cell_averages (double *data, int handle)
 Return cell averaged values. More...
 
t8_forest_t trixi_get_t8code_forest (int handle)
 
void trixi_eval_julia (const char *code)
 Execute Julia code. More...
 

Detailed Description

Typedef Documentation

◆ t8_forest_t

typedef struct t8_forest* t8_forest_t

Function Documentation

◆ trixi_calculate_dt()

double trixi_calculate_dt ( int  handle)

Get time step length.

Get the current time step length of the simulation identified by handle.

Parameters
[in]handlesimulation handle
Returns
Time step length

◆ trixi_eval_julia()

void trixi_eval_julia ( const char *  code)

Execute Julia code.

Execute the provided code in the current Julia runtime environment.

Warning
Only for development. Code is not checked prior to execution.

◆ trixi_finalize()

void trixi_finalize ( )

Finalize Julia runtime environment.

Clean up internal states. This function should be executed near the end of the process' lifetime. After the call to trixi_finalize, no other libtrixi functions may be called anymore, including trixi_finalize itself.

◆ trixi_finalize_simulation()

void trixi_finalize_simulation ( int  handle)

Finalize simulation.

Finalize the simulation identified by handle. This will also release the handle.

Parameters
[in]handlesimulation handle

◆ trixi_get_t8code_forest()

t8_forest_t trixi_get_t8code_forest ( int  handle)

Get t8code forest

For Trixi simulations on t8code meshes, the t8code forest is returned.

Parameters
[in]handlesimulation handle
Warning
The interface to t8code is experimental and implementation details may change at any time without warning.
Returns
t8code forest

◆ trixi_initialize()

void trixi_initialize ( const char *  project_directory,
const char *  depot_path 
)

Initialize Julia runtime environment.

Initialize Julia and activate the project at project_directory. If depot_path is not a null pointer, forcefully set the environment variable JULIA_DEPOT_PATH to the value of depot_path. If depot_path is null, then proceed as follows: If JULIA_DEPOT_PATH is already set, do not touch it. Otherwise, set JULIA_DEPOT_PATH to project_directory + default_depot_path

This function must be called before most other libtrixi functions can be used. Libtrixi maybe only be initialized once; subsequent calls to trixi_initialize are erroneous.

Parameters
[in]project_directoryPath to project directory.
[in]depot_pathPath to Julia depot path (optional; can be null pointer).

◆ trixi_initialize_simulation()

int trixi_initialize_simulation ( const char *  libelixir)

Set up Trixi simulation.

Set up a Trixi simulation by reading the provided libelixir file. It resembles Trixi's typical elixir files with the following differences:

  • Everything (except using ...) has to be inside a function init_simstate()
  • OrdinaryDiffEq's integrator has to be created by calling init (instead of solve)
  • A SimulationState has to be created from the semidiscretization and the integrator See the examples in the LibTrixi.jl/examples folder
Parameters
[in]libelixirPath to libelexir file.
Returns
handle (integer) to Trixi simulation instance

◆ trixi_is_finished()

int trixi_is_finished ( int  handle)

Check if simulation is finished.

Checks if the simulation identified by handle has reached its final time.

Parameters
[in]handlesimulation handle
Returns
1 if finished, 0 if not

◆ trixi_load_cell_averages()

void trixi_load_cell_averages ( double *  data,
int  handle 
)

Return cell averaged values.

Cell averaged values for each cell and each primitive variable are stored in a contiguous array, where cell values for the first variable appear first and values for the other variables subsequently (structure-of-arrays layout).

The given array has to be of correct size and memory has to be allocated beforehand.

Parameters
[in]handlesimulation handle
[out]datacell averaged values for all cells and all primitive variables

◆ trixi_ndims()

int trixi_ndims ( int  handle)

Return number of spatial dimensions.

Parameters
[in]handlesimulation handle

◆ trixi_nelements()

int trixi_nelements ( int  handle)

Return number of local elements (cells).

These usually differ from the global count when doing parallel computations.

Parameters
[in]handlesimulation handle
See also
trixi_nelements_global_api_c

◆ trixi_nelements_global()

int trixi_nelements_global ( int  handle)

Return number of global elements (cells).

These usually differ from the local count when doing parallel computations.

Parameters
[in]handlesimulation handle
See also
trixi_nelements_api_c

◆ trixi_nvariables()

int trixi_nvariables ( int  handle)

Return number of (conservative) variables.

Parameters
[in]handlesimulation handle

◆ trixi_step()

void trixi_step ( int  handle)

Perform next simulation step.

Let the simulation identified by handle advance by one step.

Parameters
[in]handlesimulation handle

◆ trixi_version_julia()

const char* trixi_version_julia ( )

Return name and version of loaded Julia packages LibTrixi directly depends on.

The return value is a read-only pointer to a NULL-terminated string with the name and version information of the loaded Julia packages, separated by newlines.

The returned pointer is to static memory and must not be used to change the contents of the version string. Multiple calls to the function will return the same address.

This function is thread-safe. It must be run after trixi_initialize has been called.

Returns
Pointer to a read-only, NULL-terminated character array with the names and versions of loaded Julia packages.

◆ trixi_version_julia_extended()

const char* trixi_version_julia_extended ( )

Return name and version of all loaded Julia packages.

The return value is a read-only pointer to a NULL-terminated string with the name and version information of all loaded Julia packages, including implicit dependencies, separated by newlines.

The returned pointer is to static memory and must not be used to change the contents of the version string. Multiple calls to the function will return the same address.

This function is thread-safe. It must be run after trixi_initialize has been called.

Returns
Pointer to a read-only, NULL-terminated character array with the names and versions of all loaded Julia packages.

◆ trixi_version_library()

const char* trixi_version_library ( )

Return full version string of libtrixi.

The return value is a read-only pointer to a NULL-terminated string with the version information. This may include not just MAJOR.MINOR.PATCH but possibly also additional build or development version information.

The returned pointer is to static memory and must not be used to change the contents of the version string. Multiple calls to the function will return the same address.

This function is thread-safe and may be run before trixi_initialize has been called.

Returns
Pointer to a read-only, NULL-terminated character array with the full version of libtrixi.

◆ trixi_version_library_major()

int trixi_version_library_major ( )

Return major version number of libtrixi.

This function may be run before trixi_initialize has been called.

Returns
Major version of libtrixi.

◆ trixi_version_library_minor()

int trixi_version_library_minor ( )

Return minor version number of libtrixi.

This function may be run before trixi_initialize has been called.

Returns
Minor version of libtrixi.

◆ trixi_version_library_patch()

int trixi_version_library_patch ( )

Return patch version number of libtrixi.

This function may be run before trixi_initialize has been called.

Returns
Patch version of libtrixi.