BlockVector<double>;
BlockVector<float>;
- LinearAlgebra::Vector<double>;
- LinearAlgebra::Vector<float> ;
-
LinearAlgebra::distributed::Vector<double>;
LinearAlgebra::distributed::Vector<float> ;
@DEAL_II_EXPAND_COMPLEX_VECTORS@;
@DEAL_II_EXPAND_COMPLEX_BLOCK_VECTORS@;
- @DEAL_II_EXPAND_COMPLEX_LA_VECTORS@;
@DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_VECTORS@;
@DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_BLOCK_VECTORS@;
BlockVector<double>;
BlockVector<float>;
- LinearAlgebra::Vector<double>;
- LinearAlgebra::Vector<float> ;
-
LinearAlgebra::distributed::Vector<double>;
LinearAlgebra::distributed::Vector<float> ;
REAL_NONBLOCK_VECTORS := { Vector<double>;
Vector<float> ;
- LinearAlgebra::Vector<double>;
- LinearAlgebra::Vector<float> ;
-
LinearAlgebra::distributed::Vector<double>;
LinearAlgebra::distributed::Vector<float> ;
"BlockVector<std::complex<double> >"
"BlockVector<std::complex<float> >"
)
- set(DEAL_II_EXPAND_COMPLEX_LA_VECTORS
- "LinearAlgebra::Vector<std::complex<double> >"
- "LinearAlgebra::Vector<std::complex<float> >"
- )
set(DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_VECTORS
"LinearAlgebra::distributed::Vector<std::complex<double> >"
"LinearAlgebra::distributed::Vector<std::complex<float> >"
--- /dev/null
+Removed: The LinearAlgebra::Vector class has been removed without deprecation.
+Users should use the standard Vector class instead.
+<br>
+(David Wells, 2023/07/03)
inline constexpr bool is_dealii_vector_type<dealii::BlockVector<Number>> =
true;
- template <typename Number>
- inline constexpr bool
- is_dealii_vector_type<dealii::LinearAlgebra::Vector<Number>> = true;
-
template <typename Number>
inline constexpr bool
is_dealii_vector_type<dealii::LinearAlgebra::BlockVector<Number>> = true;
# include <deal.II/lac/block_vector.h>
# include <deal.II/lac/la_parallel_block_vector.h>
# include <deal.II/lac/la_parallel_vector.h>
-# include <deal.II/lac/la_vector.h>
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
# include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/sparsity_tools.h>
#include <deal.II/lac/trilinos_vector.h>
#include <deal.II/lac/full_matrix.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/matrix_block.h>
#include <deal.II/lac/petsc_block_sparse_matrix.h>
#include <deal.II/lac/petsc_block_vector.h>
/**
- * Declare dealii::LinearAlgebra::Vector as distributed vector.
+ * Declare dealii::LinearAlgebra::distributed::Vector as distributed vector.
*/
template <typename Number, typename MemorySpace>
struct is_serial_vector<LinearAlgebra::distributed::Vector<Number, MemorySpace>>
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2015 - 2023 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii_la_vector_h
-#define dealii_la_vector_h
-
-
-#include <deal.II/base/config.h>
-
-#include <deal.II/base/exceptions.h>
-#include <deal.II/base/index_set.h>
-#include <deal.II/base/logstream.h>
-
-#include <deal.II/lac/read_write_vector.h>
-#include <deal.II/lac/vector_operation.h>
-#include <deal.II/lac/vector_space_vector.h>
-#include <deal.II/lac/vector_type_traits.h>
-
-// boost::serialization::make_array used to be in array.hpp, but was
-// moved to a different file in BOOST 1.64
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 106400
-# include <boost/serialization/array_wrapper.hpp>
-#else
-# include <boost/serialization/array.hpp>
-#endif
-#include <boost/serialization/split_member.hpp>
-
-#include <cstdio>
-#include <cstring>
-#include <iostream>
-#include <vector>
-
-
-DEAL_II_NAMESPACE_OPEN
-
-/**
- * A namespace for vector classes.
- *
- * This namespace contains various classes that provide wrappers to vector
- * classes from different external libraries like Trilinos (EPetra) or PETSc
- * and native implementations like LinearAlgebra::distributed::Vector.
- *
- * The different vector classes are derived from VectorSpaceVector to provide
- * a joint interface for vector space operations, are derived from
- * ReadWriteVector (or ReadWriteVector itself), or both. The separation of
- * vector space operations (like norms or vector additions) through
- * VectorSpaceVector and element access through ReadWriteVector are by design
- * and improve performance.
- */
-namespace LinearAlgebra
-{
- /**
- * @addtogroup Vectors
- * @{
- */
-
- /**
- * Numerical vector of data. This class derives from both
- * ::dealii::LinearAlgebra::ReadWriteVector and
- * ::dealii::LinearAlgebra::VectorSpaceVector. As opposed to the array of
- * the C++ standard library, this class implements an element of a vector
- * space suitable for numerical computations.
- */
- template <typename Number>
- class Vector : public ReadWriteVector<Number>,
- public VectorSpaceVector<Number>
- {
- public:
- using size_type = types::global_dof_index;
- using value_type = typename ReadWriteVector<Number>::value_type;
-
- /**
- * Constructor. Create a vector of dimension zero.
- */
- Vector() = default;
-
- /**
- * Copy constructor. Sets the dimension to that of the given vector and
- * copies all elements.
- */
- Vector(const Vector<Number> &V);
-
- /**
- * Constructor. Set dimension to @p n and initialize all elements with
- * zero.
- *
- * The constructor is made explicit to avoid accident like this:
- * <tt>v=0;</tt>. Presumably, the user wants to set every element of the
- * vector to zero, but instead, what happens is this call:
- * <tt>v=Vector@<Number@>(0);</tt>, i.e. the vector is replaced by one of
- * length zero.
- */
- explicit Vector(const size_type n);
-
- /**
- * Initialize the vector with a given range of values pointed to by the
- * iterators. This function exists in analogy to the @p std::vector class.
- */
- template <typename InputIterator>
- Vector(const InputIterator first, const InputIterator last);
-
- /**
- * Set the global size of the vector to @p size. The stored elements have
- * their index in [0,size).
- *
- * If the flag @p omit_zeroing_entries is set to false, the memory will be
- * initialized with zero, otherwise the memory will be untouched (and the
- * user must make sure to fill it with reasonable data before using it).
- */
- virtual void
- reinit(const size_type size,
- const bool omit_zeroing_entries = false) override;
-
- /**
- * Uses the same IndexSet as the one of the input vector @p in_vector and
- * allocates memory for this vector.
- *
- * If the flag @p omit_zeroing_entries is set to false, the memory will be
- * initialized with zero, otherwise the memory will be untouched (and the
- * user must make sure to fill it with reasonable data before using it).
- */
- template <typename Number2>
- void
- reinit(const ReadWriteVector<Number2> &in_vector,
- const bool omit_zeroing_entries = false);
-
- /**
- * Initializes the vector. The indices are specified by @p
- * locally_stored_indices.
- *
- * If the flag @p omit_zeroing_entries is set to false, the memory will be
- * initialized with zero, otherwise the memory will be untouched (and the
- * user must make sure to fill it with reasonable data before using it).
- * locally_stored_indices.
- */
- virtual void
- reinit(const IndexSet &locally_stored_indices,
- const bool omit_zeroing_entries = false) override;
-
-
- /**
- * Change the dimension to that of the vector V. The elements of V are not
- * copied.
- */
- virtual void
- reinit(const VectorSpaceVector<Number> &V,
- const bool omit_zeroing_entries = false) override;
-
- /**
- * Returns `false` as this is a serial vector.
- *
- * This functionality only needs to be called if using MPI based vectors and
- * exists in other objects for compatibility.
- */
- bool
- has_ghost_elements() const;
-
- /**
- * Copies the data of the input vector @p in_vector.
- */
- Vector<Number> &
- operator=(const Vector<Number> &in_vector);
-
- /**
- * Copies the data of the input vector @p in_vector.
- */
- template <typename Number2>
- Vector<Number> &
- operator=(const Vector<Number2> &in_vector);
-
- /**
- * Sets all elements of the vector to the scalar @p s. This operation is
- * only allowed if @p s is equal to zero.
- */
- virtual Vector<Number> &
- operator=(const Number s) override;
-
- /**
- * Multiply the entire vector by a fixed factor.
- */
- virtual Vector<Number> &
- operator*=(const Number factor) override;
-
- /**
- * Divide the entire vector by a fixed factor.
- */
- virtual Vector<Number> &
- operator/=(const Number factor) override;
-
- /**
- * Add the vector @p V to the present one.
- */
- virtual Vector<Number> &
- operator+=(const VectorSpaceVector<Number> &V) override;
-
- /**
- * Subtract the vector @p V from the present one.
- */
- virtual Vector<Number> &
- operator-=(const VectorSpaceVector<Number> &V) override;
-
- /**
- * Return the scalar product of two vectors.
- */
- virtual Number
- operator*(const VectorSpaceVector<Number> &V) const override;
-
- /**
- * This function is not implemented and will throw an exception.
- */
- virtual void
- import_elements(
- const ReadWriteVector<Number> &V,
- VectorOperation::values operation,
- std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- communication_pattern = {}) override;
-
- /**
- * @deprecated Use import_elements() instead.
- */
- DEAL_II_DEPRECATED
- virtual void
- import(const ReadWriteVector<Number> &V,
- VectorOperation::values operation,
- std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- communication_pattern = {}) override
- {
- import_elements(V, operation, communication_pattern);
- }
-
- /**
- * Add @p a to all components. Note that @p a is a scalar not a vector.
- */
- virtual void
- add(const Number a) override;
-
- /**
- * Simple addition of a multiple of a vector, i.e. <tt>*this += a*V</tt>.
- */
- virtual void
- add(const Number a, const VectorSpaceVector<Number> &V) override;
-
- /**
- * Multiple addition of a multiple of a vector, i.e. <tt>*this +=
- * a*V+b*W</tt>.
- */
- virtual void
- add(const Number a,
- const VectorSpaceVector<Number> &V,
- const Number b,
- const VectorSpaceVector<Number> &W) override;
-
- /**
- * Scaling and simple addition of a multiple of a vector, i.e. <tt>*this =
- * s*(*this)+a*V</tt>.
- */
- virtual void
- sadd(const Number s,
- const Number a,
- const VectorSpaceVector<Number> &V) override;
-
- /**
- * Scale each element of this vector by the corresponding element in the
- * argument. This function is mostly meant to simulate multiplication (and
- * immediate re-assignment) by a diagonal scaling matrix.
- */
- virtual void
- scale(const VectorSpaceVector<Number> &scaling_factors) override;
-
- /**
- * Assignment <tt>*this = a*V</tt>.
- */
- virtual void
- equ(const Number a, const VectorSpaceVector<Number> &V) override;
-
- /**
- * Return whether the vector contains only elements with value zero.
- */
- virtual bool
- all_zero() const override;
-
- /**
- * Return the mean value of all the entries of this vector.
- */
- virtual value_type
- mean_value() const override;
-
- /**
- * Return the l<sub>1</sub> norm of the vector (i.e., the sum of the
- * absolute values of all entries).
- */
- virtual typename VectorSpaceVector<Number>::real_type
- l1_norm() const override;
-
- /**
- * Return the l<sub>2</sub> norm of the vector (i.e., the square root of
- * the sum of the square of all entries among all processors).
- */
- virtual typename VectorSpaceVector<Number>::real_type
- l2_norm() const override;
-
- /**
- * Return the maximum norm of the vector (i.e., the maximum absolute value
- * among all entries and among all processors).
- */
- virtual typename VectorSpaceVector<Number>::real_type
- linfty_norm() const override;
-
- /**
- * Perform a combined operation of a vector addition and a subsequent
- * inner product, returning the value of the inner product. In other
- * words, the result of this function is the same as if the user called
- * @code
- * this->add(a, V);
- * return_value = *this * W;
- * @endcode
- *
- * The reason this function exists is that this operation involves less
- * memory transfer than calling the two functions separately. This method
- * only needs to load three vectors, @p this, @p V, @p W, whereas calling
- * separate methods means to load the calling vector @p this twice. Since
- * most vector operations are memory transfer limited, this reduces the time
- * by 25\% (or 50\% if @p W equals @p this).
- *
- * For complex-valued vectors, the scalar product in the second step is
- * implemented as
- * $\left<v,w\right>=\sum_i v_i \bar{w_i}$.
- */
- virtual Number
- add_and_dot(const Number a,
- const VectorSpaceVector<Number> &V,
- const VectorSpaceVector<Number> &W) override;
-
- /**
- * Return the global size of the vector, equal to the sum of the number of
- * locally owned indices among all processors.
- */
- virtual size_type
- size() const override;
-
- /**
- * Return an index set that describes which elements of this vector are
- * owned by the current processor. As a consequence, the index sets
- * returned on different processors if this is a distributed vector will
- * form disjoint sets that add up to the complete index set. Obviously, if
- * a vector is created on only one processor, then the result would
- * satisfy
- * @code
- * vec.locally_owned_elements() == complete_index_set(vec.size())
- * @endcode
- */
- virtual dealii::IndexSet
- locally_owned_elements() const override;
-
- /**
- * Print the vector to the output stream @p out.
- */
- virtual void
- print(std::ostream & out,
- const unsigned int precision = 3,
- const bool scientific = true,
- const bool across = true) const override;
-
- /**
- * Print the vector to the output stream @p out in a format that can be
- * read by numpy::readtxt(). Note that the IndexSet is not printed but only
- * the values stored in the Vector. To load the vector in python just do
- * <code>
- * vector = numpy.loadtxt('my_vector.txt')
- * </code>
- */
- void
- print_as_numpy_array(std::ostream & out,
- const unsigned int precision = 9) const;
-
- /**
- * Write the vector en bloc to a file. This is done in a binary mode, so
- * the output is neither readable by humans nor (probably) by other
- * computers using a different operating system or number format.
- */
- void
- block_write(std::ostream &out) const;
-
- /**
- * Read a vector en block from a file. This is done using the inverse
- * operations to the above function, so it is reasonably fast because the
- * bitstream is not interpreted.
- *
- * The vector is resized if necessary.
- *
- * A primitive form of error checking is performed which will recognize
- * the bluntest attempts to interpret some data as a vector stored bitwise
- * to a file, but not more.
- */
- void
- block_read(std::istream &in);
-
- /**
- * Return the memory consumption of this class in bytes.
- */
- virtual std::size_t
- memory_consumption() const override;
-
- /**
- * Write and read the data of this object from a stream for the purpose
- * of serialization using the [BOOST serialization
- * library](https://www.boost.org/doc/libs/1_74_0/libs/serialization/doc/index.html).
- */
- template <typename Archive>
- void
- serialize(Archive &ar, const unsigned int version);
-
- /**
- * Attempt to perform an operation between two incompatible vector types.
- *
- * @ingroup Exceptions
- */
- DeclException0(ExcVectorTypeNotCompatible);
-
- private:
- // Make all other ReadWriteVector types friends.
- template <typename Number2>
- friend class Vector;
- };
-
- /** @} */
- /*--------------------------- Inline functions ----------------------------*/
-
- template <typename Number>
- inline Vector<Number>::Vector(const Vector<Number> &V)
- : ReadWriteVector<Number>(V)
- {}
-
-
-
- template <typename Number>
- inline Vector<Number>::Vector(const size_type n)
- : ReadWriteVector<Number>(n)
- {}
-
-
-
- template <typename Number>
- template <typename InputIterator>
- inline Vector<Number>::Vector(const InputIterator first,
- const InputIterator last)
- {
- this->reinit(complete_index_set(std::distance(first, last)), true);
- std::copy(first, last, this->begin());
- }
-
-
-
- template <typename Number>
- inline typename Vector<Number>::size_type
- Vector<Number>::size() const
- {
- return ReadWriteVector<Number>::size();
- }
-
-
-
- template <typename Number>
- inline dealii::IndexSet
- Vector<Number>::locally_owned_elements() const
- {
- return IndexSet(ReadWriteVector<Number>::get_stored_elements());
- }
-
-
-
- template <typename Number>
- inline void
- Vector<Number>::print(std::ostream & out,
- const unsigned int precision,
- const bool scientific,
- const bool) const
- {
- ReadWriteVector<Number>::print(out, precision, scientific);
- }
-
-
-
- template <typename Number>
- template <typename Archive>
- inline void
- Vector<Number>::serialize(Archive &ar, const unsigned int)
- {
- size_type current_size = this->size();
- ar &static_cast<Subscriptor &>(*this);
- ar &this->stored_elements;
- // If necessary, resize the vector during a read operation
- if (this->size() != current_size)
- this->reinit(this->size());
- ar &boost::serialization::make_array(this->values.get(), this->size());
- }
-
-
-
- template <typename Number>
- inline std::size_t
- Vector<Number>::memory_consumption() const
- {
- return ReadWriteVector<Number>::memory_consumption();
- }
-} // end of namespace LinearAlgebra
-
-
-/**
- * Declare dealii::LinearAlgebra::Vector as serial vector.
- */
-template <typename Number>
-struct is_serial_vector<LinearAlgebra::Vector<Number>> : std::true_type
-{};
-
-#ifndef DOXYGEN
-/*----------------------- Inline functions ----------------------------------*/
-
-namespace LinearAlgebra
-{
- template <typename Number>
- inline bool
- Vector<Number>::has_ghost_elements() const
- {
- return false;
- }
-} // namespace LinearAlgebra
-
-#endif
-
-
-DEAL_II_NAMESPACE_CLOSE
-
-#ifdef DEAL_II_MSVC
-# include <deal.II/lac/la_vector.templates.h>
-#endif
-
-#endif
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2015 - 2023 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii_la_vector_templates_h
-#define dealii_la_vector_templates_h
-
-#include <deal.II/base/config.h>
-
-#include <deal.II/lac/la_vector.h>
-#include <deal.II/lac/vector_operation.h>
-#include <deal.II/lac/vector_operations_internal.h>
-
-#include <boost/io/ios_state.hpp>
-
-#include <iomanip>
-#include <iostream>
-#include <limits>
-
-DEAL_II_NAMESPACE_OPEN
-
-namespace LinearAlgebra
-{
- template <typename Number>
- void
- Vector<Number>::reinit(const size_type size, const bool omit_zeroing_entries)
- {
- ReadWriteVector<Number>::reinit(size, omit_zeroing_entries);
- }
-
-
-
- template <typename Number>
- template <typename Number2>
- void
- Vector<Number>::reinit(const ReadWriteVector<Number2> &in_vector,
- const bool omit_zeroing_entries)
- {
- ReadWriteVector<Number>::reinit(in_vector, omit_zeroing_entries);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::reinit(const IndexSet &locally_stored_indices,
- const bool omit_zeroing_entries)
- {
- ReadWriteVector<Number>::reinit(locally_stored_indices,
- omit_zeroing_entries);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::reinit(const VectorSpaceVector<Number> &V,
- const bool omit_zeroing_entries)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
-
- ReadWriteVector<Number>::reinit(down_V, omit_zeroing_entries);
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator=(const Vector<Number> &in_vector)
- {
- if (PointerComparison::equal(this, &in_vector))
- return *this;
-
- this->thread_loop_partitioner = in_vector.thread_loop_partitioner;
- if (this->size() != in_vector.size())
- this->reinit(in_vector, true);
-
- dealii::internal::VectorOperations::Vector_copy<Number, Number> copier(
- in_vector.values.get(), this->values.get());
- dealii::internal::VectorOperations::parallel_for(
- copier,
- static_cast<size_type>(0),
- this->size(),
- this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- template <typename Number2>
- Vector<Number> &
- Vector<Number>::operator=(const Vector<Number2> &in_vector)
- {
- this->thread_loop_partitioner = in_vector.thread_loop_partitioner;
- if (this->size() != in_vector.size())
- ReadWriteVector<Number>::reinit(in_vector, true);
-
- dealii::internal::VectorOperations::Vector_copy<Number, Number2> copier(
- in_vector.values.get(), this->values.get());
- dealii::internal::VectorOperations::parallel_for(
- copier,
- static_cast<size_type>(0),
- this->size(),
- this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator=(const Number s)
- {
- Assert(s == static_cast<Number>(0),
- ExcMessage("Only 0 can be assigned to a vector."));
- (void)s;
-
- dealii::internal::VectorOperations::Vector_set<Number> setter(
- Number(), this->values.get());
- dealii::internal::VectorOperations::parallel_for(
- setter, 0, this->size(), this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator*=(const Number factor)
- {
- AssertIsFinite(factor);
-
- dealii::internal::VectorOperations::Vectorization_multiply_factor<Number>
- vector_multiply(this->values.get(), factor);
- dealii::internal::VectorOperations::parallel_for(
- vector_multiply,
- static_cast<size_type>(0),
- this->size(),
- this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator/=(const Number factor)
- {
- AssertIsFinite(factor);
- Assert(factor != Number(0.), ExcZero());
- this->operator*=(Number(1.) / factor);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator+=(const VectorSpaceVector<Number> &V)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- Assert(down_V.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
-
- dealii::internal::VectorOperations::Vectorization_add_v<Number> vector_add(
- this->values.get(), down_V.values.get());
- dealii::internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Vector<Number> &
- Vector<Number>::operator-=(const VectorSpaceVector<Number> &V)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- Assert(down_V.size() == this->size(),
- ExcMessage(
- "Cannot subtract two vectors with different numbers of elements"));
- dealii::internal::VectorOperations::Vectorization_subtract_v<Number>
- vector_subtract(this->values.get(), down_V.values.get());
- dealii::internal::VectorOperations::parallel_for(
- vector_subtract, 0, this->size(), this->thread_loop_partitioner);
-
- return *this;
- }
-
-
-
- template <typename Number>
- Number
- Vector<Number>::operator*(const VectorSpaceVector<Number> &V) const
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- Assert(down_V.size() == this->size(),
- ExcMessage("Cannot compute the scalar product "
- "of two vectors with different numbers of elements"));
- Number sum;
- dealii::internal::VectorOperations::Dot<Number, Number> dot(
- this->values.get(), down_V.values.get());
- dealii::internal::VectorOperations::parallel_reduce(
- dot, 0, this->size(), sum, this->thread_loop_partitioner);
-
- return sum;
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::import_elements(
- const ReadWriteVector<Number> &,
- VectorOperation::values,
- std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>)
- {
- AssertThrow(false, ExcMessage("This function is not implemented."));
- }
-
-
-
- template <typename Number>
- inline void
- Vector<Number>::add(const Number a)
- {
- AssertIsFinite(a);
-
- dealii::internal::VectorOperations::Vectorization_add_factor<Number>
- vector_add(this->values.get(), a);
- dealii::internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::add(const Number a, const VectorSpaceVector<Number> &V)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- AssertIsFinite(a);
- Assert(down_V.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
-
- dealii::internal::VectorOperations::Vectorization_add_av<Number>
- vector_add_av(this->values.get(), down_V.values.get(), a);
- dealii::internal::VectorOperations::parallel_for(
- vector_add_av, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::add(const Number a,
- const VectorSpaceVector<Number> &V,
- const Number b,
- const VectorSpaceVector<Number> &W)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&W) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- // Downcast W. If fails, throws an exception.
- const Vector<Number> &down_W = dynamic_cast<const Vector<Number> &>(W);
- AssertIsFinite(a);
- Assert(down_V.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
- AssertIsFinite(b);
- Assert(down_W.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
-
- dealii::internal::VectorOperations::Vectorization_add_avpbw<Number>
- vector_add(
- this->values.get(), down_V.values.get(), down_W.values.get(), a, b);
- dealii::internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::sadd(const Number s,
- const Number a,
- const VectorSpaceVector<Number> &V)
- {
- AssertIsFinite(s);
- AssertIsFinite(a);
-
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. It fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- dealii::internal::VectorOperations::Vectorization_sadd_xav<Number>
- vector_sadd_xav(this->values.get(), down_V.values.get(), a, s);
- dealii::internal::VectorOperations::parallel_for(
- vector_sadd_xav, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::scale(const VectorSpaceVector<Number> &scaling_factors)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&scaling_factors) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast scaling_factors. If fails, throws an exception.
- const Vector<Number> &down_scaling_factors =
- dynamic_cast<const Vector<Number> &>(scaling_factors);
- Assert(down_scaling_factors.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
-
- dealii::internal::VectorOperations::Vectorization_scale<Number>
- vector_scale(this->values.get(), down_scaling_factors.values.get());
- dealii::internal::VectorOperations::parallel_for(
- vector_scale, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::equ(const Number a, const VectorSpaceVector<Number> &V)
- {
- AssertIsFinite(a);
-
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- dealii::internal::VectorOperations::Vectorization_equ_au<Number> vector_equ(
- this->values.get(), down_V.values.get(), a);
- dealii::internal::VectorOperations::parallel_for(
- vector_equ, 0, this->size(), this->thread_loop_partitioner);
- }
-
-
-
- template <typename Number>
- bool
- Vector<Number>::all_zero() const
- {
- Assert(this->size(), ExcEmptyObject());
-
- const size_type size = this->size();
- for (size_type i = 0; i < size; ++i)
- if (this->values[i] != Number())
- return false;
-
- return true;
- }
-
-
-
- template <typename Number>
- typename Vector<Number>::value_type
- Vector<Number>::mean_value() const
- {
- Assert(this->size(), ExcEmptyObject());
-
- using real_type = typename VectorSpaceVector<Number>::real_type;
- value_type sum;
- dealii::internal::VectorOperations::MeanValue<Number> mean_value(
- this->values.get());
- dealii::internal::VectorOperations::parallel_reduce(
- mean_value, 0, this->size(), sum, this->thread_loop_partitioner);
-
- return sum / static_cast<real_type>(this->size());
- }
-
-
-
- template <typename Number>
- typename VectorSpaceVector<Number>::real_type
- Vector<Number>::l1_norm() const
- {
- Assert(this->size(), ExcEmptyObject());
-
- using real_type = typename VectorSpaceVector<Number>::real_type;
- real_type sum;
- dealii::internal::VectorOperations::Norm1<Number, real_type> norm1(
- this->values.get());
- dealii::internal::VectorOperations::parallel_reduce(
- norm1, 0, this->size(), sum, this->thread_loop_partitioner);
-
- return sum;
- }
-
-
-
- template <typename Number>
- typename VectorSpaceVector<Number>::real_type
- Vector<Number>::l2_norm() const
- {
- Assert(this->size(), ExcEmptyObject());
-
- // if l2_norm()^2 is finite and non-zero, the answer is computed as
- // std::sqrt(norm_sqr()). If norm_sqrt() is infinite or zero, the l2 norm
- // might still be finite. In that case, recompute ig (this is a rare case,
- // so working on the vector twice is uncritical and paid off by the extended
- // precision) using the BLAS approach with a weight, see e.g. dnrm2.f.
- using real_type = typename VectorSpaceVector<Number>::real_type;
- real_type norm_square;
- dealii::internal::VectorOperations::Norm2<Number, real_type> norm2(
- this->values.get());
- dealii::internal::VectorOperations::parallel_reduce(
- norm2, 0, this->size(), norm_square, this->thread_loop_partitioner);
- if (numbers::is_finite(norm_square) &&
- norm_square >= std::numeric_limits<real_type>::min())
- return std::sqrt(norm_square);
- else
- {
- real_type scale = 0.;
- real_type sum = 1.;
- const size_type size = this->size();
- for (size_type i = 0; i < size; ++i)
- {
- if (this->values[i] != Number())
- {
- const real_type abs_x =
- numbers::NumberTraits<Number>::abs(this->values[i]);
- if (scale < abs_x)
- {
- sum = 1. + sum * (scale / abs_x) * (scale / abs_x);
- scale = abs_x;
- }
- else
- sum += (abs_x / scale) * (abs_x / scale);
- }
- }
- AssertIsFinite(scale * std::sqrt(sum));
- return scale * std::sqrt(sum);
- }
- }
-
-
-
- template <typename Number>
- typename VectorSpaceVector<Number>::real_type
- Vector<Number>::linfty_norm() const
- {
- typename ReadWriteVector<Number>::real_type norm = 0.;
- const size_type size = this->size();
- for (size_type i = 0; i < size; ++i)
- norm = std::max(std::abs(this->values[i]), norm);
-
- return norm;
- }
-
-
-
- template <typename Number>
- Number
- Vector<Number>::add_and_dot(const Number a,
- const VectorSpaceVector<Number> &V,
- const VectorSpaceVector<Number> &W)
- {
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&V) != nullptr,
- ExcVectorTypeNotCompatible());
- // Check that casting will work.
- Assert(dynamic_cast<const Vector<Number> *>(&W) != nullptr,
- ExcVectorTypeNotCompatible());
-
- // Downcast V. If fails, throws an exception.
- const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- // Downcast W. If fails, throws an exception.
- const Vector<Number> &down_W = dynamic_cast<const Vector<Number> &>(W);
- AssertIsFinite(a);
- Assert(down_V.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
- Assert(down_W.size() == this->size(),
- ExcMessage(
- "Cannot add two vectors with different numbers of elements"));
-
- Number sum;
- dealii::internal::VectorOperations::AddAndDot<Number> adder(
- this->values.get(), down_V.values.get(), down_W.values.get(), a);
- dealii::internal::VectorOperations::parallel_reduce(
- adder, 0, this->size(), sum, this->thread_loop_partitioner);
- AssertIsFinite(sum);
-
- return sum;
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::print_as_numpy_array(std::ostream & out,
- const unsigned int precision) const
- {
- AssertThrow(out.fail() == false, ExcIO());
- boost::io::ios_flags_saver restore_flags(out);
-
- out.precision(precision);
-
- const unsigned int n_elements = this->locally_owned_size();
- for (unsigned int i = 0; i < n_elements; ++i)
- out << this->values[i] << ' ';
- out << '\n' << std::flush;
-
- AssertThrow(out.fail() == false, ExcIO());
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::block_write(std::ostream &out) const
- {
- AssertThrow(out.fail() == false, ExcIO());
-
- // Other version of the following
- // out << size() << std::endl << '[';
- // Reason: operator<< seems to use some resources that lead to problems in
- // a multithreaded environment. We convert the size index to
- // unsigned long long int that is at least 64 bits to be able to output it
- // on all platforms, since std::uint64_t is not in C.
- const unsigned long long int sz = this->size();
- char buf[16];
-
- std::sprintf(buf, "%llu", sz);
- std::strcat(buf, "\n[");
-
- out.write(buf, std::strlen(buf));
- out.write(reinterpret_cast<const char *>(this->begin()),
- reinterpret_cast<const char *>(this->end()) -
- reinterpret_cast<const char *>(this->begin()));
-
- // out << ']';
- const char outro = ']';
- out.write(&outro, 1);
-
- AssertThrow(out.fail() == false, ExcIO());
- }
-
-
-
- template <typename Number>
- void
- Vector<Number>::block_read(std::istream &in)
- {
- AssertThrow(in.fail() == false, ExcIO());
-
- size_type sz;
-
- char buf[16];
-
- in.getline(buf, 16, '\n');
- sz = std::atoi(buf);
- ReadWriteVector<Number>::reinit(sz, true);
-
- char c;
- // in >> c;
- in.read(&c, 1);
- AssertThrow(c == '[', ExcIO());
-
- in.read(reinterpret_cast<char *>(this->begin()),
- reinterpret_cast<const char *>(this->end()) -
- reinterpret_cast<const char *>(this->begin()));
-
- // in >> c;
- in.read(&c, 1);
- AssertThrow(c == ']', ExcIO());
- }
-} // namespace LinearAlgebra
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif
import_elements(V, operation, communication_pattern);
}
- /**
- * Imports all the elements present in the vector's IndexSet from the
- * input vector @p vec. VectorOperation::values @p operation
- * is used to decide if the elements in @p V should be added to the
- * current vector or replace the current elements.
- *
- * @note The parameter @p communication_pattern is ignored since we are
- * dealing with a serial vector here.
- */
- void
- import_elements(
- const LinearAlgebra::Vector<Number> &vec,
- VectorOperation::values operation,
- const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- &communication_pattern = {});
-
- /**
- * @deprecated Use import_elements() instead.
- */
- DEAL_II_DEPRECATED
- void
- import(const LinearAlgebra::Vector<Number> &V,
- VectorOperation::values operation,
- const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- &communication_pattern = {})
- {
- import_elements(V, operation, communication_pattern);
- }
-
/**
* Imports all the elements present in the vector's IndexSet from the
* input vector @p vec. VectorOperation::values @p operation
#include <deal.II/lac/exceptions.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/read_write_vector.h>
#include <deal.II/lac/vector.h>
#include <deal.II/lac/vector_operations_internal.h>
- template <typename Number>
- void
- ReadWriteVector<Number>::import_elements(
- const LinearAlgebra::Vector<Number> &vec,
- VectorOperation::values operation,
- const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- &communication_pattern)
- {
- (void)communication_pattern;
-
- internal::import_serial_vector(vec, operation, *this);
- }
-
-
-
template <typename Number>
template <typename MemorySpace>
void
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/precondition.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
# include <deal.II/lac/block_vector.h>
# include <deal.II/lac/la_parallel_block_vector.h>
# include <deal.II/lac/la_parallel_vector.h>
-# include <deal.II/lac/la_vector.h>
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
# include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/base/mpi_noncontiguous_partitioner.templates.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <boost/serialization/utility.hpp>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/sparse_matrix.h>
dealii::Vector<typename VectorType::value_type>>::value ||
std::is_same<VectorType,
dealii::BlockVector<typename VectorType::value_type>>::value ||
- std::is_same<
- VectorType,
- dealii::LinearAlgebra::Vector<typename VectorType::value_type>>::value ||
std::is_same<VectorType,
dealii::LinearAlgebra::distributed::Vector<
typename VectorType::value_type>>::value ||
#include <deal.II/lac/full_matrix.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/fe/mapping_q_cache.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
dynamic_sparsity_pattern.cc
exceptions.cc
scalapack.cc
- la_vector.cc
la_parallel_vector.cc
la_parallel_block_vector.cc
matrix_out.cc
chunk_sparse_matrix.inst.in
full_matrix.inst.in
lapack_full_matrix.inst.in
- la_vector.inst.in
la_parallel_vector.inst.in
la_parallel_block_vector.inst.in
precondition_block.inst.in
const;
}
-for (S : REAL_AND_COMPLEX_SCALARS)
- {
- template void AffineConstraints<S>::distribute<LinearAlgebra::Vector<S>>(
- LinearAlgebra::Vector<S> &) const;
- }
-
-for (S : COMPLEX_SCALARS)
- {
- template void
- AffineConstraints<S::value_type>::distribute<LinearAlgebra::Vector<S>>(
- LinearAlgebra::Vector<S> &) const;
- }
-
for (V : EXTERNAL_PARALLEL_VECTORS)
{
template void AffineConstraints<V::value_type>::distribute<V>(V &) const;
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2015 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#include <deal.II/lac/la_vector.templates.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-// disable instantiation for MSVC for now because of a compiler bug,
-// see https://github.com/dealii/dealii/issues/2875
-#ifndef DEAL_II_MSVC
-
-namespace LinearAlgebra
-{
-# include "la_vector.inst"
-
- // do a few functions that currently don't fit the scheme because they have
- // two template arguments that need to be different (the case of same
- // arguments is covered by the default copy constructor and copy operator that
- // is declared separately)
-
-# define TEMPL_COPY_CONSTRUCTOR(S1, S2) \
- template Vector<S1> &Vector<S1>::operator=<S2>(const Vector<S2> &)
-
- TEMPL_COPY_CONSTRUCTOR(double, float);
- TEMPL_COPY_CONSTRUCTOR(float, double);
-
-# ifdef DEAL_II_WITH_COMPLEX_VALUES
- TEMPL_COPY_CONSTRUCTOR(std::complex<double>, std::complex<float>);
- TEMPL_COPY_CONSTRUCTOR(std::complex<float>, std::complex<double>);
-# endif
-
-# undef TEMPL_COPY_CONSTRUCTOR
-} // namespace LinearAlgebra
-
-#endif // ! DEAL_II_MSVC
-
-DEAL_II_NAMESPACE_CLOSE
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1999 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-
-for (SCALAR : REAL_SCALARS)
- {
- template class Vector<SCALAR>;
- }
-
-
-
-for (SCALAR : COMPLEX_SCALARS)
- {
- template class Vector<SCALAR>;
- }
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/solver.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_sparse_matrix.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
# include <deal.II/lac/block_vector.h>
# include <deal.II/lac/la_parallel_block_vector.h>
# include <deal.II/lac/la_parallel_vector.h>
-# include <deal.II/lac/la_vector.h>
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
+# include <deal.II/lac/trilinos_epetra_vector.h>
# include <deal.II/lac/trilinos_parallel_block_vector.h>
+# include <deal.II/lac/trilinos_tpetra_vector.h>
# include <deal.II/lac/trilinos_vector.h>
+# include <deal.II/lac/vector.h>
# include <deal.II/lac/vector_memory.h>
# include <deal.II/trilinos/nox.templates.h>
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-// check that the l2 norm is exactly the same for many runs on random vector
-// size with random vector entries. this is to ensure that the result is
-// reproducible also when parallel evaluation is done
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-
-template <typename number>
-void
-check_norms()
-{
- for (unsigned int test = 0; test < 20; ++test)
- {
- const unsigned int size = Testing::rand() % 100000;
- LinearAlgebra::Vector<number> vec(size);
- for (unsigned int i = 0; i < size; ++i)
- vec(i) = random_value<number>();
- const typename LinearAlgebra::ReadWriteVector<number>::real_type norm =
- vec.l2_norm();
- for (unsigned int i = 0; i < 30; ++i)
- AssertThrow(vec.l2_norm() == norm, ExcInternalError());
-
- LinearAlgebra::Vector<number> vec2(vec);
- for (unsigned int i = 0; i < 10; ++i)
- AssertThrow(vec2.l2_norm() == norm, ExcInternalError());
- }
-}
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- check_norms<float>();
- check_norms<double>();
-#ifdef DEAL_II_WITH_COMPLEX_VALUES
- check_norms<std::complex<double>>();
-#endif
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2022 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-// check that LinearAlgebra::Vector::add_and_dot works correctly
-
-#include <deal.II/base/numbers.h>
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-
-template <typename number>
-void
-check()
-{
- for (unsigned int test = 0; test < 5; ++test)
- {
- const unsigned int size = 17 + test * 1101;
- LinearAlgebra::Vector<number> v1(size), v2(size), v3(size), check(size);
- // Check that the assignment works
- v1 = 0.;
- for (unsigned int i = 0; i < size; ++i)
- {
- v1[i] = 0.1 + 0.005 * i;
- v2[i] = -5.2 + 0.18 * i;
- v3[i] = numbers::PI + numbers::E / (1. + i);
- }
- check = v1;
- const number factor = 0.01432;
-
- v1.add(factor, v2);
- const number prod = v1 * v3;
- const number prod_check = check.add_and_dot(factor, v2, v3);
- if (test == 0 && std::is_same<number, double>::value)
- {
- deallog << "Vector add reference: ";
- for (unsigned int i = 0; i < size; ++i)
- deallog << v1[i] << ' ';
- deallog << std::endl;
- deallog << "Vector check reference: ";
- for (unsigned int i = 0; i < size; ++i)
- deallog << check[i] << ' ';
- deallog << std::endl;
-
- const number constant = 1.;
- v1.add(constant);
- deallog << "Vector add constant: ";
- for (unsigned int i = 0; i < size; ++i)
- deallog << v1[i] << ' ';
- deallog << std::endl;
- }
-
- deallog << "Add and dot is ";
- if (std::abs(prod - prod_check) <
- 4. *
- std::abs(
- std::numeric_limits<
- typename numbers::NumberTraits<number>::real_type>::epsilon()) *
- std::sqrt(static_cast<double>(size)) * size)
- deallog << "correct" << std::endl;
- else
- deallog << "wrong; should be " << prod / static_cast<number>(size)
- << ", is " << prod_check / static_cast<number>(size)
- << std::endl;
- }
-}
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(10);
- deallog.attach(logfile);
-
- check<float>();
- check<double>();
-#ifdef DEAL_II_WITH_COMPLEX_VALUES
- check<std::complex<double>>();
-#endif
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Vector add reference: 0.0255360000 0.0331136000 0.0406912000 0.0482688000 0.0558464000 0.0634240000 0.0710016000 0.0785792000 0.0861568000 0.0937344000 0.1013120000 0.1088896000 0.1164672000 0.1240448000 0.1316224000 0.1392000000 0.1467776000
-DEAL::Vector check reference: 0.0255360000 0.0331136000 0.0406912000 0.0482688000 0.0558464000 0.0634240000 0.0710016000 0.0785792000 0.0861568000 0.0937344000 0.1013120000 0.1088896000 0.1164672000 0.1240448000 0.1316224000 0.1392000000 0.1467776000
-DEAL::Vector add constant: 1.0255360000 1.0331136000 1.0406912000 1.0482688000 1.0558464000 1.0634240000 1.0710016000 1.0785792000 1.0861568000 1.0937344000 1.1013120000 1.1088896000 1.1164672000 1.1240448000 1.1316224000 1.1392000000 1.1467776000
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::OK
+++ /dev/null
-
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Vector add reference: 0.0255360000 0.0331136000 0.0406912000 0.0482688000 0.0558464000 0.0634240000 0.0710016000 0.0785792000 0.0861568000 0.0937344000 0.1013120000 0.1088896000 0.1164672000 0.1240448000 0.1316224000 0.1392000000 0.1467776000
-DEAL::Vector check reference: 0.0255360000 0.0331136000 0.0406912000 0.0482688000 0.0558464000 0.0634240000 0.0710016000 0.0785792000 0.0861568000 0.0937344000 0.1013120000 0.1088896000 0.1164672000 0.1240448000 0.1316224000 0.1392000000 0.1467776000
-DEAL::Vector add constant: 1.0255360000 1.0331136000 1.0406912000 1.0482688000 1.0558464000 1.0634240000 1.0710016000 1.0785792000 1.0861568000 1.0937344000 1.1013120000 1.1088896000 1.1164672000 1.1240448000 1.1316224000 1.1392000000 1.1467776000
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2021 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-// check that LinearAlgebra::Vector::add_and_dot works correctly for
-// complex-valued vectors
-
-#include <deal.II/base/numbers.h>
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-
-template <typename number>
-void
-check()
-{
- for (unsigned int test = 0; test < 5; ++test)
- {
- const unsigned int size = 17 + test * 1101;
- LinearAlgebra::Vector<std::complex<number>> v1(size), v2(size), v3(size),
- check(size);
- for (unsigned int i = 0; i < size; ++i)
- {
- v1(i) = std::complex<number>(0.1 + 0.005 * i, 1.234 + 12 * i);
- v2(i) = std::complex<number>(-5.2 + 0.18 * i, 42.4242 + 42 * i);
- v3(i) =
- std::complex<number>(numbers::PI + numbers::E / (1. + i), 13.);
- }
- check = v1;
- const std::complex<number> factor = std::complex<number>(0.01432);
-
- // do things by hand once
- v1.add(factor, v2);
- const std::complex<number> prod = v1 * v3;
-
- // then do it a second time with the add_and_dot function
- const std::complex<number> prod_check = check.add_and_dot(factor, v2, v3);
- if (test == 0 && std::is_same<number, double>::value)
- {
- deallog << "Vector add reference: ";
- v1.print(deallog.get_file_stream());
- deallog << std::endl;
- deallog << "Vector check reference: ";
- check.print(deallog.get_file_stream());
- deallog << std::endl;
- }
-
- deallog << "Add and dot is ";
- // check tolerance with respect to the expected size of result which is
- // ~ size^2 including the roundoff error ~ sqrt(size) we expect
- const number tolerance = 4. * std::numeric_limits<number>::epsilon() *
- std::sqrt(static_cast<number>(size)) * size *
- size;
- if (std::abs(prod - prod_check) < tolerance)
- deallog << "correct" << std::endl;
- else
- deallog << "wrong by " << std::abs(prod - prod_check)
- << " with tolerance " << tolerance << "; should be "
- << prod / static_cast<number>(size) << ", is "
- << prod_check / static_cast<number>(size) << std::endl;
- }
-}
-
-
-int
-main()
-{
- initlog();
- deallog << std::setprecision(8);
- check<float>();
- check<double>();
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-IndexSet: {[0,16]}
-
-[0]: (2.554e-02,1.842e+00)
-[1]: (3.311e-02,1.444e+01)
-[2]: (4.069e-02,2.704e+01)
-[3]: (4.827e-02,3.965e+01)
-[4]: (5.585e-02,5.225e+01)
-[5]: (6.342e-02,6.485e+01)
-[6]: (7.100e-02,7.745e+01)
-[7]: (7.858e-02,9.005e+01)
-[8]: (8.616e-02,1.027e+02)
-[9]: (9.373e-02,1.153e+02)
-[10]: (1.013e-01,1.279e+02)
-[11]: (1.089e-01,1.405e+02)
-[12]: (1.165e-01,1.531e+02)
-[13]: (1.240e-01,1.657e+02)
-[14]: (1.316e-01,1.783e+02)
-[15]: (1.392e-01,1.909e+02)
-[16]: (1.468e-01,2.035e+02)
-DEAL::Vector add reference:
-IndexSet: {[0,16]}
-
-[0]: (2.554e-02,1.842e+00)
-[1]: (3.311e-02,1.444e+01)
-[2]: (4.069e-02,2.704e+01)
-[3]: (4.827e-02,3.965e+01)
-[4]: (5.585e-02,5.225e+01)
-[5]: (6.342e-02,6.485e+01)
-[6]: (7.100e-02,7.745e+01)
-[7]: (7.858e-02,9.005e+01)
-[8]: (8.616e-02,1.027e+02)
-[9]: (9.373e-02,1.153e+02)
-[10]: (1.013e-01,1.279e+02)
-[11]: (1.089e-01,1.405e+02)
-[12]: (1.165e-01,1.531e+02)
-[13]: (1.240e-01,1.657e+02)
-[14]: (1.316e-01,1.783e+02)
-[15]: (1.392e-01,1.909e+02)
-[16]: (1.468e-01,2.035e+02)
-DEAL::Vector check reference:
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::Add and dot is correct
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-// Check the function all_zero
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-template <typename Number>
-void
-check_all_zero()
-{
- LinearAlgebra::Vector<Number> v(10);
-
- AssertThrow(v.all_zero() == true, ExcInternalError());
-
- v[0] = 1.;
- AssertThrow(v.all_zero() == false, ExcInternalError());
-}
-
-int
-main()
-{
- initlog();
-
- check_all_zero<float>();
- check_all_zero<double>();
-
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-
-#include <deal.II/lac/la_vector.h>
-
-#include <limits>
-
-#include "../tests.h"
-
-
-
-void
-check_large_numbers()
-{
- LinearAlgebra::Vector<float> v(10);
- v(0) = 1e13;
- v(1) = 1e19;
- v(2) = 1e21;
- v(4) = 1.;
- v(7) = 1e20;
-
- const double correct = std::sqrt(1e26 + 1e38 + 1e42 + 1e40 + 1.);
- AssertThrow(std::abs(v.l2_norm() - correct) < 1e-6 * correct,
- ExcInternalError());
-
- for (unsigned int i = 0; i < v.size(); ++i)
- v[i] = (float)0.;
- v(5) = 1e-30;
- v(9) = 1e-32;
- const double correct2 = std::sqrt(1e-60 + 1e-64);
- AssertThrow(std::abs(v.l2_norm() - correct2) < 1e-6 * correct2,
- ExcInternalError());
-
- LinearAlgebra::Vector<double> w(7);
- w(0) = 1e232;
- w(6) = 1e231;
- w(3) = 1e200;
- const double correct3 = std::sqrt(100. + 1.) * 1e231;
- AssertThrow(std::abs(w.l2_norm() - correct3) < 1e-13 * correct3,
- ExcInternalError());
-
- for (unsigned int i = 0; i < w.size(); ++i)
- w[i] = (float)0.;
- w(1) = 1e-302;
- w(2) = 1e-303;
- w(3) = 2e-303;
- w(4) = 3e-303;
- w(5) = -1e-303;
- const double correct4 = std::sqrt(100. + 1. + 4. + 9 + 1.) * 1e-303;
- AssertThrow(std::abs(w.l2_norm() - correct4) <= 1e-13 * correct4,
- ExcInternalError());
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- check_large_numbers();
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2021 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-// checks that the l1 and l2 norm are computed correctly for deal.II vectors
-// (check the summation algorithm), including an accuracy test (should not
-// lose more than 1 decimal also for 200000 vector entries)
-
-#include <deal.II/base/numbers.h>
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-
-template <typename number>
-void
-check_norms()
-{
- const number acc = 1e1 * std::numeric_limits<number>::epsilon();
- unsigned int skip = 73;
- for (unsigned int size = 1; size < 200000; size += skip)
- {
- // test correctness
- if (size > 10000)
- skip += 17;
- LinearAlgebra::Vector<number> vec(size);
- for (unsigned int i = 0; i < size; ++i)
- vec[i] = i + 1;
-
- const number l1_norm = vec.l1_norm();
- AssertThrow(std::abs(l1_norm - 0.5 * size * (size + 1)) <
- acc * 0.5 * size * (size + 1),
- ExcInternalError());
-
- // test accuracy of summation
- constexpr long double value = numbers::PI;
- for (unsigned int i = 0; i < size; ++i)
- vec[i] = (number)value;
- const number l1_norma = vec.l1_norm();
- AssertThrow(std::abs(l1_norma - value * size) < acc * size * value,
- ExcInternalError());
- const number l2_norma = vec.l2_norm();
- AssertThrow(std::abs(l2_norma - value * std::sqrt((number)size)) <
- acc * std::sqrt(size) * value,
- ExcInternalError());
- }
-}
-
-
-template <typename number>
-void
-check_complex_norms()
-{
- const number acc = 1e2 * std::numeric_limits<number>::epsilon();
- unsigned int skip = 73;
- for (unsigned int size = 1; size < 100000; size += skip)
- {
- // test correctness
- if (size > 10000)
- skip += 17;
- LinearAlgebra::Vector<std::complex<number>> vec(size);
- long double sum = 0.;
- for (unsigned int i = 0; i < size; ++i)
- {
- vec(i) = std::complex<number>(i + 1, i + 2);
- sum += std::sqrt((long double)(i + 1) * (i + 1) +
- (long double)(i + 2) * (i + 2));
- }
-
- const number l1_norm = vec.l1_norm();
- AssertThrow(std::abs(l1_norm - sum) < acc * sum, ExcInternalError());
-
- // test accuracy of summation
- constexpr std::complex<long double> value(numbers::PI, 0.1);
- for (unsigned int i = 0; i < size; ++i)
- vec[i] = std::complex<number>(value);
- const number l1_norma = vec.l1_norm();
- AssertThrow(std::abs(l1_norma - std::abs(value) * size) <
- acc * size * std::abs(value),
- ExcInternalError());
- const number l2_norma = vec.l2_norm();
- AssertThrow(std::abs(l2_norma -
- std::abs(value) * std::sqrt((number)size)) <
- acc * std::sqrt((number)size) * std::abs(value),
- ExcInternalError());
- }
-}
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- check_norms<float>();
- check_norms<double>();
-#ifdef DEAL_II_WITH_COMPLEX_VALUES
- check_complex_norms<double>();
- check_complex_norms<float>();
-#endif
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2012 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-#include <deal.II/lac/la_vector.h>
-
-#include <boost/archive/text_iarchive.hpp>
-#include <boost/archive/text_oarchive.hpp>
-
-#include <string>
-
-#include "../tests.h"
-
-
-void
-test()
-{
- const char * filename = "test.txt";
- const unsigned int size(10);
- LinearAlgebra::Vector<double> vec(size);
- for (unsigned int i = 0; i < size; ++i)
- vec[i] = i;
-
- // Check block_write and block_read
- std::ofstream file_out(filename);
- // Write the vector in the file
- vec.block_write(file_out);
- file_out.close();
- // Clear the vector
- vec.reinit(0);
- // Load the vector form the file
- std::ifstream file_in(filename);
- vec.block_read(file_in);
- file_in.close();
- // Check the vector
- double eps = 1e-12;
- for (unsigned int i = 0; i < size; ++i)
- AssertThrow(
- std::abs(vec[i] - (double)i) < eps,
- ExcMessage(
- "Value in the vector has been changed by block_write or block_read"));
-
-
- // save data to archive
- {
- std::ofstream file_out2(filename);
- boost::archive::text_oarchive oa(file_out2);
- oa << vec;
- // archive and stream closed when destructors are called
- }
-
- // Clear the vector
- vec.reinit(0);
- {
- std::ifstream file_in2(filename);
- boost::archive::text_iarchive ia(file_in2);
- ia >> vec;
- }
- // Check the vector
- for (unsigned int i = 0; i < size; ++i)
- AssertThrow(std::abs(vec[i] - (double)i) < eps,
- ExcMessage(
- "Value in the vector has been changed by boost archive"));
-}
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- test();
-
- deallog << "OK" << std::endl;
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2019 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-// Check that print_as_numpy_array works
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-template <typename number>
-void
-print_vector()
-{
- const unsigned int size = 20;
- LinearAlgebra::Vector<number> vec(size);
- for (unsigned int i = 0; i < size; ++i)
- vec(i) = static_cast<number>(i);
-
- vec.print_as_numpy_array(deallog.get_file_stream());
-}
-
-
-int
-main()
-{
- initlog();
-
- print_vector<float>();
- print_vector<double>();
-}
+++ /dev/null
-
-0.00000000 1.00000000 2.00000000 3.00000000 4.00000000 5.00000000 6.00000000 7.00000000 8.00000000 9.00000000 10.0000000 11.0000000 12.0000000 13.0000000 14.0000000 15.0000000 16.0000000 17.0000000 18.0000000 19.0000000
-0.00000000 1.00000000 2.00000000 3.00000000 4.00000000 5.00000000 6.00000000 7.00000000 8.00000000 9.00000000 10.0000000 11.0000000 12.0000000 13.0000000 14.0000000 15.0000000 16.0000000 17.0000000 18.0000000 19.0000000
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-
-
-#include <deal.II/lac/la_vector.h>
-
-#include "../tests.h"
-
-
-
-const unsigned int N = 10;
-unsigned int check_point = 0;
-
-
-
-template <typename number>
-void
-print(const LinearAlgebra::Vector<number> &v)
-{
- for (unsigned int i = 0; i < v.size(); ++i)
- deallog << v(i) << '\t';
- deallog << std::endl;
-}
-
-
-
-template <typename number1, typename number2>
-void
-check_vectors(LinearAlgebra::Vector<number1> &d1,
- LinearAlgebra::Vector<number2> &d2)
-{
- deallog << "Fill & Swap" << std::endl;
- LinearAlgebra::Vector<number1> d3(d1.size());
- print(d3);
-
- for (unsigned int i = 0; i < N; ++i)
- {
- d1(i) = 2. * i;
- d2(i) = .5 * d1(i) * d1(i);
- d3(i) = 2. - .5 * i;
- };
-
- print(d1);
- print(d2);
- print(d3);
-
- swap(d1, d2);
- print(d1);
-
- d1 = d2;
- print(d1);
-
- for (unsigned int i = 0; i < N; ++i)
- d1[i] = 2.5;
- print(d1);
-
- // initialize with iterators
- number1 array[] = {0.0, 1.1, 2.2, 3.3};
- LinearAlgebra::Vector<number1> d4(&array[0], &array[4]);
- print(d4);
-
- deallog << "Extract number" << std::endl;
- // Each line should contain two equal numbers
- double sum = 0.;
- for (unsigned int i = 0; i < N; ++i)
- sum += 4. * i - i * i;
- deallog << d3 * d2 << '\t' << sum << std::endl;
-
- sum = 0.;
- for (unsigned int i = 0; i < N; ++i)
- sum += 4. * i * i;
- sum = std::sqrt(sum);
- deallog << d2.l2_norm() << '\t' << sum << std::endl;
-
- sum = 0.;
- for (unsigned int i = 0; i < N; ++i)
- sum += std::fabs(2. - .5 * i);
- deallog << d3.l1_norm() << '\t' << sum << std::endl;
-
- sum = 0.;
- for (unsigned int i = 0; i < N; ++i)
- {
- double t = std::fabs(2. - .5 * i);
- if (t > sum)
- sum = t;
- }
- deallog << d3.linfty_norm() << '\t' << sum << std::endl;
-
- deallog << "add & sub" << std::endl;
-
- d1 += d2;
- print(d1);
-
- d2 -= d1;
- print(d2);
-
- d1.add(2, d3);
- print(d1);
-
- d1.add(2., d2, .5, d3);
- print(d1);
-
- deallog << "sadd & scale" << std::endl;
-
- d2.sadd(2., 1., d1);
- print(d2);
-
- d2.sadd(2., .5, d1);
- print(d2);
-
- d1 *= 4.;
- print(d1);
-
- deallog << "equ" << std::endl;
-
- d2.equ(.25, d1);
- print(d2);
-}
-
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- LinearAlgebra::Vector<double> d1(N), d2(N);
- LinearAlgebra::Vector<float> f1(N), f2(N);
-
- // cross-tests with double/float
- // vectors at the same time are not
- // supported at present,
- // unfortunately, as many functions
- // don't accept other data types as
- // arguments
- check_vectors(d1, d2);
- check_vectors(f1, f2);
-}
+++ /dev/null
-
-DEAL::Fill & Swap
-DEAL::0 0 0 0 0 0 0 0 0 0
-DEAL::0 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00
-DEAL::0 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00
-DEAL::2.00 1.50 1.00 0.50 0 -0.50 -1.00 -1.50 -2.00 -2.50
-DEAL::0 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00
-DEAL::0 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00
-DEAL::2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50
-DEAL::0 1.10 2.20 3.30
-DEAL::Extract number
-DEAL::-105.00 -105.00
-DEAL::33.76 33.76
-DEAL::12.50 12.50
-DEAL::2.50 2.50
-DEAL::add & sub
-DEAL::2.50 4.50 6.50 8.50 10.50 12.50 14.50 16.50 18.50 20.50
-DEAL::-2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50
-DEAL::6.50 7.50 8.50 9.50 10.50 11.50 12.50 13.50 14.50 15.50
-DEAL::2.50 3.25 4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25
-DEAL::sadd & scale
-DEAL::-2.50 -1.75 -1.00 -0.25 0.50 1.25 2.00 2.75 3.50 4.25
-DEAL::-3.75 -1.88 0 1.88 3.75 5.62 7.50 9.38 11.25 13.12
-DEAL::10.00 13.00 16.00 19.00 22.00 25.00 28.00 31.00 34.00 37.00
-DEAL::equ
-DEAL::2.50 3.25 4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25
-DEAL::Fill & Swap
-DEAL::0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
-DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00
-DEAL::0.00 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00
-DEAL::2.00 1.50 1.00 0.50 0.00 -0.50 -1.00 -1.50 -2.00 -2.50
-DEAL::0.00 2.00 8.00 18.00 32.00 50.00 72.00 98.00 128.00 162.00
-DEAL::0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00
-DEAL::2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50 2.50
-DEAL::0.00 1.10 2.20 3.30
-DEAL::Extract number
-DEAL::-105.00 -105.00
-DEAL::33.76 33.76
-DEAL::12.50 12.50
-DEAL::2.50 2.50
-DEAL::add & sub
-DEAL::2.50 4.50 6.50 8.50 10.50 12.50 14.50 16.50 18.50 20.50
-DEAL::-2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50 -2.50
-DEAL::6.50 7.50 8.50 9.50 10.50 11.50 12.50 13.50 14.50 15.50
-DEAL::2.50 3.25 4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25
-DEAL::sadd & scale
-DEAL::-2.50 -1.75 -1.00 -0.25 0.50 1.25 2.00 2.75 3.50 4.25
-DEAL::-3.75 -1.88 0.00 1.88 3.75 5.62 7.50 9.38 11.25 13.12
-DEAL::10.00 13.00 16.00 19.00 22.00 25.00 28.00 31.00 34.00 37.00
-DEAL::equ
-DEAL::2.50 3.25 4.00 4.75 5.50 6.25 7.00 7.75 8.50 9.25
#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/vector.h>
#include "../tests.h"
deallog << "OK" << std::endl << std::endl;
- // make sure that is_serial_vector< dealii::LinearAlgebra::Vector<Number> > is
- // working
- Assert(is_serial_vector<dealii::LinearAlgebra::Vector<double>>::value == true,
- ExcInternalError());
-
- deallog << is_serial_vector<dealii::LinearAlgebra::Vector<float>>::value
- << std::endl;
- deallog << is_serial_vector<dealii::LinearAlgebra::Vector<double>>::value
- << std::endl;
-
- deallog << is_serial_vector<
- dealii::LinearAlgebra::Vector<std::complex<float>>>::value
- << std::endl;
- deallog << is_serial_vector<
- dealii::LinearAlgebra::Vector<std::complex<double>>>::value
- << std::endl;
-
- deallog << "OK" << std::endl << std::endl;
-
// make sure that dealii::LinearAlgebra::distributed::Vector<Number> > is
// working
Assert(is_serial_vector<
DEAL::1
DEAL::OK
DEAL::
-DEAL::1
-DEAL::1
-DEAL::1
-DEAL::1
-DEAL::OK
-DEAL::
DEAL::0
DEAL::0
DEAL::0
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/lac/la_vector.h>
-
#include <deal.II/matrix_free/fe_evaluation.h>
#include <deal.II/matrix_free/matrix_free.h>
{
using VectorizedArrayType = VectorizedArray<Number>;
- using VectorType = LinearAlgebra::Vector<Number>;
+ using VectorType = Vector<Number>;
Triangulation<dim> tria;
#include <deal.II/lac/la_parallel_block_vector.h>
#include <deal.II/lac/la_parallel_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/petsc_block_vector.h>
#include <deal.II/lac/petsc_vector.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
// non-block vectors:
check_serial<Vector<double>>();
- check_serial<LinearAlgebra::Vector<double>>();
check_unghosted_parallel<LinearAlgebra::EpetraWrappers::Vector>();
check_unghosted_parallel<LinearAlgebra::TpetraWrappers::Vector<double>>();
DEAL:0::type: dealii::Vector<double>
DEAL:0::local size: 4
DEAL:0::size: 4
-DEAL:0::type: dealii::LinearAlgebra::Vector<double>
-DEAL:0::local size: 4
-DEAL:0::size: 4
DEAL:0::type: dealii::LinearAlgebra::EpetraWrappers::Vector
DEAL:0::index set size: 4
DEAL:0::local size: 4
DEAL:1::type: dealii::Vector<double>
DEAL:1::local size: 4
DEAL:1::size: 4
-DEAL:1::type: dealii::LinearAlgebra::Vector<double>
-DEAL:1::local size: 4
-DEAL:1::size: 4
DEAL:1::type: dealii::LinearAlgebra::EpetraWrappers::Vector
DEAL:1::index set size: 4
DEAL:1::local size: 4
DEAL:2::type: dealii::Vector<double>
DEAL:2::local size: 4
DEAL:2::size: 4
-DEAL:2::type: dealii::LinearAlgebra::Vector<double>
-DEAL:2::local size: 4
-DEAL:2::size: 4
DEAL:2::type: dealii::LinearAlgebra::EpetraWrappers::Vector
DEAL:2::index set size: 4
DEAL:2::local size: 4
DEAL:3::type: dealii::Vector<double>
DEAL:3::local size: 4
DEAL:3::size: 4
-DEAL:3::type: dealii::LinearAlgebra::Vector<double>
-DEAL:3::local size: 4
-DEAL:3::size: 4
DEAL:3::type: dealii::LinearAlgebra::EpetraWrappers::Vector
DEAL:3::index set size: 4
DEAL:3::local size: 4
// check VectorTools::subtract_mean_value() for deal.II serial vectors
#include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/la_vector.h>
#include <deal.II/lac/vector.h>
#include <deal.II/numerics/vector_tools.h>
BlockVector<float> v(std::vector<types::global_dof_index>(1, 10));
test(v);
}
-
- {
- LinearAlgebra::Vector<double> v(10);
- test(v);
- }
-
- {
- LinearAlgebra::Vector<float> v(10);
- test(v);
- }
}
catch (const std::exception &exc)
{
DEAL::OK
DEAL::OK
DEAL::OK
-DEAL::OK
-DEAL::OK
#include <deal.II/grid/filtered_iterator.h>
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/lac/la_vector.h>
-
#include <deal.II/numerics/vector_tools_evaluate.h>
#include "../tests.h"
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/grid_tools_cache.h>
-#include <deal.II/lac/la_vector.h>
-
#include <deal.II/numerics/vector_tools_evaluate.h>
#include "../tests.h"
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/lac/la_vector.h>
-
#include <deal.II/numerics/vector_tools_evaluate.h>
#include "../tests.h"
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/lac/la_vector.h>
-
#include <deal.II/numerics/vector_tools_evaluate.h>
#include "../tests.h"