Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the usability of the interface code #52

Open
ktbolt opened this issue Oct 18, 2023 · 2 comments
Open

Improve the usability of the interface code #52

ktbolt opened this issue Oct 18, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ktbolt
Copy link
Contributor

ktbolt commented Oct 18, 2023

The 0D solver svZeroDPlus/src/interface code is used to interface to the 0D solver from an external application by calling functions loaded from the libsvzero_interface shared library.

The LPNSolverInterface class located in svZeroDPlus/tests/test_interface/LPNSolverInterface is used to load the libsvzero_interface shared library and call functions loaded from it.

We need to make sure that the svZeroDPlus/src/interface and svZeroDPlus/tests/test_interface/LPNSolverInterface codes provide a consistent and correct access interface functions.

@ktbolt ktbolt added the enhancement New feature or request label Oct 18, 2023
@ktbolt ktbolt self-assigned this Oct 18, 2023
@ktbolt
Copy link
Contributor Author

ktbolt commented Oct 31, 2023

I've been looking at the svZeroDPlus/src/interface and svZeroDPlus/tests/test_interface/LPNSolverInterface code and think it would be good to merge LPNSolverInterface and interface functionality.

The idea would be to define a ZeroDSolverInterface class containing methods interfacing to the solver contained in the interface shared library.

The 3D solver using the interface would include the ZeroDSolverInterface.h header. It would then load the new_interface function used to create a ZeroDSolverInterface object like so

ZeroDSolverInterface* new_interface;

 *(void**)(new_interface) = dlsym(handle, "new_interface");

auto interface = new_interface();

Calls to the solver are then made using interface methods

interface->initialize(file_name, problem_id, pts_per_cycle, num_cycles, num_output_steps, block_names, variable_names);

interface->increment_time_(time, solution);

The user does not need to load interface functions, consistency of the names and signatures of the interface functions are maintained by the ZeroDSolverInterface.h header.

@menon-karthik What do you thinK?

@ktbolt
Copy link
Contributor Author

ktbolt commented Mar 5, 2024

@menon-karthik The idea about just loading an interface class is very complicated to implement so forget that.

I think what we can do is just move the svZeroDSolver/tests/test_interface/LPNSolverInterface class to svZeroDSolver/src/interface and have that code used by svZeroDSolver/tests/test_interface/test_0*. The svZeroDSolver/tests/test_interface/LPNSolverInterface code will then be installed with the svZeroDSolver executable and shared library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant