libMesh::TrilinosPreconditioner< T > Class Template Reference

#include <trilinos_preconditioner.h>

Inheritance diagram for libMesh::TrilinosPreconditioner< T >:

Public Member Functions

 TrilinosPreconditioner (const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
 
virtual ~TrilinosPreconditioner ()
 
virtual void apply (const NumericVector< T > &x, NumericVector< T > &y)
 
virtual void clear ()
 
virtual void init ()
 
void set_params (Teuchos::ParameterList &list)
 
Epetra_FECrsMatrix * mat ()
 
void set_preconditioner_type (const PreconditionerType &preconditioner_type)
 
void compute ()
 
bool initialized () const
 
virtual void setup ()
 
void set_matrix (SparseMatrix< Number > &mat)
 
PreconditionerType type () const
 
void set_type (const PreconditionerType pct)
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static Preconditioner< T > * build (const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD, const SolverPackage solver_package=libMesh::default_solver_package())
 
static std::string get_info ()
 
static void print_info (std::ostream &out=libMesh::out)
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 

Protected Types

typedef std::map< std::string,
std::pair< unsigned int,
unsigned int > > 
Counts
 

Protected Member Functions

virtual int SetUseTranspose (bool UseTranspose)
 
virtual int Apply (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 
virtual int ApplyInverse (const Epetra_MultiVector &r, Epetra_MultiVector &z) const
 
virtual double NormInf () const
 
virtual const char * Label () const
 
virtual bool UseTranspose () const
 
virtual bool HasNormInf () const
 
virtual const Epetra_Comm & Comm () const
 
virtual const Epetra_Map & OperatorDomainMap () const
 
virtual const Epetra_Map & OperatorRangeMap () const
 
void increment_constructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 

Protected Attributes

Epetra_Operator * _prec
 
Epetra_FECrsMatrix * _mat
 
Teuchos::ParameterList _param_list
 
SparseMatrix< T > * _matrix
 
PreconditionerType _preconditioner_type
 
bool _is_initialized
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 
static Threads::atomic
< unsigned int > 
_n_objects
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 

Detailed Description

template<typename T>
class libMesh::TrilinosPreconditioner< T >

This class provides an interface to the suite of preconditioners available from Trilinos.

Author
David Andrs, 2011

Definition at line 60 of file trilinos_preconditioner.h.

Member Typedef Documentation

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information. The log is identified by the class name.

Definition at line 113 of file reference_counter.h.

Constructor & Destructor Documentation

template<typename T>
libMesh::TrilinosPreconditioner< T >::TrilinosPreconditioner ( const libMesh::Parallel::Communicator &comm  LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
inline

Constructor. Initializes PetscPreconditioner data structures

Definition at line 145 of file trilinos_preconditioner.h.

145  :
146  Preconditioner<T>(comm),
147  _prec(NULL),
148  _mat(NULL)
149 {
150 }
template<typename T >
libMesh::TrilinosPreconditioner< T >::~TrilinosPreconditioner ( )
inlinevirtual

Destructor.

Definition at line 156 of file trilinos_preconditioner.h.

157 {
158  this->clear ();
159 }

Member Function Documentation

template<typename T >
void libMesh::TrilinosPreconditioner< T >::apply ( const NumericVector< T > &  x,
NumericVector< T > &  y 
)
virtual

Computes the preconditioned vector "y" based on input "x". Usually by solving Py=x to get the action of P^-1 x.

Implements libMesh::Preconditioner< T >.

Definition at line 46 of file trilinos_preconditioner.C.

48 {
49 }
template<typename T >
int libMesh::TrilinosPreconditioner< T >::Apply ( const Epetra_MultiVector &  X,
Epetra_MultiVector &  Y 
) const
protectedvirtual

Definition at line 188 of file trilinos_preconditioner.C.

189 {
190  return _prec->Apply(X, Y);
191 }
template<typename T >
int libMesh::TrilinosPreconditioner< T >::ApplyInverse ( const Epetra_MultiVector &  r,
Epetra_MultiVector &  z 
) const
protectedvirtual

Definition at line 195 of file trilinos_preconditioner.C.

196 {
197  return _prec->ApplyInverse(r, z);
198 }
template<typename T>
Preconditioner< T > * libMesh::Preconditioner< T >::build ( const libMesh::Parallel::Communicator &comm  LIBMESH_CAN_DEFAULT_TO_COMMWORLD,
const SolverPackage  solver_package = libMesh::default_solver_package() 
)
staticinherited

Builds a Preconditioner using the linear solver package specified by solver_package

Definition at line 38 of file preconditioner.C.

References libMesh::comm, libMesh::EIGEN_SOLVERS, libMesh::err, libMeshEnums::PETSC_SOLVERS, and libMesh::TRILINOS_SOLVERS.

40 {
41  // Build the appropriate solver
42  switch (solver_package)
43  {
44 
45 /*
46 #ifdef LIBMESH_HAVE_LASPACK
47  case LASPACK_SOLVERS:
48  {
49  AutoPtr<Preconditioner<T> > ap(new LaspackPreconditioner<T>(comm));
50  return ap;
51  }
52 #endif
53 */
54 
55 #ifdef LIBMESH_HAVE_PETSC
56  case PETSC_SOLVERS:
57  {
58  return new PetscPreconditioner<T>(comm);
59  }
60 #endif
61 
62 #ifdef LIBMESH_HAVE_TRILINOS
63  case TRILINOS_SOLVERS:
64  return new TrilinosPreconditioner<T>(comm);
65 #endif
66 
67 #ifdef LIBMESH_HAVE_EIGEN
68  case EIGEN_SOLVERS:
69  return new EigenPreconditioner<T>(comm);
70 #endif
71 
72  default:
73  libMesh::err << "ERROR: Unrecognized solver package: "
74  << solver_package
75  << std::endl;
76  libmesh_error();
77  }
78 
79  return NULL;
80 }
template<typename T>
virtual void libMesh::TrilinosPreconditioner< T >::clear ( )
inlinevirtual

Release all memory and clear data structures.

Reimplemented from libMesh::Preconditioner< T >.

Definition at line 86 of file trilinos_preconditioner.h.

86 {}
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
a reference to the Parallel::Communicator object used by this mesh.

Definition at line 86 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ParallelMesh::add_elem(), libMesh::ImplicitSystem::add_matrix(), libMesh::ParallelMesh::add_node(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMLibMeshSetSystem(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::for(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::UnstructuredMesh::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().

87  { return _communicator; }
template<typename T >
const Epetra_Comm & libMesh::TrilinosPreconditioner< T >::Comm ( ) const
protectedvirtual

Definition at line 230 of file trilinos_preconditioner.C.

231 {
232  return _prec->Comm();
233 }
template<typename T >
void libMesh::TrilinosPreconditioner< T >::compute ( )

Compute the preconditioner. In Trilinos, we need to call this explicitly.

Definition at line 86 of file trilinos_preconditioner.C.

References libMeshEnums::AMG_PRECOND, libMeshEnums::ILU_PRECOND, and libMeshEnums::SOR_PRECOND.

Referenced by libMesh::Problem_Interface::computePreconditioner().

87 {
88  Ifpack_Preconditioner * ifpack = NULL;
89 #ifdef LIBMESH_HAVE_ML
90  ML_Epetra::MultiLevelPreconditioner * ml = NULL;
91 #endif
92 
93  switch (this->_preconditioner_type)
94  {
95  // IFPACK preconditioners
96  case ILU_PRECOND:
97  case SOR_PRECOND:
98  ifpack = dynamic_cast<Ifpack_Preconditioner *>(_prec);
99  ifpack->Compute();
100  break;
101 
102 #ifdef LIBMESH_HAVE_ML
103  // ML preconditioners
104  case AMG_PRECOND:
105  ml = dynamic_cast<ML_Epetra::MultiLevelPreconditioner *>(_prec);
106  ml->ComputePreconditioner();
107  break;
108 #endif
109 
110  default:
111  // no nothing here
112  break;
113  }
114 }
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

107 {
108  _enable_print_counter = false;
109  return;
110 }
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }
std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
template<typename T >
bool libMesh::TrilinosPreconditioner< T >::HasNormInf ( ) const
protectedvirtual

Definition at line 223 of file trilinos_preconditioner.C.

224 {
225  return _prec->HasNormInf();
226 }
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 163 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

164 {
165  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
166  std::pair<unsigned int, unsigned int>& p = _counts[name];
167 
168  p.first++;
169 }
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectedinherited

Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 176 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

177 {
178  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
179  std::pair<unsigned int, unsigned int>& p = _counts[name];
180 
181  p.second++;
182 }
template<typename T >
void libMesh::TrilinosPreconditioner< T >::init ( )
virtual

Initialize data structures if not done so already.

Reimplemented from libMesh::Preconditioner< T >.

Definition at line 55 of file trilinos_preconditioner.C.

References libMesh::libMeshPrivateData::_is_initialized, libMesh::err, and libMesh::EpetraMatrix< T >::mat().

56 {
57  if(!this->_matrix)
58  {
59  libMesh::err << "ERROR: No matrix set for PetscPreconditioner, but init() called" << std::endl;
60  libmesh_error();
61  }
62 
63  // Clear the preconditioner in case it has been created in the past
64  if (!this->_is_initialized)
65  {
66  EpetraMatrix<T> * matrix = libmesh_cast_ptr<EpetraMatrix<T>*, SparseMatrix<T> >(this->_matrix);
67  _mat = matrix->mat();
68  }
69 
71 
72  this->_is_initialized = true;
73 }
template<typename T>
bool libMesh::Preconditioner< T >::initialized ( ) const
inlineinherited
Returns
true if the data structures are initialized, false otherwise.

Definition at line 89 of file preconditioner.h.

89 { return _is_initialized; }
template<typename T >
const char * libMesh::TrilinosPreconditioner< T >::Label ( ) const
protectedvirtual

Definition at line 209 of file trilinos_preconditioner.C.

210 {
211  return _prec->Label();
212 }
template<typename T>
Epetra_FECrsMatrix* libMesh::TrilinosPreconditioner< T >::mat ( )
inline

Returns the actual Trilinos preconditioner object.

Definition at line 98 of file trilinos_preconditioner.h.

References libMesh::TrilinosPreconditioner< T >::_mat.

Referenced by libMesh::Problem_Interface::computePreconditioner().

98 { return _mat; }
static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 79 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

80  { return _n_objects; }
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
the number of processors in the group.

Definition at line 92 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::UnstructuredMesh::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

93  { return libmesh_cast_int<processor_id_type>(_communicator.size()); }
template<typename T >
double libMesh::TrilinosPreconditioner< T >::NormInf ( ) const
protectedvirtual

Definition at line 202 of file trilinos_preconditioner.C.

203 {
204  return _prec->NormInf();
205 }
template<typename T >
const Epetra_Map & libMesh::TrilinosPreconditioner< T >::OperatorDomainMap ( ) const
protectedvirtual

Definition at line 237 of file trilinos_preconditioner.C.

238 {
239  return _prec->OperatorDomainMap();
240 }
template<typename T >
const Epetra_Map & libMesh::TrilinosPreconditioner< T >::OperatorRangeMap ( ) const
protectedvirtual

Definition at line 244 of file trilinos_preconditioner.C.

245 {
246  return _prec->OperatorRangeMap();
247 }
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 88 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

89 {
91 }
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
the rank of this processor in the group.

Definition at line 98 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO_Helper::create(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::MeshFunction::gradient(), libMesh::MeshFunction::hessian(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::MeshFunction::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::UnstructuredMesh::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshData::read_xdr(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::UnstructuredMesh::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elements_discontinuous(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

99  { return libmesh_cast_int<processor_id_type>(_communicator.rank()); }
template<typename T >
void libMesh::Preconditioner< T >::set_matrix ( SparseMatrix< Number > &  mat)
inherited

Sets the matrix P to be preconditioned.

Definition at line 176 of file preconditioner.h.

References libMesh::libMeshPrivateData::_is_initialized.

177 {
178  //If the matrix is changing then we (probably) need to reinitialize.
179  _is_initialized = false;
180  _matrix = &mat;
181 }
template<typename T >
void libMesh::TrilinosPreconditioner< T >::set_params ( Teuchos::ParameterList &  list)

Definition at line 78 of file trilinos_preconditioner.C.

79 {
80  _param_list = list;
81 }
template<typename T >
void libMesh::TrilinosPreconditioner< T >::set_preconditioner_type ( const PreconditionerType &  preconditioner_type)

Definition at line 119 of file trilinos_preconditioner.C.

References libMeshEnums::AMG_PRECOND, libMeshEnums::ASM_PRECOND, libMeshEnums::BLOCK_JACOBI_PRECOND, libMeshEnums::CHOLESKY_PRECOND, libMeshEnums::EISENSTAT_PRECOND, libMesh::err, libMeshEnums::ICC_PRECOND, libMeshEnums::IDENTITY_PRECOND, libMeshEnums::ILU_PRECOND, libMeshEnums::JACOBI_PRECOND, libMeshEnums::LU_PRECOND, and libMeshEnums::SOR_PRECOND.

120 {
121  Ifpack_Preconditioner * pc = NULL;
122 #ifdef LIBMESH_HAVE_ML
123  ML_Epetra::MultiLevelPreconditioner * ml = NULL;
124 #endif
125 
126  switch (preconditioner_type)
127  {
128  case IDENTITY_PRECOND:
129 // pc = new Ifpack_DiagPreconditioner();
130  break;
131 
132  case CHOLESKY_PRECOND:
133  break;
134 
135  case ICC_PRECOND:
136  break;
137 
138  case ILU_PRECOND:
139  pc = new Ifpack_ILU(_mat);
140  pc->SetParameters(_param_list);
141  pc->Initialize();
142  _prec = pc;
143  break;
144 
145  case LU_PRECOND:
146  break;
147 
148  case ASM_PRECOND:
149  break;
150 
151  case JACOBI_PRECOND:
152  break;
153 
155  break;
156 
157  case SOR_PRECOND:
158  break;
159 
160  case EISENSTAT_PRECOND:
161  break;
162 
163 #ifdef LIBMESH_HAVE_ML
164  case AMG_PRECOND:
165  ml = new ML_Epetra::MultiLevelPreconditioner(*_mat, _param_list, false);;
166  _prec = ml;
167  break;
168 #endif
169 
170  default:
171  libMesh::err << "ERROR: Unsupported Trilinos Preconditioner: "
172  << preconditioner_type << std::endl
173  << "Continuing with Trilinos defaults" << std::endl;
174  }
175 
176 }
template<typename T >
void libMesh::Preconditioner< T >::set_type ( const PreconditionerType  pct)
inherited

Sets the type of preconditioner to use.

Definition at line 185 of file preconditioner.h.

References libMesh::libMeshPrivateData::_is_initialized.

186 {
187  //If the preconditioner type changes we (probably) need to reinitialize.
188  _is_initialized = false;
189  _preconditioner_type = pct;
190 }
template<typename T>
virtual void libMesh::Preconditioner< T >::setup ( )
inlinevirtualinherited

This is called every time the "operator might have changed".

This is essentially where you need to fill in your preconditioning matrix.

Definition at line 114 of file preconditioner.h.

114 {}
template<typename T >
int libMesh::TrilinosPreconditioner< T >::SetUseTranspose ( bool  UseTranspose)
protectedvirtual

Definition at line 181 of file trilinos_preconditioner.C.

182 {
183  return _prec->SetUseTranspose(UseTranspose);
184 }
template<typename T>
PreconditionerType libMesh::Preconditioner< T >::type ( ) const
inlineinherited

Returns the type of preconditioner to use.

Definition at line 124 of file preconditioner.h.

125  { return _preconditioner_type; }
template<typename T >
bool libMesh::TrilinosPreconditioner< T >::UseTranspose ( ) const
protectedvirtual

Definition at line 216 of file trilinos_preconditioner.C.

217 {
218  return _prec->UseTranspose();
219 }

Member Data Documentation

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited
bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 137 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

template<typename T>
bool libMesh::Preconditioner< T >::_is_initialized
protectedinherited

Flag indicating if the data structures have been initialized.

Definition at line 148 of file preconditioner.h.

Referenced by libMesh::Preconditioner< Number >::initialized().

template<typename T>
Epetra_FECrsMatrix* libMesh::TrilinosPreconditioner< T >::_mat
protected

Trilinos matrix that's been pulled out of the _matrix object.

Definition at line 119 of file trilinos_preconditioner.h.

Referenced by libMesh::TrilinosPreconditioner< T >::mat().

template<typename T>
SparseMatrix<T>* libMesh::Preconditioner< T >::_matrix
protectedinherited

The matrix P... ie the matrix to be preconditioned. This is often the actual system matrix of a linear sytem.

Definition at line 138 of file preconditioner.h.

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 131 of file reference_counter.h.

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects. Print the reference count information when the number returns to 0.

Definition at line 126 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

template<typename T>
Teuchos::ParameterList libMesh::TrilinosPreconditioner< T >::_param_list
protected

Parameter list to be used for building the preconditioner

Definition at line 124 of file trilinos_preconditioner.h.

template<typename T>
Epetra_Operator* libMesh::TrilinosPreconditioner< T >::_prec
protected

Trilinos preconditioner

Definition at line 114 of file trilinos_preconditioner.h.

template<typename T>
PreconditionerType libMesh::Preconditioner< T >::_preconditioner_type
protectedinherited

Enum statitng with type of preconditioner to use.

Definition at line 143 of file preconditioner.h.

Referenced by libMesh::Preconditioner< Number >::type().


The documentation for this class was generated from the following files:

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo