// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
void ConstraintMatrix::print (std::ostream &out) const
{
for (unsigned int i=0; i!=lines.size(); ++i)
- for (unsigned int j=0; j!=lines[i].entries.size(); ++j)
- out << " " << lines[i].line
- << " " << lines[i].entries[j].first
- << ": " << lines[i].entries[j].second << std::endl;
-
+ {
+ // output the list of
+ // constraints as pairs of dofs
+ // and their weights
+ if (lines[i].entries.size() > 0)
+ for (unsigned int j=0; j<lines[i].entries.size(); ++j)
+ out << " " << lines[i].line
+ << " " << lines[i].entries[j].first
+ << ": " << lines[i].entries[j].second << "\n";
+ else
+ // but also output something
+ // if the constraint simply
+ // reads x[13]=0, i.e. where
+ // the right hand side is not
+ // a linear combination of
+ // other dofs
+ out << " " << lines[i].line
+ << " = 0"
+ << "\n";
+ }
+
AssertThrow (out, ExcIO());
}
<< std::endl;
for (unsigned int i=0; i!=lines.size(); ++i)
{
- for (unsigned int j=0; j!=lines[i].entries.size(); ++j)
- out << " " << lines[i].line << "->" << lines[i].entries[j].first
- << "; // weight: "
- << lines[i].entries[j].second
- << "\n";
+ // same concept as in the
+ // previous function
+ if (lines[i].entries.size() > 0)
+ for (unsigned int j=0; j<lines[i].entries.size(); ++j)
+ out << " " << lines[i].line << "->" << lines[i].entries[j].first
+ << "; // weight: "
+ << lines[i].entries[j].second
+ << "\n";
+ else
+ out << " " << lines[i].line << "\n";
}
out << "}" << std::endl;
}
<ol>
+ <li> <p>Fixed: Neither ConstraintMatrix::print nor ConstraintMatrix::write_dot
+ produced any output for constraints of the form $x_i=0$, i.e. where the right
+ hand side is a trivial linear combination of other degrees of freedom. This
+ is now fixed.
+ <br>
+ (WB 2008/01/23)
+ </p></li>
+
<li> <p>Improved: GridGenerator::subdivided_hyper_rectangle now also colorizes
cells according to the octant they are in.
<br>
(GK 2007/12/20)
</p></li>
-
<li> <p>New: The DataOut, DataOutRotation, DataOutStack, and DataOutFaces
can now deal with vector-valued data if the functions in DataOutBase
that write in a particular graphical output format can deal with it.
--- /dev/null
+//---------------------------- constraint_graph_zero.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- constraint_graph_zero.cc ---------------------------
+
+
+// generate constraints for a case where there are nodes that have a
+// constraint x[i]=0, i.e. where the right hand side is a trivial
+// linear combination of other degrees of freedom. then write this as
+// a DOT graph.
+//
+// we used to get this case wrong (we simply forgot to output this
+// node).
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <dofs/dof_constraints.h>
+
+#include <fstream>
+
+
+void test ()
+{
+
+ ConstraintMatrix cm;
+
+ // a "regular" constraint
+ cm.add_line (1);
+ cm.add_entry (1, 2, 42.);
+
+ // a "singular" constraint
+ cm.add_line (4);
+
+ cm.write_dot (deallog.get_file_stream());
+}
+
+
+int main ()
+{
+ std::ofstream logfile("constraint_graph_zero/output");
+ logfile.precision(2);
+
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test ();
+
+ deallog << "OK" << std::endl;
+}
--- /dev/null
+
+digraph constraints {
+ 1->2; // weight: 42.
+ 4
+}
+DEAL::OK
--- /dev/null
+//---------------------------- constraints_zero.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- constraints_zero.cc ---------------------------
+
+
+// generate the constraints for a case where there are nodes that have
+// a constraint x[i]=0, i.e. where the right hand side is a trivial
+// linear combination of other degrees of freedom. then print this set
+// of constraints.
+//
+// we used to get this case wrong (we simply forgot to output this
+// node).
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <dofs/dof_constraints.h>
+
+#include <fstream>
+
+
+void test ()
+{
+
+ ConstraintMatrix cm;
+
+ // a "regular" constraint
+ cm.add_line (1);
+ cm.add_entry (1, 2, 42.);
+
+ // a "singular" constraint
+ cm.add_line (4);
+
+ cm.print (deallog.get_file_stream());
+}
+
+
+int main ()
+{
+ std::ofstream logfile("constraints_zero/output");
+ logfile.precision(2);
+
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test ();
+
+ deallog << "OK" << std::endl;
+}
--- /dev/null
+
+ 1 2: 42.
+ 4 = 0
+DEAL::OK
--- /dev/null
+//---------------------------- constraints_zero_merge.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- constraints_zero_merge.cc ---------------------------
+
+
+// generate the constraints for a case where there are nodes that have
+// a constraint x[i]=0, i.e. where the right hand side is a trivial
+// linear combination of other degrees of freedom. then merge two such
+// constraint matrices
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <dofs/dof_constraints.h>
+
+#include <fstream>
+
+
+void test ()
+{
+
+ ConstraintMatrix cm1, cm2;
+
+ // a "regular" and a singular
+ // constraint to each of the
+ // constraint matrices
+ cm1.add_line (1);
+ cm1.add_entry (1, 2, 42.);
+ cm1.add_line (4);
+
+ cm2.add_line (11);
+ cm2.add_entry (11, 22, 42.);
+ cm2.add_line (14);
+
+ cm2.merge (cm1);
+
+ deallog << "CM1" << std::endl;
+ cm1.print (deallog.get_file_stream());
+
+ deallog << "CM2" << std::endl;
+ cm2.print (deallog.get_file_stream());
+}
+
+
+int main ()
+{
+ std::ofstream logfile("constraints_zero_merge/output");
+ logfile.precision(2);
+
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test ();
+
+ deallog << "OK" << std::endl;
+}
--- /dev/null
+
+DEAL::CM1
+ 1 2: 42.
+ 4 = 0
+DEAL::CM2
+ 11 22: 42.
+ 14 = 0
+ 1 2: 42.
+ 4 = 0
+DEAL::OK