/*
 * Copyright (C) 2008-2012 Delft University of Technology - All rights reserved.
 *
 * Author: Reijer Idema
 */

/**
 * @file PreconditionerShell.h
 * Preconditioner Shell class header.
 */
#ifndef NonLinearSolver_PreconditionerShell_h
#define NonLinearSolver_PreconditionerShell_h

#include "../PetscUtils/PetscUtils.h"	// USES PetscUtils
#include "NonLinearSolver.def"

NONLINEARSOLVER_NAMESPACE_BEGIN

/**
 * %PreconditionerShell abstract base class.
 * Implements an abstract preconditioner shell class for use with the NonLinearSolver class.
 * Derived classes should... (TODO)
 */
class PreconditionerShell
{
public:
	PreconditionerShell(void);
	virtual ~PreconditionerShell(void);

	/**
	 * Get the name of the preconditioner shell.
	 * @return name of the preconditioner shell.
	 */
	virtual std::string GetName(void) const;

	virtual PetscErrorCode SetUp(PC pc) = 0;
	virtual PetscErrorCode Apply(PC pc, Vec x, Vec y) = 0;

protected:
	// MEMBER VARIABLES
	PetscErrorCode mErr;	///< Error code of the most recent PETSc error.
	std::string mName;		///< Name of the preconditioner shell.
};

NONLINEARSOLVER_NAMESPACE_END

#endif // NonLinearSolver_PreconditionerShell_h
