// array of nodes.
//////////////////////////////////////////////////////////////////////
-
#include <base/data_out_base.h>
#include <base/utilities.h>
#include <base/parameter_handler.h>
{
in >> vector_data_ranges[i].template get<0>()
>> vector_data_ranges[i].template get<1>();
+
+ // read in the name of that vector
+ // range. because it is on a separate
+ // line, we first need to read to the
+ // end of the previous line (nothing
+ // should be there any more after we've
+ // read the previous two integers) and
+ // then read the entire next line for
+ // the name
std::string name;
getline(in, name);
+ getline(in, name);
vector_data_ranges[i].template get<2>() = name;
}
--- /dev/null
+//---------------------------- data_out_04.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2004, 2004, 2007 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.
+//
+//---------------------------- data_out_04.cc ---------------------------
+
+
+// write the data in deal.II intermediate form, read it back in, and
+// make sure that the result is the same
+
+// this is as the _03 test except that it tests our ability to read and write
+// files with vector components in them
+
+#include "../tests.h"
+#include "data_out_common.cc"
+#include <lac/sparsity_pattern.h>
+#include <numerics/data_out.h>
+
+
+std::string output_file_name = "data_out_04/output";
+
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOut : public DataOut<dim>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim,dim> > &
+ get_patches() const
+ { return DataOut<dim>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOut<dim>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ // if we have enough components for a
+ // vector solution, make the last dim
+ // components a vector
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ retval;
+ if (get_dataset_names().size() >= dim)
+ retval.push_back (boost::tuple
+ <unsigned int, unsigned int, std::string>
+ (get_dataset_names().size()-dim,
+ get_dataset_names().size()-1,
+ "vector_data"));
+ return retval;
+ }
+};
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOutReader : public DataOutReader<dim>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim,dim> > &
+ get_patches() const
+ { return DataOutReader<dim>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOutReader<dim>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ return DataOutReader<dim>::get_vector_data_ranges ();
+ }
+};
+
+
+template <int dim>
+void
+check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell)
+{
+ XDataOut<dim> data_out;
+ data_out.attach_dof_handler (dof_handler);
+ data_out.add_data_vector (v_node, "node_data");
+ data_out.add_data_vector (v_cell, "cell_data");
+ data_out.build_patches ();
+
+ {
+ std::ofstream tmp ("data_out_04.tmp");
+ data_out.write_deal_II_intermediate (tmp);
+ }
+
+ XDataOutReader<dim> reader;
+ {
+ std::ifstream tmp ("data_out_04.tmp");
+ reader.read (tmp);
+ }
+
+ // finally make sure that we have
+ // read everything back in
+ // correctly
+ Assert (data_out.get_dataset_names() == reader.get_dataset_names(),
+ ExcInternalError());
+
+ Assert (data_out.get_patches().size() == reader.get_patches().size(),
+ ExcInternalError());
+
+ for (unsigned int i=0; i<reader.get_patches().size(); ++i)
+ Assert (data_out.get_patches()[i] == reader.get_patches()[i],
+ ExcInternalError());
+
+ deallog << data_out.get_vector_data_ranges().size()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges().size() ==
+ reader.get_vector_data_ranges().size(),
+ ExcInternalError());
+ for (unsigned int i=0; i<data_out.get_vector_data_ranges().size(); ++i)
+ {
+ deallog << data_out.get_vector_data_ranges()[i].template get<0>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<1>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<2>()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges()[i].template get<0>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<0>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<1>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<1>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<2>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<2>(),
+ ExcInternalError());
+ }
+
+ // for good measure, delete tmp file
+ remove ("data_out_04.tmp");
+
+ deallog << "OK" << std::endl;
+}
+
+
--- /dev/null
+
+DEAL::Checking Q1 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking Q1 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking Q1 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q2 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking Q2 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking Q2 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q3 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking Q3 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking Q3 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ0 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ0 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ0 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ1 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ1 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ1 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ2 in 1d:
+DEAL::1
+DEAL::1 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ2 in 2d:
+DEAL::1
+DEAL::0 1 vector_data
+DEAL::OK
+DEAL::Checking DGQ2 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Nedelec1 in 2d:
+DEAL::1
+DEAL::1 2 vector_data
+DEAL::OK
+DEAL::Checking Nedelec1 in 3d:
+DEAL::1
+DEAL::1 3 vector_data
+DEAL::OK
--- /dev/null
+//---------------------------- data_out_faces_04.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2004, 2004, 2006, 2007 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.
+//
+//---------------------------- data_out_faces_04.cc ---------------------------
+
+
+// write the data in deal.II intermediate form, read it back in, and
+// make sure that the result is the same
+
+// this is as the _03 test except that it tests our ability to read and write
+// files with vector components in them
+
+#include "../tests.h"
+#include "data_out_common.cc"
+#include <lac/sparsity_pattern.h>
+#include <numerics/data_out_faces.h>
+
+
+std::string output_file_name = "data_out_faces_04/output";
+
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOut : public DataOutFaces<dim>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim-1,dim> > &
+ get_patches() const
+ { return DataOutFaces<dim>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOutFaces<dim>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ return DataOutFaces<dim>::get_vector_data_ranges ();
+ }
+};
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOutReader : public DataOutReader<dim-1,dim>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim-1,dim> > &
+ get_patches() const
+ { return DataOutReader<dim-1,dim>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOutReader<dim-1,dim>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ return DataOutReader<dim-1,dim>::get_vector_data_ranges ();
+ }
+};
+
+
+
+void
+my_check_this (const DoFHandler<1> &,
+ const Vector<double> &,
+ const Vector<double> &)
+{
+ // don't check in 1d
+}
+
+
+
+
+template <int dim>
+void
+my_check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell)
+{
+ XDataOut<dim> data_out;
+ data_out.attach_dof_handler (dof_handler);
+ data_out.add_data_vector (v_node, "node_data");
+ data_out.add_data_vector (v_cell, "cell_data");
+ data_out.build_patches ();
+
+ {
+ std::ofstream tmp ("data_out_faces_04.tmp");
+ data_out.write_deal_II_intermediate (tmp);
+ }
+
+ XDataOutReader<dim> reader;
+ {
+ std::ifstream tmp ("data_out_faces_04.tmp");
+ reader.read (tmp);
+ }
+
+ // finally make sure that we have
+ // read everything back in
+ // correctly
+ Assert (data_out.get_dataset_names() == reader.get_dataset_names(),
+ ExcInternalError());
+
+ Assert (data_out.get_patches().size() == reader.get_patches().size(),
+ ExcInternalError());
+
+ for (unsigned int i=0; i<reader.get_patches().size(); ++i)
+ Assert (data_out.get_patches()[i] == reader.get_patches()[i],
+ ExcInternalError());
+
+ deallog << data_out.get_vector_data_ranges().size()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges().size() ==
+ reader.get_vector_data_ranges().size(),
+ ExcInternalError());
+ for (unsigned int i=0; i<data_out.get_vector_data_ranges().size(); ++i)
+ {
+ deallog << data_out.get_vector_data_ranges()[i].template get<0>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<1>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<2>()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges()[i].template get<0>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<0>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<1>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<1>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<2>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<2>(),
+ ExcInternalError());
+ }
+
+ // for good measure, delete tmp file
+ remove ("data_out_faces_04.tmp");
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+
+template <int dim>
+void
+check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell)
+{
+ // since we can't forward declare
+ // check_this in this file (it is forward
+ // declared in data_out_common.cc), we
+ // also can't make the driver file aware of
+ // the overload for 1d. to avoid linker
+ // errors, we can consequently not overload
+ // check_this, and need this forwarder
+ // function
+ my_check_this (dof_handler, v_node, v_cell);
+}
--- /dev/null
+
+DEAL::Checking Q1 in 1d:
+DEAL::Checking Q1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q1 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q2 in 1d:
+DEAL::Checking Q2 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q2 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q3 in 1d:
+DEAL::Checking Q3 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q3 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ0 in 1d:
+DEAL::Checking DGQ0 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ0 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ1 in 1d:
+DEAL::Checking DGQ1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ1 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ2 in 1d:
+DEAL::Checking DGQ2 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ2 in 3d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Nedelec1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Nedelec1 in 3d:
+DEAL::0
+DEAL::OK
--- /dev/null
+//---------------------------- data_out_rotation_04.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2004, 2004, 2006, 2007 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.
+//
+//---------------------------- data_out_rotation_04.cc ---------------------------
+
+
+// write the data in deal.II intermediate form, read it back in, and
+// make sure that the result is the same
+
+// this is as the _03 test except that it tests our ability to read and write
+// files with vector components in them
+
+#include "../tests.h"
+#include "data_out_common.cc"
+#include <lac/sparsity_pattern.h>
+#include <numerics/data_out_rotation.h>
+
+
+std::string output_file_name = "data_out_rotation_04/output";
+
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOut : public DataOutRotation<dim>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim+1,dim+1> > &
+ get_patches() const
+ { return DataOutRotation<dim>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOutRotation<dim>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ return DataOutRotation<dim>::get_vector_data_ranges ();
+ }
+};
+
+// have a class that makes sure we can get at the patches and data set
+// names that the base class generates
+template <int dim>
+class XDataOutReader : public DataOutReader<dim+1>
+{
+ public:
+ const std::vector<typename ::DataOutBase::Patch<dim+1,dim+1> > &
+ get_patches() const
+ { return DataOutReader<dim+1>::get_patches(); }
+
+ std::vector<std::string>
+ get_dataset_names () const
+ { return DataOutReader<dim+1>::get_dataset_names(); }
+
+ std::vector<boost::tuple<unsigned int, unsigned int, std::string> >
+ get_vector_data_ranges () const
+ {
+ return DataOutReader<dim+1>::get_vector_data_ranges ();
+ }
+};
+
+
+void
+my_check_this (const DoFHandler<3> &,
+ const Vector<double> &,
+ const Vector<double> &)
+{
+ // no checks in 3d
+}
+
+
+
+template <int dim>
+void
+my_check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell)
+{
+ XDataOut<dim> data_out;
+ data_out.attach_dof_handler (dof_handler);
+ data_out.add_data_vector (v_node, "node_data");
+ data_out.add_data_vector (v_cell, "cell_data");
+ data_out.build_patches (4);
+
+ {
+ std::ofstream tmp ("data_out_rotation_04.tmp");
+ // use full precision to avoid
+ // errors
+ tmp.precision (20);
+ data_out.write_deal_II_intermediate (tmp);
+ }
+
+ XDataOutReader<dim> reader;
+ {
+ std::ifstream tmp ("data_out_rotation_04.tmp");
+ reader.read (tmp);
+ }
+
+ // finally make sure that we have
+ // read everything back in
+ // correctly
+ Assert (data_out.get_dataset_names() == reader.get_dataset_names(),
+ ExcInternalError());
+
+ Assert (data_out.get_patches().size() == reader.get_patches().size(),
+ ExcInternalError());
+
+ for (unsigned int i=0; i<reader.get_patches().size(); ++i)
+ Assert (data_out.get_patches()[i] == reader.get_patches()[i],
+ ExcInternalError());
+
+ deallog << data_out.get_vector_data_ranges().size()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges().size() ==
+ reader.get_vector_data_ranges().size(),
+ ExcInternalError());
+ for (unsigned int i=0; i<data_out.get_vector_data_ranges().size(); ++i)
+ {
+ deallog << data_out.get_vector_data_ranges()[i].template get<0>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<1>()
+ << ' '
+ << data_out.get_vector_data_ranges()[i].template get<2>()
+ << std::endl;
+ Assert (data_out.get_vector_data_ranges()[i].template get<0>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<0>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<1>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<1>(),
+ ExcInternalError());
+ Assert (data_out.get_vector_data_ranges()[i].template get<2>()
+ ==
+ reader.get_vector_data_ranges()[i].template get<2>(),
+ ExcInternalError());
+ }
+
+ // for good measure, delete tmp file
+ remove ("data_out_rotation_04.tmp");
+
+ deallog << "OK" << std::endl;
+}
+
+
+template <int dim>
+void
+check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell)
+{
+ // since we can't forward declare
+ // check_this in this file (it is forward
+ // declared in data_out_common.cc), we
+ // also can't make the driver file aware of
+ // the overload for 1d. to avoid linker
+ // errors, we can consequently not overload
+ // check_this, and need this forwarder
+ // function
+ my_check_this (dof_handler, v_node, v_cell);
+}
--- /dev/null
+
+DEAL::Checking Q1 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q1 in 3d:
+DEAL::Checking Q2 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q2 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q2 in 3d:
+DEAL::Checking Q3 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q3 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Q3 in 3d:
+DEAL::Checking DGQ0 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ0 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ0 in 3d:
+DEAL::Checking DGQ1 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ1 in 3d:
+DEAL::Checking DGQ2 in 1d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ2 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking DGQ2 in 3d:
+DEAL::Checking Nedelec1 in 2d:
+DEAL::0
+DEAL::OK
+DEAL::Checking Nedelec1 in 3d: