Scienza / Schroedinger

A Schroedinger Equation solver in C++, with flexible basis definition
GNU Lesser General Public License v2.1
31 stars 9 forks source link

Redefine constants as constexprs, add proper check for cmath functions #62

Closed sykhro closed 5 years ago

sykhro commented 5 years ago

The redefinition of constants was especially needed because, as macros, they clashed with other external libraries (logger PR incoming).

I chose to do an in-source check over CMake compiler-version-checking-hell because that alone is not enough (std::hermite is guaranteed to be available iff __STDCPP_MATH_SPEC_FUNCS__ >= 201003L; for whatever reason MSVC doesn't actually export that macro but it's known that the minimum version has to be 19.14 for these functions to be there)

sykhro commented 5 years ago

To be honest I think that those constants would be better suited in a separate header and not as part of the Solver interface. But at that point we could have some sort of Math namespace and toss the constants there, together with other stuff like as suggested in #43.

AndreaIdini commented 5 years ago

Great PR. Regarding constants, we wanted to implement a namespace/class of "units", because definition of constants implies the definition of physical units.

I realised we never build an issue regarding this, maybe we should.