From: wolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d> Date: Fri, 6 Mar 1998 17:32:51 +0000 (+0000) Subject: Update. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c9349f67acd1137a199168cf3e69eae6b4561d4;p=dealii-svn.git Update. git-svn-id: https://svn.dealii.org/trunk@42 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/Attic/examples/poisson/poisson.cc b/deal.II/deal.II/Attic/examples/poisson/poisson.cc index 47c8848dba..f4f0530b05 100644 --- a/deal.II/deal.II/Attic/examples/poisson/poisson.cc +++ b/deal.II/deal.II/Attic/examples/poisson/poisson.cc @@ -6,11 +6,11 @@ #include <fe/fe_lib.h> #include <grid/tria_iterator.h> #include <grid/tria_accessor.h> -#include "../../deal/dsmatrix.h> +#include <lac/dsmatrix.h> #include <grid/dof_constraints.h> #include <basic/data_io.h> -#include <numerics/problem_base.h> -#include <numerics/problem_assembler.h> +#include <numerics/base.h> +#include <numerics/assembler.h> #include <fstream.h> #include <cmath> @@ -22,6 +22,41 @@ extern TriaActiveIterator<1,CellAccessor<1> > x; extern TriaActiveIterator<2,CellAccessor<2> > y; + +template <int dim> +class PoissonEquation : public Equation<dim> { + public: + PoissonEquation () : + Equation<dim>(1) {}; + + virtual void assemble (dFMatrix &cell_matrix, + vector<dVector> &rhs, + const FEValues<dim> &fe_values, + const Triangulation<dim>::cell_iterator &cell) const; +}; + + + +void PoissonEquation<1>::assemble (dFMatrix &cell_matrix, + vector<dVector> &rhs, + const FEValues<1> &fe_values, + const Triangulation<1>::cell_iterator &) const { + for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point) + for (unsigned int i=0; i<fe_values.total_dofs; ++i) + { + for (unsigned int j=0; j<fe_values.total_dofs; ++j) + cell_matrix(i,j) = fe_values.shape_grad(i,point) * + fe_values.shape_grad(j,point) * + fe_values.JxW(point); + rhs[0] = fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); + }; +}; + + + + void main () { Triangulation<1> tria; DoFHandler<1> dof(tria); diff --git a/tests/big-tests/poisson/poisson.cc b/tests/big-tests/poisson/poisson.cc index 47c8848dba..f4f0530b05 100644 --- a/tests/big-tests/poisson/poisson.cc +++ b/tests/big-tests/poisson/poisson.cc @@ -6,11 +6,11 @@ #include <fe/fe_lib.h> #include <grid/tria_iterator.h> #include <grid/tria_accessor.h> -#include "../../deal/dsmatrix.h> +#include <lac/dsmatrix.h> #include <grid/dof_constraints.h> #include <basic/data_io.h> -#include <numerics/problem_base.h> -#include <numerics/problem_assembler.h> +#include <numerics/base.h> +#include <numerics/assembler.h> #include <fstream.h> #include <cmath> @@ -22,6 +22,41 @@ extern TriaActiveIterator<1,CellAccessor<1> > x; extern TriaActiveIterator<2,CellAccessor<2> > y; + +template <int dim> +class PoissonEquation : public Equation<dim> { + public: + PoissonEquation () : + Equation<dim>(1) {}; + + virtual void assemble (dFMatrix &cell_matrix, + vector<dVector> &rhs, + const FEValues<dim> &fe_values, + const Triangulation<dim>::cell_iterator &cell) const; +}; + + + +void PoissonEquation<1>::assemble (dFMatrix &cell_matrix, + vector<dVector> &rhs, + const FEValues<1> &fe_values, + const Triangulation<1>::cell_iterator &) const { + for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point) + for (unsigned int i=0; i<fe_values.total_dofs; ++i) + { + for (unsigned int j=0; j<fe_values.total_dofs; ++j) + cell_matrix(i,j) = fe_values.shape_grad(i,point) * + fe_values.shape_grad(j,point) * + fe_values.JxW(point); + rhs[0] = fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); + }; +}; + + + + void main () { Triangulation<1> tria; DoFHandler<1> dof(tria);