#include "tao_solver.h"    /*I "tao_solver.h"  I*/
#include "taolinearsolver.h"

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolverDestroy"
/*@C
   TaoLinearSolverDestroy - Destroys the TaoLinearSolver object.

   Input Parameter:
.  TKSP - the linear solver

   Level: beginner
.seealso: TaoLinearSolve()

.keywords: linear solver

@*/
int TaoLinearSolverDestroy( TaoLinearSolver* TKSP){
  TaoFunctionBegin;
  if (TKSP){
    TKSP->rref--;
    if (TKSP->rref<1) {
      delete TKSP;
    }
  }
  TaoFunctionReturn(0);
}


#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::PreSolve"
/*@C
   PreSolve - Prepares a matrix for the linear solve.

   Input Parameter:
.  M - the matrix

   Level: intermediate
@*/
int TaoLinearSolver::PreSolve(TaoMat* M){
  TaoFunctionBegin;
  SETERRQ(56,"Operation not defined");
  /* TaoFunctionReturn(1); */
}


#undef __FUNCT__
#define __FUNCT__ "TaoMat::MinQuadraticTrustRegion"
int TaoLinearSolver::MinQuadraticTrustRegion(TaoVec*tv,TaoVec*tw,double rr, TaoTruth*tt){
  TaoFunctionBegin;
  SETERRQ(56,"Operation not defined");
  /* TaoFunctionReturn(1); */
}

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::Solve"
/*@C
   Solve - Finds the solution to A x = b .

   Input Parameter:
.  b - the right-hand side

   Output Parameter:
+  x - the solution
-  flag - TAO_TRUE if successful solve, TAO_FALSE otherwise.

   Level: intermediate
@*/
int TaoLinearSolver::Solve(TaoVec* b, TaoVec* x, TaoTruth *flag){
  TaoFunctionBegin;
  SETERRQ(56,"Operation not defined");
  /* TaoFunctionReturn(1); */
}

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::GetNumberIterations"
/*@C
   GetNumberIterations - Gets the number of iterations used to solve the system.

   Output Parameter:
.  iters - the number of iterations

   Level: intermediate
@*/
int TaoLinearSolver::GetNumberIterations(int * iters){
  int info;
  TaoFunctionBegin;
  info = PetscLogInfo((0,"TaoLinearSolver::GetNumberIterations() iterations not available.\n")); CHKERRQ(info);
  TaoFunctionReturn(0);
}

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::SetTolerances"
/*@C
   SetTolerances - Sets the convergence tolerances for solving the linear system.

   Input Parameter:
+  rtol - the relative tolerance
.  atol - the absolute tolerance
.  dtol - the divergence tolerance
-  maxits - the maximum number of iterates

   Level: intermediate
@*/
int TaoLinearSolver::SetTolerances(double rtol, double atol, double dtol, int maxits){
  int info;
  TaoFunctionBegin;
  info = PetscLogInfo((0,"TaoLinearSolver::SetTolerances() method not defined. Options ignored\n")); CHKERRQ(info);
  TaoFunctionReturn(0);
}

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::SetOptions"
/*@C
  SetOptions - Sets any relevant options from the command line.

  Input Parameters: none
  
  Level: intermediate
@*/
int TaoLinearSolver::SetOptions(){
  int info;
  TaoFunctionBegin;
  info = PetscLogInfo((0,"TaoLinearSolver::SetOptions(): method not defined or implemented.\n")); CHKERRQ(info);
  info = TaoOptionsHead("TaoLinearSolverOptions:  Not currently implemented through TAO");CHKERRQ(info);
  info = TaoOptionsTail();CHKERRQ(info);
  TaoFunctionReturn(0);
}

#undef __FUNCT__
#define __FUNCT__ "TaoLinearSolver::View"
/*@C
  View - Views the linear solver.

  Input Parameters: none
  
  Level: intermediate
@*/
int TaoLinearSolver::View(){
  int info;
  TaoFunctionBegin;
  info = PetscLogInfo((0,"TaoLinearSolver::View() method not defined.\n")); CHKERRQ(info);
  info = TaoPrintStatement(0,"  TaoLinearSolverView: No information available: \n");CHKERRQ(info);
  TaoFunctionReturn(0);
}

