#include <trilinos_epetra_vector.h>
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 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 ()
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
void increment_constructor_count (const std::string &name)
void increment_destructor_count (const std::string &name)
bool _is_closed
bool _is_initialized
ParallelType _type
static Counts _counts
static Threads::atomic< unsigned int > _n_objects
static Threads::spin_mutex _mutex
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 ()
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_
std::ostream & operator<< (std::ostream &os, const NumericVector< T > &v)
Author:
Definition at line 55 of file trilinos_epetra_vector.h.
Definition at line 105 of file reference_counter.h.
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;
}
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);
}
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);
}
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);
}
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;
}
Definition at line 718 of file trilinos_epetra_vector.h.
{
this->clear ();
}
Implements NumericVector< T >.
Definition at line 308 of file trilinos_epetra_vector.C.
{
_vec->Abs(*_vec);
}
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;
}
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;
}
Implements NumericVector< T >.
Definition at line 230 of file trilinos_epetra_vector.C.
{
this->add (1., v);
}
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.);
}
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);
}
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]);
}
Definition at line 253 of file numeric_vector.C.
References ShellMatrix< T >::vector_mult_add().
{
a.vector_mult_add(*this,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));
}
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]));
}
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;
}
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;
}
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;
}
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;
}
Definition at line 125 of file numeric_vector.h.
Referenced by DofMap::enforce_constraints_exactly(), and DofMap::max_constraint_error().
{ return _is_closed; }
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;
}
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;
}
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;
}
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;
}
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);
}
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;
}
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;
}
Definition at line 314 of file numeric_vector.h.
{ return (*this)(i); }
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];
}
}
}
}
Implements NumericVector< T >.
Definition at line 865 of file trilinos_epetra_vector.h.
References libMesh::initialized().
{
libmesh_assert (this->initialized());
return _vec->Map().MinMyGID();
}
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]);
}
}
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
}
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);
}
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++;
}
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++;
}
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());
}
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 ();
}
Implements NumericVector< T >.
Definition at line 783 of file trilinos_epetra_vector.h.
References libMesh::init().
{
this->init(n,n,fast,type);
}
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);
}
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; }
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);
}
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);
}
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);
}
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);
}
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]));
}
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));
}
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));
}
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]);
}
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;
}
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;
}
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;
}
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;
}
Implements NumericVector< T >.
Definition at line 856 of file trilinos_epetra_vector.h.
References libMesh::initialized().
{
libmesh_assert (this->initialized());
return _vec->MyLength();
}
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();
}
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);
}
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);
}
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);
}
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);
}
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;
}
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;
}
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; }
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()];
}
Definition at line 340 of file numeric_vector.h.
{ this->scale(a); return *this; }
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;
}
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;
}
Definition at line 346 of file numeric_vector.h.
{ this->scale(1./a); return *this; }
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;
}
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;
}
Definition at line 364 of file trilinos_epetra_vector.C.
References EpetraVector< T >::_vec.
{
(*_vec) = *v._vec;
return *this;
}
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;
}
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);
}
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;
}
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;
}
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;
}
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;
}
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
}
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);
}
Parameters:
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) );
}
Definition at line 795 of file trilinos_epetra_vector.C.
{
return( inputValues( numIDs, GIDs, numValuesPerID, values, false) );
}
Definition at line 775 of file trilinos_epetra_vector.C.
{
return( inputValues( numIDs, GIDs, values, false) );
}
Implements NumericVector< T >.
Definition at line 302 of file trilinos_epetra_vector.C.
{
_vec->Scale(factor_in);
}
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;
}
Definition at line 550 of file trilinos_epetra_vector.h.
References EpetraVector< T >::ignoreNonLocalEntries_.
{
ignoreNonLocalEntries_ = flag;
}
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();
}
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;
}
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);
}
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;
}
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;
}
Definition at line 766 of file trilinos_epetra_vector.C.
{
return( inputValues( numIDs, GIDs, numValuesPerID, values, true) );
}
Parameters:
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) );
}
Definition at line 746 of file trilinos_epetra_vector.C.
{
return( inputValues( numIDs, GIDs, values, true) );
}
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);
}
Definition at line 119 of file numeric_vector.h.
{ return _type; }
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; }
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; }
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);
}
Definition at line 537 of file numeric_vector.h.
{
v.print_global(os);
return os;
}
Definition at line 110 of file reference_counter.h.
Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().
Definition at line 486 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::swap().
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().
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().
Definition at line 480 of file trilinos_epetra_vector.h.
Definition at line 123 of file reference_counter.h.
Definition at line 118 of file reference_counter.h.
Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().
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().
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().
Definition at line 579 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::FEoperatorequals().
Definition at line 582 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::setIgnoreNonLocalEntries().
Definition at line 574 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::EpetraVector().
Definition at line 572 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::EpetraVector().
Definition at line 573 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::EpetraVector().
Definition at line 580 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::FEoperatorequals().
Definition at line 577 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::FEoperatorequals().
Definition at line 576 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::FEoperatorequals().
Definition at line 578 of file trilinos_epetra_vector.h.
Referenced by EpetraVector< T >::FEoperatorequals().
Generated automatically by Doxygen for libMesh from the source code.