// 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 "PoissonSolver.h"
#include "PoissonSettings.h"
#include "TemplateSolver.h"
#include "TemplateSettings.h"

#include <string.h>

#define DOLFIN_MODULE_COUNT 2

dolfin::Solver * dolfin_module_solver(const char *problem)
{
    if ( strcasecmp(problem,"poisson") == 0 ) {
        dolfin_error1("Solver for problem \"%s\" needs a grid.", problem);
    }
    if ( strcasecmp(problem,"my problem") == 0 ) {
        dolfin_error1("Solver for problem \"%s\" needs a grid.", 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,"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::Settings* dolfin_module_settings(const char *problem)
{
    if ( strcasecmp(problem,"poisson") == 0 )
        return new dolfin::PoissonSettings();
    if ( strcasecmp(problem,"my problem") == 0 )
        return new dolfin::TemplateSettings();

    dolfin_error1("Unable to find matching settings for problem \"%s\".", problem);
    return new dolfin::Settings();

}

#endif
