Poster of Linux kernelThe best gift for a Linux geek
EpetraVector

EpetraVector

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

EpetraVector -  

SYNOPSIS


#include <trilinos_epetra_vector.h>

Inherits NumericVector< T >.  

Public Member Functions


EpetraVector (const ParallelType type=AUTOMATIC)

EpetraVector (const unsigned int n, const ParallelType type=AUTOMATIC)

EpetraVector (const unsigned int n, const unsigned int n_local, const ParallelType type=AUTOMATIC)

EpetraVector (const unsigned int N, const unsigned int n_local, const std::vector< unsigned int > &ghost, const ParallelType type=AUTOMATIC)

EpetraVector (Epetra_Vector &v)

~EpetraVector ()

void close ()

void clear ()

void zero ()

AutoPtr< NumericVector< T > > clone () const

void init (const unsigned int N, const unsigned int n_local, const bool fast=false, const ParallelType type=AUTOMATIC)

void init (const unsigned int N, const bool fast=false, const ParallelType type=AUTOMATIC)

void init (const unsigned int, const unsigned int, const std::vector< unsigned int > &, const bool=false, const ParallelType=AUTOMATIC)

virtual void init (const NumericVector< T > &other, const bool fast=false)

NumericVector< T > & operator= (const T s)

NumericVector< T > & operator= (const NumericVector< T > &V)

EpetraVector< T > & operator= (const EpetraVector< T > &V)

NumericVector< T > & operator= (const std::vector< T > &v)

Real min () const

Real max () const

T sum () const

Real l1_norm () const

Real l2_norm () const

Real linfty_norm () const

unsigned int size () const

unsigned int local_size () const

unsigned int first_local_index () const

unsigned int last_local_index () const

T operator() (const unsigned int i) const

NumericVector< T > & operator+= (const NumericVector< T > &V)

NumericVector< T > & operator-= (const NumericVector< T > &V)

void set (const unsigned int i, const T value)

void add (const unsigned int i, const T value)

void add (const T s)

void add (const NumericVector< T > &V)

void add (const T a, const NumericVector< T > &v)

void add_vector (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices)

void add_vector (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices)

void add_vector (const NumericVector< T > &V, const SparseMatrix< T > &A)

void add_vector (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices)

virtual void insert (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices)

virtual void insert (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices)

virtual void insert (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices)

virtual void insert (const DenseSubVector< T > &V, const std::vector< unsigned int > &dof_indices)

void scale (const T factor)

virtual void abs ()

virtual T dot (const NumericVector< T > &V) const

void localize (std::vector< T > &v_local) const

void localize (NumericVector< T > &v_local) const

void localize (NumericVector< T > &v_local, const std::vector< unsigned int > &send_list) const

void localize (const unsigned int first_local_idx, const unsigned int last_local_idx, const std::vector< unsigned int > &send_list)

void localize_to_one (std::vector< T > &v_local, const unsigned int proc_id=0) const

virtual void pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2)

void print_matlab (const std::string name='NULL') const

virtual void create_subvector (NumericVector< T > &subvector, const std::vector< unsigned int > &rows) const

virtual void swap (NumericVector< T > &v)

Epetra_Vector * vec ()

virtual bool initialized () const

ParallelType type () const

ParallelType & type ()

virtual bool closed () const

virtual Real subset_l1_norm (const std::set< unsigned int > &indices)

virtual Real subset_l2_norm (const std::set< unsigned int > &indices)

virtual Real subset_linfty_norm (const std::set< unsigned int > &indices)

virtual T el (const unsigned int i) const

virtual void get (const std::vector< unsigned int > &index, std::vector< T > &values) const

NumericVector< T > & operator*= (const T a)

NumericVector< T > & operator/= (const T a)

void add_vector (const NumericVector< T > &v, const ShellMatrix< T > &a)

virtual int compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const

template<> int compare (const NumericVector< float > &other_vector, const Real threshold) const

template<> int compare (const NumericVector< double > &other_vector, const Real threshold) const

template<> int compare (const NumericVector< long double > &other_vector, const Real threshold) const

template<> int compare (const NumericVector< Complex > &other_vector, const Real threshold) const

virtual void print (std::ostream &os=std::cout) const

template<> void print (std::ostream &os) const

virtual void print_global (std::ostream &os=std::cout) 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 ()

static unsigned int n_objects ()
 

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
 

Private Member Functions


int SumIntoGlobalValues (int numIDs, const int *GIDs, const double *values)

int SumIntoGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values)

int ReplaceGlobalValues (int numIDs, const int *GIDs, const double *values)

int ReplaceGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values)

int SumIntoGlobalValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values)

int ReplaceGlobalValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values)

int GlobalAssemble (Epetra_CombineMode mode=Add)

void setIgnoreNonLocalEntries (bool flag)

void FEoperatorequals (const EpetraVector &source)

int inputValues (int numIDs, const int *GIDs, const double *values, bool accumulate)

int inputValues (int numIDs, const int *GIDs, const int *numValuesPerID, const double *values, bool accumulate)

int inputNonlocalValue (int GID, double value, bool accumulate)

int inputNonlocalValues (int GID, int numValues, const double *values, bool accumulate)

void destroyNonlocalData ()
 

Private Attributes


Epetra_Vector * _vec

Epetra_Map * _map

bool _destroy_vec_on_exit

int myFirstID_

int myNumIDs_

double * myCoefs_

int * nonlocalIDs_

int * nonlocalElementSize_

int numNonlocalIDs_

int allocatedNonlocalLength_

double ** nonlocalCoefs_

bool ignoreNonLocalEntries_
 

Friends


std::ostream & operator<< (std::ostream &os, const NumericVector< T > &v)
 

Detailed Description

 

template<typename T> class EpetraVector< T >

Epetra vector. Provides a nice interface to the Trilinos Epetra data structures for parallel vectors.

Author:

Derek R. Gaston, 2008

Definition at line 55 of file trilinos_epetra_vector.h.  

Member Typedef Documentation

 

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.

Definition at line 105 of file reference_counter.h.  

Constructor & Destructor Documentation

 

template<typename T > EpetraVector< T >::EpetraVector (const ParallelTypetype = AUTOMATIC) [inline, explicit]Dummy-Constructor. Dimension=0

Definition at line 592 of file trilinos_epetra_vector.h.

References NumericVector< T >::_type, and NumericVector< T >::type().

: _destroy_vec_on_exit(true),
  myFirstID_(0),
  myNumIDs_(0),
  myCoefs_(NULL),
  nonlocalIDs_(NULL),
  nonlocalElementSize_(NULL),
  numNonlocalIDs_(0),
  allocatedNonlocalLength_(0),
  nonlocalCoefs_(NULL),
  ignoreNonLocalEntries_(false)
{
  this->_type = type;
}
 

template<typename T > EpetraVector< T >::EpetraVector (const unsigned intn, const ParallelTypetype = AUTOMATIC) [inline, explicit]Constructor. Set dimension to n and initialize all elements with zero.

Definition at line 611 of file trilinos_epetra_vector.h.

References EpetraVector< T >::init().

: _destroy_vec_on_exit(true),
  myFirstID_(0),
  myNumIDs_(0),
  myCoefs_(NULL),
  nonlocalIDs_(NULL),
  nonlocalElementSize_(NULL),
  numNonlocalIDs_(0),
  allocatedNonlocalLength_(0),
  nonlocalCoefs_(NULL),
  ignoreNonLocalEntries_(false)

{
  this->init(n, n, false, type);
}
 

template<typename T > EpetraVector< T >::EpetraVector (const unsigned intn, const unsigned intn_local, const ParallelTypetype = AUTOMATIC) [inline]Constructor. Set local dimension to n_local, the global dimension to n, and initialize all elements with zero.

Definition at line 632 of file trilinos_epetra_vector.h.

References EpetraVector< T >::init().

: _destroy_vec_on_exit(true),
  myFirstID_(0),
  myNumIDs_(0),
  myCoefs_(NULL),
  nonlocalIDs_(NULL),
  nonlocalElementSize_(NULL),
  numNonlocalIDs_(0),
  allocatedNonlocalLength_(0),
  nonlocalCoefs_(NULL),
  ignoreNonLocalEntries_(false)
{
  this->init(n, n_local, false, type);
}
 

