From: Martin Kronbichler Date: Mon, 31 Aug 2009 13:05:08 +0000 (+0000) Subject: Allow reinit without setting zeros in TableBase class. X-Git-Tag: v8.0.0~7215 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b683323eb88210cea81a42f64253659817ff23ae;p=dealii.git Allow reinit without setting zeros in TableBase class. git-svn-id: https://svn.dealii.org/trunk@19353 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/table.h b/deal.II/base/include/base/table.h index 2f96016d7b..c600c22726 100644 --- a/deal.II/base/include/base/table.h +++ b/deal.II/base/include/base/table.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -542,14 +542,16 @@ class TableBase : public Subscriptor void reset_values (); /** - * Set the dimensions of this - * object to the sizes given in - * the argument, and newly - * allocate the required - * memory. Forget the previous - * content of the array. + * Set the dimensions of this object to + * the sizes given in the argument, and + * newly allocate the required + * memory. If fast is set to + * false, previous content is + * deleted, otherwise the memory is not + * touched. */ - void reinit (const TableIndices &new_size); + void reinit (const TableIndices &new_size, + const bool fast = false); /** * Size of the table in direction @@ -879,7 +881,8 @@ class Table<2,T> : public TableBase<2,T> * base class. */ void reinit (const unsigned int size1, - const unsigned int size2); + const unsigned int size2, + const bool fast = false); /** * Access operator. Generate an @@ -1607,7 +1610,8 @@ class TransposeTable : public TableBase<2,T> * base class. */ void reinit (const unsigned int size1, - const unsigned int size2); + const unsigned int size2, + const bool fast = false); /** * Direct access to one element @@ -1964,7 +1968,8 @@ TableBase::fill (const T& value) template inline void -TableBase::reinit (const TableIndices &new_sizes) +TableBase::reinit (const TableIndices &new_sizes, + const bool fast) { table_size = new_sizes; @@ -2015,7 +2020,8 @@ TableBase::reinit (const TableIndices &new_sizes) // their values after calling 'new // double[val_size]' is // indetermined. - reset_values (); + if (fast == false) + reset_values (); } @@ -2282,9 +2288,10 @@ template inline void Table<2,T>::reinit (const unsigned int size1, - const unsigned int size2) + const unsigned int size2, + const bool fast) { - this->TableBase<2,T>::reinit (TableIndices<2> (size1, size2)); + this->TableBase<2,T>::reinit (TableIndices<2> (size1, size2),fast); } @@ -2430,9 +2437,10 @@ template inline void TransposeTable::reinit (const unsigned int size1, - const unsigned int size2) + const unsigned int size2, + const bool fast) { - this->TableBase<2,T>::reinit (TableIndices<2> (size2, size1)); + this->TableBase<2,T>::reinit (TableIndices<2> (size2, size1),fast); }