libMesh::NumericVector< T > Class Template Reference
#include <numeric_vector.h>

Public Member Functions | |
| NumericVector (const ParallelType ptype=AUTOMATIC) | |
| NumericVector (const numeric_index_type n, const ParallelType ptype=AUTOMATIC) | |
| NumericVector (const numeric_index_type n, const numeric_index_type n_local, const ParallelType ptype=AUTOMATIC) | |
| NumericVector (const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const ParallelType ptype=AUTOMATIC) | |
| virtual | ~NumericVector () |
| virtual bool | initialized () const |
| ParallelType | type () const |
| ParallelType & | type () |
| virtual bool | closed () const |
| virtual void | close ()=0 |
| virtual void | clear () |
| virtual void | zero ()=0 |
| virtual AutoPtr< NumericVector < T > > | zero_clone () const =0 |
| virtual AutoPtr< NumericVector < T > > | clone () const =0 |
| virtual void | init (const numeric_index_type, const numeric_index_type, const bool=false, const ParallelType=AUTOMATIC)=0 |
| virtual void | init (const numeric_index_type, const bool=false, const ParallelType=AUTOMATIC)=0 |
| virtual void | init (const numeric_index_type, const numeric_index_type, const std::vector< numeric_index_type > &, const bool=false, const ParallelType=AUTOMATIC)=0 |
| virtual void | init (const NumericVector< T > &other, const bool fast=false)=0 |
| virtual NumericVector< T > & | operator= (const T s)=0 |
| virtual NumericVector< T > & | operator= (const NumericVector< T > &V)=0 |
| virtual NumericVector< T > & | operator= (const std::vector< T > &v)=0 |
| virtual Real | min () const =0 |
| virtual Real | max () const =0 |
| virtual T | sum () const =0 |
| virtual Real | l1_norm () const =0 |
| virtual Real | l2_norm () const =0 |
| virtual Real | linfty_norm () const =0 |
| virtual Real | subset_l1_norm (const std::set< numeric_index_type > &indices) const |
| virtual Real | subset_l2_norm (const std::set< numeric_index_type > &indices) const |
| virtual Real | subset_linfty_norm (const std::set< numeric_index_type > &indices) const |
| virtual numeric_index_type | size () const =0 |
| virtual numeric_index_type | local_size () const =0 |
| virtual numeric_index_type | first_local_index () const =0 |
| virtual numeric_index_type | last_local_index () const =0 |
| virtual T | operator() (const numeric_index_type i) const =0 |
| virtual T | el (const numeric_index_type i) const |
| virtual void | get (const std::vector< numeric_index_type > &index, std::vector< T > &values) const |
| virtual NumericVector< T > & | operator+= (const NumericVector< T > &V)=0 |
| virtual NumericVector< T > & | operator-= (const NumericVector< T > &V)=0 |
| NumericVector< T > & | operator*= (const T a) |
| NumericVector< T > & | operator/= (const T a) |
| virtual void | reciprocal ()=0 |
| virtual void | set (const numeric_index_type i, const T value)=0 |
| virtual void | add (const numeric_index_type i, const T value)=0 |
| virtual void | add (const T s)=0 |
| virtual void | add (const NumericVector< T > &V)=0 |
| virtual void | add (const T a, const NumericVector< T > &v)=0 |
| virtual void | add_vector (const std::vector< T > &v, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | add_vector (const NumericVector< T > &V, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | add_vector (const NumericVector< T > &, const SparseMatrix< T > &)=0 |
| void | add_vector (const NumericVector< T > &v, const ShellMatrix< T > &a) |
| virtual void | add_vector (const DenseVector< T > &V, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | add_vector_transpose (const NumericVector< T > &, const SparseMatrix< T > &)=0 |
| virtual void | insert (const std::vector< T > &v, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | insert (const NumericVector< T > &V, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | insert (const DenseVector< T > &V, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | insert (const DenseSubVector< T > &V, const std::vector< numeric_index_type > &dof_indices)=0 |
| virtual void | scale (const T factor)=0 |
| virtual void | abs ()=0 |
| virtual T | dot (const NumericVector< T > &) const =0 |
| virtual void | localize (std::vector< T > &v_local) const =0 |
| virtual void | localize (NumericVector< T > &v_local) const =0 |
| virtual void | localize (NumericVector< T > &v_local, const std::vector< numeric_index_type > &send_list) const =0 |
| virtual void | localize (const numeric_index_type first_local_idx, const numeric_index_type last_local_idx, const std::vector< numeric_index_type > &send_list)=0 |
| virtual void | localize_to_one (std::vector< T > &v_local, const processor_id_type proc_id=0) const =0 |
| virtual int | compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const |
| virtual int | local_relative_compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const |
| virtual int | global_relative_compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const |
| virtual void | pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0 |
| virtual void | print (std::ostream &os=libMesh::out) const |
| virtual void | print_global (std::ostream &os=libMesh::out) const |
| virtual void | print_matlab (const std::string name="NULL") const |
| virtual void | create_subvector (NumericVector< T > &, const std::vector< numeric_index_type > &) const |
| virtual void | swap (NumericVector< T > &v) |
| template<> | |
| void | print (std::ostream &os) const |
| template<> | |
| void | print_global (std::ostream &os) const |
Static Public Member Functions | |
| static AutoPtr< NumericVector < T > > | build (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 | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
| bool | _is_closed |
| bool | _is_initialized |
| ParallelType | _type |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const NumericVector< T > &v) |
Detailed Description
template<typename T>
class libMesh::NumericVector< T >
Numeric vector. Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Definition at line 57 of file numeric_vector.h.
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
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
| libMesh::NumericVector< T >::NumericVector | ( | const ParallelType | ptype = AUTOMATIC |
) | [inline, explicit] |
Dummy-Constructor. Dimension=0
Definition at line 649 of file numeric_vector.h.
00649 : 00650 _is_closed(false), 00651 _is_initialized(false), 00652 _type(ptype) 00653 { 00654 }
| libMesh::NumericVector< T >::NumericVector | ( | const numeric_index_type | n, | |
| const ParallelType | ptype = AUTOMATIC | |||
| ) | [inline, explicit] |
Constructor. Set dimension to n and initialize all elements with zero.
Definition at line 660 of file numeric_vector.h.
00661 : 00662 _is_closed(false), 00663 _is_initialized(false), 00664 _type(ptype) 00665 { 00666 libmesh_error(); // Abstract base class! 00667 // init(n, n, false, ptype); 00668 }
| libMesh::NumericVector< T >::NumericVector | ( | const numeric_index_type | n, | |
| const numeric_index_type | n_local, | |||
| const ParallelType | ptype = AUTOMATIC | |||
| ) | [inline] |
Constructor. Set local dimension to n_local, the global dimension to n, and initialize all elements with zero.
Definition at line 674 of file numeric_vector.h.
00676 : 00677 _is_closed(false), 00678 _is_initialized(false), 00679 _type(ptype) 00680 { 00681 libmesh_error(); // Abstract base class! 00682 // init(n, n_local, false, ptype); 00683 }
| libMesh::NumericVector< T >::NumericVector | ( | const numeric_index_type | N, | |
| const numeric_index_type | n_local, | |||
| const std::vector< numeric_index_type > & | ghost, | |||
| const ParallelType | ptype = AUTOMATIC | |||
| ) | [inline] |
Constructor. Set local dimension to n_local, the global dimension to n, but additionally reserve memory for the indices specified by the ghost argument.
Definition at line 689 of file numeric_vector.h.
00692 : 00693 _is_closed(false), 00694 _is_initialized(false), 00695 _type(ptype) 00696 { 00697 libmesh_error(); // Abstract base class! 00698 // init(n, n_local, ghost, false, ptype); 00699 }
| libMesh::NumericVector< T >::~NumericVector | ( | ) | [inline, virtual] |
Destructor, deallocates memory. Made virtual to allow for derived classes to behave properly.
Definition at line 705 of file numeric_vector.h.
References libMesh::NumericVector< T >::clear().
00706 { 00707 clear (); 00708 }
Member Function Documentation
| virtual void libMesh::NumericVector< T >::abs | ( | ) | [pure virtual] |
v = abs(v)... that is, each entry in v is replaced by its absolute value.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::NumericVector< T >::subset_linfty_norm().
| virtual void libMesh::NumericVector< T >::add | ( | const T | a, | |
| const NumericVector< T > & | v | |||
| ) | [pure virtual] |
. Simple vector addition, equal to the operator +=.
| virtual void libMesh::NumericVector< T >::add | ( | const NumericVector< T > & | V | ) | [pure virtual] |
: Simple vector addition, equal to the operator +=.
| virtual void libMesh::NumericVector< T >::add | ( | const T | s | ) | [pure virtual] |
. Addition of s to all components. Note that s is a scalar and not a vector.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::add | ( | const numeric_index_type | i, | |
| const T | value | |||
| ) | [pure virtual] |
v(i) += value
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::ContinuationSystem::continuation_solve(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::NewtonSolver::line_search(), libMesh::NewtonSolver::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::NewmarkSystem::update_rhs(), libMesh::ContinuationSystem::update_solution(), libMesh::NewmarkSystem::update_u_v_a(), and libMesh::TensorShellMatrix< T >::vector_mult_add().
| virtual void libMesh::NumericVector< T >::add_vector | ( | const DenseVector< T > & | V, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
where U and V are type DenseVector<T> and you want to specify WHERE to add the DenseVector<T> V
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| void libMesh::NumericVector< T >::add_vector | ( | const NumericVector< T > & | v, | |
| const ShellMatrix< T > & | a | |||
| ) | [inline] |
, add the product of a ShellMatrix A and a NumericVector V to this, where this=U.
Definition at line 358 of file numeric_vector.C.
References libMesh::ShellMatrix< T >::vector_mult_add().
| virtual void libMesh::NumericVector< T >::add_vector | ( | const NumericVector< T > & | , | |
| const SparseMatrix< T > & | ||||
| ) | [pure virtual] |
, add the product of a SparseMatrix A and a NumericVector V to this, where this=U.
| virtual void libMesh::NumericVector< T >::add_vector | ( | const NumericVector< T > & | V, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
, where U and V are type NumericVector<T> and you want to specify WHERE to add the NumericVector<T> V
| virtual void libMesh::NumericVector< T >::add_vector | ( | const std::vector< T > & | v, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
where v is a DenseVector<T> and you want to specify WHERE to add it
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::LinearImplicitSystem::assembly(), libMesh::NewmarkSystem::update_rhs(), and libMesh::SparseMatrix< T >::vector_mult_add().
| virtual void libMesh::NumericVector< T >::add_vector_transpose | ( | const NumericVector< T > & | , | |
| const SparseMatrix< T > & | ||||
| ) | [pure virtual] |
, add the product of the transpose of a SparseMatrix A_trans and a NumericVector V to this, where this=U.
| AutoPtr< NumericVector< T > > libMesh::NumericVector< T >::build | ( | const SolverPackage | solver_package = libMesh::default_solver_package() |
) | [inline, static] |
Builds a NumericVector using the linear solver package specified by solver_package
Definition at line 45 of file numeric_vector.C.
References libMesh::LASPACK_SOLVERS, libMeshEnums::PETSC_SOLVERS, and libMesh::TRILINOS_SOLVERS.
Referenced by libMesh::ExactErrorEstimator::estimate_error().
00046 { 00047 // Build the appropriate vector 00048 switch (solver_package) 00049 { 00050 00051 00052 #ifdef LIBMESH_HAVE_LASPACK 00053 case LASPACK_SOLVERS: 00054 { 00055 AutoPtr<NumericVector<T> > ap(new LaspackVector<T>); 00056 return ap; 00057 } 00058 #endif 00059 00060 00061 #ifdef LIBMESH_HAVE_PETSC 00062 case PETSC_SOLVERS: 00063 { 00064 AutoPtr<NumericVector<T> > ap(new PetscVector<T>); 00065 return ap; 00066 } 00067 #endif 00068 00069 00070 #ifdef LIBMESH_HAVE_TRILINOS 00071 case TRILINOS_SOLVERS: 00072 { 00073 AutoPtr<NumericVector<T> > ap(new EpetraVector<T>); 00074 return ap; 00075 } 00076 #endif 00077 00078 00079 default: 00080 AutoPtr<NumericVector<T> > ap(new DistributedVector<T>); 00081 return ap; 00082 } 00083 00084 AutoPtr<NumericVector<T> > ap(NULL); 00085 return ap; 00086 }
| void libMesh::NumericVector< T >::clear | ( | ) | [inline, virtual] |
- Returns:
- the
NumericVector<T>to a pristine state.
Reimplemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Definition at line 750 of file numeric_vector.h.
References libMesh::NumericVector< T >::_is_closed, and libMesh::NumericVector< T >::_is_initialized.
Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::project_vector(), and libMesh::NumericVector< T >::~NumericVector().
00751 { 00752 _is_closed = false; 00753 _is_initialized = false; 00754 }
| virtual AutoPtr<NumericVector<T> > libMesh::NumericVector< T >::clone | ( | ) | const [pure virtual] |
Creates a copy of this vector and returns it in an AutoPtr. This must be overloaded in the derived classes.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::SumShellMatrix< T >::get_diagonal(), libMesh::System::project_vector(), libMesh::TwostepTimeSolver::solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().
| virtual void libMesh::NumericVector< T >::close | ( | ) | [pure virtual] |
Call the assemble functions
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::ImplicitSystem::assemble_residual_derivatives(), libMesh::LinearImplicitSystem::assembly(), libMesh::FEMSystem::assembly(), libMesh::System::boundary_project_vector(), libMesh::ContinuationSystem::continuation_solve(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::NewtonSolver::line_search(), libMesh::System::project_vector(), libMesh::System::read_serialized_vector(), libMesh::NoxNonlinearSolver< T >::solve(), libMesh::NewtonSolver::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::ContinuationSystem::update_solution(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().
| virtual bool libMesh::NumericVector< T >::closed | ( | ) | const [inline, virtual] |
- Returns:
- true if the vector is closed and ready for computation, false otherwise.
Definition at line 127 of file numeric_vector.h.
Referenced by libMesh::DofMap::enforce_constraints_exactly(), libMesh::EpetraVector< T >::l1_norm(), libMesh::PetscVector< T >::l1_norm(), libMesh::LaspackVector< T >::l1_norm(), libMesh::EpetraVector< T >::l2_norm(), libMesh::PetscVector< T >::l2_norm(), libMesh::LaspackVector< T >::l2_norm(), libMesh::EpetraVector< T >::linfty_norm(), libMesh::PetscVector< T >::linfty_norm(), libMesh::LaspackVector< T >::linfty_norm(), libMesh::DofMap::max_constraint_error(), libMesh::EpetraVector< T >::operator+=(), libMesh::PetscVector< T >::operator+=(), libMesh::LaspackVector< T >::operator+=(), libMesh::DistributedVector< T >::operator+=(), libMesh::EpetraVector< T >::operator-=(), libMesh::PetscVector< T >::operator-=(), libMesh::LaspackVector< T >::operator-=(), libMesh::DistributedVector< T >::operator-=(), libMesh::PetscVector< T >::operator=(), libMesh::LaspackVector< T >::operator=(), libMesh::PetscVector< T >::print_matlab(), libMesh::EpetraVector< T >::sum(), libMesh::PetscVector< T >::sum(), libMesh::LaspackVector< T >::sum(), libMesh::EpetraVector< T >::zero(), libMesh::PetscVector< T >::zero(), and libMesh::LaspackVector< T >::zero().
00127 { return _is_closed; }
| int libMesh::NumericVector< T >::compare | ( | const NumericVector< T > & | other_vector, | |
| const Real | threshold = TOLERANCE | |||
| ) | const [inline, virtual] |
- Returns:
-1whenthisis equivalent toother_vector, up to the giventhreshold. When differences occur, the return value contains the first indexiwhere the difference(a[i]-b[i]) exceeded the threshold. When no threshold is given, thelibMeshTOLERANCEis used.
Definition at line 90 of file numeric_vector.C.
References std::abs(), libMesh::CommWorld, libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::last_local_index(), std::max(), libMesh::NumericVector< T >::max(), and libMesh::Parallel::Communicator::min().
00092 { 00093 libmesh_assert (this->initialized()); 00094 libmesh_assert (other_vector.initialized()); 00095 libmesh_assert_equal_to (this->first_local_index(), other_vector.first_local_index()); 00096 libmesh_assert_equal_to (this->last_local_index(), other_vector.last_local_index()); 00097 00098 int first_different_i = std::numeric_limits<int>::max(); 00099 numeric_index_type i = first_local_index(); 00100 00101 do 00102 { 00103 if ( std::abs( (*this)(i) - other_vector(i) ) > threshold ) 00104 first_different_i = i; 00105 else 00106 i++; 00107 } 00108 while (first_different_i==std::numeric_limits<int>::max() 00109 && i<last_local_index()); 00110 00111 // Find the correct first differing index in parallel 00112 CommWorld.min(first_different_i); 00113 00114 if (first_different_i == std::numeric_limits<int>::max()) 00115 return -1; 00116 00117 return first_different_i; 00118 }
| virtual void libMesh::NumericVector< T >::create_subvector | ( | NumericVector< T > & | , | |
| const std::vector< numeric_index_type > & | ||||
| ) | const [inline, virtual] |
Creates the subvector "subvector" from the indices in the "rows" array. Similar to the create_submatrix routine for the SparseMatrix class, it is currently only implemented for PetscVectors.
Definition at line 608 of file numeric_vector.h.
00610 { 00611 libMesh::err << "ERROR: Not Implemented in base class yet!" << std::endl; 00612 libmesh_error(); 00613 }
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
00107 { 00108 _enable_print_counter = false; 00109 return; 00110 }
| virtual T libMesh::NumericVector< T >::dot | ( | const NumericVector< T > & | ) | const [pure virtual] |
Computes the dot product, p = U.V
Referenced by libMesh::ContinuationSystem::continuation_solve(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ContinuationSystem::solve_tangent(), and libMesh::ContinuationSystem::update_solution().
| virtual T libMesh::NumericVector< T >::el | ( | const numeric_index_type | i | ) | const [inline, virtual] |
- Returns:
- the element
U(i)
Definition at line 324 of file numeric_vector.h.
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
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.
00101 { 00102 _enable_print_counter = true; 00103 return; 00104 }
| virtual numeric_index_type libMesh::NumericVector< T >::first_local_index | ( | ) | const [pure virtual] |
- Returns:
- the index of the first vector element actually stored on this processor. Hint: the minimum for this index is
0.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::NumericVector< T >::compare(), libMesh::DofMap::extract_local_vector(), libMesh::NumericVector< T >::global_relative_compare(), libMesh::NumericVector< T >::local_relative_compare(), libMesh::DofMap::max_constraint_error(), libMesh::BoundaryProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::ProjectSolution::operator()(), libMesh::NumericVector< T >::print(), libMesh::System::read_serialized_blocked_dof_objects(), and libMesh::System::write_serialized_blocked_dof_objects().
| void libMesh::NumericVector< T >::get | ( | const std::vector< numeric_index_type > & | index, | |
| std::vector< T > & | values | |||
| ) | const [inline, virtual] |
Access multiple components at once. values will be resized, if necessary, and filled. The default implementation calls operator() for each index, but some implementations may supply faster methods here.
Reimplemented in libMesh::PetscVector< T >.
Definition at line 760 of file numeric_vector.h.
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
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().
00048 { 00049 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00050 00051 std::ostringstream oss; 00052 00053 oss << '\n' 00054 << " ---------------------------------------------------------------------------- \n" 00055 << "| Reference count information |\n" 00056 << " ---------------------------------------------------------------------------- \n"; 00057 00058 for (Counts::iterator it = _counts.begin(); 00059 it != _counts.end(); ++it) 00060 { 00061 const std::string name(it->first); 00062 const unsigned int creations = it->second.first; 00063 const unsigned int destructions = it->second.second; 00064 00065 oss << "| " << name << " reference count information:\n" 00066 << "| Creations: " << creations << '\n' 00067 << "| Destructions: " << destructions << '\n'; 00068 } 00069 00070 oss << " ---------------------------------------------------------------------------- \n"; 00071 00072 return oss.str(); 00073 00074 #else 00075 00076 return ""; 00077 00078 #endif 00079 }
| int libMesh::NumericVector< T >::global_relative_compare | ( | const NumericVector< T > & | other_vector, | |
| const Real | threshold = TOLERANCE | |||
| ) | const [inline, virtual] |
- Returns:
-1whenthisis equivalent toother_vector, up to the given local relativethreshold. When differences occur, the return value contains the first index where the difference(a[i]-b[i])/max_j(a[j],b[j]) exceeded the threshold. When no threshold is given, thelibMeshTOLERANCEis used.
Definition at line 155 of file numeric_vector.C.
References std::abs(), libMesh::CommWorld, libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::linfty_norm(), std::max(), libMesh::NumericVector< T >::max(), libMesh::Parallel::Communicator::min(), and libMesh::Real.
00157 { 00158 libmesh_assert (this->initialized()); 00159 libmesh_assert (other_vector.initialized()); 00160 libmesh_assert_equal_to (this->first_local_index(), other_vector.first_local_index()); 00161 libmesh_assert_equal_to (this->last_local_index(), other_vector.last_local_index()); 00162 00163 int first_different_i = std::numeric_limits<int>::max(); 00164 numeric_index_type i = first_local_index(); 00165 00166 const Real my_norm = this->linfty_norm(); 00167 const Real other_norm = other_vector.linfty_norm(); 00168 const Real abs_threshold = std::max(my_norm, other_norm) * threshold; 00169 00170 do 00171 { 00172 if ( std::abs( (*this)(i) - other_vector(i) ) > abs_threshold ) 00173 first_different_i = i; 00174 else 00175 i++; 00176 } 00177 while (first_different_i==std::numeric_limits<int>::max() 00178 && i<last_local_index()); 00179 00180 // Find the correct first differing index in parallel 00181 CommWorld.min(first_different_i); 00182 00183 if (first_different_i == std::numeric_limits<int>::max()) 00184 return -1; 00185 00186 return first_different_i; 00187 }
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
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, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
00164 { 00165 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00166 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00167 00168 p.first++; 00169 }
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
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, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
00177 { 00178 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00179 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00180 00181 p.second++; 00182 }
| virtual void libMesh::NumericVector< T >::init | ( | const NumericVector< T > & | other, | |
| const bool | fast = false | |||
| ) | [pure virtual] |
Creates a vector that has the same dimension and storage type as other, including ghost dofs.
| virtual void libMesh::NumericVector< T >::init | ( | const | numeric_index_type, | |
| const | numeric_index_type, | |||
| const std::vector< numeric_index_type > & | , | |||
| const | bool = false, |
|||
| const | ParallelType = AUTOMATIC | |||
| ) | [pure virtual] |
Create a vector that holds tha local indices plus those specified in the ghost argument.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::init | ( | const | numeric_index_type, | |
| const | bool = false, |
|||
| const | ParallelType = AUTOMATIC | |||
| ) | [pure virtual] |
call init with n_local = N,
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::init | ( | const | numeric_index_type, | |
| const | numeric_index_type, | |||
| const | bool = false, |
|||
| const | ParallelType = AUTOMATIC | |||
| ) | [pure virtual] |
Change the dimension of the vector to N. The reserved memory for this vector remains unchanged if possible, to make things faster, but this may waste some memory, so take this in the back of your head. However, if N==0 all memory is freed, i.e. if you want to resize the vector and release the memory not needed, you have to first call init(0) and then init(N). This cited behaviour is analogous to that of the STL containers.
On fast==false, the vector is filled by zeros.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::System::add_vector(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::System::project_vector().
| virtual bool libMesh::NumericVector< T >::initialized | ( | ) | const [inline, virtual] |
- Returns:
- true if the vector has been initialized, false otherwise.
Definition at line 111 of file numeric_vector.h.
Referenced by libMesh::PetscVector< T >::_get_array(), libMesh::PetscVector< T >::_restore_array(), libMesh::LaspackVector< T >::abs(), libMesh::DistributedVector< T >::abs(), libMesh::LaspackVector< T >::add(), libMesh::DistributedVector< T >::add(), libMesh::DistributedVector< T >::add_vector(), libMesh::ImplicitSystem::assemble(), libMesh::EpetraVector< T >::clear(), libMesh::PetscVector< T >::clear(), libMesh::LaspackVector< T >::clear(), libMesh::EpetraVector< T >::close(), libMesh::LaspackVector< T >::close(), libMesh::DistributedVector< T >::close(), libMesh::NumericVector< T >::compare(), libMesh::PetscVector< T >::create_subvector(), libMesh::LaspackVector< T >::dot(), libMesh::EpetraVector< T >::first_local_index(), libMesh::PetscVector< T >::first_local_index(), libMesh::LaspackVector< T >::first_local_index(), libMesh::DistributedVector< T >::first_local_index(), libMesh::NumericVector< T >::global_relative_compare(), libMesh::PetscVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::DistributedVector< T >::insert(), libMesh::DistributedVector< T >::l1_norm(), libMesh::DistributedVector< T >::l2_norm(), libMesh::EpetraVector< T >::last_local_index(), libMesh::PetscVector< T >::last_local_index(), libMesh::LaspackVector< T >::last_local_index(), libMesh::DistributedVector< T >::last_local_index(), libMesh::DistributedVector< T >::linfty_norm(), libMesh::NumericVector< T >::local_relative_compare(), libMesh::EpetraVector< T >::local_size(), libMesh::PetscVector< T >::local_size(), libMesh::LaspackVector< T >::local_size(), libMesh::DistributedVector< T >::local_size(), libMesh::DistributedVector< T >::localize(), libMesh::DistributedVector< T >::localize_to_one(), libMesh::PetscVector< T >::map_global_to_local_index(), libMesh::EpetraVector< T >::max(), libMesh::LaspackVector< T >::max(), libMesh::DistributedVector< T >::max(), libMesh::EpetraVector< T >::min(), libMesh::LaspackVector< T >::min(), libMesh::DistributedVector< T >::min(), libMesh::EpetraVector< T >::operator()(), libMesh::LaspackVector< T >::operator()(), libMesh::DistributedVector< T >::operator()(), libMesh::DistributedVector< T >::operator+=(), libMesh::DistributedVector< T >::operator-=(), libMesh::LaspackVector< T >::operator=(), libMesh::DistributedVector< T >::operator=(), libMesh::NumericVector< T >::print(), libMesh::NumericVector< T >::print_global(), libMesh::LaspackVector< T >::scale(), libMesh::DistributedVector< T >::scale(), libMesh::LaspackVector< T >::set(), libMesh::DistributedVector< T >::set(), libMesh::EpetraVector< T >::size(), libMesh::PetscVector< T >::size(), libMesh::LaspackVector< T >::size(), libMesh::DistributedVector< T >::size(), libMesh::DistributedVector< T >::sum(), libMesh::EpetraVector< T >::zero(), libMesh::LaspackVector< T >::zero(), and libMesh::DistributedVector< T >::zero().
00111 { return _is_initialized; }
| virtual void libMesh::NumericVector< T >::insert | ( | const DenseSubVector< T > & | V, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
where V is a DenseSubVector<T> and you want to specify WHERE to insert it
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::insert | ( | const DenseVector< T > & | V, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
where U and V are type DenseVector<T> and you want to specify WHERE to insert the DenseVector<T> V
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::insert | ( | const NumericVector< T > & | V, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
, where U and V are type NumericVector<T> and you want to specify WHERE to insert the NumericVector<T> V
| virtual void libMesh::NumericVector< T >::insert | ( | const std::vector< T > & | v, | |
| const std::vector< numeric_index_type > & | dof_indices | |||
| ) | [pure virtual] |
where v is a std::vector<T> and you want to specify WHERE to insert it
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual Real libMesh::NumericVector< T >::l1_norm | ( | ) | const [pure virtual] |
- Returns:
- the
-norm of the vector, i.e. the sum of the absolute values.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::FEMSystem::assembly(), and libMesh::System::calculate_norm().
| virtual Real libMesh::NumericVector< T >::l2_norm | ( | ) | const [pure virtual] |
- Returns:
- the
-norm of the vector, i.e. the square root of the sum of the squares of the elements.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::System::calculate_norm(), libMesh::ContinuationSystem::continuation_solve(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::NewtonSolver::line_search(), libMesh::NewtonSolver::solve(), libMesh::ContinuationSystem::solve_tangent(), and libMesh::ContinuationSystem::update_solution().
| virtual numeric_index_type libMesh::NumericVector< T >::last_local_index | ( | ) | const [pure virtual] |
- Returns:
- the index+1 of the last vector element actually stored on this processor. Hint: the maximum for this index is
size().
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::NumericVector< T >::compare(), libMesh::DofMap::extract_local_vector(), libMesh::NumericVector< T >::global_relative_compare(), libMesh::NumericVector< T >::local_relative_compare(), libMesh::DofMap::max_constraint_error(), libMesh::BoundaryProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::ProjectSolution::operator()(), libMesh::NumericVector< T >::print(), libMesh::System::read_serialized_blocked_dof_objects(), and libMesh::System::write_serialized_blocked_dof_objects().
| virtual Real libMesh::NumericVector< T >::linfty_norm | ( | ) | const [pure virtual] |
- Returns:
- the maximum absolute value of the elements of this vector, which is the
-norm of a vector.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::System::calculate_norm(), and libMesh::NumericVector< T >::global_relative_compare().
| int libMesh::NumericVector< T >::local_relative_compare | ( | const NumericVector< T > & | other_vector, | |
| const Real | threshold = TOLERANCE | |||
| ) | const [inline, virtual] |
- Returns:
-1whenthisis equivalent toother_vector, up to the given local relativethreshold. When differences occur, the return value contains the first index where the difference(a[i]-b[i])/max(a[i],b[i]) exceeded the threshold. When no threshold is given, thelibMeshTOLERANCEis used.
Definition at line 122 of file numeric_vector.C.
References std::abs(), libMesh::CommWorld, libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::last_local_index(), std::max(), libMesh::NumericVector< T >::max(), and libMesh::Parallel::Communicator::min().
00124 { 00125 libmesh_assert (this->initialized()); 00126 libmesh_assert (other_vector.initialized()); 00127 libmesh_assert_equal_to (this->first_local_index(), other_vector.first_local_index()); 00128 libmesh_assert_equal_to (this->last_local_index(), other_vector.last_local_index()); 00129 00130 int first_different_i = std::numeric_limits<int>::max(); 00131 numeric_index_type i = first_local_index(); 00132 00133 do 00134 { 00135 if ( std::abs( (*this)(i) - other_vector(i) ) > threshold * 00136 std::max(std::abs((*this)(i)), std::abs(other_vector(i)))) 00137 first_different_i = i; 00138 else 00139 i++; 00140 } 00141 while (first_different_i==std::numeric_limits<int>::max() 00142 && i<last_local_index()); 00143 00144 // Find the correct first differing index in parallel 00145 CommWorld.min(first_different_i); 00146 00147 if (first_different_i == std::numeric_limits<int>::max()) 00148 return -1; 00149 00150 return first_different_i; 00151 }
| virtual numeric_index_type libMesh::NumericVector< T >::local_size | ( | ) | const [pure virtual] |
- Returns:
- the local size of the vector (index_stop-index_start). In ghost cell mode, this does *not* include the ghost cells.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::PetscLinearSolver< T >::adjoint_solve(), libMesh::EpetraVector< T >::init(), libMesh::LaspackVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::NumericVector< T >::print(), libMesh::System::project_vector(), and libMesh::PetscLinearSolver< T >::solve().
| virtual void libMesh::NumericVector< T >::localize | ( | const numeric_index_type | first_local_idx, | |
| const numeric_index_type | last_local_idx, | |||
| const std::vector< numeric_index_type > & | send_list | |||
| ) | [pure virtual] |
Updates a local vector with selected values from neighboring processors, as defined by send_list.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::localize | ( | NumericVector< T > & | v_local, | |
| const std::vector< numeric_index_type > & | send_list | |||
| ) | const [pure virtual] |
Creates a local vector v_local containing only information relevant to this processor, as defined by the send_list.
| virtual void libMesh::NumericVector< T >::localize | ( | NumericVector< T > & | v_local | ) | const [pure virtual] |
Same, but fills a NumericVector<T> instead of a std::vector.
| virtual void libMesh::NumericVector< T >::localize | ( | std::vector< T > & | v_local | ) | const [pure virtual] |
Creates a copy of the global vector in the local vector v_local.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::System::calculate_norm(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::NumericVector< T >::print_global(), libMesh::System::project_vector(), and libMesh::UnsteadySolver::retrieve_timestep().
| virtual void libMesh::NumericVector< T >::localize_to_one | ( | std::vector< T > & | v_local, | |
| const processor_id_type | proc_id = 0 | |||
| ) | const [pure virtual] |
Creates a local copy of the global vector in v_local only on processor proc_id. By default the data is sent to processor 0. This method is useful for outputting data from one processor.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual Real libMesh::NumericVector< T >::max | ( | ) | const [pure virtual] |
- Returns:
- the maximum element in the vector. In case of complex numbers, this returns the maximum Real part.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::NumericVector< T >::compare(), libMesh::NumericVector< T >::global_relative_compare(), and libMesh::NumericVector< T >::local_relative_compare().
| virtual Real libMesh::NumericVector< T >::min | ( | ) | const [pure virtual] |
- Returns:
- the minimum element in the vector. In case of complex numbers, this returns the minimum Real part.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
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.
00080 { return _n_objects; }
| virtual T libMesh::NumericVector< T >::operator() | ( | const numeric_index_type | i | ) | const [pure virtual] |
Access components, returns U(i).
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| NumericVector<T>& libMesh::NumericVector< T >::operator*= | ( | const T | a | ) | [inline] |
Multiplication operator. Equivalent to U.scale(a)
Definition at line 350 of file numeric_vector.h.
00350 { this->scale(a); return *this; }
| virtual NumericVector<T>& libMesh::NumericVector< T >::operator+= | ( | const NumericVector< T > & | V | ) | [pure virtual] |
Addition operator. Fast equivalent to U.add(1, V).
| virtual NumericVector<T>& libMesh::NumericVector< T >::operator-= | ( | const NumericVector< T > & | V | ) | [pure virtual] |
Subtraction operator. Fast equivalent to U.add(-1, V).
| NumericVector<T>& libMesh::NumericVector< T >::operator/= | ( | const T | a | ) | [inline] |
Division operator. Equivalent to U.scale(1./a)
Definition at line 356 of file numeric_vector.h.
00356 { this->scale(1./a); return *this; }
| virtual NumericVector<T>& libMesh::NumericVector< T >::operator= | ( | const std::vector< T > & | v | ) | [pure virtual] |
: copy all components.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual NumericVector<T>& libMesh::NumericVector< T >::operator= | ( | const NumericVector< T > & | V | ) | [pure virtual] |
: copy all components.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual NumericVector<T>& libMesh::NumericVector< T >::operator= | ( | const T | s | ) | [pure virtual] |
: fill all components.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::pointwise_mult | ( | const NumericVector< T > & | vec1, | |
| const NumericVector< T > & | vec2 | |||
| ) | [pure virtual] |
Computes the pointwise (i.e. component-wise) product of vec1 and vec2 and stores the result in *this.
Referenced by libMesh::TensorShellMatrix< T >::get_diagonal().
| void libMesh::NumericVector< Complex >::print | ( | std::ostream & | os | ) | const [inline] |
Definition at line 777 of file numeric_vector.h.
References libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::local_size(), and libMesh::NumericVector< T >::size().
00778 { 00779 libmesh_assert (this->initialized()); 00780 os << "Size\tglobal = " << this->size() 00781 << "\t\tlocal = " << this->local_size() << std::endl; 00782 00783 // std::complex<>::operator<<() is defined, but use this form 00784 os << "#\tReal part\t\tImaginary part" << std::endl; 00785 for (numeric_index_type i=this->first_local_index(); i<this->last_local_index(); i++) 00786 os << i << "\t" 00787 << (*this)(i).real() << "\t\t" 00788 << (*this)(i).imag() << std::endl; 00789 }
| void libMesh::NumericVector< T >::print | ( | std::ostream & | os = libMesh::out |
) | const [inline, virtual] |
Prints the local contents of the vector, by default to libMesh::out
Definition at line 795 of file numeric_vector.h.
References libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::local_size(), and libMesh::NumericVector< T >::size().
00796 { 00797 libmesh_assert (this->initialized()); 00798 os << "Size\tglobal = " << this->size() 00799 << "\t\tlocal = " << this->local_size() << std::endl; 00800 00801 os << "#\tValue" << std::endl; 00802 for (numeric_index_type i=this->first_local_index(); i<this->last_local_index(); i++) 00803 os << i << "\t" << (*this)(i) << std::endl; 00804 }
| void libMesh::NumericVector< Complex >::print_global | ( | std::ostream & | os | ) | const [inline] |
Definition at line 810 of file numeric_vector.h.
References libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::localize(), libMesh::processor_id(), and libMesh::NumericVector< T >::size().
00811 { 00812 libmesh_assert (this->initialized()); 00813 00814 std::vector<Complex> v(this->size()); 00815 this->localize(v); 00816 00817 // Right now we only want one copy of the output 00818 if (libMesh::processor_id()) 00819 return; 00820 00821 os << "Size\tglobal = " << this->size() << std::endl; 00822 os << "#\tReal part\t\tImaginary part" << std::endl; 00823 for (numeric_index_type i=0; i!=v.size(); i++) 00824 os << i << "\t" 00825 << v[i].real() << "\t\t" 00826 << v[i].imag() << std::endl; 00827 }
| void libMesh::NumericVector< T >::print_global | ( | std::ostream & | os = libMesh::out |
) | const [inline, virtual] |
Prints the global contents of the vector, by default to libMesh::out
Definition at line 832 of file numeric_vector.h.
References libMesh::NumericVector< T >::initialized(), libMesh::NumericVector< T >::localize(), libMesh::processor_id(), and libMesh::NumericVector< T >::size().
00833 { 00834 libmesh_assert (this->initialized()); 00835 00836 std::vector<T> v(this->size()); 00837 this->localize(v); 00838 00839 // Right now we only want one copy of the output 00840 if (libMesh::processor_id()) 00841 return; 00842 00843 os << "Size\tglobal = " << this->size() << std::endl; 00844 os << "#\tValue" << std::endl; 00845 for (numeric_index_type i=0; i!=v.size(); i++) 00846 os << i << "\t" << v[i] << std::endl; 00847 }
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out |
) | [static, inherited] |
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().
00089 { 00090 if( _enable_print_counter ) out_stream << ReferenceCounter::get_info(); 00091 }
| virtual void libMesh::NumericVector< T >::print_matlab | ( | const std::string | name = "NULL" |
) | const [inline, virtual] |
Print the contents of the matrix in Matlab's sparse matrix format. Optionally prints the matrix to the file named name. If name is not specified it is dumped to the screen.
Reimplemented in libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Definition at line 595 of file numeric_vector.h.
00596 { 00597 libMesh::err << "ERROR: Not Implemented in base class yet!" << std::endl; 00598 libMesh::err << "ERROR writing MATLAB file " << name << std::endl; 00599 libmesh_error(); 00600 }
| virtual void libMesh::NumericVector< T >::reciprocal | ( | ) | [pure virtual] |
Replace each entry v_i of this vector by its reciprocal, 1/v_i.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| virtual void libMesh::NumericVector< T >::scale | ( | const T | factor | ) | [pure virtual] |
Scale each element of the vector by the given factor.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::ContinuationSystem::continuation_solve(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::NumericVector< Number >::operator*=(), libMesh::NumericVector< Number >::operator/=(), libMesh::ContinuationSystem::solve_tangent(), libMesh::NewmarkSystem::update_u_v_a(), and libMesh::TensorShellMatrix< T >::vector_mult().
| virtual void libMesh::NumericVector< T >::set | ( | const numeric_index_type | i, | |
| const T | value | |||
| ) | [pure virtual] |
v(i) = value
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::DofMap::enforce_constraints_exactly(), libMesh::BoundaryProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::ProjectSolution::operator()(), libMesh::System::project_vector(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), and libMesh::System::zero_variable().
| virtual numeric_index_type libMesh::NumericVector< T >::size | ( | ) | const [pure virtual] |
- Returns:
- dimension of the vector. This function was formerly called
n(), but was renamed to get theNumericVector<T>class closer to the C++ standard library'sstd::vectorcontainer.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::PetscVector< T >::add_vector(), libMesh::LaspackVector< T >::add_vector(), libMesh::DistributedVector< T >::add_vector(), libMesh::System::calculate_norm(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::DofMap::extract_local_vector(), libMesh::EpetraVector< T >::init(), libMesh::LaspackVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::PetscVector< T >::insert(), libMesh::LaspackVector< T >::insert(), libMesh::DistributedVector< T >::insert(), libMesh::NumericVector< T >::print(), libMesh::NumericVector< T >::print_global(), libMesh::System::project_vector(), libMesh::PetscLinearSolver< T >::solve(), and libMesh::System::write_serialized_vector().
| Real libMesh::NumericVector< T >::subset_l1_norm | ( | const std::set< numeric_index_type > & | indices | ) | const [inline, virtual] |
- Returns:
- the
-norm of the vector, i.e. the sum of the absolute values for the specified entries in the vector.
Note that the indices must necessary live on this processor.
Definition at line 298 of file numeric_vector.C.
References std::abs(), libMesh::CommWorld, libMesh::Real, and libMesh::Parallel::Communicator::sum().
Referenced by libMesh::System::discrete_var_norm().
00299 { 00300 const NumericVector<T> & v = *this; 00301 00302 std::set<numeric_index_type>::const_iterator it = indices.begin(); 00303 const std::set<numeric_index_type>::const_iterator it_end = indices.end(); 00304 00305 Real norm = 0; 00306 00307 for(; it!=it_end; ++it) 00308 norm += std::abs(v(*it)); 00309 00310 CommWorld.sum(norm); 00311 00312 return norm; 00313 }
| Real libMesh::NumericVector< T >::subset_l2_norm | ( | const std::set< numeric_index_type > & | indices | ) | const [inline, virtual] |
- Returns:
- the
-norm of the vector, i.e. the square root of the sum of the squares of the elements for the specified entries in the vector.
Note that the indices must necessary live on this processor.
Definition at line 316 of file numeric_vector.C.
References libMesh::CommWorld, libMesh::TensorTools::norm_sq(), libMesh::Real, and libMesh::Parallel::Communicator::sum().
Referenced by libMesh::System::discrete_var_norm().
00317 { 00318 const NumericVector<T> & v = *this; 00319 00320 std::set<numeric_index_type>::const_iterator it = indices.begin(); 00321 const std::set<numeric_index_type>::const_iterator it_end = indices.end(); 00322 00323 Real norm = 0; 00324 00325 for(; it!=it_end; ++it) 00326 norm += TensorTools::norm_sq(v(*it)); 00327 00328 CommWorld.sum(norm); 00329 00330 return std::sqrt(norm); 00331 }
| Real libMesh::NumericVector< T >::subset_linfty_norm | ( | const std::set< numeric_index_type > & | indices | ) | const [inline, virtual] |
- Returns:
- the maximum absolute value of the specified entries of this vector, which is the
-norm of a vector.
Note that the indices must necessary live on this processor.
Definition at line 334 of file numeric_vector.C.
References libMesh::NumericVector< T >::abs(), libMesh::CommWorld, libMesh::Parallel::Communicator::max(), and libMesh::Real.
Referenced by libMesh::System::discrete_var_norm().
00335 { 00336 const NumericVector<T> & v = *this; 00337 00338 std::set<numeric_index_type>::const_iterator it = indices.begin(); 00339 const std::set<numeric_index_type>::const_iterator it_end = indices.end(); 00340 00341 Real norm = 0; 00342 00343 for(; it!=it_end; ++it) 00344 { 00345 Real value = std::abs(v(*it)); 00346 if(value > norm) 00347 norm = value; 00348 } 00349 00350 CommWorld.max(norm); 00351 00352 return norm; 00353 }
| virtual T libMesh::NumericVector< T >::sum | ( | ) | const [pure virtual] |
returns the sum of the elements in a vector
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
| void libMesh::NumericVector< T >::swap | ( | NumericVector< T > & | v | ) | [inline, virtual] |
Exchanges the values/sizes of two vectors. There should be enough indirection in subclasses to make this an O(1) header-swap operation.
Definition at line 853 of file numeric_vector.h.
References libMesh::NumericVector< T >::_is_closed, libMesh::NumericVector< T >::_is_initialized, and libMesh::NumericVector< T >::_type.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), and libMesh::AdjointRefinementEstimator::estimate_error().
00854 { 00855 std::swap(_is_closed, v._is_closed); 00856 std::swap(_is_initialized, v._is_initialized); 00857 std::swap(_type, v._type); 00858 }
| ParallelType& libMesh::NumericVector< T >::type | ( | ) | [inline] |
- Returns:
- the type (SERIAL, PARALLEL, GHOSTED) of the vector.
Definition at line 121 of file numeric_vector.h.
00121 { return _type; }
| ParallelType libMesh::NumericVector< T >::type | ( | ) | const [inline] |
- Returns:
- the type (SERIAL, PARALLEL, GHOSTED) of the vector.
Definition at line 116 of file numeric_vector.h.
Referenced by libMesh::PetscVector< T >::_get_array(), libMesh::PetscVector< T >::_restore_array(), libMesh::PetscVector< T >::abs(), libMesh::PetscVector< T >::add(), libMesh::PetscVector< T >::close(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::PetscVector< T >::get(), libMesh::MeshFunction::gradient(), libMesh::MeshFunction::hessian(), libMesh::EpetraVector< T >::init(), libMesh::LaspackVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::PetscVector< T >::localize(), libMesh::PetscVector< T >::operator()(), libMesh::MeshFunction::operator()(), libMesh::PetscVector< T >::operator=(), libMesh::PetscVector< T >::pointwise_mult(), libMesh::System::project_vector(), libMesh::System::read_serialized_vector(), libMesh::PetscVector< T >::scale(), and libMesh::PetscVector< T >::zero().
00116 { return _type; }
| virtual void libMesh::NumericVector< T >::zero | ( | ) | [pure virtual] |
Set all entries to zero. Equivalent to v = 0, but more obvious and faster.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::ImplicitSystem::assemble(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::ContinuationSystem::continuation_solve(), libMesh::SumShellMatrix< T >::get_diagonal(), libMesh::NewmarkSystem::initial_conditions(), libMesh::NewtonSolver::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::NewmarkSystem::update_rhs(), libMesh::SumShellMatrix< T >::vector_mult(), and libMesh::SparseMatrix< T >::vector_mult().
| virtual AutoPtr<NumericVector<T> > libMesh::NumericVector< T >::zero_clone | ( | ) | const [pure virtual] |
Creates a vector which has the same type, size and partitioning as this vector, but whose data is all zero. Returns it in an AutoPtr. This must be overloaded in the derived classes.
Implemented in libMesh::DistributedVector< T >, libMesh::LaspackVector< T >, libMesh::PetscVector< T >, and libMesh::EpetraVector< T >.
Referenced by libMesh::NewtonSolver::solve(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
Friends And Related Function Documentation
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const NumericVector< T > & | v | |||
| ) | [friend] |
Same as above but allows you to use stream syntax.
Definition at line 583 of file numeric_vector.h.
Member Data Documentation
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
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().
bool libMesh::NumericVector< T >::_is_closed [protected] |
Flag to see if the Numeric assemble routines have been called yet
Definition at line 628 of file numeric_vector.h.
Referenced by libMesh::EpetraVector< T >::add(), libMesh::PetscVector< T >::add(), libMesh::LaspackVector< T >::add(), libMesh::EpetraVector< T >::clear(), libMesh::PetscVector< T >::clear(), libMesh::NumericVector< T >::clear(), libMesh::LaspackVector< T >::clear(), libMesh::DistributedVector< T >::clear(), libMesh::EpetraVector< T >::close(), libMesh::PetscVector< T >::close(), libMesh::LaspackVector< T >::close(), libMesh::DistributedVector< T >::close(), libMesh::NumericVector< Number >::closed(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::EpetraVector< T >::init(), libMesh::PetscVector< T >::init(), libMesh::DistributedVector< T >::localize(), libMesh::LaspackVector< T >::operator=(), libMesh::DistributedVector< T >::operator=(), libMesh::PetscVector< T >::PetscVector(), libMesh::PetscVector< T >::set(), libMesh::LaspackVector< T >::set(), and libMesh::NumericVector< T >::swap().
bool libMesh::NumericVector< T >::_is_initialized [protected] |
Flag to tell if init has been called yet
Definition at line 634 of file numeric_vector.h.
Referenced by libMesh::EpetraVector< T >::clear(), libMesh::PetscVector< T >::clear(), libMesh::NumericVector< T >::clear(), libMesh::LaspackVector< T >::clear(), libMesh::DistributedVector< T >::clear(), libMesh::PetscVector< T >::create_subvector(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::EpetraVector< T >::init(), libMesh::PetscVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::NumericVector< Number >::initialized(), libMesh::DistributedVector< T >::localize(), libMesh::DistributedVector< T >::operator=(), libMesh::PetscVector< T >::PetscVector(), and libMesh::NumericVector< T >::swap().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
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 [static, protected, inherited] |
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().
ParallelType libMesh::NumericVector< T >::_type [protected] |
Type of vector
Definition at line 639 of file numeric_vector.h.
Referenced by libMesh::DistributedVector< T >::DistributedVector(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::EpetraVector< T >::init(), libMesh::PetscVector< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::LaspackVector< T >::LaspackVector(), libMesh::PetscVector< T >::operator=(), libMesh::PetscVector< T >::PetscVector(), libMesh::NumericVector< T >::swap(), and libMesh::NumericVector< Number >::type().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:32 UTC
Hosted By: