From: wolf Date: Tue, 21 Aug 2001 16:06:28 +0000 (+0000) Subject: Let file conform to coding standards. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39612089fa1963f06fa2c2280cda6a65dc59ce71;p=dealii-svn.git Let file conform to coding standards. git-svn-id: https://svn.dealii.org/trunk@4900 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/vector2d.h b/deal.II/base/include/base/vector2d.h index 53c270e538..ab088432a3 100644 --- a/deal.II/base/include/base/vector2d.h +++ b/deal.II/base/include/base/vector2d.h @@ -14,7 +14,7 @@ #define __deal2__vector2d_h #include -#include + /** * Two-dimensional array of arbitrary data. @@ -26,85 +26,87 @@ * standard C++ classes. This, although array would have been * preferrable, since a vector should be element of a vector space. * - * @author Guido Kanschat, 2001 + * @author Guido Kanschat, 2001. Parts by Wolfgang Bangerth and others. */ template class vector2d : public Subscriptor { public: - /** - * Constructor for a quadratic - * @p{rows} by @p{rows} array. The - * standard constructor creates an - * empty object. - */ - vector2d (const unsigned int rows = 0); - - /** - * Constructor for a @p{rows} by - * @p{cols} array. - */ - vector2d (const unsigned int rows, - const unsigned int cols); - - /** - * Copy-constructor for deep copy. - */ - vector2d (const vector2d&); + /** + * Constructor for a quadratic + * @p{rows} by @p{rows} array. The + * standard constructor creates an + * empty object. + */ + vector2d (const unsigned int rows = 0); + + /** + * Constructor for a @p{rows} by + * @p{cols} array. + */ + vector2d (const unsigned int rows, + const unsigned int cols); + + /** + * Copy-constructor for deep copy. + */ + vector2d (const vector2d&); /** * Constructor initializing from * an array of data elements. The array * is arranged line by line. No * range checking is performed. */ - vector2d (const unsigned int rows, - const unsigned int cols, - const T* entries); - - /** - * Assignment operator. - * Copy all elements of @p{src} - * into the matrix. The size is - * adjusted if needed. - * - * We can't use the other, templatized - * version since if we don't declare - * this one, the compiler will happily - * generate a predefined copy - * operator which is not what we want. - */ + vector2d (const unsigned int rows, + const unsigned int cols, + const T* entries); + + /** + * Assignment operator. + * Copy all elements of @p{src} + * into the matrix. The size is + * adjusted if needed. + * + * We can't use the other, templatized + * version since if we don't declare + * this one, the compiler will happily + * generate a predefined copy + * operator which is not what we want. + */ vector2d& operator = (const vector2d& src); - - /** - * Destructor. Free allocated memory. - */ - ~vector2d (); - - /** - * Assignment operator. - * Copy all elements of @p{src} - * into the array. The size is - * adjusted if needed. - * - * This function requires that the - * type @p{T2} is convertible to - * @p{T}. - */ - template - vector2d& operator = (const vector2d& src); - - /** - * Set dimension to $m\times n$ and - * allocate memory if necessary. Forget - * the previous content of the array. - */ + + /** + * Destructor. Free allocated memory. + */ + ~vector2d (); + + /** + * Assignment operator. + * Copy all elements of @p{src} + * into the array. The size is + * adjusted if needed. + * + * This function requires that the + * type @p{T2} is convertible to + * @p{T}. + */ + template + vector2d& operator = (const vector2d &src); + + /** + * Set dimension to $m\times n$ + * and allocate memory if + * necessary. Forget the previous + * content of the array. + */ void reinit (const unsigned int m, const unsigned int n); /** - * Set dimension to $n\times n$ and - * allocate memory if necessary. Forget - * the previous content of the array. + * Set dimension to $n\times n$ + * and allocate memory if + * necessary. Forget the previous + * content of the array. */ void reinit (const unsigned int n); @@ -116,7 +118,7 @@ class vector2d : public Subscriptor * array will be zero. */ template - void reinit (const vector2d&); + void reinit (const vector2d &shape); /** * Number of rows. @@ -150,12 +152,13 @@ class vector2d : public Subscriptor void clear (); /** - * Fill array with an array of elements. - * The array is arranged line by line. No + * Fill array with an array of + * elements. The array is + * arranged line by line. No * range checking is performed. */ template - void fill (const T2* entries); + void fill (const T2 *entries); /** * Determine an estimate for the @@ -165,26 +168,27 @@ class vector2d : public Subscriptor unsigned int memory_consumption () const; protected: - /** - * Return a read-write reference to the - * element @p{(i,j)}. - * - * This function does no bounds - * checking and is only to be used - * internally and in functions - * already checked. - */ - T & el (const unsigned int i, const unsigned int j); + /** + * Return a read-write reference + * to the element @p{(i,j)}. + * + * This function does no bounds + * checking and is only to be + * used internally and in + * functions already checked. + */ + T & el (const unsigned int i, const unsigned int j); - /** - * Return the value of the element @p{(i,j)}. - * - * This function does no bounds checking - * and is only to be used - * internally and in functions - * already checked. - */ - T el (const unsigned int i, const unsigned int j) const; + /** + * Return the value of the + * element @p{(i,j)}. + * + * This function does no bounds + * checking and is only to be + * used internally and in + * functions already checked. + */ + T el (const unsigned int i, const unsigned int j) const; /** * Direct read-only access to @@ -200,8 +204,14 @@ class vector2d : public Subscriptor * Component-array. */ T* val; + /** - * Size of array. + * Size of array. This may be + * larger than the number of + * actually used elements, since + * we don't shrink the array upon + * calls to @p{reinit} unless the + * new size is zero. */ unsigned int val_size; @@ -217,6 +227,8 @@ class vector2d : public Subscriptor }; +/* --------------------- Template and inline functions ---------------- */ + template inline vector2d::~vector2d () @@ -226,6 +238,7 @@ vector2d::~vector2d () }; + template inline void @@ -236,6 +249,7 @@ vector2d::clear () }; + template template inline @@ -247,6 +261,7 @@ vector2d::fill (const T2* entries) } + template void vector2d::reinit (const unsigned int mm, @@ -292,6 +307,7 @@ vector2d::reinit (const unsigned int mm, }; + template void vector2d::reinit (const unsigned int n) @@ -300,6 +316,7 @@ vector2d::reinit (const unsigned int n) }; + template template void @@ -309,6 +326,7 @@ vector2d::reinit (const vector2d &B) }; + template vector2d::vector2d (const unsigned int m, const unsigned int n) : @@ -321,6 +339,7 @@ vector2d::vector2d (const unsigned int m, }; + template vector2d::vector2d (const unsigned int m) : val (0), @@ -349,6 +368,7 @@ vector2d::vector2d (const unsigned int m, }; + template vector2d::vector2d (const vector2d &m) : Subscriptor (), @@ -364,6 +384,7 @@ vector2d::vector2d (const vector2d &m) : }; + template vector2d& vector2d::operator = (const vector2d& m) @@ -377,6 +398,7 @@ vector2d::operator = (const vector2d& m) } + template template vector2d& @@ -391,6 +413,7 @@ vector2d::operator = (const vector2d& m) } + template inline unsigned int @@ -401,6 +424,7 @@ vector2d::n_rows () const } + template inline unsigned int @@ -410,6 +434,8 @@ vector2d::n_cols () const } + + template inline T & vector2d::el (const unsigned int i, const unsigned int j) @@ -427,6 +453,7 @@ vector2d::el (const unsigned int i, const unsigned int j) const }; + template inline T vector2d::operator() (const unsigned int i, const unsigned int j) const @@ -448,6 +475,7 @@ vector2d::operator() (const unsigned int i, const unsigned int j) }; + template inline const T * @@ -457,6 +485,7 @@ vector2d::data () const } + template inline unsigned int