* Output of the matrix in
* user-defined format.
*/
- void print (std::ostream &s,
+ template <class STREAM>
+ void print (STREAM &s,
const unsigned int width=5,
const unsigned int precision=2) const;
/**
- * Print the matrix in the usual
- * format, i.e. as a matrix and
- * not as a list of nonzero
- * elements. For better
- * readability, elements not in
- * the matrix are displayed as
- * empty space, while matrix
- * elements which are explicitly
- * set to zero are displayed as
- * such.
- *
+ * Print the matrix and allow
+ * formatting of entries.
+ *
* The parameters allow for a
* flexible setting of the output
- * format: <tt>precision</tt> and
- * <tt>scientific</tt> are used to
- * determine the number format,
- * where <tt>scientific</tt> = <tt>false</tt>
- * means fixed point notation. A
- * zero entry for <tt>width</tt> makes
- * the function compute a width,
- * but it may be changed to a
- * positive value, if output is
- * crude.
+ * format:
*
- * Additionally, a character for
- * an empty value may be
- * specified.
+ * @arg <tt>precision</tt>
+ * denotes the number of trailing
+ * digits.
*
- * Finally, the whole matrix can
- * be multiplied with a common
- * denominator to produce more
- * readable output, even
- * integers.
+ * @arg <tt>scientific</tt> is
+ * used to determine the number
+ * format, where
+ * <tt>scientific</tt> =
+ * <tt>false</tt> means fixed
+ * point notation.
*
- * @attention This function
- * may produce <b>large</b> amounts of
- * output if applied to a large matrix!
- */
+ * @arg <tt>width</tt> denotes
+ * the with of each column. A
+ * zero entry for <tt>width</tt>
+ * makes the function compute a
+ * width, but it may be changed
+ * to a positive value, if output
+ * is crude.
+ *
+ * @arg <tt>zero_string</tt>
+ * specifies a string printed for
+ * zero entries.
+ *
+ * @arg <tt>denominator</tt>
+ * Multiply the whole matrix by
+ * this common denominator to get
+ * nicer numbers.
+ *
+ * @arg <tt>threshold</tt>: all
+ * entries with absolute value
+ * smaller than this are
+ * considered zero.
+ */
void print_formatted (std::ostream &out,
const unsigned int presicion=3,
const bool scientific = true,
const unsigned int width = 0,
const char *zero_string = " ",
- const double denominator = 1.) const;
+ const double denominator = 1.,
+ const double threshold = 0.) const;
/**
* Determine an estimate for the
template <typename number>
+template <class STREAM>
void
-FullMatrix<number>::print (std::ostream &s,
+FullMatrix<number>::print (STREAM &s,
const unsigned int w,
const unsigned int p) const
{
template <typename number>
void
-FullMatrix<number>::print_formatted (std::ostream &out,
- const unsigned int precision,
- const bool scientific,
- const unsigned int width_,
- const char *zero_string,
- const double denominator) const
+FullMatrix<number>::print_formatted (
+ std::ostream &out,
+ const unsigned int precision,
+ const bool scientific,
+ const unsigned int width_,
+ const char *zero_string,
+ const double denominator,
+ const double threshold) const
{
unsigned int width = width_;
for (unsigned int i=0; i<m(); ++i)
{
for (unsigned int j=0; j<n(); ++j)
- if (this->el(i,j) != 0)
+ if (std::fabs(this->el(i,j)) > threshold)
out << std::setw(width)
<< this->el(i,j) * denominator << ' ';
else
template class FullMatrix<TYPEMAT>;
+template void FullMatrix<TYPEMAT>::print(
+ LogStream&, const unsigned int, const unsigned int) const;
+template void FullMatrix<TYPEMAT>::print(
+ std::ostream&, const unsigned int, const unsigned int) const;
+
template FullMatrix<TYPEMAT>& FullMatrix<TYPEMAT>::operator =(
const FullMatrix<float>&);
#include <lac/full_matrix.templates.h>
+#include <base/logstream.h>
#define TYPEMAT float
template class FullMatrix<TYPEMAT>;
+template void FullMatrix<TYPEMAT>::print(
+ LogStream&, const unsigned int, const unsigned int) const;
+template void FullMatrix<TYPEMAT>::print(
+ std::ostream&, const unsigned int, const unsigned int) const;
+
template FullMatrix<TYPEMAT>& FullMatrix<TYPEMAT>::operator =(
const FullMatrix<double>&);
deallog.attach(logfile);
deallog.depth_console(0);
// deallog.log_execution_time(true);
+// deallog.log_time_differences(true);
test_fe_datas<1>();
test_fe_datas<2>();
// transfer.cc,v 1.4 2003/04/09 15:49:55 wolf Exp
// Version:
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
//---------------------------- show_transfer.cc ---------------------------
#include "../tests.h"
+#include <base/logstream.h>
#include <base/quadrature_lib.h>
#include <lac/vector.h>
#include <lac/sparse_matrix.h>
template<int dim>
inline void
-print_matrix(std::ostream& of,
+print_matrix(LogStream& of,
Triangulation<dim>& tr,
unsigned int level,
const FiniteElement<dim>& finel,
int
main()
{
+ std::ofstream of("transfer.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
Triangulation<2> tr2;
GridGenerator::hyper_cube(tr2, -1., 1.);
GridGenerator::hyper_cube(tr3, -1., 1.);
tr3.refine_global(3);
- std::ofstream of("transfer.output");
-
TEST(2, 1, FE_Q, 1);
TEST(2, 1, FE_Q, 2);
TEST(2, 1, FE_Q, 3);