Program Listing for File InterpolatedDerivatives.h

Return to documentation for file (/home/kpenev/projects/git/poet/poet_src/StellarEvolution/InterpolatedDerivatives.h)

#ifndef __INTERPOLATED_DERIVATIVES_H
#define __INTERPOLATED_DERIVATIVES_H

#include "../Core/SharedLibraryExportMacros.h"
#include "mass_feh_interp.h"
#include "../Core/LogDerivatives.h"
#include "../Core/Functions.h"
#include <vector>

namespace StellarEvolution {

    class LIB_LOCAL InterpolatedDerivatives : public LogDerivatives {
    private:
        double
            __stellar_mass,

            __stellar_feh;

        std::vector<const FunctionDerivatives *> *__interp_deriv;


        const alglib::real_1d_array
            &__interp_masses,

            &__interp_feh;

        bool __delete_derivatives;
    protected:
        double calc_deriv(unsigned deriv_order) const;
    public:
        InterpolatedDerivatives(
            double mass,

            double feh,

            std::vector<const FunctionDerivatives*> *derivatives,

            const alglib::real_1d_array &interp_masses,

            const alglib::real_1d_array &interp_feh,

            double age = NaN,

            bool log_quantity = false,

            bool delete_derivatives = false
        );

        ~InterpolatedDerivatives()
        {
            if(__delete_derivatives) {
                for(size_t i = 0; i < __interp_deriv->size(); i++)
                    delete (*__interp_deriv)[i];
                delete __interp_deriv;
            }
        }
    }; //End of InterpolatedDerivatives class.

} //End of StellarEvolution namespace.

#endif