<commit_before>// $Id: laspack_interface.h,v 1.4 2004-10-12 19:46:57 benkirk Exp $

// The libMesh Finite Element Library.
// Copyright (C) 2002-2004  <NAME>, <NAME>
  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
  
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __laspack_interface_h__
#define __laspack_interface_h__

#include "libmesh_common.h"

#if defined(HAVE_LASPACK)
//#if defined(HAVE_LASPACK) && !defined(USE_COMPLEX_NUMBERS)


// C++ includes

// Local includes
#include "linear_solver_interface.h"
#include "laspack_vector.h"
#include "laspack_matrix.h"


#include <itersolv.h>
#include <rtc.h>
#include <errhandl.h>



/**
 * This class provides an interface to Laspack
 * iterative solvers that is compatible with the \p libMesh
 * \p LinearSolverInterface<>
 * 
 * @author <NAME>, 2002-2004
 */
template <typename T>
class LaspackInterface : public LinearSolverInterface<T>
{
 public:
  /**
   *  Constructor. Initializes Laspack data structures
   */
  LaspackInterface ();
    
  /**
   * Destructor.
   */
  ~LaspackInterface ();
  
  /**
   * Release all memory and clear data structures.
   */
  void clear ();

  /**
   * Initialize data structures if not done so already.
   */
  void init ();
  

  /**
   * Call the Laspack solver
   */    
  std::pair<unsigned int, Real> 
    solve (SparseMatrix<T>  &matrix,
	   NumericVector<T> &solution,
	   NumericVector<T> &rhs,
	   const double tol,
	   const unsigned int m_its);
  /**
   * Call the Laspack solver
   */    
  std::pair<unsigned int, Real> 
    solve (SparseMatrix<T>  &matrix,
	   SparseMatrix<T>  &pc,
	   NumericVector<T> &solution,
	   NumericVector<T> &rhs,
	   const double tol,
	   const unsigned int m_its);
   
 private:
  
  /**
   * Tells LASPACK to use the user-specified preconditioner stored in
   * \p _preconditioner_type
   */
  void set_laspack_preconditioner_type ();

  /**
   * Preconditioner type
   */
  PrecondProcType _precond_type;
};


/*----------------------- functions ----------------------------------*/
template <typename T>
inline
LaspackInterface<T>::LaspackInterface () :
  _precond_type (ILUPrecond)
{
}



template <typename T>
inline
LaspackInterface<T>::~LaspackInterface ()
{
  this->clear ();
}



template <typename T>
inline
std::pair<unsigned int, Real>
LaspackInterface<T>::solve (SparseMatrix<T>&,
			    SparseMatrix<T>&,
			    NumericVector<T>&,
			    NumericVector<T>&,
			    const double,
			    const unsigned int)
{
  std::cerr << "ERROR: LASPACK does not support a user-supplied preconditioner!"
	    << std::endl;
  error();
}

#endif // #ifdef HAVE_LASPACK
#endif // #ifndef __laspack_interface_h__<commit_msg>added missing return value<commit_after>// $Id: laspack_interface.h,v 1.5 2004-10-15 04:38:19 benkirk Exp $

// The libMesh Finite Element Library.
// Copyright (C) 2002-2004  <NAME>, <NAME>
  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
  
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __laspack_interface_h__
#define __laspack_interface_h__

#include "libmesh_common.h"

#if defined(HAVE_LASPACK)
//#if defined(HAVE_LASPACK) && !defined(USE_COMPLEX_NUMBERS)


// C++ includes

// Local includes
#include "linear_solver_interface.h"
#include "laspack_vector.h"
#include "laspack_matrix.h"


#include <itersolv.h>
#include <rtc.h>
#include <errhandl.h>



/**
 * This class provides an interface to Laspack
 * iterative solvers that is compatible with the \p libMesh
 * \p LinearSolverInterface<>
 * 
 * @author <NAME>, 2002-2004
 */
template <typename T>
class LaspackInterface : public LinearSolverInterface<T>
{
 public:
  /**
   *  Constructor. Initializes Laspack data structures
   */
  LaspackInterface ();
    
  /**
   * Destructor.
   */
  ~LaspackInterface ();
  
  /**
   * Release all memory and clear data structures.
   */
  void clear ();

  /**
   * Initialize data structures if not done so already.
   */
  void init ();
  

  /**
   * Call the Laspack solver
   */    
  std::pair<unsigned int, Real> 
    solve (SparseMatrix<T>  &matrix,
	   NumericVector<T> &solution,
	   NumericVector<T> &rhs,
	   const double tol,
	   const unsigned int m_its);
  /**
   * Call the Laspack solver
   */    
  std::pair<unsigned int, Real> 
    solve (SparseMatrix<T>  &matrix,
	   SparseMatrix<T>  &pc,
	   NumericVector<T> &solution,
	   NumericVector<T> &rhs,
	   const double tol,
	   const unsigned int m_its);
   
 private:
  
  /**
   * Tells LASPACK to use the user-specified preconditioner stored in
   * \p _preconditioner_type
   */
  void set_laspack_preconditioner_type ();

  /**
   * Preconditioner type
   */
  PrecondProcType _precond_type;
};


/*----------------------- functions ----------------------------------*/
template <typename T>
inline
LaspackInterface<T>::LaspackInterface () :
  _precond_type (ILUPrecond)
{
}



template <typename T>
inline
LaspackInterface<T>::~LaspackInterface ()
{
  this->clear ();
}



template <typename T>
inline
std::pair<unsigned int, Real>
LaspackInterface<T>::solve (SparseMatrix<T>&,
			    SparseMatrix<T>&,
			    NumericVector<T>&,
			    NumericVector<T>&,
			    const double,
			    const unsigned int)
{
  std::cerr << "ERROR: LASPACK does not support a user-supplied preconditioner!"
	    << std::endl;
  error();

  std::pair<unsigned int, Real> p;
  return p;
}

#endif // #ifdef HAVE_LASPACK
#endif // #ifndef __laspack_interface_h__
{'fraction_non_alphanumeric': 0.1251311254308407, 'fraction_numerical': 0.014386332983665517, 'mean_word_length': 3.1325077399380805, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 64, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4639503', 'n_tokens_mistral': 2257, 'n_tokens_neox': 2111, 'n_words': 662}