]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Slight reorganisation (getting the ansatz points of a finite element) and doc updates...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 May 1998 08:35:58 +0000 (08:35 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 May 1998 08:35:58 +0000 (08:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@301 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/fe/fe.cc
deal.II/deal.II/source/fe/fe_lib.linear.cc

index 602e91e364227aa1035d3d1b46d985a2baa0ac57..e4f4d313b2f6d6263ac77dab0eb6b300fba38d69 100644 (file)
@@ -129,7 +129,7 @@ void FiniteElement<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &cell,
                                       const bool         compute_ansatz_points,
                                       vector<Point<1> > &q_points,
                                       const bool         compute_q_points,
-                                      const Boundary<1> &) const {
+                                      const Boundary<1> &boundary) const {
   Assert (jacobians.size() == unit_points.size(),
          ExcWrongFieldDimension(jacobians.size(), unit_points.size()));
   Assert (q_points.size() == unit_points.size(),
@@ -153,19 +153,8 @@ void FiniteElement<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &cell,
                                   // belong to vertex one, the second ones
                                   // to vertex two, all following are
                                   // equally spaced along the line
-  if (compute_ansatz_points) 
-    {
-      unsigned int next = 0;
-                                      // first the dofs in the vertices
-      for (unsigned int vertex=0; vertex<2; vertex++) 
-       for (unsigned int i=0; i<dofs_per_vertex; ++i)
-         ansatz_points[next++] = cell->vertex(vertex);
-      
-                                      // now dofs on line
-      for (unsigned int i=0; i<dofs_per_line; ++i) 
-       ansatz_points[next++] = cell->vertex(0) +
-                               Point<1>((i+1.0)/(total_dofs+1.0)*h);
-    };
+  if (compute_ansatz_points)
+    get_ansatz_points (cell, boundary, ansatz_points);
 };
 
 
@@ -309,6 +298,42 @@ void FiniteElement<dim>::fill_fe_subface_values (const DoFHandler<dim>::cell_ite
 };
 
 
+
+
+void FiniteElement<1>::get_ansatz_points (const DoFHandler<1>::cell_iterator &cell,
+                                         const Boundary<1> &,
+                                         vector<Point<1> > &ansatz_points) const {
+  Assert (ansatz_points.size() == total_dofs,
+         ExcWrongFieldDimension(ansatz_points.size(), total_dofs));
+                                  // compute ansatz points. The first ones
+                                  // belong to vertex one, the second ones
+                                  // to vertex two, all following are
+                                  // equally spaced along the line
+  unsigned int next = 0;
+                                  // local mesh width
+  const double h=(cell->vertex(1)(0) - cell->vertex(0)(0));
+                                  // first the dofs in the vertices
+  for (unsigned int vertex=0; vertex<2; vertex++) 
+    for (unsigned int i=0; i<dofs_per_vertex; ++i)
+      ansatz_points[next++] = cell->vertex(vertex);
+  
+                                  // now dofs on line
+  for (unsigned int i=0; i<dofs_per_line; ++i) 
+    ansatz_points[next++] = cell->vertex(0) +
+                           Point<1>((i+1.0)/(total_dofs+1.0)*h);
+};
+
+
+
+template <int dim>
+void FiniteElement<dim>::get_ansatz_points (const DoFHandler<dim>::cell_iterator &,
+                                           const Boundary<dim> &,
+                                           vector<Point<dim> > &) const {
+  Assert (false, ExcPureFunctionCalled());
+};
+
+
+
 /*------------------------------- Explicit Instantiations -------------*/
 
 template class FiniteElementData<1>;
index e242af02055404a205ad6f47f25b12bb153b9222..e7d081ea44d8079d172c8fdd9edc62dacc516c63 100644 (file)
@@ -3,6 +3,7 @@
 #include <fe/fe_lib.h>
 #include <grid/tria_iterator.h>
 #include <grid/dof_accessor.h>
+#include <grid/geometry_info.h>
 #include <algorithm>
 
 
@@ -89,6 +90,14 @@ void FELinear<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &cell,
 
 
 
+void FELinear<1>::get_ansatz_points (const typename DoFHandler<1>::cell_iterator &cell,
+                                    const Boundary<1>  &boundary,
+                                    vector<Point<1> >  &ansatz_points) const {
+  FiniteElement<1>::get_ansatz_points (cell, boundary, ansatz_points);
+};
+
+
+
 void FELinear<1>::get_face_ansatz_points (const typename DoFHandler<1>::face_iterator &,
                                          const Boundary<1>  &,
                                          vector<Point<1> >  &) const {
@@ -269,7 +278,7 @@ void FELinear<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
                                    const bool           compute_ansatz_points,
                                    vector<Point<dim> > &q_points,
                                    const bool           compute_q_points,
-                                   const Boundary<dim> &) const {
+                                   const Boundary<dim> &boundary) const {
   Assert (jacobians.size() == unit_points.size(),
          ExcWrongFieldDimension(jacobians.size(), unit_points.size()));
   Assert (q_points.size() == unit_points.size(),
@@ -277,11 +286,10 @@ void FELinear<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
   Assert (ansatz_points.size() == total_dofs,
          ExcWrongFieldDimension(ansatz_points.size(), total_dofs));
   
-  const unsigned int n_vertices=(1<<dim);
   unsigned int n_points=unit_points.size();
 
-  Point<dim> vertices[n_vertices];
-  for (unsigned int l=0; l<n_vertices; ++l)
+  Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
+  for (unsigned int l=0; l<GeometryInfo<dim>::vertices_per_cell; ++l)
     vertices[l] = cell->vertex(l);
   
 
@@ -299,7 +307,7 @@ void FELinear<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
                                       // 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; j<n_vertices; ++j) 
+      for (unsigned int j=0; j<GeometryInfo<dim>::vertices_per_cell; ++j) 
        for (unsigned int l=0; l<n_points; ++l) 
          q_points[l] += vertices[j] * shape_value(j, unit_points[l]);
     };
@@ -329,7 +337,7 @@ void FELinear<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
       for (unsigned int l=0; l<n_points; ++l) 
        {
          M.clear ();
-         for (unsigned int s=0; s<n_vertices; ++s)
+         for (unsigned int s=0; s<GeometryInfo<dim>::vertices_per_cell; ++s)
            {
                                               // we want a linear transform and
                                               // if we prepend the class name in
@@ -348,22 +356,35 @@ void FELinear<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
 
                                   // compute ansatz points, which are
                                   // the corners for linear elements
-  if (compute_ansatz_points) 
-    for (unsigned int vertex=0; vertex<n_vertices; ++vertex)
-      ansatz_points[vertex] = vertices[vertex];
+  if (compute_ansatz_points)
+    get_ansatz_points (cell, boundary, ansatz_points);
 };
 
 
 
+template <int dim>
+void FELinear<dim>::get_ansatz_points (const typename DoFHandler<dim>::cell_iterator &cell,
+                                      const Boundary<dim>  &,
+                                      vector<Point<dim> >  &ansatz_points) const {
+  Assert (ansatz_points.size() == total_dofs,
+         ExcWrongFieldDimension (ansatz_points.size(), 1<<(dim-1)));
+  
+  for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_cell; ++vertex)
+    ansatz_points[vertex] = cell->vertex(vertex);
+};
+
+
 
 template <int dim>
 void FELinear<dim>::get_face_ansatz_points (const typename DoFHandler<dim>::face_iterator &face,
                                            const Boundary<dim>  &,
                                            vector<Point<dim> >  &ansatz_points) const {
-  Assert (ansatz_points.size() == (1<<(dim-1)),
-         ExcWrongFieldDimension (ansatz_points.size(), 1<<(dim-1)));
+  Assert ((ansatz_points.size() == dofs_per_face) &&
+         (ansatz_points.size() == GeometryInfo<dim>::vertices_per_face),
+         ExcWrongFieldDimension (ansatz_points.size(),
+                                 GeometryInfo<dim>::vertices_per_face));
 
-  for (unsigned int vertex=0; vertex<(1<<(dim-1)); ++vertex)
+  for (unsigned int vertex=0; vertex<dofs_per_face; ++vertex)
     ansatz_points[vertex] = face->vertex(vertex);
 };
 
@@ -498,6 +519,14 @@ void FEQuadratic<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &cell,
 
 
 
+void FEQuadratic<1>::get_ansatz_points (const typename DoFHandler<1>::cell_iterator &cell,
+                                       const Boundary<1>  &boundary,
+                                       vector<Point<1> >  &ansatz_points) const {
+  FiniteElement<1>::get_ansatz_points (cell, boundary, ansatz_points);
+};
+
+
+
 void FEQuadratic<1>::get_face_ansatz_points (const typename DoFHandler<1>::face_iterator &,
                                             const Boundary<1>  &,
                                             vector<Point<1> >  &) const {
@@ -609,6 +638,15 @@ void FEQuadratic<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &,
 
 
 
+template <int dim>
+void FEQuadratic<dim>::get_ansatz_points (const typename DoFHandler<dim>::cell_iterator &,
+                                         const Boundary<dim>  &,
+                                         vector<Point<dim> >  &) const {
+  Assert (false, ExcNotImplemented());
+};
+
+
+
 template <int dim>
 void FEQuadratic<dim>::get_face_ansatz_points (const typename DoFHandler<dim>::face_iterator &,
                                               const Boundary<dim>  &,
@@ -691,6 +729,14 @@ void FECubic<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &cell,
 
 
 
+void FECubic<1>::get_ansatz_points (const typename DoFHandler<1>::cell_iterator &cell,
+                                   const Boundary<1>  &boundary,
+                                   vector<Point<1> >  &ansatz_points) const {
+  FiniteElement<1>::get_ansatz_points (cell, boundary, ansatz_points);
+};
+
+
+
 void FECubic<1>::get_face_ansatz_points (const typename DoFHandler<1>::face_iterator &,
                                         const Boundary<1>  &,
                                         vector<Point<1> >  &) const {
@@ -789,6 +835,15 @@ void FECubic<dim>::fill_fe_values (const DoFHandler<dim>::cell_iterator &,
 
 
 
+template <int dim>
+void FECubic<dim>::get_ansatz_points (const typename DoFHandler<dim>::cell_iterator &,
+                                     const Boundary<dim>  &,
+                                     vector<Point<dim> >  &) const {
+  Assert (false, ExcNotImplemented());
+};
+
+
+
 template <int dim>
 void FECubic<dim>::get_face_ansatz_points (const typename DoFHandler<dim>::face_iterator &,
                                           const Boundary<dim>  &,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.