Revision 41e684800fbdd0bf24b91ff51f61f60818cc9bc0 authored by Konrad Werys on 14 November 2019, 09:31:46 UTC, committed by Konrad Werys on 14 November 2019, 09:31:46 UTC
1 parent 8e25865
Raw File
OxFactoryOfStartPointCalculators.h
/*!
 * \file OxFactoryOfStartPointCalculators.h
 * \author Konrad Werys
 * \date 2018/08/18
 */

#ifndef Tomato_OXFACTORYOFStartPointCalculators_H
#define Tomato_OXFACTORYOFStartPointCalculators_H

#include "CmakeConfigForTomato.h"

#include "OxStartPointCalculatorBasic.h"
#include "OxStartPointCalculatorShmolli.h"

namespace Ox {

    template<typename TYPE>
    struct TomatoOptions;


    static const char *startPointCalculatorsTypeNames[] = {
            "Basic",
            "StartPointSHMOLLI",
            "NoStartPointCalculators"
    };

    enum startPointCalculatorsType_t {
        Basic = 0,
        StartPointSHMOLLI = 1,
        NoStartPointCalculators = 2,
        lastStartPointCalculatorType = NoStartPointCalculators
    };

    static int startPointCalculatorsAvailability[] = {
            1, // Basic
            1, // StartPointSHMOLLI
            1  // NoStartPointCalculators
    };

    template<typename TYPE>
    class FactoryOfStartPointCalculators {
    public:

        static StartPointCalculator<TYPE>* newByFactory(TomatoOptions<TYPE> *opts){
            switch (opts->start_point_calc_method){
                case Basic: {
                    return new StartPointCalculatorBasic<TYPE>();
                }
                case StartPointSHMOLLI: {
                    return new StartPointCalculatorShmolli<TYPE>();
                }
                case NoStartPointCalculators: {
                    return 0;
                }
                default:
                    throw std::runtime_error("start_point_calc_method object not available");
            }
        }

        static void disp(int start_point_calc_method = -1){

            if (start_point_calc_method >= 0) {
                printf("%-28s%-22s", " start_point_calc_method: ", startPointCalculatorsTypeNames[start_point_calc_method]);
            }

            printf("options: [ ");

            for (int i = 0; i < lastStartPointCalculatorType+1; i++){

                if(startPointCalculatorsAvailability[i]){
                    printf("%s ", startPointCalculatorsTypeNames[i]);
                }
            }

            printf("] \n");
        }
    };

} // namespace Ox

#endif //Tomato_OXFACTORYOFStartPointCalculators_H
back to top