//---------------------------- data_out.cc ---------------------------
// $Id$
-// Version: $Name$
+// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2007, 2008 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2011 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/mapping_q1.h>
-#include <deal.II/dofs/dof_tools.h>
#include <deal.II/fe/fe_values.h>
-#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/function.h>
#include <deal.II/numerics/vectors.h>
#include <deal.II/numerics/matrices.h>
#include <deal.II/lac/vector.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/sparse_matrix.h>
-#include <deal.II/lac/solver_cg.h>
-#include <deal.II/lac/vector_memory.h>
-#include <deal.II/lac/precondition.h>
#include <deal.II/numerics/data_out.h>
#include <deal.II/numerics/data_out_rotation.h>
template <int dim>
-class LaplaceProblem
+class LaplaceProblem
{
public:
LaplaceProblem ();
void run ();
-
+
private:
void make_grid_and_dofs ();
void solve ();
FE_Q<dim> fe;
DoFHandler<dim> dof_handler;
- SparsityPattern sparsity_pattern;
- SparseMatrix<double> system_matrix;
-
Vector<double> solution;
- Vector<double> system_rhs;
-};
-
-
-template <int dim>
-class RightHandSide : public Function<dim>
-{
- public:
- virtual double value (const Point<dim> &p,
- const unsigned int component = 0) const;
};
-
-template <int dim>
-class BoundaryValues : public Function<dim>
-{
- public:
- virtual double value (const Point<dim> &p,
- const unsigned int component = 0) const;
-};
-
-
-
-
-template <int dim>
-double RightHandSide<dim>::value (const Point<dim> &p,
- const unsigned int) const
-{
- double return_value = 0;
- for (unsigned int i=0; i<dim; ++i)
- return_value += 4*pow(p(i), 4);
-
- return return_value;
-}
-
-
-template <int dim>
-double BoundaryValues<dim>::value (const Point<dim> &p,
- const unsigned int) const
-{
- return p.square();
-}
-
-
-
-
template <int dim>
LaplaceProblem<dim>::LaplaceProblem () :
fe (1), dof_handler (triangulation)
triangulation.begin_active()->set_refine_flag ();
triangulation.execute_coarsening_and_refinement ();
};
-
-
+
+
deallog << " Number of active cells: "
<< triangulation.n_active_cells()
<< std::endl
<< dof_handler.n_dofs()
<< std::endl;
- sparsity_pattern.reinit (dof_handler.n_dofs(),
- dof_handler.n_dofs(),
- dof_handler.max_couplings_between_dofs());
- DoFTools::make_sparsity_pattern (dof_handler, sparsity_pattern);
- sparsity_pattern.compress();
-
- system_matrix.reinit (sparsity_pattern);
-
solution.reinit (dof_handler.n_dofs());
- system_rhs.reinit (dof_handler.n_dofs());
}
template <int dim>
-void LaplaceProblem<dim>::solve ()
+void LaplaceProblem<dim>::solve ()
{
// dummy solve. just insert some
// arbitrary values
template <int dim>
-void LaplaceProblem<dim>::run ()
+void LaplaceProblem<dim>::run ()
{
make_grid_and_dofs();
solve ();
output_results ();
}
-
-int main ()
+
+int main ()
{
deallog.depth_console (0);
logfile << std::setprecision(2);
deallog << std::setprecision(2);
-
+
LaplaceProblem<2> laplace_problem_2d;
laplace_problem_2d.run ();
LaplaceProblem<3> laplace_problem_3d;
laplace_problem_3d.run ();
-
+
return 0;
}