// 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 <iostream>
#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 ) {
        std::cout << "Solver for problem \"" << problem << "\" needs a grid." << std::endl;
    }
    if ( strcasecmp(problem,"my problem") == 0 ) {
        std::cout << "Solver for problem \"" << problem << "\" needs a grid." << std::endl;
    }

    std::cout << "Could not find any matching solver for problem \"" << problem << "\"" << std::endl;
    exit(1);

    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);

    std::cout << "Could not find any matching solver for problem \"" << problem << "\"" << std::endl;
    exit(1);

    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();

    std::cout << "Could not find any matching settings for problem \"" << problem << "\"" << std::endl;
    return new dolfin::Settings();

}

#endif
