libMesh
trilinos_epetra_vector.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 
30 // Trilinos includes
31 #include "libmesh/ignore_warnings.h"
32 #include <Epetra_CombineMode.h>
33 #include <Epetra_Map.h>
34 #include <Epetra_MultiVector.h>
35 #include <Epetra_Vector.h>
36 #include <Epetra_MpiComm.h>
37 #include "libmesh/restore_warnings.h"
38 
39 // C++ includes
40 #include <cstddef>
41 #include <limits>
42 #include <memory>
43 #include <mutex>
44 #include <vector>
45 
46 // Forward declarations
47 class Epetra_IntSerialDenseVector;
48 class Epetra_SerialDenseVector;
49 
50 namespace libMesh
51 {
52 
53 // forward declarations
54 template <typename T> class SparseMatrix;
55 
64 template <typename T>
65 class EpetraVector final : public NumericVector<T>
66 {
67 public:
68 
72  explicit
74  const ParallelType type = AUTOMATIC);
75 
79  explicit
81  const numeric_index_type n,
82  const ParallelType type = AUTOMATIC);
83 
89  const numeric_index_type n,
90  const numeric_index_type n_local,
91  const ParallelType type = AUTOMATIC);
92 
99  const numeric_index_type N,
100  const numeric_index_type n_local,
101  const std::vector<numeric_index_type> & ghost,
102  const ParallelType type = AUTOMATIC);
103 
111  EpetraVector(Epetra_Vector & v,
112  const Parallel::Communicator & comm);
113 
119  EpetraVector (EpetraVector &&) = delete;
120  EpetraVector (const EpetraVector &) = delete;
121  EpetraVector & operator= (const EpetraVector &) = delete;
122  EpetraVector & operator= (EpetraVector &&) = delete;
123  virtual ~EpetraVector ();
124 
125  virtual void close () override;
126 
130  virtual void clear () noexcept override;
131 
132  virtual void zero () override;
133 
134  virtual std::unique_ptr<NumericVector<T>> zero_clone () const override;
135 
136  virtual std::unique_ptr<NumericVector<T>> clone () const override;
137 
138  virtual void init (const numeric_index_type N,
139  const numeric_index_type n_local,
140  const bool fast=false,
141  const ParallelType type=AUTOMATIC) override;
142 
143  virtual void init (const numeric_index_type N,
144  const bool fast=false,
145  const ParallelType type=AUTOMATIC) override;
146 
147  virtual void init (const numeric_index_type N,
148  const numeric_index_type n_local,
149  const std::vector<numeric_index_type> & ghost,
150  const bool fast = false,
151  const ParallelType = AUTOMATIC) override;
152 
153  virtual void init (const NumericVector<T> & other,
154  const bool fast = false) override;
155 
156  virtual NumericVector<T> & operator= (const T s) override;
157 
158  virtual NumericVector<T> & operator= (const NumericVector<T> & v) override;
159 
160  virtual NumericVector<T> & operator= (const std::vector<T> & v) override;
161 
162  virtual Real min () const override;
163 
164  virtual Real max () const override;
165 
166  virtual T sum () const override;
167 
168  virtual Real l1_norm () const override;
169 
170  virtual Real l2_norm () const override;
171 
172  virtual Real linfty_norm () const override;
173 
174  virtual numeric_index_type size () const override;
175 
176  virtual numeric_index_type local_size() const override;
177 
178  virtual numeric_index_type first_local_index() const override;
179 
180  virtual numeric_index_type last_local_index() const override;
181 
182  virtual T operator() (const numeric_index_type i) const override;
183 
184  virtual NumericVector<T> & operator += (const NumericVector<T> & v) override;
185 
186  virtual NumericVector<T> & operator -= (const NumericVector<T> & v) override;
187 
188  virtual NumericVector<T> & operator *= (const NumericVector<T> & v) override;
189 
190  virtual NumericVector<T> & operator /= (const NumericVector<T> & v) override;
191 
192  virtual void reciprocal() override;
193 
194  virtual void conjugate() override;
195 
196  virtual void set (const numeric_index_type i, const T value) override;
197 
198  virtual void add (const numeric_index_type i, const T value) override;
199 
200  virtual void add (const T s) override;
201 
202  virtual void add (const NumericVector<T> & v) override;
203 
204  virtual void add (const T a, const NumericVector<T> & v) override;
205 
211 
212  virtual void add_vector (const T * v,
213  const std::vector<numeric_index_type> & dof_indices) override;
214 
215  virtual void add_vector (const NumericVector<T> & v,
216  const SparseMatrix<T> & A) override;
217 
218  virtual void add_vector_transpose (const NumericVector<T> & v,
219  const SparseMatrix<T> & A) override;
220 
226 
227  virtual void insert (const T * v,
228  const std::vector<numeric_index_type> & dof_indices) override;
229 
230  virtual void scale (const T factor) override;
231 
232  virtual void abs() override;
233 
234  virtual T dot(const NumericVector<T> & v) const override;
235 
236  virtual void localize (std::vector<T> & v_local) const override;
237 
238  virtual void localize (NumericVector<T> & v_local) const override;
239 
240  virtual void localize (NumericVector<T> & v_local,
241  const std::vector<numeric_index_type> & send_list) const override;
242 
243  virtual void localize (std::vector<T> & v_local,
244  const std::vector<numeric_index_type> & indices) const override;
245 
246  virtual void localize (const numeric_index_type first_local_idx,
247  const numeric_index_type last_local_idx,
248  const std::vector<numeric_index_type> & send_list) override;
249 
250  virtual void localize_to_one (std::vector<T> & v_local,
251  const processor_id_type proc_id=0) const override;
252 
253  virtual void pointwise_mult (const NumericVector<T> & vec1,
254  const NumericVector<T> & vec2) override;
255 
256  virtual void create_subvector (NumericVector<T> & subvector,
257  const std::vector<numeric_index_type> & rows) const override;
258 
259  virtual void swap (NumericVector<T> & v) override;
260 
261  virtual std::size_t max_allowed_id() const override;
262 
271  Epetra_Vector * vec () { libmesh_assert(_vec); return _vec; }
272 
273 private:
274 
278  Epetra_Vector * _vec;
279 
283  std::unique_ptr<Epetra_Map> _map;
284 
290 
291  // The following were copied (and slightly modified) from
292  // Epetra_FEVector.h in order to allow us to use a standard
293  // Epetra_Vector... which is more compatible with other Trilinos
294  // packages such as NOX. All of this code is originally under LGPL
295 
300  int SumIntoGlobalValues(int numIDs,
301  const int * GIDs,
302  const double * values);
303 
314  int SumIntoGlobalValues(const Epetra_IntSerialDenseVector & GIDs,
315  const Epetra_SerialDenseVector & values);
316 
321  int ReplaceGlobalValues(int numIDs,
322  const int * GIDs,
323  const double * values);
324 
335  int ReplaceGlobalValues(const Epetra_IntSerialDenseVector & GIDs,
336  const Epetra_SerialDenseVector & values);
337 
338  int SumIntoGlobalValues(int numIDs,
339  const int * GIDs,
340  const int * numValuesPerID,
341  const double * values);
342 
343  int ReplaceGlobalValues(int numIDs,
344  const int * GIDs,
345  const int * numValuesPerID,
346  const double * values);
347 
356  int GlobalAssemble(Epetra_CombineMode mode = Add);
357 
361  void setIgnoreNonLocalEntries(bool flag)
362  {
363  ignoreNonLocalEntries_ = flag;
364  }
365 
366  void FEoperatorequals(const EpetraVector & source);
367 
368  int inputValues(int numIDs,
369  const int * GIDs,
370  const double * values,
371  bool accumulate);
372 
373  int inputValues(int numIDs,
374  const int * GIDs,
375  const int * numValuesPerID,
376  const double * values,
377  bool accumulate);
378 
379  int inputNonlocalValue(int GID,
380  double value,
381  bool accumulate);
382 
383  int inputNonlocalValues(int GID,
384  int numValues,
385  const double * values,
386  bool accumulate);
387 
388  void destroyNonlocalData();
389 
392  double * myCoefs_;
393 
398  double ** nonlocalCoefs_;
399 
405  unsigned char last_edit;
406 
408 };
409 
410 
411 /*----------------------- Inline functions ----------------------------------*/
412 
413 
414 
415 template <typename T>
416 inline
418  const ParallelType type) :
419  NumericVector<T>(comm, type),
420  _destroy_vec_on_exit(true),
421  myFirstID_(0),
422  myNumIDs_(0),
423  myCoefs_(nullptr),
424  nonlocalIDs_(nullptr),
425  nonlocalElementSize_(nullptr),
426  numNonlocalIDs_(0),
427  allocatedNonlocalLength_(0),
428  nonlocalCoefs_(nullptr),
429  last_edit(0),
430  ignoreNonLocalEntries_(false)
431 {
432  this->_type = type;
433 }
434 
435 
436 
437 template <typename T>
438 inline
440  const numeric_index_type n,
441  const ParallelType type) :
442  NumericVector<T>(comm, type),
443  _destroy_vec_on_exit(true),
444  myFirstID_(0),
445  myNumIDs_(0),
446  myCoefs_(nullptr),
447  nonlocalIDs_(nullptr),
448  nonlocalElementSize_(nullptr),
449  numNonlocalIDs_(0),
450  allocatedNonlocalLength_(0),
451  nonlocalCoefs_(nullptr),
452  last_edit(0),
453  ignoreNonLocalEntries_(false)
454 
455 {
456  this->init(n, n, false, type);
457 }
458 
459 
460 
461 template <typename T>
462 inline
464  const numeric_index_type n,
465  const numeric_index_type n_local,
466  const ParallelType type) :
467  NumericVector<T>(comm, type),
468  _destroy_vec_on_exit(true),
469  myFirstID_(0),
470  myNumIDs_(0),
471  myCoefs_(nullptr),
472  nonlocalIDs_(nullptr),
473  nonlocalElementSize_(nullptr),
474  numNonlocalIDs_(0),
475  allocatedNonlocalLength_(0),
476  nonlocalCoefs_(nullptr),
477  last_edit(0),
478  ignoreNonLocalEntries_(false)
479 {
480  this->init(n, n_local, false, type);
481 }
482 
483 
484 
485 
486 template <typename T>
487 inline
489  const Parallel::Communicator & comm) :
490  NumericVector<T>(comm, AUTOMATIC),
491  _destroy_vec_on_exit(false),
492  myFirstID_(0),
493  myNumIDs_(0),
494  myCoefs_(nullptr),
495  nonlocalIDs_(nullptr),
496  nonlocalElementSize_(nullptr),
497  numNonlocalIDs_(0),
498  allocatedNonlocalLength_(0),
499  nonlocalCoefs_(nullptr),
500  last_edit(0),
501  ignoreNonLocalEntries_(false)
502 {
503  _vec = &v;
504 
505  this->_type = PARALLEL; // FIXME - need to determine this from v!
506 
507  myFirstID_ = _vec->Map().MinMyGID();
508  myNumIDs_ = _vec->Map().NumMyElements();
509 
510  _map = std::make_unique<Epetra_Map>
511  (_vec->GlobalLength(),
512  _vec->MyLength(),
513  0, // IndexBase = 0 for C/C++, 1 for Fortran.
514  Epetra_MpiComm (this->comm().get()));
515 
516  //Currently we impose the restriction that NumVectors==1, so we won't
517  //need the LDA argument when calling ExtractView. Hence the "dummy" arg.
518  int dummy;
519  _vec->ExtractView(&myCoefs_, &dummy);
520 
521  this->_is_closed = true;
522  this->_is_initialized = true;
523 }
524 
525 
526 
527 template <typename T>
528 inline
530  const numeric_index_type n,
531  const numeric_index_type n_local,
532  const std::vector<numeric_index_type> & ghost,
533  const ParallelType type) :
534  NumericVector<T>(comm, AUTOMATIC),
535  _destroy_vec_on_exit(true),
536  myFirstID_(0),
537  myNumIDs_(0),
538  myCoefs_(nullptr),
539  nonlocalIDs_(nullptr),
540  nonlocalElementSize_(nullptr),
541  numNonlocalIDs_(0),
542  allocatedNonlocalLength_(0),
543  nonlocalCoefs_(nullptr),
544  last_edit(0),
545  ignoreNonLocalEntries_(false)
546 {
547  this->init(n, n_local, ghost, false, type);
548 }
549 
550 
551 
552 // Default implementation for solver packages for which ghosted
553 // vectors are not yet implemented.
554 template <class T>
556  const bool fast)
557 {
558  this->init(other.size(),other.local_size(),fast,other.type());
559 }
560 
561 
562 
563 template <typename T>
564 inline
566 {
567  this->clear ();
568 }
569 
570 
571 
572 template <typename T>
573 inline
575  const numeric_index_type n_local,
576  const bool fast,
577  const ParallelType type)
578 {
579  // We default to allocating n_local local storage
580  numeric_index_type my_n_local = n_local;
581 
582  if (type == AUTOMATIC)
583  {
584  if (n == n_local)
585  this->_type = SERIAL;
586  else
587  this->_type = PARALLEL;
588  }
589  else if (type == GHOSTED)
590  {
591  // We don't yet support GHOSTED Epetra vectors, so to get the
592  // same functionality we need a SERIAL vector with local
593  // storage allocated for every entry.
594  this->_type = SERIAL;
595  my_n_local = n;
596  }
597  else
598  this->_type = type;
599 
600  libmesh_assert ((this->_type==SERIAL && n==my_n_local) ||
601  this->_type==PARALLEL);
602 
603  _map = std::make_unique<Epetra_Map>
604  (static_cast<int>(n),
605  my_n_local,
606  0,
607  Epetra_MpiComm (this->comm().get()));
608 
609  _vec = new Epetra_Vector(*_map);
610 
611  myFirstID_ = _vec->Map().MinMyGID();
612  myNumIDs_ = _vec->Map().NumMyElements();
613 
614  // Currently we impose the restriction that NumVectors==1, so we won't
615  // need the LDA argument when calling ExtractView. Hence the "dummy" arg.
616  int dummy;
617  _vec->ExtractView(&myCoefs_, &dummy);
618 
619  this->_is_initialized = true;
620  this->_is_closed = true;
621  this->last_edit = 0;
622 
623  if (fast == false)
624  this->zero ();
625 }
626 
627 
628 template <typename T>
629 inline
631  const numeric_index_type n_local,
632  const std::vector<numeric_index_type> & /*ghost*/,
633  const bool fast,
634  const ParallelType type)
635 {
636  // TODO: we shouldn't ignore the ghost sparsity pattern
637  this->init(n, n_local, fast, type);
638 }
639 
640 
641 
642 template <typename T>
643 inline
645  const bool fast,
646  const ParallelType type)
647 {
648  this->init(n,n,fast,type);
649 }
650 
651 
652 
653 template <typename T>
654 inline
656 {
657  libmesh_assert (this->initialized());
658 
659  // Are we adding or inserting?
660  unsigned char global_last_edit = last_edit;
661  this->comm().max(global_last_edit);
662  libmesh_assert(!last_edit || last_edit == global_last_edit);
663 
664  if (global_last_edit == 1)
665  this->GlobalAssemble(Insert);
666  else if (global_last_edit == 2)
667  this->GlobalAssemble(Add);
668  else
669  libmesh_assert(!global_last_edit);
670 
671  this->_is_closed = true;
672  this->last_edit = 0;
673 }
674 
675 
676 
677 template <typename T>
678 inline
679 void EpetraVector<T>::clear () noexcept
680 {
681  if (this->initialized())
682  {
683  // We might just be an interface to a user-provided _vec
684  if (this->_destroy_vec_on_exit)
685  {
686  delete _vec;
687  _vec = nullptr;
688  }
689 
690  // But we currently always own our own _map
691  _map.reset();
692  }
693 
694  this->_is_closed = this->_is_initialized = false;
695 }
696 
697 
698 
699 template <typename T>
700 inline
702 {
703  libmesh_assert (this->initialized());
704  libmesh_assert (this->closed());
705 
706  _vec->PutScalar(0.0);
707 }
708 
709 
710 
711 template <typename T>
712 inline
713 std::unique_ptr<NumericVector<T>> EpetraVector<T>::zero_clone () const
714 {
715  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
716  cloned_vector->init(*this);
717  return std::unique_ptr<NumericVector<T>>(cloned_vector);
718 }
719 
720 
721 
722 template <typename T>
723 inline
724 std::unique_ptr<NumericVector<T>> EpetraVector<T>::clone () const
725 {
726  NumericVector<T> * cloned_vector = new EpetraVector<T>(this->comm(), AUTOMATIC);
727  cloned_vector->init(*this, true);
728  *cloned_vector = *this;
729  return std::unique_ptr<NumericVector<T>>(cloned_vector);
730 }
731 
732 
733 
734 template <typename T>
735 inline
737 {
738  libmesh_assert (this->initialized());
739 
740  return _vec->GlobalLength();
741 }
742 
743 
744 
745 template <typename T>
746 inline
748 {
749  libmesh_assert (this->initialized());
750 
751  return _vec->MyLength();
752 }
753 
754 template <typename T>
755 inline
757 {
758  libmesh_assert (this->initialized());
759 
760  return _vec->Map().MinMyGID();
761 }
762 
763 
764 
765 template <typename T>
766 inline
768 {
769  libmesh_assert (this->initialized());
770 
771  return _vec->Map().MaxMyGID()+1;
772 }
773 
774 
775 template <typename T>
776 inline
778 {
779  libmesh_assert (this->initialized());
780  libmesh_assert ( ((i >= this->first_local_index()) &&
781  (i < this->last_local_index())) );
782 
783  return (*_vec)[i-this->first_local_index()];
784 }
785 
786 
787 
788 template <typename T>
789 inline
791 {
792  libmesh_assert (this->initialized());
793 
794  T value;
795 
796  _vec->MinValue(&value);
797 
798  return value;
799 }
800 
801 
802 
803 template <typename T>
804 inline
806 {
807  libmesh_assert (this->initialized());
808 
809  T value;
810 
811  _vec->MaxValue(&value);
812 
813  return value;
814 }
815 
816 
817 
818 template <typename T>
819 inline
821 {
822  NumericVector<T>::swap(other);
823 
824  EpetraVector<T> & v = cast_ref<EpetraVector<T> &>(other);
825 
826  std::swap(_vec, v._vec);
827  _map.swap(v._map);
828  std::swap(_destroy_vec_on_exit, v._destroy_vec_on_exit);
829  std::swap(myFirstID_, v.myFirstID_);
830  std::swap(myNumIDs_, v.myNumIDs_);
831  std::swap(myCoefs_, v.myCoefs_);
832  std::swap(nonlocalIDs_, v.nonlocalIDs_);
833  std::swap(nonlocalElementSize_, v.nonlocalElementSize_);
834  std::swap(numNonlocalIDs_, v.numNonlocalIDs_);
835  std::swap(allocatedNonlocalLength_, v.allocatedNonlocalLength_);
836  std::swap(nonlocalCoefs_, v.nonlocalCoefs_);
837  std::swap(last_edit, v.last_edit);
838  std::swap(ignoreNonLocalEntries_, v.ignoreNonLocalEntries_);
839 }
840 
841 
842 
843 template <typename T>
844 inline
846 {
847  // Epetra_Vector seems to use hard-coded ints in its various indexing routines.
848  return std::numeric_limits<int>::max();
849 }
850 
851 
852 
853 // Trilinos only got serious about const in version 10.4
854 inline
856 {
857  return reinterpret_cast<int *>(const_cast<numeric_index_type *>(p));
858 }
859 
860 } // namespace libMesh
861 
862 
863 #endif // #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
864 #endif // LIBMESH_TRILINOS_EPETRA_VECTOR_H
virtual NumericVector< T > & operator/=(const NumericVector< T > &v) override
Computes the component-wise division of this vector&#39;s entries by another&#39;s, .
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:273
This class provides a nice interface to the Trilinos Epetra_Vector object.
virtual T operator()(const numeric_index_type i) const override
std::unique_ptr< Epetra_Map > _map
Holds the distributed Map.
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
virtual void reciprocal() override
Computes the component-wise reciprocal, .
virtual numeric_index_type last_local_index() const override
virtual void add(const numeric_index_type i, const T value) override
Adds value to the vector entry specified by i.
virtual void close() override
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
virtual std::unique_ptr< NumericVector< T > > zero_clone() const override
virtual numeric_index_type size() const =0
Epetra_Vector * _vec
Actual Epetra vector datatype to hold vector entries.
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.
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
Definition: vector_fe_ex5.C:43
const Parallel::Communicator & comm() const
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.
int inputNonlocalValues(int GID, int numValues, const double *values, bool accumulate)
bool _is_initialized
true once init() has been called.
virtual void conjugate() override
Negates the imaginary component of each entry in the vector.
virtual Real max() const override
The libMesh namespace provides an interface to certain functionality in the library.
const Number zero
.
Definition: libmesh.h:280
virtual void zero() override
Set all entries to zero.
virtual T sum() const override
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.
int GlobalAssemble(Epetra_CombineMode mode=Add)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
virtual numeric_index_type size() const override
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
uint8_t processor_id_type
Definition: id_types.h:104
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...
int inputValues(int numIDs, const int *GIDs, const double *values, bool accumulate)
Generic sparse matrix.
Definition: vector_fe_ex5.C:45
bool _destroy_vec_on_exit
This boolean value should only be set to false for the constructor which takes a Epetra Vec object...
void setIgnoreNonLocalEntries(bool flag)
Set whether or not non-local data values should be ignored.
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 ...
dof_id_type numeric_index_type
Definition: id_types.h:99
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:247
EpetraVector(const Parallel::Communicator &comm, const ParallelType type=AUTOMATIC)
Dummy-Constructor.
virtual NumericVector< T > & operator*=(const NumericVector< T > &v) override
Computes the component-wise multiplication of this vector&#39;s entries by another&#39;s, ...
virtual NumericVector< T > & operator+=(const NumericVector< T > &v) override
Adds v to *this, .
virtual Real l1_norm() const override
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
libmesh_assert(ctx)
virtual void abs() override
Sets for each entry in the vector.
virtual NumericVector< T > & operator-=(const NumericVector< T > &v) override
Subtracts v from *this, .
int inputNonlocalValue(int GID, double value, bool accumulate)
virtual void clear() noexcept override
clear() is called from the destructor, so it should not throw.
virtual Real min() const override
virtual Real linfty_norm() const override
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.
virtual std::size_t max_allowed_id() const override
ParallelType _type
Type of vector.
ParallelType type() const
virtual void localize(std::vector< T > &v_local) const override
Creates a copy of the global vector in the local vector v_local.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
virtual T dot(const NumericVector< T > &v) const override
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...
virtual Real l2_norm() const override
virtual numeric_index_type local_size() const =0
static const bool value
Definition: xdr_io.C:54
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.
virtual numeric_index_type first_local_index() const override
void FEoperatorequals(const EpetraVector &source)
virtual void swap(NumericVector< T > &v) override
Swaps the contents of this with v.
virtual std::unique_ptr< NumericVector< T > > clone() const override
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:266
int * numeric_trilinos_cast(const numeric_index_type *p)
virtual void scale(const T factor) override
Scale each element of the vector by the given factor.
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]...
bool _is_closed
Flag which tracks whether the vector&#39;s values are consistent on all processors after insertion or add...
virtual numeric_index_type local_size() const override
EpetraVector & operator=(const EpetraVector &)=delete
ParallelType
Defines an enum for parallel data structure types.