Commit 34b7fbce authored by Damien L-G's avatar Damien L-G

Add enum to select from bicubic or bilinear (not implemented yet) interpolation

parent 3fe4e2af
Pipeline #58 failed with stages
......@@ -14,7 +14,14 @@ struct opaque {
Spline2D<Bicubic> _spline;
};
opaque *noname_spline2d_create(char const *xa, char const *ya, char const *za) {
opaque *noname_spline2d_create(noname_interpolation_type which, char const *xa,
char const *ya, char const *za) {
if (which == NONAME_BILINEAR) {
throw std::runtime_error(
"bilinear intepolation not implemented at this time");
} else if (which != NONAME_BICUBIC) {
throw std::invalid_argument("unexpected interpolation type");
}
auto const x = [xa]() {
std::ifstream fs(xa);
return parse_x(fs);
......
......@@ -7,7 +7,11 @@ struct opaque;
typedef struct opaque opaque;
#endif
opaque *noname_spline2d_create(char const *xa, char const *ya, char const *za);
// NOTE only bicubic interpolation is implemented at the moment
enum noname_interpolation_type { NONAME_BILINEAR, NONAME_BICUBIC };
opaque *noname_spline2d_create(noname_interpolation_type which, char const *xa,
char const *ya, char const *za);
void noname_spline2d_destroy(opaque *p);
double noname_spline2d_eval(opaque *p, double x, double y);
......
......@@ -75,8 +75,8 @@ int main() {
std::cout << "\n";
}
auto *spline2d =
noname_spline2d_create("../T.csv", "../p.csv", "../hmolar.csv");
auto *spline2d = noname_spline2d_create(NONAME_BICUBIC, "../T.csv",
"../p.csv", "../hmolar.csv");
double const v = noname_spline2d_eval(spline2d, 100., 100000.);
noname_spline2d_destroy(spline2d);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment