<h3>General</h3>
<ol>
- <li> <p> Changed: The build system was entirely revised. Object
- files in debug more now have the suffix <code>.g.o</code> instead of
- <code>.go</code>. All object files from the subdirectories are now
- placed into the <code>/lib</code> top-level directory, rather than
- in library directories in the individual subdirs.
- <br>
- (WB 2002/02/11)
- </p>
+ <li> <p>
+ Changed: The build system was entirely revised. Object
+ files in debug more now have the suffix <code>.g.o</code>
+ instead of <code>.go</code>. All object files from the
+ subdirectories are now placed into the <code>/lib</code>
+ top-level directory, rather than in library directories in the
+ individual subdirs.
+ <br>
+ (WB 2002/02/11)
+ </p>
</ol>
<a name="base"></a>
<h3>base</h3>
-
- <li> <p> Changed: The quite logorrhoeic function name <code
- class="class">TensorProductPolynomials</code>::<code
- class="member">n_tensor_product_polynomials</code> was changed to
- <code class="member">n</code> to be compliant wth the new class <code
- class="class">PolynomialSpace</code>.
- <br>
- (GK 2002/02/11)
- </p>
-
- <li> <p> New: The class <code class="class">PolynomialSpace</code>
- implements the space of polynomials at most a certain degree in
- arbitrary space dimensions.
- <br>
- (GK 2002/02/11)
- </p>
-
- <li> <p> New: The function <code class="class">DataOutBase</code>::
- <code class="member">write_tecplot_binary</code> has been added. This
- function will write Tecplot binary files if the Tecplot API is detected
- by ./configure. To use this feature be sure that the environment
- variable TECHOME points to a valid Tecplot installation and that the files
- $TECHOME/include/TECIO.h and $TECHOME/lib/tecio.a exist. The name of the
- file to be written is specified through the <code class="class">DataOutBase</code>
- ::<code class="member">TecplotFlags</code>.
- <code class="member">tecplot_binary_file_name</code> variable. If the API is not
- available this code simply calls the existing ASCII output function.
- <br>
- (BK 2002/02/11)
- </p>
-
+ <li> <p>
+ Changed: The quite logorrhoeic function name <code
+ class="class">TensorProductPolynomials</code>::<code
+ class="member">n_tensor_product_polynomials</code> was changed to
+ <code class="member">n</code> to be compliant wth the new class <code
+ class="class">PolynomialSpace</code>.
+ <br>
+ (GK 2002/02/11)
+ </p>
+
+ <li> <p>
+ New: The class <code class="class">PolynomialSpace</code>
+ implements the space of polynomials at most a certain degree in
+ arbitrary space dimensions.
+ <br>
+ (GK 2002/02/11)
+ </p>
+
+ <li> <p>
+ New: The function <code class="class">DataOutBase</code>::
+ <code class="member">write_tecplot_binary</code> has been
+ added. This function will write Tecplot binary files if the
+ Tecplot API is detected by ./configure. To use this feature be
+ sure that the environment variable TECHOME points to a valid
+ Tecplot installation and that the files
+ $TECHOME/include/TECIO.h and $TECHOME/lib/tecio.a exist. The
+ name of the file to be written is specified through the <code
+ class="class">DataOutBase</code> ::<code
+ class="member">TecplotFlags</code>. <code
+ class="member">tecplot_binary_file_name</code> variable. If the
+ API is not available this code simply calls the existing ASCII
+ output function.
+ <br>
+ (BK 2002/02/11)
+ </p>
<ol>
</ol>
<h3>lac</h3>
<ol>
- <li> <p> New: Functions <code
- class="member">SparsityPattern::copy_from</code> and <code
- class="member">SparseMatrix::copy_from</code> allow to copy a full
- matrix into a sparse matrix.
- <br>
- (WB 2002/02/06)
- </p>
+ <li> <p>
+ New: Function <code
+ class="member">SparsityPattern::matrix_position</code> is the
+ inverse function for <code
+ class="member">SparsityPattern::operator()</code>.
+ <br>
+ (WB 2002/02/13)
+ </p>
+
+ <li> <p>
+ New: Functions <code
+ class="member">SparsityPattern::copy_from</code> and <code
+ class="member">SparseMatrix::copy_from</code> allow to copy a full
+ matrix into a sparse matrix.
+ <br>
+ (WB 2002/02/06)
+ </p>
</ol>
<a name="deal.II"></a>
<h3>deal.II</h3>
-
- <li> <p> New: Finite element family with complete polynomial spaces
- for discontinuous Galerkin: <code class="class">FE_DGP</code>
- <br>
- (GK 2002/02/11)
- </p>
-
+ <li> <p>
+ New: Finite element family with complete polynomial spaces
+ for discontinuous Galerkin: <code class="class">FE_DGP</code>
+ <br>
+ (GK 2002/02/11)
+ </p>
<ol>
</ol>
~SparsityPattern ();
/**
- * Copy operator. For this the same holds
- * as for the copy constructor: it is
- * declared, defined and fine to be called,
- * but the latter only for empty objects.
+ * Copy operator. For this the
+ * same holds as for the copy
+ * constructor: it is declared,
+ * defined and fine to be called,
+ * but the latter only for empty
+ * objects.
*/
SparsityPattern & operator = (const SparsityPattern &);
/**
* Return the index of the matrix
- * element with row number @p{i} and
- * column number @p{j}. If the matrix
- * element is not a nonzero one,
- * return @p{SparsityPattern::invalid_entry}.
+ * element with row number @p{i}
+ * and column number @p{j}. If
+ * the matrix element is not a
+ * nonzero one, return
+ * @p{SparsityPattern::invalid_entry}.
*
* This function is usually called
* by the @p{operator()} of the
* with a binary sort algorithm
* because the column numbers are
* sorted.
+ *
+ * If @p{m} is the number of
+ * entries in @p{row}, then the
+ * complexity of this function is
+ * @p{log(m)} if the sparsity
+ * pattern is compressed.
*/
unsigned int operator() (const unsigned int i,
const unsigned int j) const;
+ /**
+ * This is the inverse operation
+ * to @p{operator()}: given a
+ * global index, find out row and
+ * column of the matrix entry to
+ * which it belongs. The returned
+ * value is the pair composed of
+ * row and column index.
+ *
+ * This function may only be
+ * called if the sparsity pattern
+ * is closed. The global index
+ * must then be between zero and
+ * @p{n_nonzero_elements}.
+ *
+ * If @p{N} is the number of
+ * rows of this matrix, then the
+ * complexity of this function is
+ * @p{log(N)}.
+ */
+ std::pair<unsigned int, unsigned int>
+ matrix_position (const unsigned int global_index) const;
+
/**
* Add a nonzero entry to the matrix.
* This function may only be called
}
+
+std::pair<unsigned int, unsigned int>
+SparsityPattern::matrix_position (const unsigned int global_index) const
+{
+ Assert (compressed == true, ExcNotCompressed());
+ Assert (global_index < n_nonzero_elements(),
+ ExcIndexRange (global_index, 0, n_nonzero_elements()));
+
+ // first find the row in which the
+ // entry is located. for this note
+ // that the rowstart array indexes
+ // the global indices at which each
+ // row starts. since it is sorted,
+ // and since there is an element
+ // for the one-past-last row, we
+ // can simply use a bisection
+ // search on it
+ const unsigned int row
+ = (std::upper_bound (&rowstart[0], &rowstart[rows], global_index)
+ - &rowstart[0] - 1);
+
+ // now, the column index is simple
+ // since that is what the colnums
+ // array stores:
+ const unsigned int col = colnums[global_index];
+
+ // so return the respective pair
+ return std::make_pair (row,col);
+};
+
+
+
void
SparsityPattern::symmetrize ()
{
for (; sp3_p != sp3.get_column_numbers()+sp3.get_rowstart_indices()[row+1]; ++sp3_p, ++sp4_p)
Assert (*sp3_p == *sp4_p, ExcInternalError());
};
+
+
+ // check the matrix_position
+ // function with sparsity patterns
+ // sp1 through sp4. the checked
+ // function should be the inverse
+ // of operator()
+ //
+ // check inverseness property first
+ // forward, then backward
+ for (unsigned int loop=1; loop<=4; ++loop)
+ {
+ const SparsityPattern &
+ sp = (loop==1 ? sp1 : (loop==2 ? sp2 : (loop==3 ? sp3 : sp4)));
+ for (unsigned int i=0; i<sp.n_nonzero_elements(); ++i)
+ Assert (sp(sp.matrix_position(i).first,
+ sp.matrix_position(i).second) == i,
+ ExcInternalError());
+ for (unsigned int row=0; row<sp.n_rows(); ++row)
+ for (unsigned int col=0; col<sp.n_cols(); ++col)
+ if (sp(row,col) != SparsityPattern::invalid_entry)
+ Assert (sp.matrix_position(sp(row,col)) ==
+ std::make_pair(row,col),
+ ExcInternalError());
+ };
};