From 7b2b1c5f57a4816eb3abaf881aff54ecc5e5c879 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 6 Mar 1998 10:52:31 +0000 Subject: [PATCH] Cell transform stuff. git-svn-id: https://svn.dealii.org/trunk@29 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/fe.cc | 42 +++++++++-- deal.II/deal.II/source/fe/fe_lib.linear.cc | 83 ++++++++++++++++++++-- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 501a17d0b4..79db61b61c 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -2,6 +2,10 @@ #include #include +#include +#include + +extern TriaIterator<1,CellAccessor<1> > __dummy2687; // for gcc2.8 @@ -89,8 +93,11 @@ void FEValues<1>::reinit (const Triangulation<1>::cell_iterator &cell, // compute Jacobi determinants in // quadrature points. + // refer to the general doc for + // why we take the inverse of the + // determinant for (unsigned int i=0; i::reinit (const Triangulation<2>::cell_iterator &cell, unit_shape_gradients[i][j](b) * jacobi_matrices[j](b,s); }; - // compute Jacobi determinants in - // quadrature points. + // refer to the general doc for + // why we take the inverse of the + // determinant for (unsigned int i=0; i::operator == (const FiniteElement<1> &f) const { +void FiniteElement<1>::fill_fe_values (const Triangulation<1>::cell_iterator &cell, + const vector > &unit_points, + vector &jacobians, + vector > &points) const { + // local mesh width + double h=(cell->vertex(1)(0) - cell->vertex(0)(0)); + + unsigned int n_points = unit_points.size(); + for (unsigned int i=0; ivertex(0) + h*unit_points[i]; + }; +}; + + + bool FiniteElement<2>::operator == (const FiniteElement<2> &f) const { return ((dofs_per_vertex == f.dofs_per_vertex) && (dofs_per_line == f.dofs_per_line) && @@ -235,6 +260,15 @@ bool FiniteElement<2>::operator == (const FiniteElement<2> &f) const { +void FiniteElement<2>::fill_fe_values (const Triangulation<2>::cell_iterator &, + const vector > &, + vector &, + vector > &) const { + Assert (false, ExcPureFunctionCalled()); +}; + + + /*------------------------------- Explicit Instantiations -------------*/ diff --git a/deal.II/deal.II/source/fe/fe_lib.linear.cc b/deal.II/deal.II/source/fe/fe_lib.linear.cc index a56521b238..0c392f0608 100644 --- a/deal.II/deal.II/source/fe/fe_lib.linear.cc +++ b/deal.II/deal.II/source/fe/fe_lib.linear.cc @@ -1,7 +1,11 @@ /* $Id$ */ #include +#include +#include +extern TriaIterator<1,CellAccessor<1> > __dummy2687; // for gcc2.8 +extern TriaIterator<2,CellAccessor<2> > __dummy2688; // for gcc2.8 FELinear<1>::FELinear () : @@ -75,6 +79,18 @@ FELinear<1>::shape_grad(const unsigned int i, +void FELinear<1>::fill_fe_values (const Triangulation<1>::cell_iterator &cell, + const vector > &unit_points, + vector &jacobians, + vector > &points) const { + // simply pass down + FiniteElement<1>::fill_fe_values (cell, unit_points, jacobians, points); +}; + + + + + FELinear<2>::FELinear () : FiniteElement<2> (1, 0, 0) { @@ -176,8 +192,8 @@ FELinear<2>::FELinear () : double -FELinear<2>::shape_value(const unsigned int i, - const Point<2>& p) const +FELinear<2>::shape_value (const unsigned int i, + const Point<2>& p) const { Assert((i::shape_value(const unsigned int i, Point<2> -FELinear<2>::shape_grad(const unsigned int i, - const Point<2>& p) const +FELinear<2>::shape_grad (const unsigned int i, + const Point<2>& p) const { Assert((i::shape_grad(const unsigned int i, +// this function may be generalised to three or more dimensions with gcc2.8 +// you will have to change th number of vertices +void FELinear<2>::fill_fe_values (const Triangulation<2>::cell_iterator &cell, + const vector > &unit_points, + vector &jacobians, + vector > &points) const { + const unsigned int dim=2; + const unsigned int n_vertices=4; + + unsigned int n_points=unit_points.size(); + + // initialize points to zero + for (unsigned int i=0; i (); + + // note: let x_l be the vector of the + // lth quadrature point in real space and + // xi_l that on the unit cell, let further + // p_j be the vector of the jth vertex + // of the cell in real space and + // N_j(xi_l) be the value of the associated + // basis function at xi_l, then + // x_l(xi_l) = sum_j p_j N_j(xi_l) + for (unsigned int j=0; jvertex(j) * shape_value(j, unit_points[l]); + +// computation of jacobian still missing +}; + + + + + + FEQuadratic<1>::FEQuadratic () : FiniteElement<1> (1, 1) {}; + +void FEQuadratic<1>::fill_fe_values (const Triangulation<1>::cell_iterator &cell, + const vector > &unit_points, + vector &jacobians, + vector > &points) const { + // simply pass down + FiniteElement<1>::fill_fe_values (cell, unit_points, jacobians, points); +}; + + + FEQuadratic<2>::FEQuadratic () : FiniteElement<2> (1, 1, 1) { @@ -229,10 +291,23 @@ FEQuadratic<2>::FEQuadratic () : + FECubic<1>::FECubic () : FiniteElement<1> (1, 2) {}; + +void FECubic<1>::fill_fe_values (const Triangulation<1>::cell_iterator &cell, + const vector > &unit_points, + vector &jacobians, + vector > &points) const { + // simply pass down + FiniteElement<1>::fill_fe_values (cell, unit_points, jacobians, points); +}; + + + + FECubic<2>::FECubic () : FiniteElement<2> (1, 2, 4) {}; -- 2.39.5