]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
adapted to new boundary structure
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 21 Jun 1999 21:17:31 +0000 (21:17 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 21 Jun 1999 21:17:31 +0000 (21:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@1430 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/dof_test.cc
tests/deal.II/grid_test.cc

index 0fffc3cb8e7d7ad653fdf7a4cbd0ecb9a3878bdf..a0554e7d6cc783314fc950051c649af345c3fe09 100644 (file)
 
 
 template <int dim>
-class Ball :
-  public StraightBoundary<dim> {
+class Ball
+  :
+  public StraightBoundary<dim>
+{
   public:
     virtual Point<dim>
-    get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const {
-      Point<dim> middle = StraightBoundary<dim>::get_new_point_on_line(line);
+    get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const
+      {
+       Point<dim> middle = StraightBoundary<dim>::get_new_point_on_line(line);
       
-      for (int i=0; i<dim; ++i)
-       middle(i) -= .5;
-      middle *= sqrt(dim) / (sqrt(middle.square())*2);
-      for (int i=0; i<dim; ++i)
-       middle(i) += .5;
+       for (int i=0; i<dim; ++i)
+         middle(i) -= .5;
+       middle *= sqrt(dim) / (sqrt(middle.square())*2);
+       for (int i=0; i<dim; ++i)
+         middle(i) += .5;
       
-      return middle;
-    };
+       return middle;
+      };
 
     
     virtual Point<dim>
-    get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const {
-      Point<dim> middle = StraightBoundary<dim>::get_new_point_on_quad(quad);
+    get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const
+      {
+       Point<dim> middle = StraightBoundary<dim>::get_new_point_on_quad(quad);
       
-      for (int i=0; i<dim; ++i)
-       middle(i) -= .5;
-      middle *= sqrt(dim) / (sqrt(middle.square())*2);
-      for (int i=0; i<dim; ++i)
-       middle(i) += .5;
+       for (int i=0; i<dim; ++i)
+         middle(i) -= .5;
+       middle *= sqrt(dim) / (sqrt(middle.square())*2);
+       for (int i=0; i<dim; ++i)
+         middle(i) += .5;
       
-      return middle;
-    };
+       return middle;
+      };
 };
 
 
 template <int dim>
-class CurvedLine :
-  public StraightBoundary<dim> {
+class CurvedLine
+  :
+  public StraightBoundary<dim>
+{
   public:
     virtual Point<dim>
     get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const;
@@ -164,7 +170,8 @@ CurvedLine<dim>::get_new_point_on_quad (const typename Triangulation<dim>::quad_
 
 
 template <int dim>
-class TestCases {
+class TestCases
+{
   public:
     TestCases ();
     virtual ~TestCases ();
@@ -175,6 +182,8 @@ class TestCases {
   private:
     Triangulation<dim> *tria;
     DoFHandler<dim>    *dof;
+    CurvedLine<dim> curved_line;
+    Ball<dim> ball;
 };
 
 
@@ -194,7 +203,8 @@ TestCases<dim>::~TestCases ()
 
 
 template <int dim>
-void TestCases<dim>::create_new () {
+void TestCases<dim>::create_new ()
+{
   if (dof  != 0) delete dof;
   if (tria != 0) delete tria;
 
@@ -209,13 +219,13 @@ void TestCases<dim>::create_new () {
 
 
 template <int dim>
-void TestCases<dim>::run (const unsigned int test_case) {
+void TestCases<dim>::run (const unsigned int test_case)
+{
   cout << "Dimension = " << dim
        << ", Test case = " << test_case << endl
        << endl;
   
   cout << "    Making grid..." << endl;  
-  Boundary<dim> *boundary = 0;
   
   switch (test_case) 
     {
@@ -254,10 +264,8 @@ void TestCases<dim>::run (const unsigned int test_case) {
          };
        
                                         // set the boundary function
-       boundary = (test_case==2 ?
-                   static_cast<Boundary<dim>*>(new Ball<dim>()) :
-                   static_cast<Boundary<dim>*>(new CurvedLine<dim>()));
-       tria->set_boundary (boundary);
+       tria->set_boundary(1, (test_case==2)
+                          ? ((Boundary<dim>&)ball) : ((Boundary<dim>&)curved_line));
        
                                         // refine once
        tria->begin_active()->set_refine_flag();
@@ -325,9 +333,6 @@ void TestCases<dim>::run (const unsigned int test_case) {
                                   // release the lock that dof has to the
                                   // finite element object
   dof->clear ();
-  tria->set_boundary (0);
-  if (boundary)
-    delete boundary;
 };
 
 
index 7bbcd56750fd09ab9f8251a972fe60ff497b7e1e..1f733eb0b4d1b46db3dc3e9fbcac8423686a48a4 100644 (file)
@@ -216,9 +216,9 @@ void test (const int test_case) {
        Ball<dim>       ball;
        CurvedLine<dim> curved_line;
        if (test_case==2)
-         tria.set_boundary (&ball);
+         tria.set_boundary (1, ball);
        else
-         tria.set_boundary (&curved_line);
+         tria.set_boundary (1, curved_line);
        
                                         // refine once
        tria.begin_active()->set_refine_flag();

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.