Loading...
Searching...
No Matches
EonRelaxClient.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
5#ifndef GPR_NEB_EONRELAXCLIENT_H_
6#define GPR_NEB_EONRELAXCLIENT_H_
7
8#include <cstdint>
9#include <string>
10
11#include "eon_relax_engine.h"
12
13namespace pot {
15}
16
17namespace gpr {
18namespace neb {
19
30public:
31 EonRelaxClient() = default;
35
39 bool load(const std::string& path = {});
40 [[nodiscard]] bool loaded() const noexcept
41 {
42 return run_ != nullptr;
43 }
44
48 bool create(const void* config = nullptr, std::size_t config_len = 0);
49 [[nodiscard]] bool created() const noexcept
50 {
51 return engine_ != nullptr;
52 }
53
58 eon_relax_outcome_t& outcome);
59
63 eon_relax_outcome_t& outcome);
64
65 int reset();
66 int setSurfaceEpoch(std::uint64_t epoch);
67 [[nodiscard]] int lastError() const;
68
69 void destroy();
70
71 [[nodiscard]] const std::string& lastMessage() const noexcept
72 {
73 return message_;
74 }
75 [[nodiscard]] eon_relax_version_t stamp() const noexcept
76 {
77 return stamp_;
78 }
79
80private:
81 void* lib_ = nullptr;
82 EonRelaxEngine* engine_ = nullptr;
83 std::string message_;
84 eon_relax_version_t stamp_{0, 0};
85
86 using abi_stamp_fn = int (*)(eon_relax_version_t*);
87 using available_fn = int (*)(void);
88 using create_fn = EonRelaxEngine* (*)(const void*, size_t, char*, size_t);
89 using run_fn = int (*)(EonRelaxEngine*, eon_relax_band_t*,
91 using step_fn = int (*)(EonRelaxEngine*, eon_relax_band_t*,
93 using reset_fn = int (*)(EonRelaxEngine*);
94 using set_epoch_fn = int (*)(EonRelaxEngine*, std::uint64_t);
95 using last_error_fn = int (*)(const EonRelaxEngine*);
96 using destroy_fn = void (*)(EonRelaxEngine*);
97
98 create_fn create_ = nullptr;
99 run_fn run_ = nullptr;
100 step_fn step_ = nullptr;
101 reset_fn reset_ = nullptr;
102 set_epoch_fn set_epoch_ = nullptr;
103 last_error_fn last_error_ = nullptr;
104 destroy_fn destroy_ = nullptr;
105};
106
114 eon_relax_surface_request_t* req) noexcept;
115
116} // namespace neb
117} // namespace gpr
118
119#endif
EonRelaxClient(const EonRelaxClient &)=delete
bool loaded() const noexcept
eon_relax_version_t stamp() const noexcept
bool created() const noexcept
int setSurfaceEpoch(std::uint64_t epoch)
EonRelaxClient & operator=(const EonRelaxClient &)=delete
const std::string & lastMessage() const noexcept
int run(eon_relax_band_t &band, eon_relax_surface_fn surface, void *user, eon_relax_outcome_t &outcome)
int step(eon_relax_band_t &band, eon_relax_surface_fn surface, void *user, eon_relax_outcome_t &outcome)
bool create(const void *config=nullptr, std::size_t config_len=0)
bool load(const std::string &path={})
Tier-2 C ABI: eOn as a dlopen relaxation engine.
struct EonRelaxEngine EonRelaxEngine
eon_relax_band_t eon_relax_surface_fn surface
eon_relax_band_t * band
uint64_t epoch
size_t config_len
int(* eon_relax_surface_fn)(void *user, eon_relax_surface_request_t *req)
eon_relax_band_t eon_relax_surface_fn void * user
The nudged elastic band: path, GP-NEB driver, configuration and result, acquisition,...
int gprMeanSurfaceCallback(void *user, eon_relax_surface_request_t *req) noexcept
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
Potential wrappers and the batched oracle interface.