From 18bc8008725a1752c05d20272ca516fc01d11ced Mon Sep 17 00:00:00 2001 From: turcksin Date: Wed, 4 Dec 2013 17:21:18 +0000 Subject: [PATCH] Reindent paralution_vector.h. git-svn-id: https://svn.dealii.org/branches/branch_paralution@31881 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/paralution_vector.h | 378 +++++++++--------- 1 file changed, 189 insertions(+), 189 deletions(-) diff --git a/deal.II/include/deal.II/lac/paralution_vector.h b/deal.II/include/deal.II/lac/paralution_vector.h index aa106ef1fe..7813163971 100644 --- a/deal.II/include/deal.II/lac/paralution_vector.h +++ b/deal.II/include/deal.II/lac/paralution_vector.h @@ -46,194 +46,194 @@ namespace ParalutionWrappers * The interface of this class is modeled after the existing Vector class in * deal.II. It has almost the same member functions, and is often * exchangeable. However, Paralution LocalVector only supports int, float, - * and double. + * and double. * * @ingroup ParalutionWrappers * @ingroup Vectors * @author Bruno Turcksin, 2013 */ //TODO: lots of functions are missing - template + template class Vector : public Subscriptor { - public : - /** - * Declare some the standard types used in all containers. These types - * parallel those in the C standard libraries - * vector<...> class. - */ - typedef dealii::types::global_dof_index size_type; - typedef Number* iterator; - typedef const Number* const_iterator; - - /** - * @name 1: Basic Object-handling - */ - //@{ - - /** - * Default constructor that generates and empy (zero size) vector. The - * function reinit() will have to give the vector the correct - * size. - */ - Vector(); - - /** - * Copy constructor. Sets the dimension to that of the given vector, and - * copies all the elements. The copied vector stays on the host/device - * where it is create. - */ - //TODO: Look to use choose between CopyFrom and Clone. Difference between - //copy and clone: copy the vector stays on his host/device, with clone - //the vector goes on the same host/device. - Vector(const Vector &v); - - /** - * Constructor. Set dimensionto @p n and initialize all the elements - * with zero. - * - * The constructor is made explicit to avoid accidents like this: - * v=0;. Presumably, the user want to set every element of the - * vector to zero, but instead, what happens is this call: - * v=Vector@(0);, i.e. the vector is replaced by one - * length zero. - */ - explicit Vector(const size_type n); - - /** - * Initialize the vector with a given range of values pointed to by the - * iterators. This function is there in anlogy to the @p std::vector - * class. - */ - //TODO - // template - // Vector (const InputIterator first, - // const InputIterator last); - - /** - * Destructor. - */ - ~Vector(); - - /** - * Change the dimension of the vector to @p N. The vector is filled with - * zeros. - */ - //TODO look to add fast - void reinit(const size_type N); - - /** - * Return dimension of the vector. - */ - std::size_t size() const; - - /** - * Make the @p Vector class a bit loke the vector<> class of - * the C++ standard library by returning iterators to the strat and end - * of the elements of this vector. The iterator is created on the host - * or the device and cannot be moved. - */ - iterator begin(); - - /** - * Return constant iterator to the start of the vectors. The iterator is - * created on the host of the device and cannot be moved. - */ - const_iterator begin() const; - - /** - * Return an iterator pointing to the element past the end of the array. - * The iterator is created on the host or the device and cannot be - * moved. - */ - iterator end(); - - /** - * Return a constant iterator pointing to the element past the end of - * the array. The iterator is created on the host or the device and - * cannot be moved. - */ - const_iterator end() const; - //@} - - /** - * @name 2: Data-Acess - */ - //@{ - /** - * Access the value of the @p ith component. Works only on the host. - */ - Number operator() (const size_type i) const; - - /** - * Access the @p ith component as writeable reference. Works only on the - * host. - */ - Number& operator() (const size_type i); - - /** - * Access the value of the @p ith component. Works only on the host. - * - * Exactly the same as operator(). - */ - Number operator[] (const size_type i) const; - - /** - * Access the @p ith component as a writeable reference. - * - * Exactly thte asame as operator(). - */ - Number& operator[] (const size_type i); - - /** - * Return a constant reference to the underlying Paralution LocalVector - * class. - */ - const paralution::LocalVector& paralution_vector() const; - - /** - * Return a (modifyable) reference to the underlying Paralution - * LocalVector class. - */ - paralution::LocalVector& paralution_vector(); - //@} - - /** - * @name 3: Modification of vectors - */ - //@{ - /** - * Add the given vector to the present one. - */ - Vector& operator+= (const Vector &v); - - /** - * Substract the given vector from the present one. - */ - Vector& operator-= (const Vector &v); - - /** - * Addition of @p s to all components. Note that @p s is a scalar and - * not a vector. - */ - void add(const Number s); - - /** - * Scale each element of the vector by a constant value. - */ - Vector& operator*= (const Number factor); - - /** - * Scale each element of the vector by the inverse of the given value. - */ - Vector& operator/= (const Number factor); - //@} - - private : - /** - * Underlying Paralution LocalVector. - */ - paralution::LocalVector local_vector; + public : + /** + * Declare some the standard types used in all containers. These types + * parallel those in the C standard libraries + * vector<...> class. + */ + typedef dealii::types::global_dof_index size_type; + typedef Number *iterator; + typedef const Number *const_iterator; + + /** + * @name 1: Basic Object-handling + */ + //@{ + + /** + * Default constructor that generates and empy (zero size) vector. The + * function reinit() will have to give the vector the correct + * size. + */ + Vector(); + + /** + * Copy constructor. Sets the dimension to that of the given vector, and + * copies all the elements. The copied vector stays on the host/device + * where it is create. + */ + //TODO: Look to use choose between CopyFrom and Clone. Difference between + //copy and clone: copy the vector stays on his host/device, with clone + //the vector goes on the same host/device. + Vector(const Vector &v); + + /** + * Constructor. Set dimensionto @p n and initialize all the elements + * with zero. + * + * The constructor is made explicit to avoid accidents like this: + * v=0;. Presumably, the user want to set every element of the + * vector to zero, but instead, what happens is this call: + * v=Vector@(0);, i.e. the vector is replaced by one + * length zero. + */ + explicit Vector(const size_type n); + + /** + * Initialize the vector with a given range of values pointed to by the + * iterators. This function is there in anlogy to the @p std::vector + * class. + */ + //TODO + // template + // Vector (const InputIterator first, + // const InputIterator last); + + /** + * Destructor. + */ + ~Vector(); + + /** + * Change the dimension of the vector to @p N. The vector is filled with + * zeros. + */ + //TODO look to add fast + void reinit(const size_type N); + + /** + * Return dimension of the vector. + */ + std::size_t size() const; + + /** + * Make the @p Vector class a bit loke the vector<> class of + * the C++ standard library by returning iterators to the strat and end + * of the elements of this vector. The iterator is created on the host + * or the device and cannot be moved. + */ + iterator begin(); + + /** + * Return constant iterator to the start of the vectors. The iterator is + * created on the host of the device and cannot be moved. + */ + const_iterator begin() const; + + /** + * Return an iterator pointing to the element past the end of the array. + * The iterator is created on the host or the device and cannot be + * moved. + */ + iterator end(); + + /** + * Return a constant iterator pointing to the element past the end of + * the array. The iterator is created on the host or the device and + * cannot be moved. + */ + const_iterator end() const; + //@} + + /** + * @name 2: Data-Acess + */ + //@{ + /** + * Access the value of the @p ith component. Works only on the host. + */ + Number operator() (const size_type i) const; + + /** + * Access the @p ith component as writeable reference. Works only on the + * host. + */ + Number &operator() (const size_type i); + + /** + * Access the value of the @p ith component. Works only on the host. + * + * Exactly the same as operator(). + */ + Number operator[] (const size_type i) const; + + /** + * Access the @p ith component as a writeable reference. + * + * Exactly thte asame as operator(). + */ + Number &operator[] (const size_type i); + + /** + * Return a constant reference to the underlying Paralution LocalVector + * class. + */ + const paralution::LocalVector& paralution_vector() const; + + /** + * Return a (modifyable) reference to the underlying Paralution + * LocalVector class. + */ + paralution::LocalVector& paralution_vector(); + //@} + + /** + * @name 3: Modification of vectors + */ + //@{ + /** + * Add the given vector to the present one. + */ + Vector& operator+= (const Vector &v); + + /** + * Substract the given vector from the present one. + */ + Vector& operator-= (const Vector &v); + + /** + * Addition of @p s to all components. Note that @p s is a scalar and + * not a vector. + */ + void add(const Number s); + + /** + * Scale each element of the vector by a constant value. + */ + Vector& operator*= (const Number factor); + + /** + * Scale each element of the vector by the inverse of the given value. + */ + Vector& operator/= (const Number factor); + //@} + + private : + /** + * Underlying Paralution LocalVector. + */ + paralution::LocalVector local_vector; }; @@ -247,7 +247,7 @@ namespace ParalutionWrappers template - inline Vector::Vector(const Vector &v) + inline Vector::Vector(const Vector &v) { local_vector.CopyFrom(v.paralution_vector()); } @@ -255,7 +255,7 @@ namespace ParalutionWrappers template - inline Vector::Vector(const size_type n) + inline Vector::Vector(const size_type n) { local_vector.Allocate("deal_ii_vector",n); } @@ -269,7 +269,7 @@ namespace ParalutionWrappers } - + template void Vector::reinit(const size_type n) { @@ -330,7 +330,7 @@ namespace ParalutionWrappers template - inline Number& Vector::operator() (const size_type i) + inline Number &Vector::operator() (const size_type i) { AssertIndexRange(i,static_cast(local_vector.get_size())); @@ -346,21 +346,21 @@ namespace ParalutionWrappers return local_vector[i]; } - + template - inline Number& Vector::operator[] (const size_type i) + inline Number &Vector::operator[] (const size_type i) { AssertIndexRange(i,static_cast(local_vector.get_size())); return local_vector[i]; } - - + + template - inline paralution::LocalVector const& Vector::paralution_vector() const + inline paralution::LocalVector const &Vector::paralution_vector() const { return local_vector; } -- 2.39.5