template<typename T > EpetraVector< T >::EpetraVector (const unsigned intN, const unsigned intn_local, const std::vector< unsigned int > &ghost, const ParallelTypetype = 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 685 of file trilinos_epetra_vector.h.

References EpetraVector< T >::init().

: _destroy_vec_on_exit(true),
  myFirstID_(0),
  myNumIDs_(0),
  myCoefs_(NULL),
  nonlocalIDs_(NULL),
  nonlocalElementSize_(NULL),
  numNonlocalIDs_(0),
  allocatedNonlocalLength_(0),
  nonlocalCoefs_(NULL),
  ignoreNonLocalEntries_(false)
{
  this->init(n, n_local, ghost, false, type);
}
 

template<typename T > EpetraVector< T >::EpetraVector (Epetra_Vector &v) [inline]Constructor. Creates a EpetraVector assuming you already have a valid Epetra Vec object. In this case, v is NOT destroyed by the EpetraVector constructor when this object goes out of scope. This allows ownership of v to remain with the original creator, and to simply provide additional functionality with the EpetraVector.

Definition at line 654 of file trilinos_epetra_vector.h.

References NumericVector< T >::_is_initialized, NumericVector< T >::_type, EpetraVector< T >::_vec, EpetraVector< T >::myCoefs_, EpetraVector< T >::myFirstID_, EpetraVector< T >::myNumIDs_, and libMeshEnums::PARALLEL.

: _destroy_vec_on_exit(false),
  myFirstID_(0),
  myNumIDs_(0),
  myCoefs_(NULL),
  nonlocalIDs_(NULL),
  nonlocalElementSize_(NULL),
  numNonlocalIDs_(0),
  allocatedNonlocalLength_(0),
  nonlocalCoefs_(NULL),
  ignoreNonLocalEntries_(false)
{
  _vec = &v;

  this->_type = PARALLEL; // FIXME - need to determine this from v!

  myFirstID_ = _vec->Map().MinMyGID();
  myNumIDs_ = _vec->Map().NumMyElements();

  //Currently we impose the restriction that NumVectors==1, so we won't
  //need the LDA argument when calling ExtractView. Hence the 'dummy' arg.
  int dummy;
  _vec->ExtractView(&myCoefs_, &dummy);

  this->_is_initialized = true;
}
 

template<typename T > EpetraVector< T >::~EpetraVector () [inline]Destructor, deallocates memory. Made virtual to allow for derived classes to behave properly.

Definition at line 718 of file trilinos_epetra_vector.h.

{
  this->clear ();
}
 

Member Function Documentation

 

template<typename T > void EpetraVector< T >::abs () [virtual]v = abs(v)... that is, each entry in v is replaced by its absolute value.

Implements NumericVector< T >.

Definition at line 308 of file trilinos_epetra_vector.C.

{
  _vec->Abs(*_vec);
}
 

template<typename T > void EpetraVector< T >::add (const unsigned inti, const Tvalue) [virtual]v(i) += value

Implements NumericVector< T >.

Definition at line 141 of file trilinos_epetra_vector.C.

{
  int i = static_cast<int> (i_in);
  T value = value_in;

  libmesh_assert(i_in<this->size());
  
  SumIntoGlobalValues(1, &i, &value);

  this->_is_closed = false;
}
 

template<typename T > void EpetraVector< T >::add (const Ts) [virtual]$U(0-LIBMESH_DIM)+=s$. Addition of s to all components. Note that s is a scalar and not a vector.

Implements NumericVector< T >.

Definition at line 216 of file trilinos_epetra_vector.C.

{
  const unsigned int nl = _vec->MyLength();

  T * values = _vec->Values();
  
  for (unsigned int i=0; i<nl; i++)
    values[i]+=v_in;

  this->_is_closed = false;
}
 

template<typename T > void EpetraVector< T >::add (const NumericVector< T > &V) [virtual]$ U+=V $ . Simple vector addition, equal to the operator +=.

Implements NumericVector< T >.

Definition at line 230 of file trilinos_epetra_vector.C.

{
  this->add (1., v);
}
 

template<typename T > void EpetraVector< T >::add (const Ta, const NumericVector< T > &v) [virtual]$ U+=a*V $ . Simple vector addition, equal to the operator +=.

Implements NumericVector< T >.

Definition at line 237 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec, and EpetraVector< T >::size().

{
  const EpetraVector<T>* v = libmesh_cast_ptr<const EpetraVector<T>*>(&v_in);

  libmesh_assert(this->size() == v->size());

  _vec->Update(a_in,*v->_vec, 1.);
}
 

template<typename T > void EpetraVector< T >::add_vector (const NumericVector< T > &V, const SparseMatrix< T > &A) [virtual]$U+=A*V$, add the product of a SparseMatrix A and a NumericVector V to this, where this=U.

Implements NumericVector< T >.

Definition at line 182 of file trilinos_epetra_vector.C.

{
  libmesh_not_implemented();

//   const EpetraVector<T>* V = libmesh_cast_ptr<const EpetraVector<T>*>(&V_in);
//   const EpetraMatrix<T>* A = libmesh_cast_ptr<const EpetraMatrix<T>*>(&A_in);

//   int ierr=0;

//   A->close();

//   // The const_cast<> is not elegant, but it is required since Epetra
//   // is not const-correct.  
//   ierr = MatMultAdd(const_cast<EpetraMatrix<T>*>(A)->mat(), V->_vec, _vec, _vec);
//          CHKERRABORT(libMesh::COMM_WORLD,ierr); 
}
 

template<typename T > void EpetraVector< T >::add_vector (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$U+=V $ where U and V are type DenseVector<T> and you want to specify WHERE to add the DenseVector<T> V

Implements NumericVector< T >.

Definition at line 203 of file trilinos_epetra_vector.C.

References DenseVector< T >::get_values(), and DenseVector< T >::size().

{
  libmesh_assert (V_in.size() == dof_indices.size());

  SumIntoGlobalValues(dof_indices.size(),
                      (int *)&dof_indices[0],
                      &const_cast<DenseVector<T> *>(&V_in)->get_values()[0]);
}
 

template<typename T> void NumericVector< T >::add_vector (const NumericVector< T > &v, const ShellMatrix< T > &a) [inherited]$U+=A*V$, add the product of a ShellMatrix A and a NumericVector V to this, where this=U.

Definition at line 253 of file numeric_vector.C.

References ShellMatrix< T >::vector_mult_add().

{
  a.vector_mult_add(*this,v);
}
 

template<typename T > void EpetraVector< T >::add_vector (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U+=V $ where U and V are type NumericVector<T> and you want to specify WHERE to add the NumericVector<T> V

Implements NumericVector< T >.

Definition at line 169 of file trilinos_epetra_vector.C.

References NumericVector< T >::size().

{
  libmesh_assert (V.size() == dof_indices.size());

  for (unsigned int i=0; i<V.size(); i++)
    this->add (dof_indices[i], V(i));
}
 

template<typename T > void EpetraVector< T >::add_vector (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices) [virtual]$ U+=v $ where v is a std::vector<T> and you want to specify WHERE to add it

Implements NumericVector< T >.

Definition at line 156 of file trilinos_epetra_vector.C.

{
  libmesh_assert (v.size() == dof_indices.size());

  SumIntoGlobalValues (v.size(),
                       (int*) &dof_indices[0],
                       const_cast<T*>(&v[0]));
}
 

template<typename T > AutoPtr< NumericVector< T > > NumericVector< T >::build (const SolverPackagesolver_package = libMesh::default_solver_package()) [static, inherited]Builds a NumericVector using the linear solver package specified by solver_package

Definition at line 41 of file numeric_vector.C.

References LASPACK_SOLVERS, libMeshEnums::PETSC_SOLVERS, and TRILINOS_SOLVERS.

Referenced by ExactErrorEstimator::estimate_error().

{
  // Build the appropriate vector
  switch (solver_package)
    {


#ifdef LIBMESH_HAVE_LASPACK
    case LASPACK_SOLVERS:
      {
        AutoPtr<NumericVector<T> > ap(new LaspackVector<T>);
        return ap;
      }
#endif


#ifdef LIBMESH_HAVE_PETSC
    case PETSC_SOLVERS:
      {
        AutoPtr<NumericVector<T> > ap(new PetscVector<T>);
        return ap;
      }
#endif


#ifdef LIBMESH_HAVE_TRILINOS
    case TRILINOS_SOLVERS:
      {
        AutoPtr<NumericVector<T> > ap(new EpetraVector<T>);
        return ap;
      }
#endif


    default:
      AutoPtr<NumericVector<T> > ap(new DistributedVector<T>);
      return ap;
    }
    
  AutoPtr<NumericVector<T> > ap(NULL);
  return ap;    
}
 

template<typename T > void EpetraVector< T >::clear () [inline, virtual]Returns:

the EpetraVector<T> to a pristine state.

Reimplemented from NumericVector< T >.

Definition at line 807 of file trilinos_epetra_vector.h.

References libMesh::libMeshPrivateData::_is_initialized, and libMesh::initialized().

{
  if ((this->initialized()) && (this->_destroy_vec_on_exit))
    delete _vec;

  this->_is_closed = this->_is_initialized = false;
}
 

template<typename T > AutoPtr< NumericVector< T > > EpetraVector< T >::clone () const [inline, virtual]Creates a copy of this vector and returns it in an AutoPtr.

Implements NumericVector< T >.

Definition at line 830 of file trilinos_epetra_vector.h.

{
  AutoPtr<NumericVector<T> > cloned_vector (new EpetraVector<T>);

  cloned_vector->init(*this, true);

  *cloned_vector = *this;

  return cloned_vector;
}
 

template<typename T > void EpetraVector< T >::close () [inline, virtual]Call the assemble functions

Implements NumericVector< T >.

Definition at line 794 of file trilinos_epetra_vector.h.

References libMesh::initialized().

Referenced by Problem_Interface::computeF().

{
  libmesh_assert (this->initialized());

  this->GlobalAssemble();

  this->_is_closed = true;
}
 

template<typename T> virtual bool NumericVector< T >::closed () const [inline, virtual, inherited]Returns:

true if the vector is closed and ready for computation, false otherwise.

Definition at line 125 of file numeric_vector.h.

Referenced by DofMap::enforce_constraints_exactly(), and DofMap::max_constraint_error().

{ return _is_closed; }
 

template<typename T> virtual int NumericVector< T >::compare (const NumericVector< T > &other_vector, const Realthreshold = TOLERANCE) const [virtual, inherited]Returns:

-1 when this is equivalent to other_vector, up to the given threshold. When differences occur, the return value contains the first index where the difference exceeded the threshold. When no threshold is given, the libMesh TOLERANCE is used.

 

template<> int NumericVector< float >::compare (const NumericVector< float > &other_vector, const Realthreshold) const [inherited]

Definition at line 89 of file numeric_vector.C.

References NumericVector< T >::first_local_index(), NumericVector< T >::initialized(), libMesh::initialized(), and NumericVector< T >::last_local_index().

{
  libmesh_assert (this->initialized());
  libmesh_assert (other_vector.initialized());
  libmesh_assert (this->first_local_index() == other_vector.first_local_index());
  libmesh_assert (this->last_local_index()  == other_vector.last_local_index());

  int rvalue     = -1;
  unsigned int i = first_local_index();

  do
    {
      if ( std::abs( (*this)(i) - other_vector(i) ) > threshold )
        rvalue = i;
      else
        i++;
    }
  while (rvalue==-1 && i<last_local_index());

  return rvalue;
}
 

template<> int NumericVector< double >::compare (const NumericVector< double > &other_vector, const Realthreshold) const [inherited]

Definition at line 114 of file numeric_vector.C.

References NumericVector< T >::first_local_index(), NumericVector< T >::initialized(), libMesh::initialized(), and NumericVector< T >::last_local_index().

{
  libmesh_assert (this->initialized());
  libmesh_assert (other_vector.initialized());
  libmesh_assert (this->first_local_index() == other_vector.first_local_index());
  libmesh_assert (this->last_local_index()  == other_vector.last_local_index());

  int rvalue     = -1;
  unsigned int i = first_local_index();

  do
    {
      if ( std::abs( (*this)(i) - other_vector(i) ) > threshold )
        rvalue = i;
      else
        i++;
    }
  while (rvalue==-1 && i<last_local_index());

  return rvalue;
}
 

template<> int NumericVector< long double >::compare (const NumericVector< long double > &other_vector, const Realthreshold) const [inherited]

Definition at line 140 of file numeric_vector.C.

References NumericVector< T >::first_local_index(), NumericVector< T >::initialized(), libMesh::initialized(), and NumericVector< T >::last_local_index().

{
  libmesh_assert (this->initialized());
  libmesh_assert (other_vector.initialized());
  libmesh_assert (this->first_local_index() == other_vector.first_local_index());
  libmesh_assert (this->last_local_index()  == other_vector.last_local_index());

  int rvalue     = -1;
  unsigned int i = first_local_index();

  do
    {
      if ( std::abs( (*this)(i) - other_vector(i) ) > threshold )
        rvalue = i;
      else
        i++;
    }
  while (rvalue==-1 && i<last_local_index());

  return rvalue;
}
 

template<> int NumericVector< Complex >::compare (const NumericVector< Complex > &other_vector, const Realthreshold) const [inherited]

Definition at line 167 of file numeric_vector.C.

References NumericVector< T >::first_local_index(), NumericVector< T >::initialized(), libMesh::initialized(), and NumericVector< T >::last_local_index().

{
  libmesh_assert (this->initialized());
  libmesh_assert (other_vector.initialized());
  libmesh_assert (this->first_local_index() == other_vector.first_local_index());
  libmesh_assert (this->last_local_index()  == other_vector.last_local_index());

  int rvalue     = -1;
  unsigned int i = first_local_index();

  do
    {
      if (( std::abs( (*this)(i).real() - other_vector(i).real() ) > threshold ) ||
          ( std::abs( (*this)(i).imag() - other_vector(i).imag() ) > threshold ))
        rvalue = i;
      else
        i++;
    }
  while (rvalue==-1 && i<this->last_local_index());

  return rvalue;
}
 

template<typename T > void EpetraVector< T >::create_subvector (NumericVector< T > &subvector, const std::vector< unsigned int > &rows) const [virtual]Creates a 'subvector' from this vector using the rows indices of the 'rows' array.

Reimplemented from NumericVector< T >.

Definition at line 644 of file trilinos_epetra_vector.C.

{
  libmesh_not_implemented();

//   // Epetra data structures
//   IS parent_is, subvector_is;
//   VecScatter scatter;
//   int ierr = 0;
  
//   // Make sure the passed int subvector is really a EpetraVector
//   EpetraVector<T>* epetra_subvector = libmesh_cast_ptr<EpetraVector<T>*>(&subvector);
//   libmesh_assert(epetra_subvector != NULL);
  
//   // If the epetra_subvector is already initialized, we assume that the
//   // user has already allocated the *correct* amount of space for it.
//   // If not, we use the appropriate Epetra routines to initialize it.
//   if (!epetra_subvector->initialized())
//     {
//       // Initialize the epetra_subvector to have enough space to hold
//       // the entries which will be scattered into it.  Note: such an
//       // init() function (where we let Epetra decide the number of local
//       // entries) is not currently offered by the EpetraVector
//       // class.  Should we differentiate here between sequential and
//       // parallel vector creation based on libMesh::n_processors() ?
//       ierr = VecCreateMPI(libMesh::COMM_WORLD,
//                        EPETRA_DECIDE,          // n_local
//                        rows.size(),           // n_global
//                        &(epetra_subvector->_vec)); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//       ierr = VecSetFromOptions (epetra_subvector->_vec); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//       // Mark the subvector as initialized
//       epetra_subvector->_is_initialized = true;
//     }
  
//   // Use iota to fill an array with entries [0,1,2,3,4,...rows.size()]
//   std::vector<int> idx(rows.size());
//   Utility::iota (idx.begin(), idx.end(), 0);

//   // Construct index sets
//   ierr = ISCreateGeneral(libMesh::COMM_WORLD,
//                       rows.size(),
//                       (int*) &rows[0],
//                       &parent_is); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   ierr = ISCreateGeneral(libMesh::COMM_WORLD,
//                       rows.size(),
//                       (int*) &idx[0],
//                       &subvector_is); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   // Construct the scatter object
//   ierr = VecScatterCreate(this->_vec,
//                        parent_is,
//                        epetra_subvector->_vec,
//                        subvector_is,
//                        &scatter); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   // Actually perform the scatter
// #if EPETRA_VERSION_LESS_THAN(2,3,3)
//   ierr = VecScatterBegin(this->_vec,
//                       epetra_subvector->_vec,
//                       INSERT_VALUES,
//                       SCATTER_FORWARD,
//                       scatter); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   ierr = VecScatterEnd(this->_vec,
//                     epetra_subvector->_vec,
//                     INSERT_VALUES,
//                     SCATTER_FORWARD,
//                     scatter); CHKERRABORT(libMesh::COMM_WORLD,ierr);
// #else
//   // API argument order change in Epetra 2.3.3
//   ierr = VecScatterBegin(scatter,
//                       this->_vec,
//                       epetra_subvector->_vec,
//                       INSERT_VALUES,
//                       SCATTER_FORWARD); CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   ierr = VecScatterEnd(scatter,
//                     this->_vec,
//                     epetra_subvector->_vec,
//                     INSERT_VALUES,
//                     SCATTER_FORWARD); CHKERRABORT(libMesh::COMM_WORLD,ierr);
// #endif
  
//   // Clean up 
//   ierr = ISDestroy(parent_is);       CHKERRABORT(libMesh::COMM_WORLD,ierr);
//   ierr = ISDestroy(subvector_is);    CHKERRABORT(libMesh::COMM_WORLD,ierr);
//   ierr = VecScatterDestroy(scatter); CHKERRABORT(libMesh::COMM_WORLD,ierr); 
}
 

template<typename T > void EpetraVector< T >::destroyNonlocalData () [private]

Definition at line 1040 of file trilinos_epetra_vector.C.

{
  if (allocatedNonlocalLength_ > 0) {
    delete [] nonlocalIDs_;
    delete [] nonlocalElementSize_;
    nonlocalIDs_ = NULL;
    nonlocalElementSize_ = NULL;
    for(int i=0; i<numNonlocalIDs_; ++i) {
      delete [] nonlocalCoefs_[i];
    }
    delete [] nonlocalCoefs_;
    nonlocalCoefs_ = NULL;
    numNonlocalIDs_ = 0;
    allocatedNonlocalLength_ = 0;
  }
  return;
}
 

template<typename T > T EpetraVector< T >::dot (const NumericVector< T > &V) const [virtual]Computes the dot product, p = U.V

Implements NumericVector< T >.

Definition at line 315 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec.

{
  const EpetraVector<T>* V = libmesh_cast_ptr<const EpetraVector<T>*>(&V_in);

  T result=0.0;

  _vec->Dot(*V->_vec, &result);

  return result;
}
 

template<typename T> virtual T NumericVector< T >::el (const unsigned inti) const [inline, virtual, inherited]Returns:

the element U(i)

Definition at line 314 of file numeric_vector.h.

{ return (*this)(i); }
 

template<typename T > void EpetraVector< T >::FEoperatorequals (const EpetraVector< T > &source) [private]

Definition at line 1013 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec, EpetraVector< T >::allocatedNonlocalLength_, EpetraVector< T >::nonlocalCoefs_, EpetraVector< T >::nonlocalElementSize_, EpetraVector< T >::nonlocalIDs_, and EpetraVector< T >::numNonlocalIDs_.

{
  (*_vec) = *(source._vec);

  destroyNonlocalData();

  if (source.allocatedNonlocalLength_ > 0) {
    allocatedNonlocalLength_ = source.allocatedNonlocalLength_;
    numNonlocalIDs_ = source.numNonlocalIDs_;
    nonlocalIDs_ = new int[allocatedNonlocalLength_];
    nonlocalElementSize_ = new int[allocatedNonlocalLength_];
    nonlocalCoefs_ = new double*[allocatedNonlocalLength_];
    for(int i=0; i<numNonlocalIDs_; ++i) {
      int elemSize = source.nonlocalElementSize_[i];
      nonlocalCoefs_[i] = new double[elemSize];
      nonlocalIDs_[i] = source.nonlocalIDs_[i];
      nonlocalElementSize_[i] = elemSize;
      for(int j=0; j<elemSize; ++j) {
        nonlocalCoefs_[i][j] = source.nonlocalCoefs_[i][j];
      }
    }
  }
}
 

template<typename T > unsigned int EpetraVector< T >::first_local_index () const [inline, virtual]Returns:

the index of the first vector element actually stored on this processor

Implements NumericVector< T >.

Definition at line 865 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  
  return _vec->Map().MinMyGID();
}
 

template<typename T> void NumericVector< T >::get (const std::vector< unsigned int > &index, std::vector< T > &values) const [inline, virtual, inherited]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 PetscVector< T >.

Definition at line 714 of file numeric_vector.h.

{
  const unsigned int num = index.size();
  values.resize(num);
  for(unsigned int i=0; i<num; i++)
    {
      values[i] = (*this)(index[i]);
    }
}
 

std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.

Definition at line 45 of file reference_counter.C.

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

Referenced by ReferenceCounter::print_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream out;
  
  out << '
      << ' ---------------------------------------------------------------------------- 
      << '| Reference count information                                                |
      << ' ---------------------------------------------------------------------------- ;
  
  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      out << '| ' << name << ' reference count information:
          << '|  Creations:    ' << creations    << '
          << '|  Destructions: ' << destructions << ';
    }
  
  out << ' ---------------------------------------------------------------------------- ;

  return out.str();

#else

  return '';
  
#endif
}
 

