libMesh
numeric_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 
19 
20 #ifndef LIBMESH_NUMERIC_VECTOR_H
21 #define LIBMESH_NUMERIC_VECTOR_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/enum_parallel_type.h"
26 #include "libmesh/id_types.h"
27 #include "libmesh/int_range.h"
28 #include "libmesh/reference_counted_object.h"
29 #include "libmesh/libmesh.h"
30 #include "libmesh/parallel_object.h"
31 #include "libmesh/dense_subvector.h"
32 #include "libmesh/dense_vector.h"
33 
34 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
35 namespace libMesh
36 {
37 enum SolverPackage : int;
38 }
39 #else
40 #include "libmesh/enum_solver_package.h"
41 #endif
42 
43 // C++ includes
44 #include <cstddef>
45 #include <set>
46 #include <vector>
47 #include <memory>
48 
49 namespace libMesh
50 {
51 
52 
53 // forward declarations
54 template <typename T> class NumericVector;
55 template <typename T> class DenseVector;
56 template <typename T> class DenseSubVector;
57 template <typename T> class SparseMatrix;
58 template <typename T> class ShellMatrix;
59 
74 template <typename T>
75 class NumericVector : public ReferenceCountedObject<NumericVector<T>>,
76  public ParallelObject
77 {
78 public:
79 
83  explicit
84  NumericVector (const Parallel::Communicator & comm_in,
85  const ParallelType ptype = AUTOMATIC);
86 
90  explicit
91  NumericVector (const Parallel::Communicator & comm_in,
92  const numeric_index_type n,
93  const ParallelType ptype = AUTOMATIC);
94 
99  NumericVector (const Parallel::Communicator & comm_in,
100  const numeric_index_type n,
101  const numeric_index_type n_local,
102  const ParallelType ptype = AUTOMATIC);
103 
109  NumericVector (const Parallel::Communicator & comm_in,
110  const numeric_index_type N,
111  const numeric_index_type n_local,
112  const std::vector<numeric_index_type> & ghost,
113  const ParallelType ptype = AUTOMATIC);
114 
126  virtual NumericVector<T> & operator= (const NumericVector<T> & v) = 0;
127 
132  NumericVector (NumericVector &&) = default;
133  NumericVector (const NumericVector &) = default;
134  NumericVector & operator= (NumericVector &&) = default;
135 
140  virtual ~NumericVector() = default;
141 
147  static std::unique_ptr<NumericVector<T>>
148  build(const Parallel::Communicator & comm,
149  const SolverPackage solver_package = libMesh::default_solver_package());
150 
155  virtual bool initialized() const { return _is_initialized; }
156 
160  ParallelType type() const { return _type; }
161 
165  ParallelType & type() { return _type; }
166 
171  virtual bool closed() const { return _is_closed; }
172 
177  virtual void close () = 0;
178 
182  virtual void clear ();
183 
188  virtual void zero () = 0;
189 
196  virtual std::unique_ptr<NumericVector<T>> zero_clone () const = 0;
197 
203  virtual std::unique_ptr<NumericVector<T>> clone () const = 0;
204 
215  virtual void init (const numeric_index_type n,
216  const numeric_index_type n_local,
217  const bool fast = false,
218  const ParallelType ptype = AUTOMATIC) = 0;
219 
223  virtual void init (const numeric_index_type n,
224  const bool fast = false,
225  const ParallelType ptype = AUTOMATIC) = 0;
226 
231  virtual void init (const numeric_index_type n,
232  const numeric_index_type n_local,
233  const std::vector<numeric_index_type> & ghost,
234  const bool fast = false,
235  const ParallelType ptype = AUTOMATIC) = 0;
236 
241  virtual void init (const NumericVector<T> & other,
242  const bool fast = false) = 0;
243 
249  virtual NumericVector<T> & operator= (const T s) = 0;
250 
256  virtual NumericVector<T> & operator= (const std::vector<T> & v) = 0;
257 
262  virtual Real min () const = 0;
263 
268  virtual Real max () const = 0;
269 
273  virtual T sum() const = 0;
274 
279  virtual Real l1_norm () const = 0;
280 
285  virtual Real l2_norm () const = 0;
286 
291  virtual Real linfty_norm () const = 0;
292 
299  virtual Real subset_l1_norm (const std::set<numeric_index_type> & indices) const;
300 
308  virtual Real subset_l2_norm (const std::set<numeric_index_type> & indices) const;
309 
316  virtual Real subset_linfty_norm (const std::set<numeric_index_type> & indices) const;
317 
321  virtual numeric_index_type size () const = 0;
322 
326  virtual numeric_index_type local_size() const = 0;
327 
334  virtual numeric_index_type first_local_index() const = 0;
335 
342  virtual numeric_index_type last_local_index() const = 0;
343 
347  virtual T operator() (const numeric_index_type i) const = 0;
348 
352  virtual T el(const numeric_index_type i) const { return (*this)(i); }
353 
360  virtual void get(const std::vector<numeric_index_type> & index,
361  T * values) const;
362 
369  void get(const std::vector<numeric_index_type> & index,
370  std::vector<T> & values) const;
371 
379  virtual NumericVector<T> & operator += (const NumericVector<T> & v) = 0;
380 
388  virtual NumericVector<T> & operator -= (const NumericVector<T> & v) = 0;
389 
397  NumericVector<T> & operator *= (const T a) { this->scale(a); return *this; }
398 
406  virtual NumericVector<T> & operator *= (const NumericVector<T> & v) = 0;
407 
415  NumericVector<T> & operator /= (const T a) { this->scale(1./a); return *this; }
416 
423  virtual NumericVector<T> & operator /= (const NumericVector<T> & v) = 0;
424 
429  virtual void reciprocal() = 0;
430 
434  virtual void conjugate() = 0;
435 
439  virtual void set (const numeric_index_type i, const T value) = 0;
440 
444  virtual void add (const numeric_index_type i, const T value) = 0;
445 
450  virtual void add (const T s) = 0;
451 
457  virtual void add (const NumericVector<T> & v) = 0;
458 
464  virtual void add (const T a, const NumericVector<T> & v) = 0;
465 
472  virtual void add_vector (const T * v,
473  const std::vector<numeric_index_type> & dof_indices);
474 
480  void add_vector (const std::vector<T> & v,
481  const std::vector<numeric_index_type> & dof_indices);
482 
488  virtual void add_vector (const NumericVector<T> & v,
489  const std::vector<numeric_index_type> & dof_indices);
490 
496  void add_vector (const DenseVector<T> & v,
497  const std::vector<numeric_index_type> & dof_indices);
498 
504  virtual void add_vector (const NumericVector<T> & v,
505  const SparseMatrix<T> & A) = 0;
506 
512  void add_vector (const NumericVector<T> & v,
513  const ShellMatrix<T> & A);
514 
520  virtual void add_vector_transpose (const NumericVector<T> & v,
521  const SparseMatrix<T> & A) = 0;
522 
526  virtual void insert (const T * v,
527  const std::vector<numeric_index_type> & dof_indices);
528 
532  void insert (const std::vector<T> & v,
533  const std::vector<numeric_index_type> & dof_indices);
534 
538  virtual void insert (const NumericVector<T> & v,
539  const std::vector<numeric_index_type> & dof_indices);
540 
544  void insert (const DenseVector<T> & v,
545  const std::vector<numeric_index_type> & dof_indices);
546 
550  void insert (const DenseSubVector<T> & v,
551  const std::vector<numeric_index_type> & dof_indices);
552 
556  virtual void scale (const T factor) = 0;
557 
561  virtual void abs() = 0;
562 
569  virtual T dot(const NumericVector<T> & v) const = 0;
570 
575  virtual void localize (std::vector<T> & v_local) const = 0;
576 
581  virtual void localize (NumericVector<T> & v_local) const = 0;
582 
587  virtual void localize (NumericVector<T> & v_local,
588  const std::vector<numeric_index_type> & send_list) const = 0;
589 
619  virtual void localize (std::vector<T> & v_local,
620  const std::vector<numeric_index_type> & indices) const = 0;
621 
626  virtual void localize (const numeric_index_type first_local_idx,
627  const numeric_index_type last_local_idx,
628  const std::vector<numeric_index_type> & send_list) = 0;
629 
635  virtual void localize_to_one (std::vector<T> & v_local,
636  const processor_id_type proc_id=0) const = 0;
637 
643  virtual int compare (const NumericVector<T> & other_vector,
644  const Real threshold = TOLERANCE) const;
645 
651  virtual int local_relative_compare (const NumericVector<T> & other_vector,
652  const Real threshold = TOLERANCE) const;
653 
659  virtual int global_relative_compare (const NumericVector<T> & other_vector,
660  const Real threshold = TOLERANCE) const;
661 
667  virtual void pointwise_mult (const NumericVector<T> & vec1,
668  const NumericVector<T> & vec2) = 0;
669 
674  virtual void print(std::ostream & os=libMesh::out) const;
675 
680  virtual void print_global(std::ostream & os=libMesh::out) const;
681 
685  friend std::ostream & operator << (std::ostream & os, const NumericVector<T> & v)
686  {
687  v.print_global(os);
688  return os;
689  }
690 
696  virtual void print_matlab(const std::string & /*name*/ = "") const
697  {
698  libmesh_not_implemented();
699  }
700 
708  const std::vector<numeric_index_type> &) const
709  {
710  libmesh_not_implemented();
711  }
712 
718  virtual void swap (NumericVector<T> & v);
719 
720 protected:
721 
728 
733 
738 };
739 
740 
741 /*----------------------- Inline functions ----------------------------------*/
742 
743 
744 
745 template <typename T>
746 inline
747 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
748  const ParallelType ptype) :
749  ParallelObject(comm_in),
750  _is_closed(false),
751  _is_initialized(false),
752  _type(ptype)
753 {
754 }
755 
756 
757 
758 template <typename T>
759 inline
760 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
761  const numeric_index_type /*n*/,
762  const ParallelType ptype) :
763  ParallelObject(comm_in),
764  _is_closed(false),
765  _is_initialized(false),
766  _type(ptype)
767 {
768  libmesh_not_implemented(); // Abstract base class!
769  // init(n, n, false, ptype);
770 }
771 
772 
773 
774 template <typename T>
775 inline
776 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
777  const numeric_index_type /*n*/,
778  const numeric_index_type /*n_local*/,
779  const ParallelType ptype) :
780  ParallelObject(comm_in),
781  _is_closed(false),
782  _is_initialized(false),
783  _type(ptype)
784 {
785  libmesh_not_implemented(); // Abstract base class!
786  // init(n, n_local, false, ptype);
787 }
788 
789 
790 
791 template <typename T>
792 inline
793 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
794  const numeric_index_type /*n*/,
795  const numeric_index_type /*n_local*/,
796  const std::vector<numeric_index_type> & /*ghost*/,
797  const ParallelType ptype) :
798  ParallelObject(comm_in),
799  _is_closed(false),
800  _is_initialized(false),
801  _type(ptype)
802 {
803  libmesh_not_implemented(); // Abstract base class!
804  // init(n, n_local, ghost, false, ptype);
805 }
806 
807 
808 
809 template <typename T>
810 inline
812 {
813  _is_closed = false;
814  _is_initialized = false;
815 }
816 
817 
818 
819 template <typename T>
820 inline
821 void NumericVector<T>::get(const std::vector<numeric_index_type> & index,
822  T * values) const
823 {
824  const std::size_t num = index.size();
825  for (std::size_t i=0; i<num; i++)
826  {
827  values[i] = (*this)(index[i]);
828  }
829 }
830 
831 
832 
833 template <typename T>
834 inline
835 void NumericVector<T>::get(const std::vector<numeric_index_type> & index,
836  std::vector<T> & values) const
837 {
838  const std::size_t num = index.size();
839  values.resize(num);
840  if (!num)
841  return;
842 
843  this->get(index, values.data());
844 }
845 
846 
847 
848 template <typename T>
849 inline
850 void NumericVector<T>::add_vector(const std::vector<T> & v,
851  const std::vector<numeric_index_type> & dof_indices)
852 {
853  libmesh_assert(v.size() == dof_indices.size());
854  if (!v.empty())
855  this->add_vector(v.data(), dof_indices);
856 }
857 
858 
859 
860 template <typename T>
861 inline
863  const std::vector<numeric_index_type> & dof_indices)
864 {
865  libmesh_assert(v.size() == dof_indices.size());
866  if (!v.empty())
867  this->add_vector(&v(0), dof_indices);
868 }
869 
870 
871 
872 template <typename T>
873 inline
874 void NumericVector<T>::insert(const std::vector<T> & v,
875  const std::vector<numeric_index_type> & dof_indices)
876 {
877  libmesh_assert(v.size() == dof_indices.size());
878  if (!v.empty())
879  this->insert(v.data(), dof_indices);
880 }
881 
882 
883 
884 template <typename T>
885 inline
887  const std::vector<numeric_index_type> & dof_indices)
888 {
889  libmesh_assert(v.size() == dof_indices.size());
890  if (!v.empty())
891  this->insert(&v(0), dof_indices);
892 }
893 
894 
895 
896 template <typename T>
897 inline
899  const std::vector<numeric_index_type> & dof_indices)
900 {
901  libmesh_assert(v.size() == dof_indices.size());
902  if (!v.empty())
903  this->insert(&v(0), dof_indices);
904 }
905 
906 
907 
908 // Full specialization of the print() member for complex
909 // variables. This must precede the non-specialized
910 // version, at least according to icc v7.1
911 template <>
912 inline
913 void NumericVector<Complex>::print(std::ostream & os) const
914 {
915  libmesh_assert (this->initialized());
916  os << "Size\tglobal = " << this->size()
917  << "\t\tlocal = " << this->local_size() << std::endl;
918 
919  // std::complex<>::operator<<() is defined, but use this form
920  os << "#\tReal part\t\tImaginary part" << std::endl;
921  for (auto i : index_range(*this))
922  os << i << "\t"
923  << (*this)(i).real() << "\t\t"
924  << (*this)(i).imag() << std::endl;
925 }
926 
927 
928 
929 template <typename T>
930 inline
931 void NumericVector<T>::print(std::ostream & os) const
932 {
933  libmesh_assert (this->initialized());
934  os << "Size\tglobal = " << this->size()
935  << "\t\tlocal = " << this->local_size() << std::endl;
936 
937  os << "#\tValue" << std::endl;
938  for (auto i : index_range(*this))
939  os << i << "\t" << (*this)(i) << std::endl;
940 }
941 
942 
943 
944 template <>
945 inline
946 void NumericVector<Complex>::print_global(std::ostream & os) const
947 {
948  libmesh_assert (this->initialized());
949 
950  std::vector<Complex> v(this->size());
951  this->localize(v);
952 
953  // Right now we only want one copy of the output
954  if (this->processor_id())
955  return;
956 
957  os << "Size\tglobal = " << this->size() << std::endl;
958  os << "#\tReal part\t\tImaginary part" << std::endl;
959  for (auto i : IntRange<numeric_index_type>(0, v.size()))
960  os << i << "\t"
961  << v[i].real() << "\t\t"
962  << v[i].imag() << std::endl;
963 }
964 
965 
966 template <typename T>
967 inline
968 void NumericVector<T>::print_global(std::ostream & os) const
969 {
970  libmesh_assert (this->initialized());
971 
972  std::vector<T> v(this->size());
973  this->localize(v);
974 
975  // Right now we only want one copy of the output
976  if (this->processor_id())
977  return;
978 
979  os << "Size\tglobal = " << this->size() << std::endl;
980  os << "#\tValue" << std::endl;
981  for (auto i : IntRange<numeric_index_type>(0, v.size()))
982  os << i << "\t" << v[i] << std::endl;
983 }
984 
985 
986 
987 template <typename T>
988 inline
990 {
991  std::swap(_is_closed, v._is_closed);
992  std::swap(_is_initialized, v._is_initialized);
993  std::swap(_type, v._type);
994 }
995 
996 
997 } // namespace libMesh
998 
999 
1000 // Workaround for weird boost/NumericVector interaction bug
1001 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
1002 namespace boost { namespace multiprecision { namespace detail {
1003 template <typename T, typename To>
1004 struct is_lossy_conversion<libMesh::NumericVector<T>, To> {
1005  typedef boost::mpl::true_ type;
1006  static const bool value = type::value;
1007 };
1008 }}}
1009 #endif
1010 
1011 
1012 #endif // LIBMESH_NUMERIC_VECTOR_H
libMesh::ShellMatrix
Generic shell matrix, i.e.
Definition: eigen_preconditioner.h:36
libMesh::NumericVector::zero
virtual void zero()=0
Set all entries to zero.
libMesh::SolverPackage
SolverPackage
Defines an enum for various linear solver packages.
Definition: enum_solver_package.h:34
libMesh::NumericVector::add
virtual void add(const numeric_index_type i, const T value)=0
Adds value to each entry of the vector.
libMesh::NumericVector::operator()
virtual T operator()(const numeric_index_type i) const =0
libMesh::NumericVector::reciprocal
virtual void reciprocal()=0
Computes the component-wise reciprocal, .
libMesh::NumericVector::print_matlab
virtual void print_matlab(const std::string &="") const
Print the contents of the vector in Matlab's sparse matrix format.
Definition: numeric_vector.h:696
libMesh::NumericVector::swap
virtual void swap(NumericVector< T > &v)
Swaps the contents of this with v.
Definition: numeric_vector.h:989
libMesh::DenseSubVector::empty
virtual bool empty() const override
Definition: dense_subvector.h:93
libMesh::NumericVector::subset_linfty_norm
virtual Real subset_linfty_norm(const std::set< numeric_index_type > &indices) const
Definition: numeric_vector.C:342
libMesh::NumericVector::last_local_index
virtual numeric_index_type last_local_index() const =0
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::NumericVector::operator+=
virtual NumericVector< T > & operator+=(const NumericVector< T > &v)=0
Adds v to *this, .
libMesh::NumericVector::close
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
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::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::default_solver_package
SolverPackage default_solver_package()
Definition: libmesh.C:993
libMesh::NumericVector::clone
virtual std::unique_ptr< NumericVector< T > > clone() const =0
libMesh::NumericVector::_is_initialized
bool _is_initialized
true once init() has been called.
Definition: numeric_vector.h:732
libMesh::NumericVector::max
virtual Real max() const =0
boost
Definition: numeric_vector.h:1002
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::NumericVector::operator*=
NumericVector< T > & operator*=(const T a)
Scales the vector by a, .
Definition: numeric_vector.h:397
libMesh::NumericVector::~NumericVector
virtual ~NumericVector()=default
While this class doesn't manage any memory, the derived class might and users may be deleting through...
libMesh::NumericVector::pointwise_mult
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0
Computes (summation not implied) i.e.
libMesh::NumericVector::insert
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
Inserts the entries of v in *this at the locations specified by v.
Definition: numeric_vector.C:83
libMesh::SparseMatrix
Generic sparse matrix.
Definition: vector_fe_ex5.C:45
libMesh::NumericVector::closed
virtual bool closed() const
Definition: numeric_vector.h:171
libMesh::NumericVector::NumericVector
NumericVector(const Parallel::Communicator &comm_in, const ParallelType ptype=AUTOMATIC)
Dummy-Constructor.
Definition: numeric_vector.h:747
libMesh::NumericVector::build
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
Definition: numeric_vector.C:49
libMesh::NumericVector::size
virtual numeric_index_type size() const =0
libMesh::NumericVector::min
virtual Real min() const =0
libMesh::NumericVector
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Definition: vector_fe_ex5.C:43
libMesh::NumericVector::_type
ParallelType _type
Type of vector.
Definition: numeric_vector.h:737
libMesh::NumericVector::operator-=
virtual NumericVector< T > & operator-=(const NumericVector< T > &v)=0
Subtracts v from *this, .
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::IntRange
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
Definition: int_range.h:53
libMesh::NumericVector::add_vector
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
Definition: numeric_vector.C:363
libMesh::NumericVector::localize
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
libMesh::NumericVector::subset_l2_norm
virtual Real subset_l2_norm(const std::set< numeric_index_type > &indices) const
Definition: numeric_vector.C:327
boost::multiprecision::detail::is_lossy_conversion< libMesh::NumericVector< T >, To >::type
boost::mpl::true_ type
Definition: numeric_vector.h:1005
libMesh::DenseSubVector::size
virtual unsigned int size() const override
Definition: dense_subvector.h:90
libMesh::NumericVector::initialized
virtual bool initialized() const
Definition: numeric_vector.h:155
libMesh::NumericVector::el
virtual T el(const numeric_index_type i) const
Definition: numeric_vector.h:352
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::NumericVector::local_relative_compare
virtual int local_relative_compare(const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
Definition: numeric_vector.C:137
libMesh::DenseVector::empty
virtual bool empty() const override
Definition: dense_vector.h:97
libMesh::NumericVector::add_vector_transpose
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A)=0
Computes , i.e.
libMesh::NumericVector::local_size
virtual numeric_index_type local_size() const =0
libMesh::NumericVector::operator=
virtual NumericVector< T > & operator=(const NumericVector< T > &v)=0
This looks like a copy assignment operator, but note that, unlike normal copy assignment operators,...
A
static PetscErrorCode Mat * A
Definition: petscdmlibmeshimpl.C:1026
libMesh::NumericVector::type
ParallelType & type()
Definition: numeric_vector.h:165
libMesh::NumericVector::print_global
virtual void print_global(std::ostream &os=libMesh::out) const
Prints the global contents of the vector, by default to libMesh::out.
Definition: numeric_vector.h:968
libMesh::DenseVector::size
virtual unsigned int size() const override
Definition: dense_vector.h:92
libMesh::NumericVector::l1_norm
virtual Real l1_norm() const =0
libMesh::NumericVector::clear
virtual void clear()
Restores the NumericVector<T> to a pristine state.
Definition: numeric_vector.h:811
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::DenseSubVector
Defines a dense subvector for use in finite element computations.
Definition: dense_subvector.h:43
libMesh::NumericVector::linfty_norm
virtual Real linfty_norm() const =0
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::NumericVector::operator<<
friend std::ostream & operator<<(std::ostream &os, const NumericVector< T > &v)
Same as above but allows you to use stream syntax.
Definition: numeric_vector.h:685
libMesh::libMeshPrivateData::_is_initialized
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:246
libMesh::NumericVector::set
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
value
static const bool value
Definition: xdr_io.C:56
libMesh::NumericVector::localize_to_one
virtual void localize_to_one(std::vector< T > &v_local, const processor_id_type proc_id=0) const =0
Creates a local copy of the global vector in v_local only on processor proc_id.
libMesh::NumericVector::l2_norm
virtual Real l2_norm() const =0
libMesh::NumericVector::scale
virtual void scale(const T factor)=0
Scale each element of the vector by the given factor.
libMesh::NumericVector::create_subvector
virtual void create_subvector(NumericVector< T > &, const std::vector< numeric_index_type > &) const
Fills in subvector from this vector using the indices in rows.
Definition: numeric_vector.h:707
libMesh::NumericVector::sum
virtual T sum() const =0
libMesh::NumericVector::print
virtual void print(std::ostream &os=libMesh::out) const
Prints the local contents of the vector, by default to libMesh::out.
Definition: numeric_vector.h:931
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::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::ParallelObject
An object whose state is distributed along a set of processors.
Definition: parallel_object.h:55
libMesh::NumericVector::conjugate
virtual void conjugate()=0
Negates the imaginary component of each entry in the vector.
libMesh::out
OStreamProxy out
libMesh::NumericVector::subset_l1_norm
virtual Real subset_l1_norm(const std::set< numeric_index_type > &indices) const
Definition: numeric_vector.C:312
libMesh::NumericVector::operator/=
NumericVector< T > & operator/=(const T a)
Scales the vector by 1/a, .
Definition: numeric_vector.h:415
libMesh::NumericVector::global_relative_compare
virtual int global_relative_compare(const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
Definition: numeric_vector.C:170
libMesh::NumericVector::zero_clone
virtual std::unique_ptr< NumericVector< T > > zero_clone() const =0
libMesh::NumericVector::type
ParallelType type() const
Definition: numeric_vector.h:160
std::imag
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
Definition: float128_shims.h:83
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::NumericVector::dot
virtual T dot(const NumericVector< T > &v) const =0
libMesh::DenseVector
Defines a dense vector for use in Finite Element-type computations.
Definition: meshless_interpolation_function.h:39
libMesh::NumericVector::abs
virtual void abs()=0
Sets for each entry in the vector.
libMesh::NumericVector::first_local_index
virtual numeric_index_type first_local_index() const =0
libMesh::NumericVector::compare
virtual int compare(const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
Definition: numeric_vector.C:105
std::real
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
Definition: float128_shims.h:77