]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed normal_vector tests.
authorheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Jan 2014 11:54:27 +0000 (11:54 +0000)
committerheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Jan 2014 11:54:27 +0000 (11:54 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32343 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/tria_boundary_lib.cc
tests/deal.II/normal_vector_01.cc
tests/deal.II/normal_vector_01_2d.cc
tests/deal.II/normal_vector_02.cc
tests/deal.II/normal_vector_02_2d.cc
tests/deal.II/normal_vector_03.cc
tests/deal.II/normal_vector_03_2d.cc
tests/deal.II/normals_at_vertices_01.cc
tests/deal.II/normals_at_vertices_02.cc

index 77044ede7888f0984bd06b6ba2a462930be0dee7..d7357be4be4870054a66e9a7b84757bf0a63ad76 100644 (file)
@@ -277,7 +277,8 @@ HyperBallBoundary<dim,spacedim>::
 normal_vector (const std::vector<Point<spacedim> > & vertices, 
               const Point<spacedim> &vertex) const
 {
-  return vertex-center;
+  Point<spacedim> n = vertex-center;
+  return n/n.norm();
 }
 
 template <int dim, int spacedim>
@@ -348,7 +349,7 @@ normal_vector (const std::vector<Point<dim> > & vertices,
       return normal;
     }
   else if(at_distance_R)
-    return vertex-this->center;
+    return HyperBallBoundary<dim>::normal_vector(vertices,vertex);
   else
     {
       Assert(false,
index ad7783bbf337daf3d265751d711adfaf5b4dae68..c14c8091cd773c185d4282cf4c9bf8737cc965f8 100644 (file)
@@ -69,7 +69,8 @@ int main ()
 
   Triangulation<3> tria;
   StraightBoundary<3> boundary;
-  Boundary<3>::FaceVertexNormals normals;
+  std::vector<Point<3> > normals(GeometryInfo<3>::vertices_per_face);
+
   for (unsigned int case_no=0; case_no<2; ++case_no)
     {
       deallog << "Case" << case_no << std::endl;
@@ -79,9 +80,12 @@ int main ()
       for (unsigned int face_no=0; face_no<GeometryInfo<3>::faces_per_cell; ++face_no)
         {
           face=cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<3> > vs(GeometryInfo<3>::vertices_per_face);
+         for(unsigned int i=0; i<GeometryInfo<3>::vertices_per_face; ++i)
+           vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
           for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
-            Assert ((boundary.normal_vector (face,
+            Assert ((boundary.normal_vector (vs,
                                              face->vertex(v))
                      -
                      normals[v] / normals[v].norm()).norm()
index 65123e6e753fc140a5a82606a1c7914bb60349a4..bb53f0b7fbb247e263a947ce88a06e74d2828f40 100644 (file)
@@ -69,7 +69,8 @@ int main ()
 
   Triangulation<2> tria;
   StraightBoundary<2> boundary;
-  Boundary<2>::FaceVertexNormals normals;
+  std::vector<Point<2> > normals(GeometryInfo<2>::vertices_per_face);
+
   for (unsigned int case_no=0; case_no<2; ++case_no)
     {
       deallog << "Case" << case_no << std::endl;
@@ -79,9 +80,12 @@ int main ()
       for (unsigned int face_no=0; face_no<GeometryInfo<2>::faces_per_cell; ++face_no)
         {
           face=cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<2> > vs(GeometryInfo<2>::vertices_per_face);
+          for(unsigned int i=0; i<GeometryInfo<2>::vertices_per_face; ++i)
+            vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
           for (unsigned int v=0; v<GeometryInfo<2>::vertices_per_face; ++v)
-            Assert ((boundary.normal_vector (face,
+            Assert ((boundary.normal_vector (vs,
                                              face->vertex(v))
                      -
                      normals[v] / normals[v].norm()).norm()
index 7d4c921860a4148d4342fc899fb155a31b64163a..0b695e92ed881b7ccdafa8c048d58a8957f520ab 100644 (file)
@@ -43,7 +43,7 @@ int main ()
   HyperBallBoundary<3> boundary (Point<3>(1,0,0));
 
   Triangulation<3> tria;
-  Boundary<3>::FaceVertexNormals normals;
+  std::vector<Point<3> > normals(GeometryInfo<3>::vertices_per_face);
 
   GridGenerator::hyper_ball (tria, Point<3>(1,0,0), 3);
 
@@ -54,9 +54,12 @@ int main ()
       if (cell->at_boundary(face_no))
         {
           Triangulation<3>::face_iterator face = cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<3> > vs(GeometryInfo<3>::vertices_per_face);
+          for(unsigned int i=0; i<GeometryInfo<3>::vertices_per_face; ++i)
+            vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
           for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
-            Assert ((boundary.normal_vector (face,
+            Assert ((boundary.normal_vector (vs,
                                              face->vertex(v))
                      -
                      normals[v] / normals[v].norm()).norm()
index 8e41a1ed42fbb3c2f20f55c5ddda52e73a533cc8..99a55b68673ed5f1f53593e593a40e9ba916fff4 100644 (file)
@@ -43,7 +43,7 @@ int main ()
   HyperBallBoundary<2> boundary (Point<2>(1,0));
 
   Triangulation<2> tria;
-  Boundary<2>::FaceVertexNormals normals;
+  std::vector<Point<2> > normals(GeometryInfo<2>::vertices_per_face);
 
   GridGenerator::hyper_ball (tria, Point<2>(1,0), 3);
 
@@ -54,9 +54,13 @@ int main ()
       if (cell->at_boundary(face_no))
         {
           Triangulation<2>::face_iterator face = cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<2> > vs(GeometryInfo<2>::vertices_per_face);
+          for(unsigned int i=0; i<GeometryInfo<2>::vertices_per_face; ++i)
+            vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
+
           for (unsigned int v=0; v<GeometryInfo<2>::vertices_per_face; ++v)
-            Assert ((boundary.normal_vector (face,
+            Assert ((boundary.normal_vector (vs,
                                              face->vertex(v))
                      -
                      normals[v] / normals[v].norm()).norm()
index 7d8c6fb9dca3cb07f3fb29160d52e24fd56391e3..999211d7d5a47b366070aa07fbb09ff4474382e6 100644 (file)
@@ -72,7 +72,8 @@ int main ()
 
   Triangulation<3> tria;
   StraightBoundary<3> boundary;
-  Boundary<3>::FaceVertexNormals normals;
+  std::vector<Point<3> > normals(GeometryInfo<3>::vertices_per_face);
+
   for (unsigned int case_no=0; case_no<2; ++case_no)
     {
       deallog << "Case" << case_no << std::endl;
@@ -82,7 +83,10 @@ int main ()
       for (unsigned int face_no=0; face_no<GeometryInfo<3>::faces_per_cell; ++face_no)
         {
           face=cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<3> > vs(GeometryInfo<3>::vertices_per_face);
+          for(unsigned int i=0; i<GeometryInfo<3>::vertices_per_face; ++i)
+            vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
 
           for (double xi=0; xi<=1; xi+=0.234)
             for (double eta=0; eta<=1; eta+=0.234)
@@ -99,10 +103,10 @@ int main ()
                 normal /= normal.norm();
 
                 deallog << "p=" << p
-                        << ", n=" << boundary.normal_vector (face, p)
+                        << ", n=" << boundary.normal_vector (vs, p)
                         << std::endl;
 
-                Assert ((boundary.normal_vector (face, p)
+                Assert ((boundary.normal_vector (vs, p)
                          -
                          normal).norm()
                         <
index f0ac17e2b26c9a2d0ba604afb6c2dd7052d7ccba..7dc4d1d7555d60b20f43b06c45b2e4aea91afcf9 100644 (file)
@@ -72,7 +72,8 @@ int main ()
 
   Triangulation<2> tria;
   StraightBoundary<2> boundary;
-  Boundary<2>::FaceVertexNormals normals;
+  std::vector<Point<2> > normals(GeometryInfo<2>::vertices_per_face);
+
   for (unsigned int case_no=0; case_no<2; ++case_no)
     {
       deallog << "Case" << case_no << std::endl;
@@ -82,7 +83,10 @@ int main ()
       for (unsigned int face_no=0; face_no<GeometryInfo<2>::faces_per_cell; ++face_no)
         {
           face=cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<2> > vs(GeometryInfo<2>::vertices_per_face);
+          for(unsigned int i=0; i<GeometryInfo<2>::vertices_per_face; ++i)
+            vs[i] = face->vertex(i);
+          boundary.get_normals_at_points(vs, normals);
 
           for (double xi=0; xi<=1; xi+=0.234)
             for (double eta=0; eta<=1; eta+=0.234)
@@ -99,10 +103,10 @@ int main ()
                 normal /= normal.norm();
 
                 deallog << "p=" << p
-                        << ", n=" << boundary.normal_vector (face, p)
+                        << ", n=" << boundary.normal_vector (vs, p)
                         << std::endl;
 
-                Assert ((boundary.normal_vector (face, p)
+                Assert ((boundary.normal_vector (vs, p)
                          -
                          normal).norm()
                         <
index f10d2f493b3c296d65e2faa0c516bc0837eab593..fdcdc855ea72655d1ee22d10f7df19aaae845c18 100644 (file)
@@ -68,7 +68,8 @@ int main ()
 
   Triangulation<3> tria;
   StraightBoundary<3> boundary;
-  Boundary<3>::FaceVertexNormals normals;
+  std::vector<Point<3> > normals(GeometryInfo<3>::vertices_per_face);
+
   for (unsigned int case_no=0; case_no<2; ++case_no)
     {
       deallog << "Case" << case_no << std::endl;
@@ -79,7 +80,10 @@ int main ()
         {
           deallog << " Face" << face_no << std::endl;
           face=cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+         std::vector<Point<3> > v(GeometryInfo<3>::vertices_per_face);
+         for(unsigned int i=0; i<GeometryInfo<3>::vertices_per_face; ++i)
+           v[i] = face->vertex(i);
+          boundary.get_normals_at_points(v, normals);
           for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
             {
               deallog << "  vertex=" << face->vertex(v)
index 0451f25eaaffdebbb6fa1f60edac9194021b0da1..cbfde8409d38be91d7a30697a3b88cf92d811e49 100644 (file)
@@ -43,7 +43,7 @@ int main ()
   HyperBallBoundary<3> boundary (Point<3>(1,0,0));
 
   Triangulation<3> tria;
-  Boundary<3>::FaceVertexNormals normals;
+  std::vector<Point<3> > normals(GeometryInfo<3>::vertices_per_face);
 
   GridGenerator::hyper_ball (tria, Point<3>(1,0,0), 3);
 
@@ -55,7 +55,12 @@ int main ()
         {
           deallog << " Face" << face_no << std::endl;
           Triangulation<3>::face_iterator face = cell->face(face_no);
-          boundary.get_normals_at_vertices(face, normals);
+
+         std::vector<Point<3> > v(GeometryInfo<3>::vertices_per_face);
+         for(unsigned int i=0; i<GeometryInfo<3>::vertices_per_face; ++i)
+           v[i] = face->vertex(i);
+          boundary.get_normals_at_points(v, normals);
+
           for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
             {
               deallog << "  vertex=" << face->vertex(v)

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.