template<typename T > int EpetraVector< T >::GlobalAssemble (Epetra_CombineModemode = Add) [private]Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was passed to this vector at construction time. Data imported from other processors is stored on the owning processor with a 'sumInto' or accumulate operation. This is a collective method -- every processor must enter it before any will complete it.

Definition at line 968 of file trilinos_epetra_vector.C.

{
  //In this method we need to gather all the non-local (overlapping) data
  //that's been input on each processor, into the (probably) non-overlapping
  //distribution defined by the map that 'this' vector was constructed with.

  //We don't need to do anything if there's only one processor or if
  //ignoreNonLocalEntries_ is true.
  if (_vec->Map().Comm().NumProc() < 2 || ignoreNonLocalEntries_) {
    return(0);
  }


  
  //First build a map that describes the data in nonlocalIDs_/nonlocalCoefs_.
  //We'll use the arbitrary distribution constructor of Map.

  Epetra_BlockMap sourceMap(-1, numNonlocalIDs_,
                            nonlocalIDs_, nonlocalElementSize_,
                            _vec->Map().IndexBase(), _vec->Map().Comm());

  //Now build a vector to hold our nonlocalCoefs_, and to act as the source-
  //vector for our import operation.
  Epetra_MultiVector nonlocalVector(sourceMap, 1);

  int i,j;
  for(i=0; i<numNonlocalIDs_; ++i) {
    for(j=0; j<nonlocalElementSize_[i]; ++j) {
      nonlocalVector.ReplaceGlobalValue(nonlocalIDs_[i], j, 0,
                                        nonlocalCoefs_[i][j]);
    }
  }

  Epetra_Export exporter(sourceMap, _vec->Map());

  EPETRA_CHK_ERR( _vec->Export(nonlocalVector, exporter, mode) );

  destroyNonlocalData();

  return(0);
}
 

void 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 149 of file reference_counter.h.

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

Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
 

void 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 167 of file reference_counter.h.

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

Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
 

template<class T > void EpetraVector< T >::init (const NumericVector< T > &other, const boolfast = false) [virtual]Creates a vector that has the same dimension and storage type as other, including ghost dofs.

Implements NumericVector< T >.

Definition at line 708 of file trilinos_epetra_vector.h.

References libMesh::init(), NumericVector< T >::local_size(), NumericVector< T >::size(), and NumericVector< T >::type().

{
  this->init(other.size(),other.local_size(),fast,other.type());
}
 

