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

Implement C API / Add support for scripting languages #5

Open
MilheiroSantos opened this issue Dec 11, 2014 · 0 comments
Open

Implement C API / Add support for scripting languages #5

MilheiroSantos opened this issue Dec 11, 2014 · 0 comments

Comments

@MilheiroSantos
Copy link
Contributor

These two issues are tightly coupled, so I'll discuss them together. I think having a simple C API for scripting proposes would be very interesting. Why C if we are using C++? Two reasons"

  1. There is no standard way to access C++ functions from a binary file. It's main problem is the lack of a standardized ABI. The C language, on the contrary, provides a standard ABI.
  2. C is the de facto standard for scripting languages. Almost all of them (Python, Perl, MATLAB, Julia, etc) provide simple ways to interface with C code.

The idea would be to implement and "external" API in C and wrap it on our favorite scripting language. The "external" API would be mainly implemented in the Framework with the following objectives:

  1. Configuring a CFcase. Adding modules, configuring boundary and initial conditions with user-defined functions, changing modules at run time, retrieving the module config options.
  2. Getting and setting data. Accessing the mesh and physical properties.
  3. Implement prototyping modules. One could start implementing a module using a higher-level language and, when all the building blocks are properly defined and debugged, implement a fast module in C++.
  4. Implement a general and extendable GUI.

Point 3 might be the most controversial. Why spend time implementing the same module in two different languages? The though process is adapted to COOLFluiD's developers:

  • COOLFLuiD is probably the first large code that the students working on it ever faced. They have little experience on software patterns, algorithms or data structures (I certainly had!).
  • It may even be the first C++ code or the first time working on Linux!

So, by first interfacing COOLFuiD through Octave/MATLAB ( or any other language the students have already used ) the development process is "eased in", with the focus first on the algorithm and getting things done with simpler tools and debug processes. Later, with the help of the more experienced programmers, the design for an efficient C++ code can be laid out and implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant