libtrixi
Functions
C API

Functions

void trixi_initialize (const char *project_directory, const char *depot_path)
 Initialize Julia runtime environment. More...
 
int trixi_initialize_simulation (const char *libelixir)
 Set up Trixi simulation. More...
 
double trixi_calculate_dt (int handle)
 Get time step length. More...
 
int trixi_is_finished (int handle)
 Check if simulation is finished. More...
 
void trixi_step (int handle)
 Perform next simulation step. More...
 
void trixi_finalize_simulation (int handle)
 Finalize simulation. More...
 
void trixi_finalize ()
 Finalize Julia runtime environment. More...
 
void julia_eval_string (const char *code)
 Execute Julia code. More...
 

Detailed Description

Function Documentation

◆ julia_eval_string()

void julia_eval_string ( 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_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_finalize()

void trixi_finalize ( )

Finalize Julia runtime environment.

◆ 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_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

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_step()

void trixi_step ( int  handle)

Perform next simulation step.

Let the simulation identified by handle advance by one step.

Parameters
[in]handlesimulation handle