template<typename T > void EpetraVector< T >::init (const unsigned intN, const unsigned intn_local, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, 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.

Implements NumericVector< T >.

Definition at line 727 of file trilinos_epetra_vector.h.

References libMesh::libMeshPrivateData::_is_initialized, libMeshEnums::AUTOMATIC, libMesh::COMM_WORLD, libMeshEnums::PARALLEL, libMeshEnums::SERIAL, and libMesh::zero.

Referenced by EpetraVector< T >::EpetraVector().

{
  if (type == AUTOMATIC)
    {
      if (n == n_local)
        this->_type = SERIAL;
      else
        this->_type = PARALLEL;
    }
  else
    this->_type = type;

  libmesh_assert ((this->_type==SERIAL && n==n_local) ||
                  this->_type==PARALLEL);

  _map = new Epetra_Map(n, 
                        n_local, 
                        0, 
                        Epetra_MpiComm (libMesh::COMM_WORLD));
              
  _vec = new Epetra_Vector(*_map);

  myFirstID_ = _vec->Map().MinMyGID();
  myNumIDs_ = _vec->Map().NumMyElements();

  //Currently we impose the restriction that NumVectors==1, so we won't
  //need the LDA argument when calling ExtractView. Hence the 'dummy' arg.
  int dummy;
  _vec->ExtractView(&myCoefs_, &dummy);
  
  this->_is_initialized = true;
  
  if (fast == false)
    this->zero ();
}
 

template<typename T > void EpetraVector< T >::init (const unsigned intN, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, virtual]call init with n_local = N,

Implements NumericVector< T >.

Definition at line 783 of file trilinos_epetra_vector.h.

References libMesh::init().

{
  this->init(n,n,fast,type);
}
 

template<typename T > void EpetraVector< T >::init (const unsigned intn, const unsigned intn_local, const std::vector< unsigned int > &, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, virtual]Create a vector that holds the local indices plus those specified in the ghost argument.

Implements NumericVector< T >.

Definition at line 769 of file trilinos_epetra_vector.h.

References libMesh::init().

{
  // TODO: we shouldn't ignore the ghost sparsity pattern
  this->init(n, n_local, fast, type);
}
 

template<typename T> virtual bool NumericVector< T >::initialized () const [inline, virtual, inherited]Returns:

true if the vector has been initialized, false otherwise.

Definition at line 109 of file numeric_vector.h.

Referenced by ImplicitSystem::assemble(), ExplicitSystem::assemble_qoi(), ExplicitSystem::assemble_qoi_derivative(), NumericVector< T >::compare(), PetscVector< T >::create_subvector(), and PetscVector< T >::init().

{ return _is_initialized; }
 

template<typename T > int EpetraVector< T >::inputNonlocalValue (intGID, doublevalue, boolaccumulate) [private]

Definition at line 868 of file trilinos_epetra_vector.C.

{
  int insertPoint = -1;

  //find offset of GID in nonlocalIDs_
  int offset = Epetra_Util_binary_search(GID, nonlocalIDs_, numNonlocalIDs_,
                                         insertPoint);
  if (offset >= 0) {
    //if offset >= 0
    //  put value in nonlocalCoefs_[offset][0]

    if (accumulate) {
      nonlocalCoefs_[offset][0] += value;
    }
    else {
      nonlocalCoefs_[offset][0] = value;
    }
  }
  else {
    //else
    //  insert GID in nonlocalIDs_
    //  insert 1   in nonlocalElementSize_
    //  insert value in nonlocalCoefs_

    int tmp1 = numNonlocalIDs_;
    int tmp2 = allocatedNonlocalLength_;
    int tmp3 = allocatedNonlocalLength_;
    EPETRA_CHK_ERR( Epetra_Util_insert(GID, insertPoint, nonlocalIDs_,
                                       tmp1, tmp2) );
    --tmp1;
    EPETRA_CHK_ERR( Epetra_Util_insert(1, insertPoint, nonlocalElementSize_,
                                       tmp1, tmp3) );
    double* values = new double[1];
    values[0] = value;
    EPETRA_CHK_ERR( Epetra_Util_insert(values, insertPoint, nonlocalCoefs_,
                                       numNonlocalIDs_, allocatedNonlocalLength_) );
  }

  return(0);
}
 

template<typename T > int EpetraVector< T >::inputNonlocalValues (intGID, intnumValues, const double *values, boolaccumulate) [private]

Definition at line 911 of file trilinos_epetra_vector.C.

{
  int insertPoint = -1;

  //find offset of GID in nonlocalIDs_
  int offset = Epetra_Util_binary_search(GID, nonlocalIDs_, numNonlocalIDs_,
                                         insertPoint);
  if (offset >= 0) {
    //if offset >= 0
    //  put value in nonlocalCoefs_[offset][0]

    if (numValues != nonlocalElementSize_[offset]) {
      cerr << 'Epetra_FEVector ERROR: block-size for GID ' << GID << ' is '
           << numValues<<' which doesn't match previously set block-size of '
           << nonlocalElementSize_[offset] << endl;
      return(-1);
    }

    if (accumulate) {
      for(int j=0; j<numValues; ++j) {
        nonlocalCoefs_[offset][j] += values[j];
      }
    }
    else {
      for(int j=0; j<numValues; ++j) {
        nonlocalCoefs_[offset][j] = values[j];
      }
    }
  }
  else {
    //else
    //  insert GID in nonlocalIDs_
    //  insert numValues   in nonlocalElementSize_
    //  insert values in nonlocalCoefs_

    int tmp1 = numNonlocalIDs_;
    int tmp2 = allocatedNonlocalLength_;
    int tmp3 = allocatedNonlocalLength_;
    EPETRA_CHK_ERR( Epetra_Util_insert(GID, insertPoint, nonlocalIDs_,
                                       tmp1, tmp2) );
    --tmp1;
    EPETRA_CHK_ERR( Epetra_Util_insert(numValues, insertPoint, nonlocalElementSize_,
                                       tmp1, tmp3) );
    double* newvalues = new double[numValues];
    for(int j=0; j<numValues; ++j) {
      newvalues[j] = values[j];
    }
    EPETRA_CHK_ERR( Epetra_Util_insert(newvalues, insertPoint, nonlocalCoefs_,
                                       numNonlocalIDs_, allocatedNonlocalLength_) );
  }

  return(0);
}
 

template<typename T > int EpetraVector< T >::inputValues (intnumIDs, const int *GIDs, const double *values, boolaccumulate) [private]

Definition at line 804 of file trilinos_epetra_vector.C.

{
 //Important note!! This method assumes that there is only 1 point
 //associated with each element.

  for(int i=0; i<numIDs; ++i) {
    if (_vec->Map().MyGID(GIDs[i])) {
      if (accumulate) {
        _vec->SumIntoGlobalValue(GIDs[i], 0, 0, values[i]);
      }
      else {
        _vec->ReplaceGlobalValue(GIDs[i], 0, 0, values[i]);
      }
    }
    else {
      if (!ignoreNonLocalEntries_) {
        EPETRA_CHK_ERR( inputNonlocalValue(GIDs[i], values[i], accumulate) );
      }
    }
  }

  return(0);
}
 

template<typename T > int EpetraVector< T >::inputValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values, boolaccumulate) [private]

Definition at line 833 of file trilinos_epetra_vector.C.

{
  int offset=0;
  for(int i=0; i<numIDs; ++i) {
    int numValues = numValuesPerID[i];
    if (_vec->Map().MyGID(GIDs[i])) {
      if (accumulate) {
        for(int j=0; j<numValues; ++j) {
          _vec->SumIntoGlobalValue(GIDs[i], j, 0, values[offset+j]);
        }
      }
      else {
        for(int j=0; j<numValues; ++j) {
          _vec->ReplaceGlobalValue(GIDs[i], j, 0, values[offset+j]);
        }
      }
    }
    else {
      if (!ignoreNonLocalEntries_) {
        EPETRA_CHK_ERR( inputNonlocalValues(GIDs[i], numValues,
                                            &(values[offset]), accumulate) );
      }
    }
    offset += numValues;
  }

  return(0);
}
 

template<typename T > void EpetraVector< T >::insert (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices) [virtual]$ U=v $ where v is a DenseVector<T> and you want to specify WHERE to insert it

Implements NumericVector< T >.

Definition at line 249 of file trilinos_epetra_vector.C.

{
  libmesh_assert (v.size() == dof_indices.size());

  ReplaceGlobalValues (v.size(),
                       (int*) &dof_indices[0],
                       const_cast<T*>(&v[0]));
}
 

template<typename T > void EpetraVector< T >::insert (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$U=V$, where U and V are type NumericVector<T> and you want to specify WHERE to insert the NumericVector<T> V

Implements NumericVector< T >.

Definition at line 262 of file trilinos_epetra_vector.C.

References NumericVector< T >::size().

{
  libmesh_assert (V.size() == dof_indices.size());

  // TODO: If V is an EpetraVector this can be optimized
  for (unsigned int i=0; i<V.size(); i++)
    this->set (dof_indices[i], V(i));
}
 

template<typename T > void EpetraVector< T >::insert (const DenseSubVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U=V $ where V is type DenseSubVector<T> and you want to specify WHERE to insert it

Implements NumericVector< T >.

Definition at line 290 of file trilinos_epetra_vector.C.

References DenseVectorBase< T >::size().

{
  libmesh_assert (v.size() == dof_indices.size());
  
  for (unsigned int i=0; i < v.size(); ++i)
    this->set (dof_indices[i], v(i));
}
 

template<typename T > void EpetraVector< T >::insert (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U=V $ where V is type DenseVector<T> and you want to specify WHERE to insert it

Implements NumericVector< T >.

Definition at line 275 of file trilinos_epetra_vector.C.

References DenseVector< T >::size().

{
  libmesh_assert (v.size() == dof_indices.size());
  
  std::vector<T> &vals = const_cast<DenseVector<T>&>(v).get_values();
  
  ReplaceGlobalValues (v.size(),
                       (int*) &dof_indices[0],
                       &vals[0]);
}
 

template<typename T > Real EpetraVector< T >::l1_norm () const [virtual]Returns:

the $l_1$-norm of the vector, i.e. the sum of the absolute values.

Implements NumericVector< T >.

Definition at line 64 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());

  Real value;

  _vec->Norm1(&value);
  
  return value;
}
 

template<typename T > Real EpetraVector< T >::l2_norm () const [virtual]Returns:

the $l_2$-norm of the vector, i.e. the square root of the sum of the squares of the elements.

Implements NumericVector< T >.

Definition at line 76 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());
  
  Real value;

  _vec->Norm2(&value);
  
  return value;
}
 

template<typename T > unsigned int EpetraVector< T >::last_local_index () const [inline, virtual]Returns:

the index of the last vector element actually stored on this processor

Implements NumericVector< T >.

Definition at line 876 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  
  return _vec->Map().MaxMyGID()+1;
}
 

template<typename T > Real EpetraVector< T >::linfty_norm () const [virtual]Returns:

