42 using artn_fn = void (*)(
const int nat,
const double *etot,
const double *f,
43 int const *ityp,
double *
const tau,
const int *order,
44 const double *lat,
const int *if_pos,
int *disp_code,
45 double *disp_vec,
bool *lconv);
47 using set_param_fn = int (*)(
const char *
const name,
const int crank,
48 const int *csize,
const void *cval);
57 double *
const force,
int const *ityp,
58 double *
const pos,
const double *box,
59 const int *if_pos,
double *displ_vec,
73 [[nodiscard]]
virtual bool is_loaded() const noexcept = 0;
165 template <
typename Fn> Fn
load_sym(
const char *name)
const {
artn_destroy_fn get_destroy_fn() const override
void require_loaded() override
Throws std::runtime_error if libartn is not available.
print_caller_fn print_caller_
artn_step_fn get_artn_step_fn() const override
get_data_fn get_get_data_fn() const override
ARTnResource(const ARTnResource &)=delete
print_caller_fn get_print_caller_fn() const override
ARTnResource & operator=(const ARTnResource &)=delete
get_param_fn get_get_param_fn() const override
artn_create_fn artn_create_
set_param_fn get_set_param_fn() const override
setup_artn_fn get_setup_fn() const override
get_runparam_fn get_get_runparam_fn() const override
get_error_fn get_get_error_fn() const override
May be null on older pARTn builds that predate the C get_error wrapper; callers must null-check befor...
get_runparam_fn get_runparam_
Fn load_sym(const char *name) const
Try to load a symbol; returns nullptr on failure.
artn_destroy_fn artn_destroy_
artn_create_fn get_create_fn() const override
setup_artn_fn setup_artn_
artn_fn get_artn_fn() const override
bool is_loaded() const noexcept override
static ARTnResource & instance()
Thread-safe singleton accessor (Meyer's pattern).
virtual get_param_fn get_get_param_fn() const =0
void(*)(const int nat, bool *cerr) setup_artn_fn
virtual artn_step_fn get_artn_step_fn() const =0
void(*)() print_caller_fn
virtual bool is_loaded() const noexcept=0
void(*)(const int nat, const double *etot, const double *f, int const *ityp, double *const tau, const int *order, const double *lat, const int *if_pos, int *disp_code, double *disp_vec, bool *lconv) artn_fn
int(*)(const char *name, void **cval) get_param_fn
pARTn bind(C) get_param / get_runparam: type(c_ptr), intent(out).
int(*)(void **cmsg) get_error_fn
Retrieve pARTn error code + c_malloc'd message pointer.
int(*)(const char *name, void **cval) get_data_fn
virtual set_param_fn get_set_param_fn() const =0
virtual void require_loaded()=0
void(*)(const int nat, const double etot, double *const force, int const *ityp, double *const pos, const double *box, const int *if_pos, double *displ_vec, bool *lconv) artn_step_fn
virtual ~IARTnResource()=default
virtual artn_destroy_fn get_destroy_fn() const =0
IARTnResource(const IARTnResource &)=delete
virtual artn_fn get_artn_fn() const =0
void(*)() artn_destroy_fn
virtual setup_artn_fn get_setup_fn() const =0
int(*)(const char *name, void **cval) get_runparam_fn
virtual artn_create_fn get_create_fn() const =0
virtual get_error_fn get_get_error_fn() const =0
May be null on older pARTn builds that predate the C get_error wrapper; callers must null-check befor...
virtual print_caller_fn get_print_caller_fn() const =0
virtual get_runparam_fn get_get_runparam_fn() const =0
virtual get_data_fn get_get_data_fn() const =0
int(*)(const char *const name, const int crank, const int *csize, const void *cval) set_param_fn
std::mutex library_mutex
Serializes access to the Fortran backend's shared global state.
void * sym(Handle h, const char *name) noexcept
RAII resource manager for the ARTn C library with global synchronization.
ARTnResource & get_artn_resource()
Global access to thread-safe ARTn resource.