21 #ifndef LIBMESH_LASPACK_VECTOR_H 22 #define LIBMESH_LASPACK_VECTOR_H 28 #ifdef LIBMESH_HAVE_LASPACK 44 template <
typename T>
class LaspackLinearSolver;
45 template <
typename T>
class SparseMatrix;
56 class LaspackVector final :
public NumericVector<T>
92 const std::vector<numeric_index_type> & ghost,
100 LaspackVector<T> &
operator= (
const LaspackVector<T> & v);
112 virtual void close ()
override;
114 virtual void clear ()
override;
116 virtual void zero ()
override;
118 virtual std::unique_ptr<NumericVector<T>>
zero_clone ()
const override;
120 virtual std::unique_ptr<NumericVector<T>>
clone ()
const override;
124 const bool fast=
false,
128 const bool fast=
false,
133 const std::vector<numeric_index_type> & ghost,
134 const bool fast =
false,
137 virtual void init (
const NumericVector<T> & other,
138 const bool fast =
false)
override;
140 virtual NumericVector<T> &
operator= (
const T s)
override;
142 virtual NumericVector<T> &
operator= (
const NumericVector<T> & v)
override;
144 virtual NumericVector<T> &
operator= (
const std::vector<T> & v)
override;
146 virtual Real min ()
const override;
148 virtual Real max ()
const override;
150 virtual T
sum ()
const override;
168 virtual NumericVector<T> &
operator += (
const NumericVector<T> & v)
override;
170 virtual NumericVector<T> &
operator -= (
const NumericVector<T> & v)
override;
172 virtual NumericVector<T> &
operator /= (
const NumericVector<T> & v)
override;
182 virtual void add (
const T s)
override;
184 virtual void add (
const NumericVector<T> & v)
override;
186 virtual void add (
const T a,
const NumericVector<T> & v)
override;
194 virtual void add_vector (
const NumericVector<T> & v,
195 const SparseMatrix<T> &
A)
override;
198 const SparseMatrix<T> &
A)
override;
200 virtual void scale (
const T factor)
override;
202 virtual void abs()
override;
204 virtual T
dot(
const NumericVector<T> & v)
const override;
206 virtual void localize (std::vector<T> & v_local)
const override;
208 virtual void localize (NumericVector<T> & v_local)
const override;
210 virtual void localize (NumericVector<T> & v_local,
211 const std::vector<numeric_index_type> & send_list)
const override;
213 virtual void localize (std::vector<T> & v_local,
214 const std::vector<numeric_index_type> & indices)
const override;
218 const std::vector<numeric_index_type> & send_list)
override;
224 const NumericVector<T> & vec2)
override;
226 virtual void swap (NumericVector<T> & v)
override;
246 template <
typename T>
257 template <
typename T>
264 this->
init(n, n,
false, ptype);
269 template <
typename T>
277 this->
init(n, n_local,
false, ptype);
282 template <
typename T>
287 const std::vector<numeric_index_type> & ghost,
291 this->
init(N, n_local, ghost,
false, ptype);
296 template <
typename T>
305 template <
typename T>
314 libmesh_assert_equal_to (n, n_local);
326 std::sprintf(foo,
"Vec-%d", cnt++);
328 V_Constr(&_vec, const_cast<char *>(foo), n, Normal, _LPTrue);
332 this->_is_closed =
true;
344 template <
typename T>
350 this->
init(n,n,fast,ptype);
354 template <
typename T>
358 const std::vector<numeric_index_type> & libmesh_dbg_var(ghost),
362 libmesh_assert(ghost.empty());
363 this->
init(n,n_local,fast,ptype);
379 template <
typename T>
386 this->_is_closed =
true;
392 template <
typename T>
403 this->_is_closed =
false;
409 template <
typename T>
inline 413 libmesh_assert (this->
closed());
415 V_SetAllCmp (&_vec, 0.);
420 template <
typename T>
426 cloned_vector->
init(*
this);
428 return std::unique_ptr<NumericVector<T>>(cloned_vector);
433 template <
typename T>
439 cloned_vector->
init(*
this,
true);
441 *cloned_vector = *
this;
443 return std::unique_ptr<NumericVector<T>>(cloned_vector);
448 template <
typename T>
459 template <
typename T>
470 template <
typename T>
481 template <
typename T>
492 template <
typename T>
497 libmesh_assert_less (i, this->size());
499 V_SetCmp (&_vec, i+1,
value);
502 this->_is_closed =
false;
508 template <
typename T>
513 libmesh_assert_less (i, this->size());
515 V_AddCmp (&_vec, i+1,
value);
518 this->_is_closed =
false;
524 template <
typename T>
529 libmesh_assert ( ((i >= this->first_local_index()) &&
530 (i < this->last_local_index())) );
533 return static_cast<T
>(V_GetCmp(const_cast<QVector*>(&_vec), i+1));
538 template <
typename T>
548 std::swap(_vec.Instance, v._vec.Instance);
549 std::swap(_vec.LockLevel, v._vec.LockLevel);
563 #endif // #ifdef LIBMESH_HAVE_LASPACK 564 #endif // LIBMESH_LASPACK_VECTOR_H virtual void add_vector(const NumericVector< T > &v, const SparseMatrix< T > &A) override
virtual void swap(NumericVector< T > &v) override
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
virtual void close() override
virtual numeric_index_type size() const override
virtual NumericVector< T > & operator-=(const NumericVector< T > &v) override
virtual void abs() override
virtual void scale(const T factor) override
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A) override
virtual T dot(const NumericVector< T > &v) const override
virtual void set(const numeric_index_type i, const T value) override
virtual numeric_index_type size() const =0
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
LaspackVector< T > & operator=(const LaspackVector< T > &v)
LaspackVector(const Parallel::Communicator &comm, const ParallelType=AUTOMATIC)
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
uint8_t processor_id_type
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
const Parallel::Communicator & comm() const
virtual T operator()(const numeric_index_type i) const override
virtual NumericVector< T > & operator+=(const NumericVector< T > &v) override
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
virtual std::unique_ptr< NumericVector< T > > zero_clone() const override
virtual std::unique_ptr< NumericVector< T > > clone() const override
virtual Real max() const override
virtual Real l2_norm() const override
dof_id_type numeric_index_type
virtual void add(const numeric_index_type i, const T value) override
virtual Real min() const override
virtual void localize(std::vector< T > &v_local) const override
void init(triangulateio &t)
virtual numeric_index_type last_local_index() const override
virtual void localize_to_one(std::vector< T > &v_local, const processor_id_type proc_id=0) const override
virtual numeric_index_type first_local_index() const override
virtual void zero() override
ParallelType type() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void conjugate() override
virtual Real linfty_norm() const override
static PetscErrorCode Mat * A
void swap(Iterator &lhs, Iterator &rhs)
virtual numeric_index_type local_size() const =0
virtual numeric_index_type local_size() const override
virtual void clear() override
virtual NumericVector< T > & operator/=(const NumericVector< T > &v) override
virtual T sum() const override
virtual void reciprocal() override
virtual Real l1_norm() const override