the maximum absolute value of the elements of this vector, which is the $l_infty$-norm of a vector.

Implements NumericVector< T >.

Definition at line 88 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());
  
  Real value;

  _vec->NormInf(&value);
  
  return value;
}
 

template<typename T > unsigned int EpetraVector< T >::local_size () const [inline, virtual]Returns:

the local size of the vector (index_stop-index_start)

Implements NumericVector< T >.

Definition at line 856 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  
  return _vec->MyLength();
}
 

template<typename T > void EpetraVector< T >::localize (const unsigned intfirst_local_idx, const unsigned intlast_local_idx, const std::vector< unsigned int > &send_list) [virtual]Updates a local vector with selected values from neighboring processors, as defined by send_list.

Implements NumericVector< T >.

Definition at line 447 of file trilinos_epetra_vector.C.

{
  libmesh_not_implemented();

//   // Only good for serial vectors.
//   libmesh_assert (this->size() == this->local_size());
//   libmesh_assert (last_local_idx > first_local_idx);
//   libmesh_assert (send_list.size() <= this->size());
//   libmesh_assert (last_local_idx < this->size());
  
//   const unsigned int size       = this->size();
//   const unsigned int local_size = (last_local_idx - first_local_idx + 1);
//   int ierr=0;  
  
//   // Don't bother for serial cases
//   if ((first_local_idx == 0) &&
//       (local_size == size))
//     return;
  
  
//   // Build a parallel vector, initialize it with the local
//   // parts of (*this)
//   EpetraVector<T> parallel_vec;

//   parallel_vec.init (size, local_size, true, PARALLEL);


//   // Copy part of *this into the parallel_vec
//   {
//     IS is;
//     VecScatter scatter;

//     // Create idx, idx[i] = i+first_local_idx;
//     std::vector<int> idx(local_size);
//     Utility::iota (idx.begin(), idx.end(), first_local_idx);

//     // Create the index set & scatter object
//     ierr = ISCreateGeneral(libMesh::COMM_WORLD, local_size, &idx[0], &is); 
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);

//     ierr = VecScatterCreate(_vec,              is,
//                          parallel_vec._vec, is,
//                          &scatter);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);

//     // Perform the scatter
// #if EPETRA_VERSION_LESS_THAN(2,3,3)

//     ierr = VecScatterBegin(_vec, parallel_vec._vec, INSERT_VALUES,
//                         SCATTER_FORWARD, scatter);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);
  
//     ierr = VecScatterEnd  (_vec, parallel_vec._vec, INSERT_VALUES,
//                         SCATTER_FORWARD, scatter);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);

// #else
           
//       // API argument order change in Epetra 2.3.3
//     ierr = VecScatterBegin(scatter, _vec, parallel_vec._vec,
//                         INSERT_VALUES, SCATTER_FORWARD);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);
  
//     ierr = VecScatterEnd  (scatter, _vec, parallel_vec._vec,
//                         INSERT_VALUES, SCATTER_FORWARD);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);
           
// #endif

//     // Clean up
//     ierr = ISDestroy (is);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);
  
//     ierr = VecScatterDestroy(scatter);
//            CHKERRABORT(libMesh::COMM_WORLD,ierr);
//   }

//   // localize like normal
//   parallel_vec.close();
//   parallel_vec.localize (*this, send_list);
//   this->close();
}
 

template<typename T > void EpetraVector< T >::localize (std::vector< T > &v_local) const [virtual]Creates a copy of the global vector in the local vector v_local.

Implements NumericVector< T >.

Definition at line 535 of file trilinos_epetra_vector.C.

{
  // This function must be run on all processors at once
  parallel_only();

  const unsigned int n  = this->size();
  const unsigned int nl = this->local_size();

  libmesh_assert (this->_vec != NULL);

  v_local.clear();
  v_local.reserve(n);

  // build up my local part
  for (unsigned int i=0; i<nl; i++)
    v_local.push_back((*this->_vec)[i]);

  Parallel::allgather (v_local);
}
 

template<typename T > void EpetraVector< T >::localize (NumericVector< T > &v_local) const [virtual]Same, but fills a NumericVector<T> instead of a std::vector.

Implements NumericVector< T >.

Definition at line 412 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec.

{
  EpetraVector<T>* v_local = libmesh_cast_ptr<EpetraVector<T>*>(&v_local_in);

  Epetra_Map rootMap = Epetra_Util::Create_Root_Map( *_map, -1);
  v_local->_vec->ReplaceMap(rootMap);

  Epetra_Import importer(v_local->_vec->Map(), *_map);
  v_local->_vec->Import(*_vec, importer, Insert);
}
 

template<typename T > void EpetraVector< T >::localize (NumericVector< T > &v_local, const std::vector< unsigned int > &send_list) const [virtual]Creates a local vector v_local containing only information relevant to this processor, as defined by the send_list.

Implements NumericVector< T >.

Definition at line 426 of file trilinos_epetra_vector.C.

{
  // TODO: optimize to sync only the send list values
  this->localize(v_local_in);
  
//   EpetraVector<T>* v_local =
//   libmesh_cast_ptr<EpetraVector<T>*>(&v_local_in);

//   libmesh_assert (this->_map.get() != NULL);
//   libmesh_assert (v_local->_map.get() != NULL);
//   libmesh_assert (v_local->local_size() == this->size());
//   libmesh_assert (send_list.size() <= v_local->size());

//   Epetra_Import importer (*v_local->_map, *this->_map);
  
//   v_local->_vec->Import (*this->_vec, importer, Insert);
}
 

template<typename T > void EpetraVector< T >::localize_to_one (std::vector< T > &v_local, const unsigned intproc_id = 0) const [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.

Implements NumericVector< T >.

Definition at line 558 of file trilinos_epetra_vector.C.

References libMesh::n_processors().

{
  // This function must be run on all processors at once
  parallel_only();

  const unsigned int n  = this->size();
  const unsigned int nl = this->local_size();

  libmesh_assert (pid < libMesh::n_processors());
  libmesh_assert (this->_vec != NULL);
  
  v_local.clear();
  v_local.reserve(n);
  
  
  // build up my local part
  for (unsigned int i=0; i<nl; i++)
    v_local.push_back((*this->_vec)[i]);

  Parallel::gather (pid, v_local);
}
 

template<typename T > Real EpetraVector< T >::max () const [inline, virtual]Returns:

the maximum element in the vector. In case of complex numbers, this returns the maximum Real part.

Implements NumericVector< T >.

Definition at line 914 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());

  T value;

  _vec->MaxValue(&value);

  return value;
}
 

template<typename T > Real EpetraVector< T >::min () const [inline, virtual]Returns:

the minimum element in the vector. In case of complex numbers, this returns the minimum Real part.

Implements NumericVector< T >.

Definition at line 899 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());

  T value;

  _vec->MinValue(&value);

  return value;
}
 

static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 76 of file reference_counter.h.

References ReferenceCounter::_n_objects.

Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().

  { return _n_objects; }
 

template<typename T > T EpetraVector< T >::operator() (const unsigned inti) const [inline, virtual]Access components, returns U(i).

Implements NumericVector< T >.

Definition at line 886 of file trilinos_epetra_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  libmesh_assert ( ((i >= this->first_local_index()) &&
                    (i <  this->last_local_index())) );

  return (*_vec)[i-this->first_local_index()];
}
 

template<typename T> NumericVector<T>& NumericVector< T >::operator*= (const Ta) [inline, inherited]Multiplication operator. Equivalent to U.scale(a)

Definition at line 340 of file numeric_vector.h.

{ this->scale(a); return *this; }
 

template<typename T > NumericVector< T > & EpetraVector< T >::operator+= (const NumericVector< T > &V) [virtual]Addition operator. Fast equivalent to U.add(1, V).

Implements NumericVector< T >.

Definition at line 101 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());
  
  this->add(1., v);
  
  return *this;
}
 

template<typename T > NumericVector< T > & EpetraVector< T >::operator-= (const NumericVector< T > &V) [virtual]Subtraction operator. Fast equivalent to U.add(-1, V).

Implements NumericVector< T >.

Definition at line 114 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());
  
  this->add(-1., v);
  
  return *this;
}
 

template<typename T> NumericVector<T>& NumericVector< T >::operator/= (const Ta) [inline, inherited]Division operator. Equivalent to U.scale(1./a)

Definition at line 346 of file numeric_vector.h.

{ this->scale(1./a); return *this; }
 

template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const Ts) [virtual]Change the dimension to that of the vector V. The same applies as for the other init function.

The elements of V are not copied, i.e. this function is the same as calling init(V.size(),fast). $U(0-N) = s$: fill all components.

Implements NumericVector< T >.

Definition at line 340 of file trilinos_epetra_vector.C.

{
  _vec->PutScalar(s_in);
  
  return *this;
}
 

template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const NumericVector< T > &V) [virtual]$U = V$: copy all components.

Implements NumericVector< T >.

Definition at line 351 of file trilinos_epetra_vector.C.

{
  const EpetraVector<T>* v = libmesh_cast_ptr<const EpetraVector<T>*>(&v_in);

  *this = *v;
  
  return *this;
}
 

template<typename T > EpetraVector< T > & EpetraVector< T >::operator= (const EpetraVector< T > &V)$U = V$: copy all components.

Definition at line 364 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec.

{
  (*_vec) = *v._vec;
  
  return *this;
}
 

template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const std::vector< T > &v) [virtual]$U = V$: copy all components.

Case 1: The vector is the same size of The global vector. Only add the local components.

Case 2: The vector is the same size as our local piece. Insert directly to the local piece.

Implements NumericVector< T >.

Definition at line 375 of file trilinos_epetra_vector.C.

{
  T * values = _vec->Values();
  
  if(this->size() == v.size())
  {
    const unsigned int nl=this->local_size();
    const unsigned int fli=this->first_local_index();
    
    for(unsigned int i=0;i<nl;i++)
      values[i]=v[fli+i];
  }

  else
  {
    libmesh_assert(v.size()==this->local_size());
    
    const unsigned int nl=this->local_size();
    
    for(unsigned int i=0;i<nl;i++)
      values[i]=v[i];
  }

  return *this;
}
 

template<typename T > void EpetraVector< T >::pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2) [virtual]Computes the pointwise (i.e. component-wise) product of vec1 and vec2 and stores the result in *this.

Implements NumericVector< T >.

Definition at line 328 of file trilinos_epetra_vector.C.

References EpetraVector< T >::_vec.

{
  const EpetraVector<T>* V1 = libmesh_cast_ptr<const EpetraVector<T>*>(&vec1);
  const EpetraVector<T>* V2 = libmesh_cast_ptr<const EpetraVector<T>*>(&vec2);

  _vec->Multiply(1.0, *V1->_vec, *V2->_vec, 0.0);
}
 

template<typename T > void NumericVector< T >::print (std::ostream &os = std::cout) const [inline, virtual, inherited]Prints the local contents of the vector to the screen.

Definition at line 749 of file numeric_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  os << 'Size	global =  ' << this->size()
     << '		local =  ' << this->local_size() << std::endl;

  os << '#	Value' << std::endl;
  for (unsigned int i=this->first_local_index(); i<this->last_local_index(); i++)
    os << i << '	' << (*this)(i) << std::endl;
}
 

template<> void NumericVector< Complex >::print (std::ostream &os) const [inline, inherited]

Definition at line 731 of file numeric_vector.h.

References libMesh::initialized().

{
  libmesh_assert (this->initialized());
  os << 'Size	global =  ' << this->size()
     << '		local =  ' << this->local_size() << std::endl;
  
  // std::complex<>::operator<<() is defined, but use this form
  os << '#	Real part		Imaginary part' << std::endl;
  for (unsigned int i=this->first_local_index(); i<this->last_local_index(); i++)
    os << i << '	' 
       << (*this)(i).real() << '		' 
       << (*this)(i).imag() << std::endl;
}
 

template<> void NumericVector< Complex >::print_global (std::ostream &os) const [inline, inherited]

Definition at line 764 of file numeric_vector.h.

References libMesh::initialized(), and libMesh::processor_id().

{
  libmesh_assert (this->initialized());

  std::vector<Complex> v(this->size());
  this->localize(v);

  // Right now we only want one copy of the output
  if (libMesh::processor_id())
    return;
  
  os << 'Size	global =  ' << this->size() << std::endl;
  os << '#	Real part		Imaginary part' << std::endl;
  for (unsigned int i=0; i!=v.size(); i++)
    os << i << '	' 
       << v[i].real() << '		' 
       << v[i].imag() << std::endl;
}
 

template<typename T > void NumericVector< T >::print_global (std::ostream &os = std::cout) const [inline, virtual, inherited]Prints the global contents of the vector to the screen.

Definition at line 786 of file numeric_vector.h.

References libMesh::initialized(), and libMesh::processor_id().

{
  libmesh_assert (this->initialized());

  std::vector<T> v(this->size());
  this->localize(v);

  // Right now we only want one copy of the output
  if (libMesh::processor_id())
    return;

  os << 'Size	global =  ' << this->size() << std::endl;
  os << '#	Value' << std::endl;
  for (unsigned int i=0; i!=v.size(); i++)
    os << i << '	' << v[i] << std::endl;
}
 

void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.

Definition at line 83 of file reference_counter.C.

References ReferenceCounter::get_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
  
  std::cout << ReferenceCounter::get_info();
  
#endif
}
 

template<typename T > void EpetraVector< T >::print_matlab (const std::stringname = 'NULL') const [virtual]Print the contents of the vector in Matlab format. Optionally prints the matrix to the file named name. If name is not specified it is dumped to the screen.

Create an ASCII file containing the matrix if a filename was provided.

Otherwise the matrix will be dumped to the screen.

Destroy the viewer.

Reimplemented from NumericVector< T >.

Definition at line 584 of file trilinos_epetra_vector.C.

{
  libmesh_not_implemented();

//   libmesh_assert (this->initialized());
//   libmesh_assert (this->closed());
  
//   int ierr=0; 
//   EpetraViewer epetra_viewer;


//   ierr = EpetraViewerCreate (libMesh::COMM_WORLD,
//                          &epetra_viewer);
//          CHKERRABORT(libMesh::COMM_WORLD,ierr);

//   /**
//    * Create an ASCII file containing the matrix
//    * if a filename was provided.  
//    */
//   if (name != 'NULL')
//     {
//       ierr = EpetraViewerASCIIOpen( libMesh::COMM_WORLD,
//                                 name.c_str(),
//                                 &epetra_viewer);
//              CHKERRABORT(libMesh::COMM_WORLD,ierr);
      
//       ierr = EpetraViewerSetFormat (epetra_viewer,
//                                 EPETRA_VIEWER_ASCII_MATLAB);
//              CHKERRABORT(libMesh::COMM_WORLD,ierr);
  
//       ierr = VecView (_vec, epetra_viewer);
//              CHKERRABORT(libMesh::COMM_WORLD,ierr);
//     }

//   /**
//    * Otherwise the matrix will be dumped to the screen.
//    */
//   else
//     {
//       ierr = EpetraViewerSetFormat (EPETRA_VIEWER_STDOUT_WORLD,
//                                 EPETRA_VIEWER_ASCII_MATLAB);
//              CHKERRABORT(libMesh::COMM_WORLD,ierr);
  
//       ierr = VecView (_vec, EPETRA_VIEWER_STDOUT_WORLD);
//              CHKERRABORT(libMesh::COMM_WORLD,ierr);
//     }


//   /**
//    * Destroy the viewer.
//    */
//   ierr = EpetraViewerDestroy (epetra_viewer);
//          CHKERRABORT(libMesh::COMM_WORLD,ierr);
}
 

template<typename T > int EpetraVector< T >::ReplaceGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values) [private]Copy values into the vector, replacing any values that already exist for the specified GIDs.

Parameters:

GIDs List of global ids. Must be the same length as the accompanying list of values.
values List of coefficient values. Must be the same length as the accompanying list of GIDs.

Definition at line 783 of file trilinos_epetra_vector.C.

{
  if (GIDs.Length() != values.Length()) {
    return(-1);
  }

  return( inputValues( GIDs.Length(), GIDs.Values(), values.Values(), false) );
}
 

template<typename T > int EpetraVector< T >::ReplaceGlobalValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values) [private]

Definition at line 795 of file trilinos_epetra_vector.C.

{
  return( inputValues( numIDs, GIDs, numValuesPerID, values, false) );
}
 

template<typename T > int EpetraVector< T >::ReplaceGlobalValues (intnumIDs, const int *GIDs, const double *values) [private]Copy values into the vector overwriting any values that already exist for the specified indices.

Definition at line 775 of file trilinos_epetra_vector.C.

{
  return( inputValues( numIDs, GIDs, values, false) );
}
 

template<typename T > void EpetraVector< T >::scale (const Tfactor) [virtual]Scale each element of the vector by the given factor.

Implements NumericVector< T >.

Definition at line 302 of file trilinos_epetra_vector.C.

{
  _vec->Scale(factor_in);
}
 

template<typename T > void EpetraVector< T >::set (const unsigned inti, const Tvalue) [virtual]v(i) = value

Implements NumericVector< T >.

Definition at line 126 of file trilinos_epetra_vector.C.

{
  int i = static_cast<int> (i_in);
  T value = value_in;

  libmesh_assert(i_in<this->size());

  ReplaceGlobalValues(1, &i, &value);

  this->_is_closed = false;
}
 

template<typename T> void EpetraVector< T >::setIgnoreNonLocalEntries (boolflag) [inline, private]Set whether or not non-local data values should be ignored.

Definition at line 550 of file trilinos_epetra_vector.h.

References EpetraVector< T >::ignoreNonLocalEntries_.

                                           {
    ignoreNonLocalEntries_ = flag;
  }
 

template<typename T > unsigned int EpetraVector< T >::size () const [inline, virtual]Returns:

dimension of the vector. This function was formerly called n(), but was renamed to get the EpetraVector<T> class closer to the C++ standard library's std::vector container.

Implements NumericVector< T >.

Definition at line 845 of file trilinos_epetra_vector.h.

References libMesh::initialized().

Referenced by EpetraVector< T >::add().

{
  libmesh_assert (this->initialized());  

  return _vec->GlobalLength();
}
 

template<class T > Real NumericVector< T >::subset_l1_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:

the $l_1$-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 193 of file numeric_vector.C.

Referenced by System::discrete_var_norm().

{
  NumericVector<T> & v = *this;
  
  std::set<unsigned int>::iterator it = indices.begin();
  const std::set<unsigned int>::iterator it_end = indices.end();

  Real norm = 0;
  
  for(; it!=it_end; ++it)
    norm += std::abs(v(*it));

  Parallel::sum(norm);

  return norm;
}
 

template<class T > Real NumericVector< T >::subset_l2_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:

the $l_2$-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 211 of file numeric_vector.C.

References libmesh_norm().

Referenced by System::discrete_var_norm().

{
  NumericVector<T> & v = *this;

  std::set<unsigned int>::iterator it = indices.begin();
  const std::set<unsigned int>::iterator it_end = indices.end();

  Real norm = 0;
  
  for(; it!=it_end; ++it)
    norm += libmesh_norm(v(*it));

  Parallel::sum(norm);

  return std::sqrt(norm);
}
 

template<class T > Real NumericVector< T >::subset_linfty_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:

the maximum absolute value of the specified entries of this vector, which is the $l_infty$-norm of a vector.

Note that the indices must necessary live on this processor.

Definition at line 229 of file numeric_vector.C.

References std::max().

Referenced by System::discrete_var_norm().

{
  NumericVector<T> & v = *this;

  std::set<unsigned int>::iterator it = indices.begin();
  const std::set<unsigned int>::iterator it_end = indices.end();

  Real norm = 0;
  
  for(; it!=it_end; ++it)
    {
      Real value = std::abs(v(*it));
      if(value > norm)
        norm = value;
    }

  Parallel::max(norm);

  return norm;
}
 

template<typename T > T EpetraVector< T >::sum () const [virtual]Returns:

the sum of values in a vector

Implements NumericVector< T >.

Definition at line 45 of file trilinos_epetra_vector.C.

References libMesh::closed().

{
  libmesh_assert(this->closed());
  
  const unsigned int nl = _vec->MyLength();

  T sum=0.0;

  T * values = _vec->Values();
  
  for (unsigned int i=0; i<nl; i++)
    sum += values[i];

  Parallel::sum<T>(sum);
  
  return sum;
}
 

template<typename T > int EpetraVector< T >::SumIntoGlobalValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values) [private]

Definition at line 766 of file trilinos_epetra_vector.C.

{
  return( inputValues( numIDs, GIDs, numValuesPerID, values, true) );
}
 

template<typename T > int EpetraVector< T >::SumIntoGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values) [private]Accumulate values into the vector, adding them to any values that already exist for the specified GIDs.

Parameters:

GIDs List of global ids. Must be the same length as the accompanying list of values.
values List of coefficient values. Must be the same length as the accompanying list of GIDs.

Definition at line 754 of file trilinos_epetra_vector.C.

{
  if (GIDs.Length() != values.Length()) {
    return(-1);
  }

  return( inputValues( GIDs.Length(), GIDs.Values(), values.Values(), true) );
}
 

template<typename T > int EpetraVector< T >::SumIntoGlobalValues (intnumIDs, const int *GIDs, const double *values) [private]Accumulate values into the vector, adding them to any values that already exist for the specified indices.

Definition at line 746 of file trilinos_epetra_vector.C.

{
  return( inputValues( numIDs, GIDs, values, true) );
}
 

template<typename T > void EpetraVector< T >::swap (NumericVector< T > &v) [inline, virtual]Swaps the raw Epetra vector context pointers.

Reimplemented from NumericVector< T >.

Definition at line 929 of file trilinos_epetra_vector.h.

References EpetraVector< T >::_destroy_vec_on_exit, and EpetraVector< T >::_vec.

Referenced by Problem_Interface::computeF().

{
  EpetraVector<T>& v = libmesh_cast_ref<EpetraVector<T>&>(other);

  std::swap(_vec, v._vec);
  std::swap(_destroy_vec_on_exit, v._destroy_vec_on_exit);
}
 

template<typename T> ParallelType& NumericVector< T >::type () [inline, inherited]Returns:

the type (SERIAL, PARALLEL, GHOSTED) of the vector.

Definition at line 119 of file numeric_vector.h.

{ return _type; }
 

template<typename T> ParallelType NumericVector< T >::type () const [inline, inherited]Returns:

the type (SERIAL, PARALLEL, GHOSTED) of the vector.

Definition at line 114 of file numeric_vector.h.

Referenced by DistributedVector< T >::DistributedVector(), DofMap::enforce_constraints_exactly(), EpetraVector< T >::EpetraVector(), EpetraVector< T >::init(), LaspackVector< T >::init(), DistributedVector< T >::init(), PetscVector< T >::localize(), PetscVector< T >::PetscVector(), System::project_vector(), and System::read_serialized_vector().

{ return _type; }
 

template<typename T> Epetra_Vector* EpetraVector< T >::vec () [inline]Returns the raw PETSc vector context pointer. Note this is generally not required in user-level code. Just don't do anything crazy like calling VecDestroy()!

Definition at line 467 of file trilinos_epetra_vector.h.

References EpetraVector< T >::_vec.

Referenced by EpetraMatrix< T >::get_diagonal(), and NoxNonlinearSolver< T >::solve().

{ libmesh_assert (_vec != NULL); return _vec; }
 

template<typename T > void EpetraVector< T >::zero () [inline, virtual]Set all entries to zero. Equivalent to v = 0, but more obvious and faster.

Implements NumericVector< T >.

Definition at line 819 of file trilinos_epetra_vector.h.

References libMesh::initialized().

Referenced by Problem_Interface::computeF().

{
  libmesh_assert (this->initialized());

  _vec->PutScalar(0.0);
}
 

Friends And Related Function Documentation

 

template<typename T> std::ostream& operator<< (std::ostream &os, const NumericVector< T > &v) [friend, inherited]Same as above but allows you to use stream syntax.

Definition at line 537 of file numeric_vector.h.

  {
    v.print_global(os);
    return os;
  }
 

Member Data Documentation

 

ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.

Definition at line 110 of file reference_counter.h.

Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().  

template<typename T> bool EpetraVector< T >::_destroy_vec_on_exit [private]This boolean value should only be set to false for the constructor which takes a Epetra Vec object.

Definition at line 486 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::swap().  

template<typename T> bool NumericVector< T >::_is_closed [protected, inherited]Flag to see if the Numeric assemble routines have been called yet

Definition at line 582 of file numeric_vector.h.

Referenced by NumericVector< Number >::closed(), PetscVector< T >::init(), DistributedVector< T >::localize(), LaspackVector< T >::operator=(), DistributedVector< T >::operator=(), PetscVector< T >::PetscVector(), and NumericVector< T >::swap().  

template<typename T> bool NumericVector< T >::_is_initialized [protected, inherited]Flag to tell if init has been called yet

Definition at line 588 of file numeric_vector.h.

Referenced by PetscVector< T >::create_subvector(), EpetraVector< T >::EpetraVector(), PetscVector< T >::init(), NumericVector< Number >::initialized(), DistributedVector< T >::localize(), DistributedVector< T >::operator=(), PetscVector< T >::PetscVector(), and NumericVector< T >::swap().  

template<typename T> Epetra_Map* EpetraVector< T >::_map [private]Holds the distributed Map

Definition at line 480 of file trilinos_epetra_vector.h.  

Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.

Definition at line 123 of file reference_counter.h.  

Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.

Definition at line 118 of file reference_counter.h.

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

template<typename T> ParallelType NumericVector< T >::_type [protected, inherited]Type of vector

Definition at line 593 of file numeric_vector.h.

Referenced by DistributedVector< T >::DistributedVector(), EpetraVector< T >::EpetraVector(), PetscVector< T >::init(), PetscVector< T >::operator=(), PetscVector< T >::PetscVector(), NumericVector< T >::swap(), and NumericVector< Number >::type().  

template<typename T> Epetra_Vector* EpetraVector< T >::_vec [private]Actual Epetra vector datatype to hold vector entries

Definition at line 475 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::add(), EpetraVector< T >::dot(), EpetraVector< T >::EpetraVector(), EpetraVector< T >::FEoperatorequals(), EpetraVector< T >::localize(), EpetraVector< T >::operator=(), EpetraVector< T >::pointwise_mult(), EpetraVector< T >::swap(), and EpetraVector< T >::vec().  

template<typename T> int EpetraVector< T >::allocatedNonlocalLength_ [private]

Definition at line 579 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::FEoperatorequals().  

template<typename T> bool EpetraVector< T >::ignoreNonLocalEntries_ [private]

Definition at line 582 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::setIgnoreNonLocalEntries().  

template<typename T> double* EpetraVector< T >::myCoefs_ [private]

Definition at line 574 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::EpetraVector().  

template<typename T> int EpetraVector< T >::myFirstID_ [private]

Definition at line 572 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::EpetraVector().  

template<typename T> int EpetraVector< T >::myNumIDs_ [private]

Definition at line 573 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::EpetraVector().  

template<typename T> double** EpetraVector< T >::nonlocalCoefs_ [private]

Definition at line 580 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::FEoperatorequals().  

template<typename T> int* EpetraVector< T >::nonlocalElementSize_ [private]

Definition at line 577 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::FEoperatorequals().  

template<typename T> int* EpetraVector< T >::nonlocalIDs_ [private]

Definition at line 576 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::FEoperatorequals().  

template<typename T> int EpetraVector< T >::numNonlocalIDs_ [private]

Definition at line 578 of file trilinos_epetra_vector.h.

Referenced by EpetraVector< T >::FEoperatorequals().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Types
Protected Member Functions
Protected Attributes
Static Protected Attributes
Private Member Functions
Private Attributes
Friends
Detailed Description
template<typename T> class EpetraVector< T >
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
Constructor & Destructor Documentation
template<typename T > EpetraVector< T >::EpetraVector (const ParallelTypetype = AUTOMATIC) [inline, explicit]Dummy-Constructor. Dimension=0
template<typename T > EpetraVector< T >::EpetraVector (const unsigned intn, const ParallelTypetype = AUTOMATIC) [inline, explicit]Constructor. Set dimension to n and initialize all elements with zero.
template<typename T > EpetraVector< T >::EpetraVector (const unsigned intn, const unsigned intn_local, const ParallelTypetype = AUTOMATIC) [inline]Constructor. Set local dimension to n_local, the global dimension to n, and initialize all elements with zero.
template<typename T > EpetraVector< T >::EpetraVector (const unsigned intN, const unsigned intn_local, const std::vector< unsigned int > &ghost, const ParallelTypetype = 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.
template<typename T > EpetraVector< T >::EpetraVector (Epetra_Vector &v) [inline]Constructor. Creates a EpetraVector assuming you already have a valid Epetra Vec object. In this case, v is NOT destroyed by the EpetraVector constructor when this object goes out of scope. This allows ownership of v to remain with the original creator, and to simply provide additional functionality with the EpetraVector.
template<typename T > EpetraVector< T >::~EpetraVector () [inline]Destructor, deallocates memory. Made virtual to allow for derived classes to behave properly.
Member Function Documentation
template<typename T > void EpetraVector< T >::abs () [virtual]v = abs(v)... that is, each entry in v is replaced by its absolute value.
template<typename T > void EpetraVector< T >::add (const unsigned inti, const Tvalue) [virtual]v(i) += value
template<typename T > void EpetraVector< T >::add (const Ts) [virtual]$U(0-LIBMESH_DIM)+=s$. Addition of s to all components. Note that s is a scalar and not a vector.
template<typename T > void EpetraVector< T >::add (const NumericVector< T > &V) [virtual]$ U+=V $ . Simple vector addition, equal to the operator +=.
template<typename T > void EpetraVector< T >::add (const Ta, const NumericVector< T > &v) [virtual]$ U+=a*V $ . Simple vector addition, equal to the operator +=.
template<typename T > void EpetraVector< T >::add_vector (const NumericVector< T > &V, const SparseMatrix< T > &A) [virtual]$U+=A*V$, add the product of a SparseMatrix A and a NumericVector V to this, where this=U.
template<typename T > void EpetraVector< T >::add_vector (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$U+=V $ where U and V are type DenseVector<T> and you want to specify WHERE to add the DenseVector<T> V
template<typename T> void NumericVector< T >::add_vector (const NumericVector< T > &v, const ShellMatrix< T > &a) [inherited]$U+=A*V$, add the product of a ShellMatrix A and a NumericVector V to this, where this=U.
template<typename T > void EpetraVector< T >::add_vector (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U+=V $ where U and V are type NumericVector<T> and you want to specify WHERE to add the NumericVector<T> V
template<typename T > void EpetraVector< T >::add_vector (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices) [virtual]$ U+=v $ where v is a std::vector<T> and you want to specify WHERE to add it
template<typename T > AutoPtr< NumericVector< T > > NumericVector< T >::build (const SolverPackagesolver_package = libMesh::default_solver_package()) [static, inherited]Builds a NumericVector using the linear solver package specified by solver_package
template<typename T > void EpetraVector< T >::clear () [inline, virtual]Returns:
template<typename T > AutoPtr< NumericVector< T > > EpetraVector< T >::clone () const [inline, virtual]Creates a copy of this vector and returns it in an AutoPtr.
template<typename T > void EpetraVector< T >::close () [inline, virtual]Call the assemble functions
template<typename T> virtual bool NumericVector< T >::closed () const [inline, virtual, inherited]Returns:
template<typename T> virtual int NumericVector< T >::compare (const NumericVector< T > &other_vector, const Realthreshold = TOLERANCE) const [virtual, inherited]Returns:
template<> int NumericVector< float >::compare (const NumericVector< float > &other_vector, const Realthreshold) const [inherited]
template<> int NumericVector< double >::compare (const NumericVector< double > &other_vector, const Realthreshold) const [inherited]
template<> int NumericVector< long double >::compare (const NumericVector< long double > &other_vector, const Realthreshold) const [inherited]
template<> int NumericVector< Complex >::compare (const NumericVector< Complex > &other_vector, const Realthreshold) const [inherited]
template<typename T > void EpetraVector< T >::create_subvector (NumericVector< T > &subvector, const std::vector< unsigned int > &rows) const [virtual]Creates a 'subvector' from this vector using the rows indices of the 'rows' array.
template<typename T > void EpetraVector< T >::destroyNonlocalData () [private]
template<typename T > T EpetraVector< T >::dot (const NumericVector< T > &V) const [virtual]Computes the dot product, p = U.V
template<typename T> virtual T NumericVector< T >::el (const unsigned inti) const [inline, virtual, inherited]Returns:
template<typename T > void EpetraVector< T >::FEoperatorequals (const EpetraVector< T > &source) [private]
template<typename T > unsigned int EpetraVector< T >::first_local_index () const [inline, virtual]Returns:
template<typename T> void NumericVector< T >::get (const std::vector< unsigned int > &index, std::vector< T > &values) const [inline, virtual, inherited]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.
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
template<typename T > int EpetraVector< T >::GlobalAssemble (Epetra_CombineModemode = Add) [private]Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was passed to this vector at construction time. Data imported from other processors is stored on the owning processor with a 'sumInto' or accumulate operation. This is a collective method -- every processor must enter it before any will complete it.
void 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.
void 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.
template<class T > void EpetraVector< T >::init (const NumericVector< T > &other, const boolfast = false) [virtual]Creates a vector that has the same dimension and storage type as other, including ghost dofs.
template<typename T > void EpetraVector< T >::init (const unsigned intN, const unsigned intn_local, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, 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.
template<typename T > void EpetraVector< T >::init (const unsigned intN, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, virtual]call init with n_local = N,
template<typename T > void EpetraVector< T >::init (const unsigned intn, const unsigned intn_local, const std::vector< unsigned int > &, const boolfast = false, const ParallelTypetype = AUTOMATIC) [inline, virtual]Create a vector that holds the local indices plus those specified in the ghost argument.
template<typename T> virtual bool NumericVector< T >::initialized () const [inline, virtual, inherited]Returns:
template<typename T > int EpetraVector< T >::inputNonlocalValue (intGID, doublevalue, boolaccumulate) [private]
template<typename T > int EpetraVector< T >::inputNonlocalValues (intGID, intnumValues, const double *values, boolaccumulate) [private]
template<typename T > int EpetraVector< T >::inputValues (intnumIDs, const int *GIDs, const double *values, boolaccumulate) [private]
template<typename T > int EpetraVector< T >::inputValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values, boolaccumulate) [private]
template<typename T > void EpetraVector< T >::insert (const std::vector< T > &v, const std::vector< unsigned int > &dof_indices) [virtual]$ U=v $ where v is a DenseVector<T> and you want to specify WHERE to insert it
template<typename T > void EpetraVector< T >::insert (const NumericVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$U=V$, where U and V are type NumericVector<T> and you want to specify WHERE to insert the NumericVector<T> V
template<typename T > void EpetraVector< T >::insert (const DenseSubVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U=V $ where V is type DenseSubVector<T> and you want to specify WHERE to insert it
template<typename T > void EpetraVector< T >::insert (const DenseVector< T > &V, const std::vector< unsigned int > &dof_indices) [virtual]$ U=V $ where V is type DenseVector<T> and you want to specify WHERE to insert it
template<typename T > Real EpetraVector< T >::l1_norm () const [virtual]Returns:
template<typename T > Real EpetraVector< T >::l2_norm () const [virtual]Returns:
template<typename T > unsigned int EpetraVector< T >::last_local_index () const [inline, virtual]Returns:
template<typename T > Real EpetraVector< T >::linfty_norm () const [virtual]Returns:
template<typename T > unsigned int EpetraVector< T >::local_size () const [inline, virtual]Returns:
template<typename T > void EpetraVector< T >::localize (const unsigned intfirst_local_idx, const unsigned intlast_local_idx, const std::vector< unsigned int > &send_list) [virtual]Updates a local vector with selected values from neighboring processors, as defined by send_list.
template<typename T > void EpetraVector< T >::localize (std::vector< T > &v_local) const [virtual]Creates a copy of the global vector in the local vector v_local.
template<typename T > void EpetraVector< T >::localize (NumericVector< T > &v_local) const [virtual]Same, but fills a NumericVector<T> instead of a std::vector.
template<typename T > void EpetraVector< T >::localize (NumericVector< T > &v_local, const std::vector< unsigned int > &send_list) const [virtual]Creates a local vector v_local containing only information relevant to this processor, as defined by the send_list.
template<typename T > void EpetraVector< T >::localize_to_one (std::vector< T > &v_local, const unsigned intproc_id = 0) const [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.
template<typename T > Real EpetraVector< T >::max () const [inline, virtual]Returns:
template<typename T > Real EpetraVector< T >::min () const [inline, virtual]Returns:
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
template<typename T > T EpetraVector< T >::operator() (const unsigned inti) const [inline, virtual]Access components, returns U(i).
template<typename T> NumericVector<T>& NumericVector< T >::operator*= (const Ta) [inline, inherited]Multiplication operator. Equivalent to U.scale(a)
template<typename T > NumericVector< T > & EpetraVector< T >::operator+= (const NumericVector< T > &V) [virtual]Addition operator. Fast equivalent to U.add(1, V).
template<typename T > NumericVector< T > & EpetraVector< T >::operator-= (const NumericVector< T > &V) [virtual]Subtraction operator. Fast equivalent to U.add(-1, V).
template<typename T> NumericVector<T>& NumericVector< T >::operator/= (const Ta) [inline, inherited]Division operator. Equivalent to U.scale(1./a)
template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const Ts) [virtual]Change the dimension to that of the vector V. The same applies as for the other init function.
template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const NumericVector< T > &V) [virtual]$U = V$: copy all components.
template<typename T > EpetraVector< T > & EpetraVector< T >::operator= (const EpetraVector< T > &V)$U = V$: copy all components.
template<typename T > NumericVector< T > & EpetraVector< T >::operator= (const std::vector< T > &v) [virtual]$U = V$: copy all components.
template<typename T > void EpetraVector< T >::pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2) [virtual]Computes the pointwise (i.e. component-wise) product of vec1 and vec2 and stores the result in *this.
template<typename T > void NumericVector< T >::print (std::ostream &os = std::cout) const [inline, virtual, inherited]Prints the local contents of the vector to the screen.
template<> void NumericVector< Complex >::print (std::ostream &os) const [inline, inherited]
template<> void NumericVector< Complex >::print_global (std::ostream &os) const [inline, inherited]
template<typename T > void NumericVector< T >::print_global (std::ostream &os = std::cout) const [inline, virtual, inherited]Prints the global contents of the vector to the screen.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
template<typename T > void EpetraVector< T >::print_matlab (const std::stringname = 'NULL') const [virtual]Print the contents of the vector in Matlab format. Optionally prints the matrix to the file named name. If name is not specified it is dumped to the screen.
template<typename T > int EpetraVector< T >::ReplaceGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values) [private]Copy values into the vector, replacing any values that already exist for the specified GIDs.
template<typename T > int EpetraVector< T >::ReplaceGlobalValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values) [private]
template<typename T > int EpetraVector< T >::ReplaceGlobalValues (intnumIDs, const int *GIDs, const double *values) [private]Copy values into the vector overwriting any values that already exist for the specified indices.
template<typename T > void EpetraVector< T >::scale (const Tfactor) [virtual]Scale each element of the vector by the given factor.
template<typename T > void EpetraVector< T >::set (const unsigned inti, const Tvalue) [virtual]v(i) = value
template<typename T> void EpetraVector< T >::setIgnoreNonLocalEntries (boolflag) [inline, private]Set whether or not non-local data values should be ignored.
template<typename T > unsigned int EpetraVector< T >::size () const [inline, virtual]Returns:
template<class T > Real NumericVector< T >::subset_l1_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:
template<class T > Real NumericVector< T >::subset_l2_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:
template<class T > Real NumericVector< T >::subset_linfty_norm (const std::set< unsigned int > &indices) [virtual, inherited]Returns:
template<typename T > T EpetraVector< T >::sum () const [virtual]Returns:
template<typename T > int EpetraVector< T >::SumIntoGlobalValues (intnumIDs, const int *GIDs, const int *numValuesPerID, const double *values) [private]
template<typename T > int EpetraVector< T >::SumIntoGlobalValues (const Epetra_IntSerialDenseVector &GIDs, const Epetra_SerialDenseVector &values) [private]Accumulate values into the vector, adding them to any values that already exist for the specified GIDs.
template<typename T > int EpetraVector< T >::SumIntoGlobalValues (intnumIDs, const int *GIDs, const double *values) [private]Accumulate values into the vector, adding them to any values that already exist for the specified indices.
template<typename T > void EpetraVector< T >::swap (NumericVector< T > &v) [inline, virtual]Swaps the raw Epetra vector context pointers.
template<typename T> ParallelType& NumericVector< T >::type () [inline, inherited]Returns:
template<typename T> ParallelType NumericVector< T >::type () const [inline, inherited]Returns:
template<typename T> Epetra_Vector* EpetraVector< T >::vec () [inline]Returns the raw PETSc vector context pointer. Note this is generally not required in user-level code. Just don't do anything crazy like calling VecDestroy()!
template<typename T > void EpetraVector< T >::zero () [inline, virtual]Set all entries to zero. Equivalent to v = 0, but more obvious and faster.
Friends And Related Function Documentation
template<typename T> std::ostream& operator<< (std::ostream &os, const NumericVector< T > &v) [friend, inherited]Same as above but allows you to use stream syntax.
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
template<typename T> bool EpetraVector< T >::_destroy_vec_on_exit [private]This boolean value should only be set to false for the constructor which takes a Epetra Vec object.
template<typename T> bool NumericVector< T >::_is_closed [protected, inherited]Flag to see if the Numeric assemble routines have been called yet
template<typename T> bool NumericVector< T >::_is_initialized [protected, inherited]Flag to tell if init has been called yet
template<typename T> Epetra_Map* EpetraVector< T >::_map [private]Holds the distributed Map
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
template<typename T> ParallelType NumericVector< T >::_type [protected, inherited]Type of vector
template<typename T> Epetra_Vector* EpetraVector< T >::_vec [private]Actual Epetra vector datatype to hold vector entries
template<typename T> int EpetraVector< T >::allocatedNonlocalLength_ [private]
template<typename T> bool EpetraVector< T >::ignoreNonLocalEntries_ [private]
template<typename T> double* EpetraVector< T >::myCoefs_ [private]
template<typename T> int EpetraVector< T >::myFirstID_ [private]
template<typename T> int EpetraVector< T >::myNumIDs_ [private]
template<typename T> double** EpetraVector< T >::nonlocalCoefs_ [private]
template<typename T> int* EpetraVector< T >::nonlocalElementSize_ [private]
template<typename T> int* EpetraVector< T >::nonlocalIDs_ [private]
template<typename T> int EpetraVector< T >::numNonlocalIDs_ [private]
Author

This document was created by man2html, using the manual pages.
Time: 21:45:37 GMT, April 16, 2011