// This code is automatically generated by the script scanmodules.sh
// Modules are automatically detected from src/modules/ as directories
// containing a file src/modules/<name>/<name>.module.
 
#ifndef __DOLFIN_MODULES_H
#define __DOLFIN_MODULES_H
 
#include <dolfin/dolfin_log.h>
#include <dolfin/Solver.h>
#include "ConvDiffSolver.h"
#include "ODESolverWrapper.h"
#include "PoissonSolver.h"
#include "TemplateSolver.h"

#include <string.h>

#define DOLFIN_MODULE_COUNT 4

dolfin::Solver* dolfin_module_solver(const char* problem)
{
    if ( strcasecmp(problem,"convection-diffusion") == 0 )
        dolfin_error1("Missing parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"ode") == 0 )
        dolfin_error1("Missing parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"poisson") == 0 )
        dolfin_error1("Missing parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"my problem") == 0 )
        dolfin_error1("Missing parameter for problem \"%s\".", problem);

    dolfin_error1("Unable to find a matching solver for problem \"%s\".", problem);

    return 0;
}

dolfin::Solver* dolfin_module_solver(const char* problem, dolfin::Grid& grid)
{
    if ( strcasecmp(problem,"convection-diffusion") == 0 )
        return new dolfin::ConvDiffSolver(grid);
    if ( strcasecmp(problem,"ode") == 0 )
        dolfin_error1("Illegal parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"poisson") == 0 )
        return new dolfin::PoissonSolver(grid);
    if ( strcasecmp(problem,"my problem") == 0 )
        return new dolfin::TemplateSolver(grid);

    dolfin_error1("Unable to find a matching solver for problem \"%s\".", problem);

    return 0;
}

dolfin::Solver* dolfin_module_solver(const char *problem, dolfin::ODE& ode)
{
    if ( strcasecmp(problem,"convection-diffusion") == 0 )
        dolfin_error1("Illegal parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"ode") == 0 )
        return new dolfin::ODESolverWrapper(ode);
    if ( strcasecmp(problem,"poisson") == 0 )
        dolfin_error1("Illegal parameter for problem \"%s\".", problem);
    if ( strcasecmp(problem,"my problem") == 0 )
        dolfin_error1("Illegal parameter for problem \"%s\".", problem);

    dolfin_error1("Unable to find a matching solver for problem \"%s\".", problem);

    return 0;
}

#endif
