libMesh
trilinos_epetra_vector.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #ifndef LIBMESH_TRILINOS_EPETRA_VECTOR_H
19 #define LIBMESH_TRILINOS_EPETRA_VECTOR_H
20 
21 
22 #include "libmesh/libmesh_common.h"
23 
24 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
25 
26 // Local includes
27 #include "libmesh/numeric_vector.h"
28 #include "libmesh/parallel.h"
29 #include "libmesh/auto_ptr.h" // libmesh_make_unique
30 
31 // Trilinos includes
32 #include "libmesh/ignore_warnings.h"
33 #include <Epetra_CombineMode.h>
34 #include <Epetra_Map.h>
35 #include <Epetra_MultiVector.h>
36 #include <Epetra_Vector.h>
37 #include <Epetra_MpiComm.h>
38 #include "libmesh/restore_warnings.h"
39 
40 // C++ includes
41 #include <cstddef>
42 #include <vector>
43 
44 // Forward declarations
45 class Epetra_IntSerialDenseVector;
46 class Epetra_SerialDenseVector;
47 
48 namespace libMesh
49 {
50 
51 // forward declarations
52 template <typename T> class SparseMatrix;
53 
62 template <typename T>
63 class EpetraVector final : public NumericVector<T>
64 {
65 public:
66 
70  explicit
71  EpetraVector (const Parallel::Communicator & comm,
72  const ParallelType type = AUTOMATIC);
73 
77  explicit
78  EpetraVector (const Parallel::Communicator & comm,
79  const numeric_index_type n,
80  const ParallelType type = AUTOMATIC);
81 
86  EpetraVector (const Parallel::Communicator & comm,
87  const numeric_index_type n,
88  const numeric_index_type n_local,
89  const ParallelType type = AUTOMATIC);
90 
96  EpetraVector (const Parallel::Communicator & comm,
97  const numeric_index_type N,
98  const numeric_index_type n_local,
99  const std::vector<numeric_index_type> & ghost,
100  const ParallelType type = AUTOMATIC);
101 
109  EpetraVector(Epetra_Vector & v,
110  const Parallel::Communicator & comm);
111 
117  EpetraVector (EpetraVector &&) = delete;
118  EpetraVector (const EpetraVector &) = delete;
119  EpetraVector & operator= (const EpetraVector &) = delete;
120  EpetraVector & operator= (EpetraVector &&) = delete;
121  virtual ~EpetraVector ();
122 
123  virtual void close () override;
124 
125  virtual void clear () override;
126 
127  virtual void zero () override;
128 
129  virtual std::unique_ptr<NumericVector<T>> zero_clone () const override;
130 
131  virtual std::unique_ptr<NumericVector<T>> clone () const override;
132 
133  virtual void init (const numeric_index_type N,
134  const numeric_index_type n_local,
135  const bool fast=false,
136  const ParallelType type=AUTOMATIC) override;
137 
138  virtual void init (const numeric_index_type N,
139  const bool fast=false,
140  const ParallelType type=AUTOMATIC) override;
141 
142  virtual void init (const numeric_index_type N,
143  const numeric_index_type n_local,
144  const std::vector<numeric_index_type> & ghost,
145  const bool fast = false,
146  const ParallelType = AUTOMATIC) override;
147 
148  virtual void init (const NumericVector<T> & other,
149  const bool fast = false) override;
150 
151  virtual NumericVector<T> & operator= (const T s) override;
152 
153  virtual NumericVector<T> & operator= (const NumericVector<T> & v) override;
154 
155  virtual NumericVector<T> & operator= (const std::vector<T> & v) override;
156 
157  virtual Real min () const override;
158 
159  virtual Real max () const override;
160 
161  virtual T sum () const override;
162 
163  virtual Real l1_norm () const override;
164 
165  virtual Real l2_norm () const override;
166 
167  virtual Real linfty_norm () const override;
168 
169  virtual numeric_index_type size () const override;
170 
171  virtual numeric_index_type local_size() const override;
172 
173  virtual numeric_index_type first_local_index() const override;
174 
175  virtual numeric_index_type last_local_index() const override;
176 
177  virtual T operator() (const numeric_index_type i) const override;
178 
179  virtual NumericVector<T> & operator += (const NumericVector<T> & v) override;
180 
181  virtual NumericVector<T> & operator -= (const NumericVector<T> & v) override;
182 
183  virtual NumericVector<T> & operator *= (const NumericVector<T> & v) override;
184 
185  virtual NumericVector<T> & operator /= (const NumericVector<T> & v) override;
186 
187  virtual void reciprocal() override;
188 
189  virtual void conjugate() override;
190 
191  virtual void set (const numeric_index_type i, const T value) override;
192 
193  virtual void add (const numeric_index_type i, const T value) override;
194 
195  virtual void add (const T s) override;
196 
197  virtual void add (const NumericVector<T> & v) override;
198 
199  virtual void add (const T a, const NumericVector<T> & v) override;
200 
206 
207  virtual void add_vector (const T * v,
208  const std::vector<numeric_index_type> & dof_indices) override;
209 
210  virtual void add_vector (const NumericVector<T> & v,
211  const SparseMatrix<T> & A) override;
212 
213  virtual void add_vector_transpose (const NumericVector<T> & v,
214  const SparseMatrix<T> & A) override;
215 
221 
222  virtual void insert (const T * v,
223  const std::vector<numeric_index_type> & dof_indices) override;
224 
225  virtual void scale (const T factor) override;
226 
227  virtual void abs() override;
228 
229  virtual T dot(const NumericVector<T> & v) const override;
230 
231  virtual void localize (std::vector<T> & v_local) const override;
232 
233  virtual void localize (NumericVector<T> & v_local) const override;
234 
235  virtual void localize (NumericVector<T> & v_local,
236  const std::vector<numeric_index_type> & send_list) const override;
237 
238  virtual void localize (std::vector<T> & v_local,
239  const std::vector<numeric_index_type> & indices) const override;
240 
241  virtual void localize (const numeric_index_type first_local_idx,
242  const numeric_index_type last_local_idx,
243  const std::vector<numeric_index_type> & send_list) override;
244 
245  virtual void localize_to_one (std::vector<T> & v_local,
246  const processor_id_type proc_id=0) const override;
247 
248  virtual void pointwise_mult (const NumericVector<T> & vec1,
249  const NumericVector<T> & vec2) override;
250 
251  virtual void create_subvector (NumericVector<T> & subvector,
252  const std::vector<numeric_index_type> & rows) const override;
253 
254  virtual void swap (NumericVector<T> & v) override;
255 
264  Epetra_Vector * vec () { libmesh_assert(_vec); return _vec; }
265 
266 private:
267 
271  Epetra_Vector * _vec;
272 
276  std::unique_ptr<Epetra_Map> _map;
277 
283 
284  // The following were copied (and slightly modified) from
285  // Epetra_FEVector.h in order to allow us to use a standard
286  // Epetra_Vector... which is more compatible with other Trilinos
287  // packages such as NOX. All of this code is originally under LGPL
288 
293  int SumIntoGlobalValues(int numIDs,
294  const int * GIDs,
295  const double * values);
296 
307  int SumIntoGlobalValues(const Epetra_IntSerialDenseVector & GIDs,
308  const Epetra_SerialDenseVector & values);
309 
314  int ReplaceGlobalValues(int numIDs,
315  const int * GIDs,
316  const double * values);
317 
328  int ReplaceGlobalValues(const Epetra_IntSerialDenseVector & GIDs,
329  const Epetra_SerialDenseVector & values);
330 
331  int SumIntoGlobalValues(int numIDs,
332  const int * GIDs,
333  const int * numValuesPerID,
334  const double * values);
335 
336  int ReplaceGlobalValues(int numIDs,
337  const int * GIDs,
338  const int * numValuesPerID,
339  const double * values);
340 
349  int GlobalAssemble(Epetra_CombineMode mode = Add);
350 
354  void setIgnoreNonLocalEntries(bool flag) {
355  ignoreNonLocalEntries_ = flag;
356  }
357 
358  void FEoperatorequals(const EpetraVector & source);
359 
360  int inputValues(int numIDs,
361  const int * GIDs,
362  const double * values,
363  bool accumulate);
364 
365  int inputValues(int numIDs,
366  const int * GIDs,
367  const int * numValuesPerID,
368  const double * values,
369  bool accumulate);
370 
371  int inputNonlocalValue(int GID,
372  double value,
373  bool accumulate);
374 
375  int inputNonlocalValues(int GID,
376  int numValues,
377  const double * values,
378  bool accumulate);
379 
380  void destroyNonlocalData();
381 
384  double * myCoefs_;
385 
390  double ** nonlocalCoefs_;
391 
397  unsigned char last_edit;
398 
400 };
401 
402 
403 /*----------------------- Inline functions ----------------------------------*/
404 
405 
406 
407 template <typename T>
408 inline
409 EpetraVector<T>::EpetraVector (const Parallel::Communicator & comm,
410  const ParallelType type) :
411  NumericVector<T>(comm, type),
412  _destroy_vec_on_exit(true),
413  myFirstID_(0),
414  myNumIDs_(0),
415  myCoefs_(nullptr),
416  nonlocalIDs_(nullptr),
417  nonlocalElementSize_(nullptr),
418  numNonlocalIDs_(0),
419  allocatedNonlocalLength_(0),
420  nonlocalCoefs_(nullptr),
421  last_edit(0),
422  ignoreNonLocalEntries_(false)
423 {
424  this->_type = type;
425 }
426 
427 
428 
429 template <typename T>
430 inline
431 EpetraVector<T>::EpetraVector (const Parallel::Communicator & comm,
432  const numeric_index_type n,
433  const ParallelType type) :
434  NumericVector<T>(comm, type),
435  _destroy_vec_on_exit(true),
436  myFirstID_(0),
437  myNumIDs_(0),
438  myCoefs_(nullptr),
439  nonlocalIDs_(nullptr),
440  nonlocalElementSize_(nullptr),
441  numNonlocalIDs_(0),
442  allocatedNonlocalLength_(0),
443  nonlocalCoefs_(nullptr),
444  last_edit(0),
445  ignoreNonLocalEntries_(false)
446 
447 {
448  this->init(n, n, false, type);
449 }
450 
451 
452 
453 template <typename T>
454 inline
455 EpetraVector<T>::EpetraVector (const Parallel::Communicator & comm,
456  const numeric_index_type n,
457  const numeric_index_type n_local,
458  const ParallelType type) :
459  NumericVector<T>(comm, type),
460  _destroy_vec_on_exit(true),
461  myFirstID_(0),
462  myNumIDs_(0),
463  myCoefs_(nullptr),
464  nonlocalIDs_(nullptr),
465  nonlocalElementSize_(nullptr),
466  numNonlocalIDs_(0),
467  allocatedNonlocalLength_(0),
468  nonlocalCoefs_(nullptr),
469  last_edit(0),
470  ignoreNonLocalEntries_(false)
471 {
472  this->init(n, n_local, false, type);
473 }
474 
475 
476 
477 
478 template <typename T>
479 inline
481  const Parallel::Communicator & comm) :
482  NumericVector<T>(comm, AUTOMATIC),
483  _destroy_vec_on_exit(false),
484  myFirstID_(0),
485  myNumIDs_(0),
486  myCoefs_(nullptr),
487  nonlocalIDs_(nullptr),
488  nonlocalElementSize_(nullptr),
489  numNonlocalIDs_(0),
490  allocatedNonlocalLength_(0),
491  nonlocalCoefs_(nullptr),
492  last_edit(0),
493  ignoreNonLocalEntries_(false)
494 {
495  _vec = &v;
496 
497  this->_type = PARALLEL; // FIXME - need to determine this from v!
498 
499  myFirstID_ = _vec->Map().MinMyGID();
500  myNumIDs_ = _vec->Map().NumMyElements();
501 
502  _map = libmesh_make_unique<Epetra_Map>
503  (_vec->GlobalLength(),
504  _vec->MyLength(),
505  0, // IndexBase = 0 for C/C++, 1 for Fortran.
506  Epetra_MpiComm (this->comm().get()));
507 
508  //Currently we impose the restriction that NumVectors==1, so we won't
509  //need the LDA argument when calling ExtractView. Hence the "dummy" arg.
510  int dummy;
511  _vec->ExtractView(&myCoefs_, &dummy);
512 
513  this->_is_closed = true;
514  this->_is_initialized = true;
515 }
516 
517 
518 
519 template <typename T>
520 inline
521 EpetraVector<T>::EpetraVector (const Parallel::Communicator & comm,
522  const numeric_index_type n,
523  const numeric_index_type n_local,
524  const std::vector<numeric_index_type> & ghost,
525  const ParallelType type) :
526  NumericVector<T>(comm, AUTOMATIC),
527  _destroy_vec_on_exit(true),
528  myFirstID_(0),
529  myNumIDs_(0),
530  myCoefs_(nullptr),
531  nonlocalIDs_(nullptr),
532  nonlocalElementSize_(nullptr),
533  numNonlocalIDs_(0),
534  allocatedNonlocalLength_(0),
535  nonlocalCoefs_(nullptr),
536  last_edit(0),
537  ignoreNonLocalEntries_(false)
538 {
539  this->init(n, n_local, ghost, false, type);
540 }
541 
542 
543 
544 // Default implementation for solver packages for which ghosted
545 // vectors are not yet implemented.
546 template <class T>
548  const bool fast)
549 {
550  this->init(other.size(),other.local_size(),fast,other.type());
551 }
552 
553 
554 
555 template <typename T>
556 inline
558 {
559  this->clear ();
560 }
561 
562 
563 
564 template <typename T>
565 inline
567  const numeric_index_type n_local,
568  const bool fast,
569  const ParallelType type)
570 {
571  // We default to allocating n_local local storage
572  numeric_index_type my_n_local = n_local;
573 
574  if (type == AUTOMATIC)
575  {
576  if (n == n_local)
577  this->_type = SERIAL;
578  else
579  this->_type = PARALLEL;
580  }
581  else if (type == GHOSTED)
582  {
583  // We don't yet support GHOSTED Epetra vectors, so to get the
584  // same functionality we need a SERIAL vector with local
585  // storage allocated for every entry.
586  this->_type = SERIAL;
587  my_n_local = n;
588  }
589  else
590  this->_type = type;
591 
592  libmesh_assert ((this->_type==SERIAL && n==my_n_local) ||
593  this->_type==PARALLEL);
594 
595  _map = libmesh_make_unique<Epetra_Map>
596  (static_cast<int>(n),
597  my_n_local,
598  0,
599  Epetra_MpiComm (this->comm().get()));
600 
601  _vec = new Epetra_Vector(*_map);
602 
603  myFirstID_ = _vec->Map().MinMyGID();
604  myNumIDs_ = _vec->Map().NumMyElements();
605 
606  // Currently we impose the restriction that NumVectors==1, so we won't
607  // need the LDA argument when calling ExtractView. Hence the "dummy" arg.
608  int dummy;
609  _vec->ExtractView(&myCoefs_, &dummy);
610 
611  this->_is_initialized = true;
612  this->_is_closed = true;
613  this->last_edit = 0;
614 
615  if (fast == false)
616  this->zero ();
617 }
618 
619 
620 template <typename T>
621 inline
623  const numeric_index_type n_local,
624  const std::vector<numeric_index_type> & /*ghost*/,
625  const bool fast,
626  const ParallelType type)
627 {
628  // TODO: we shouldn't ignore the ghost sparsity pattern
629  this->init(n, n_local, fast, type);
630 }
631 
632 
633 
634 template <typename T>
635 inline
637  const bool fast,
638  const ParallelType type)
639 {
640  this->init(n,n,fast,type);
641 }
642 
643 
644 
645 template <typename T>
646 inline
648 {
649  libmesh_assert (this->initialized());
650 
651  // Are we adding or inserting?
652  unsigned char global_last_edit = last_edit;
653  this->comm().max(global_last_edit);
654  libmesh_assert(!last_edit || last_edit == global_last_edit);
655 
656  if (global_last_edit == 1)
657  this->GlobalAssemble(Insert);
658  else if (global_last_edit == 2)
659  this->GlobalAssemble(Add);
660  else
661  libmesh_assert(!global_last_edit);
662 
663  this->_is_closed = true;
664  this->last_edit = 0;
665 }
666 
667 
668 
669 template <typename T>
670 inline
672 {
673  if (this->initialized())
674  {
675  // We might just be an interface to a user-provided _vec
676  if (this->_destroy_vec_on_exit)
677  {
678  delete _vec;
679  _vec = nullptr;
680  }
681 
682  // But we currently always own our own _map
683  _map.reset();
684  }
685 
686  this->_is_closed = this->_is_initialized = false;
687 }
688 
689 
690 
691 template <typename T>
692 inline
694 {
695  libmesh_assert (this->initialized());
696  libmesh_assert (this->closed());
697 
698  _vec->PutScalar(0.0);
699 }
700 
701 
702 
703 template <typename T>
704 inline
705 std::unique_ptr<NumericVector<T>> EpetraVector<T>::zero_clone () const
706 {
707  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
708  cloned_vector->init(*this);
709  return std::unique_ptr<NumericVector<T>>(cloned_vector);
710 }
711 
712 
713 
714 template <typename T>
715 inline
716 std::unique_ptr<NumericVector<T>> EpetraVector<T>::clone () const
717 {
718  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
719  cloned_vector->init(*this, true);
720  *cloned_vector = *this;
721  return std::unique_ptr<NumericVector<T>>(cloned_vector);
722 }
723 
724 
725 
726 template <typename T>
727 inline
729 {
730  libmesh_assert (this->initialized());
731 
732  return _vec->GlobalLength();
733 }
734 
735 
736 
737 template <typename T>
738 inline
740 {
741  libmesh_assert (this->initialized());
742 
743  return _vec->MyLength();
744 }
745 
746 template <typename T>
747 inline
749 {
750  libmesh_assert (this->initialized());
751 
752  return _vec->Map().MinMyGID();
753 }
754 
755 
756 
757 template <typename T>
758 inline
760 {
761  libmesh_assert (this->initialized());
762 
763  return _vec->Map().MaxMyGID()+1;
764 }
765 
766 
767 template <typename T>
768 inline
770 {
771  libmesh_assert (this->initialized());
772  libmesh_assert ( ((i >= this->first_local_index()) &&
773  (i < this->last_local_index())) );
774 
775  return (*_vec)[i-this->first_local_index()];
776 }
777 
778 
779 
780 template <typename T>
781 inline
783 {
784  libmesh_assert (this->initialized());
785 
786  T value;
787 
788  _vec->MinValue(&value);
789 
790  return value;
791 }
792 
793 
794 
795 template <typename T>
796 inline
798 {
799  libmesh_assert (this->initialized());
800 
801  T value;
802 
803  _vec->MaxValue(&value);
804 
805  return value;
806 }
807 
808 
809 
810 template <typename T>
811 inline
813 {
814  NumericVector<T>::swap(other);
815 
816  EpetraVector<T> & v = cast_ref<EpetraVector<T> &>(other);
817 
818  std::swap(_vec, v._vec);
819  _map.swap(v._map);
820  std::swap(_destroy_vec_on_exit, v._destroy_vec_on_exit);
821  std::swap(myFirstID_, v.myFirstID_);
822  std::swap(myNumIDs_, v.myNumIDs_);
823  std::swap(myCoefs_, v.myCoefs_);
824  std::swap(nonlocalIDs_, v.nonlocalIDs_);
825  std::swap(nonlocalElementSize_, v.nonlocalElementSize_);
826  std::swap(numNonlocalIDs_, v.numNonlocalIDs_);
827  std::swap(allocatedNonlocalLength_, v.allocatedNonlocalLength_);
828  std::swap(nonlocalCoefs_, v.nonlocalCoefs_);
829  std::swap(last_edit, v.last_edit);
830  std::swap(ignoreNonLocalEntries_, v.ignoreNonLocalEntries_);
831 }
832 
833 
834 // Trilinos only got serious about const in version 10.4
835 inline
837 {
838  return reinterpret_cast<int *>(const_cast<numeric_index_type *>(p));
839 }
840 
841 } // namespace libMesh
842 
843 
844 #endif // #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
845 #endif // LIBMESH_TRILINOS_EPETRA_VECTOR_H
libMesh::EpetraVector::operator*=
virtual NumericVector< T > & operator*=(const NumericVector< T > &v) override
Computes the component-wise multiplication of this vector's entries by another's, .
Definition: trilinos_epetra_vector.C:131
libMesh::EpetraVector::zero_clone
virtual std::unique_ptr< NumericVector< T > > zero_clone() const override
Definition: trilinos_epetra_vector.h:705
libMesh::EpetraVector::last_local_index
virtual numeric_index_type last_local_index() const override
Definition: trilinos_epetra_vector.h:759
libMesh::EpetraVector::allocatedNonlocalLength_
int allocatedNonlocalLength_
Definition: trilinos_epetra_vector.h:389
libMesh::EpetraVector::operator-=
virtual NumericVector< T > & operator-=(const NumericVector< T > &v) override
Subtracts v from *this, .
Definition: trilinos_epetra_vector.C:119
libMesh::EpetraVector::nonlocalElementSize_
int * nonlocalElementSize_
Definition: trilinos_epetra_vector.h:387
libMesh::EpetraVector::destroyNonlocalData
void destroyNonlocalData()
Definition: trilinos_epetra_vector.C:909
libMesh::EpetraVector::inputValues
int inputValues(int numIDs, const int *GIDs, const double *values, bool accumulate)
Definition: trilinos_epetra_vector.C:653
libMesh::EpetraVector::FEoperatorequals
void FEoperatorequals(const EpetraVector &source)
Definition: trilinos_epetra_vector.C:881
libMesh::PARALLEL
Definition: enum_parallel_type.h:36
libMesh::EpetraVector::SumIntoGlobalValues
int SumIntoGlobalValues(int numIDs, const int *GIDs, const double *values)
Accumulate values into the vector, adding them to any values that already exist for the specified ind...
Definition: trilinos_epetra_vector.C:591
libMesh::NumericVector::swap
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
Definition: numeric_vector.h:989
libMesh::EpetraVector::create_subvector
virtual void create_subvector(NumericVector< T > &subvector, const std::vector< numeric_index_type > &rows) const override
Fills in subvector from this vector using the indices in rows.
Definition: trilinos_epetra_vector.C:576
libMesh::EpetraVector::conjugate
virtual void conjugate() override
Negates the imaginary component of each entry in the vector.
Definition: trilinos_epetra_vector.C:205
libMesh::SERIAL
Definition: enum_parallel_type.h:35
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::EpetraVector::zero
virtual void zero() override
Set all entries to zero.
Definition: trilinos_epetra_vector.h:693
libMesh::EpetraVector::myFirstID_
int myFirstID_
Definition: trilinos_epetra_vector.h:382
libMesh::NumericVector::init
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
Change the dimension of the vector to n.
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::EpetraVector::scale
virtual void scale(const T factor) override
Scale each element of the vector by the given factor.
Definition: trilinos_epetra_vector.C:314
libMesh::GHOSTED
Definition: enum_parallel_type.h:37
libMesh::EpetraVector::ReplaceGlobalValues
int ReplaceGlobalValues(int numIDs, const int *GIDs, const double *values)
Copy values into the vector overwriting any values that already exist for the specified indices.
Definition: trilinos_epetra_vector.C:622
libMesh::NumericVector::_is_initialized
bool _is_initialized
true once init() has been called.
Definition: numeric_vector.h:732
libMesh::EpetraVector::localize
virtual void localize(std::vector< T > &v_local) const override
Creates a copy of the global vector in the local vector v_local.
Definition: trilinos_epetra_vector.C:527
libMesh::NumericVector::_is_closed
bool _is_closed
Flag which tracks whether the vector's values are consistent on all processors after insertion or add...
Definition: numeric_vector.h:727
libMesh::EpetraVector::GlobalAssemble
int GlobalAssemble(Epetra_CombineMode mode=Add)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Definition: trilinos_epetra_vector.C:835
libMesh::EpetraVector::min
virtual Real min() const override
Definition: trilinos_epetra_vector.h:782
libMesh::EpetraVector::insert
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices) override
Inserts the entries of v in *this at the locations specified by v.
Definition: trilinos_epetra_vector.C:301
libMesh::EpetraVector::linfty_norm
virtual Real linfty_norm() const override
Definition: trilinos_epetra_vector.C:93
libMesh::SparseMatrix
Generic sparse matrix.
Definition: vector_fe_ex5.C:45
libMesh::EpetraVector::reciprocal
virtual void reciprocal() override
Computes the component-wise reciprocal, .
Definition: trilinos_epetra_vector.C:177
libMesh::NumericVector::size
virtual numeric_index_type size() const =0
libMesh::NumericVector
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Definition: vector_fe_ex5.C:43
libMesh::zero
const Number zero
.
Definition: libmesh.h:243
libMesh::EpetraVector
This class provides a nice interface to the Trilinos Epetra_Vector object.
Definition: trilinos_epetra_vector.h:63
libMesh::TriangleWrapper::init
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
libMesh::EpetraVector::init
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType type=AUTOMATIC) override
Change the dimension of the vector to n.
Definition: trilinos_epetra_vector.h:566
libMesh::NumericVector::_type
ParallelType _type
Type of vector.
Definition: numeric_vector.h:737
libMesh::EpetraVector::last_edit
unsigned char last_edit
Keep track of whether the last write operation on this vector was nothing (0) or a sum (1) or an add ...
Definition: trilinos_epetra_vector.h:397
libMesh::EpetraVector::clear
virtual void clear() override
Restores the NumericVector<T> to a pristine state.
Definition: trilinos_epetra_vector.h:671
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::EpetraVector::inputNonlocalValues
int inputNonlocalValues(int GID, int numValues, const double *values, bool accumulate)
Definition: trilinos_epetra_vector.C:776
libMesh::EpetraVector::operator/=
virtual NumericVector< T > & operator/=(const NumericVector< T > &v) override
Computes the component-wise division of this vector's entries by another's, .
Definition: trilinos_epetra_vector.C:146
libMesh::EpetraVector::ignoreNonLocalEntries_
bool ignoreNonLocalEntries_
Definition: trilinos_epetra_vector.h:399
libMesh::EpetraVector::set
virtual void set(const numeric_index_type i, const T value) override
Sets v(i) = value.
Definition: trilinos_epetra_vector.C:162
libMesh::EpetraVector::close
virtual void close() override
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
Definition: trilinos_epetra_vector.h:647
libMesh::EpetraVector::inputNonlocalValue
int inputNonlocalValue(int GID, double value, bool accumulate)
Definition: trilinos_epetra_vector.C:733
libMesh::EpetraVector::myNumIDs_
int myNumIDs_
Definition: trilinos_epetra_vector.h:383
libMesh::EpetraVector::EpetraVector
EpetraVector(const Parallel::Communicator &comm, const ParallelType type=AUTOMATIC)
Dummy-Constructor.
Definition: trilinos_epetra_vector.h:409
libMesh::EpetraVector::vec
Epetra_Vector * vec()
Definition: trilinos_epetra_vector.h:264
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::EpetraVector::dot
virtual T dot(const NumericVector< T > &v) const override
Definition: trilinos_epetra_vector.C:327
libMesh::EpetraVector::operator=
EpetraVector & operator=(const EpetraVector &)=delete
libMesh::EpetraVector::swap
virtual void swap(NumericVector< T > &v) override
Swaps the contents of this with v.
Definition: trilinos_epetra_vector.h:812
libMesh::EpetraVector::_vec
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
Definition: trilinos_epetra_vector.h:271
libMesh::EpetraVector::l1_norm
virtual Real l1_norm() const override
Definition: trilinos_epetra_vector.C:69
libMesh::NumericVector::local_size
virtual numeric_index_type local_size() const =0
libMesh::EpetraVector::max
virtual Real max() const override
Definition: trilinos_epetra_vector.h:797
libMesh::EpetraVector::local_size
virtual numeric_index_type local_size() const override
Definition: trilinos_epetra_vector.h:739
libMesh::EpetraVector::~EpetraVector
virtual ~EpetraVector()
Definition: trilinos_epetra_vector.h:557
A
static PetscErrorCode Mat * A
Definition: petscdmlibmeshimpl.C:1026
libMesh::EpetraVector::size
virtual numeric_index_type size() const override
Definition: trilinos_epetra_vector.h:728
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::EpetraVector::l2_norm
virtual Real l2_norm() const override
Definition: trilinos_epetra_vector.C:81
libMesh::EpetraVector::pointwise_mult
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
Definition: trilinos_epetra_vector.C:340
libMesh::initialized
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:265
swap
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
Definition: variant_filter_iterator.h:478
libMesh::ReferenceElem::get
const Elem & get(const ElemType type_in)
Definition: reference_elem.C:237
libMesh::libMeshPrivateData::_is_initialized
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:246
libMesh::EpetraVector::clone
virtual std::unique_ptr< NumericVector< T > > clone() const override
Definition: trilinos_epetra_vector.h:716
value
static const bool value
Definition: xdr_io.C:56
libMesh::EpetraVector::add_vector_transpose
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
Definition: trilinos_epetra_vector.C:259
libMesh::EpetraVector::abs
virtual void abs() override
Sets for each entry in the vector.
Definition: trilinos_epetra_vector.C:320
libMesh::EpetraVector::nonlocalIDs_
int * nonlocalIDs_
Definition: trilinos_epetra_vector.h:386
libMesh::numeric_trilinos_cast
int * numeric_trilinos_cast(const numeric_index_type *p)
Definition: trilinos_epetra_vector.h:836
libMesh::EpetraVector::setIgnoreNonLocalEntries
void setIgnoreNonLocalEntries(bool flag)
Set whether or not non-local data values should be ignored.
Definition: trilinos_epetra_vector.h:354
libMesh::EpetraVector::operator+=
virtual NumericVector< T > & operator+=(const NumericVector< T > &v) override
Adds v to *this, .
Definition: trilinos_epetra_vector.C:106
libMesh::EpetraVector::localize_to_one
virtual void localize_to_one(std::vector< T > &v_local, const processor_id_type proc_id=0) const override
Creates a local copy of the global vector in v_local only on processor proc_id.
Definition: trilinos_epetra_vector.C:550
libMesh::EpetraVector::_destroy_vec_on_exit
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object.
Definition: trilinos_epetra_vector.h:282
libMesh::EpetraVector::myCoefs_
double * myCoefs_
Definition: trilinos_epetra_vector.h:384
libMesh::EpetraVector::nonlocalCoefs_
double ** nonlocalCoefs_
Definition: trilinos_epetra_vector.h:390
libMesh::AUTOMATIC
Definition: enum_parallel_type.h:34
libMesh::ParallelType
ParallelType
Defines an enum for parallel data structure types.
Definition: enum_parallel_type.h:33
libMesh::NumericVector::get
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
Definition: numeric_vector.h:821
libMesh::EpetraVector::add
virtual void add(const numeric_index_type i, const T value) override
Adds value to each entry of the vector.
Definition: trilinos_epetra_vector.C:213
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::EpetraVector::operator()
virtual T operator()(const numeric_index_type i) const override
Definition: trilinos_epetra_vector.h:769
libMesh::EpetraVector::first_local_index
virtual numeric_index_type first_local_index() const override
Definition: trilinos_epetra_vector.h:748
libMesh::EpetraVector::_map
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
Definition: trilinos_epetra_vector.h:276
libMesh::EpetraVector::add_vector
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices) override
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
Definition: trilinos_epetra_vector.C:228
libMesh::EpetraVector::sum
virtual T sum() const override
Definition: trilinos_epetra_vector.C:50
libMesh::NumericVector::type
ParallelType type() const
Definition: numeric_vector.h:160
libMesh::EpetraVector::numNonlocalIDs_
int numNonlocalIDs_
Definition: trilinos_epetra_vector.h:388
libMesh::closed
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:272