/[escript]/trunk/pycad/test/python/run_pycad_test.py
ViewVC logotype

Diff of /trunk/pycad/test/python/run_pycad_test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2699 by gross, Mon Aug 24 01:57:34 2009 UTC revision 2700 by gross, Wed Sep 30 08:28:55 2009 UTC
# Line 3336  class Test_PyCAD_Primitives(unittest.Tes Line 3336  class Test_PyCAD_Primitives(unittest.Tes
3336          self.failUnless(cc[cc.index(s6_i)].hasSameOrientation(s6_i),"s6_i in modified object has wrong orientation.")          self.failUnless(cc[cc.index(s6_i)].hasSameOrientation(s6_i),"s6_i in modified object has wrong orientation.")
3337          self.failUnless(s6_i.isColocated(s6_i_m),"s6_i in dilated object as wrong location.")          self.failUnless(s6_i.isColocated(s6_i_m),"s6_i in dilated object as wrong location.")
3338    
    def test_PropertySet0D(self):  
        p0=Point(1.,2.,3.,local_scale=9.)  
        p1=Point(0.,0.,0.,local_scale=9.)  
        p3=Point(8.,6,6,local_scale=9.)  
        p4=Point(8.,6,-6,local_scale=9.)  
         
        # create property set with dim:  
        self.failUnlessRaises(TypeError,PropertySet,"test0",p0, Line(p0,p1))  
   
        ps=PropertySet("test0",p0, p1)  
        self.failUnless(ps.getManifoldClass() == Point, "wrong manifold")  
        self.failUnless(ps.getDim() == 0, "wrong dimension")  
        self.failUnless(ps.getName() == "test0", "wrong name")  
        ps.setName("test1")  
        self.failUnless(ps.getName() == "test1", "wrong new name")  
   
        self.failUnless(ps.getTag() == 7, "wrong tag")  
         
        self.failUnlessRaises(TypeError,ps.addItem, Line(p0,p1))  
        ps.addItem(p3,p4)  
        pp=ps.getItems()  
        self.failUnless(len(pp) == 4, "wrong number of items")  
        self.failUnless(p0 in pp, "p0 missing in items.")  
        self.failUnless(p1 in pp, "p1 missing in items.")  
        self.failUnless(p3 in pp, "p3 missing in items.")  
        self.failUnless(p4 in pp, "p4 missing in items.")  
   
        pp=ps.getPrimitives()  
        self.failUnless(len(pp) == 5, "wrong number of items")  
        self.failUnless(ps in pp, "ps missing in items.")  
        self.failUnless(p0 in pp, "p0 missing in items.")  
        self.failUnless(p1 in pp, "p1 missing in items.")  
        self.failUnless(p3 in pp, "p3 missing in items.")  
        self.failUnless(p4 in pp, "p4 missing in items.")  
         
        ps.clearItems()  
        self.failUnless(len(ps.getItems()) == 0, "cleaning items failed.")  
         
         
3339     def test_PropertySet1D(self):     def test_PropertySet1D(self):
3340         p0=Point(1.,2.,3.,local_scale=9.)         p0=Point(1.,2.,3.,local_scale=9.)
3341         p1=Point(0.,0.,0.,local_scale=9.)         p1=Point(0.,0.,0.,local_scale=9.)
# Line 3812  class Test_PyCAD_Design(unittest.TestCas Line 3773  class Test_PyCAD_Design(unittest.TestCas
3773                
3774         d.setOptions(algorithm=d.TETGEN,optimize_quality=False,smoothing=4)         d.setOptions(algorithm=d.TETGEN,optimize_quality=False,smoothing=4)
3775         cmd=d.getCommandString()         cmd=d.getCommandString()
3776         self.failUnless("gmsh -format msh -2 -algo tetgen -smooth 4 -v 0 -order 1 -o %s %s"%(os.path.join(".","mesh.msh"), os.path.join(".","script.geo")) == cmd%os.path.join(".","script.geo"))         self.failUnless("gmsh -format msh -2 -algo tetgen -smooth 4 -v 3 -order 1 -o %s %s"%(os.path.join(".","mesh.msh"), os.path.join(".","script.geo")) == cmd%os.path.join(".","script.geo"))
3777    
3778         d.setOptions(optimize_quality=True)         d.setOptions(optimize_quality=True)
3779         cmd=d.getCommandString()         cmd=d.getCommandString()
3780         self.failUnless("gmsh -format msh -2 -algo iso -smooth 1 -optimize -v 0 -order 1 -o %s %s"%(os.path.join(".","mesh.msh"), os.path.join(".","script.geo")) == cmd%os.path.join(".","script.geo"))         self.failUnless("gmsh -format msh -2 -algo iso -smooth 1 -optimize -v 3 -order 1 -o %s %s"%(os.path.join(".","mesh.msh"), os.path.join(".","script.geo")) == cmd%os.path.join(".","script.geo"))
3781    
3782         p0=Point(0.,0.,0.)         p0=Point(0.,0.,0.)
3783         p1=Point(1.,0.,0.)         p1=Point(1.,0.,0.)
# Line 3836  class Test_PyCAD_Design(unittest.TestCas Line 3797  class Test_PyCAD_Design(unittest.TestCas
3797         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3798         ref = \         ref = \
3799  """// generated by esys.pycad  """// generated by esys.pycad
3800    General.Terminal = 1;
3801  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };
3802  Point(2) = {1.0 , 0.0, 0.0 , 0.01 };  Point(2) = {1.0 , 0.0, 0.0 , 0.01 };
3803  Point(3) = {1.0 , 1.0, 0.0 , 0.01 };  Point(3) = {1.0 , 1.0, 0.0 , 0.01 };
# Line 3849  Plane Surface(10) = {9}; Line 3811  Plane Surface(10) = {9};
3811  Physical Surface(11) = {10};  Physical Surface(11) = {10};
3812  Physical Line(12) = {5, 8};  Physical Line(12) = {5, 8};
3813  Physical Line(13) = {6, 7};  Physical Line(13) = {6, 7};
3814    Physical Surface(14) = {10};
3815  """  """
3816         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3817    
# Line 3907  Physical Line(13) = {6, 7}; Line 3870  Physical Line(13) = {6, 7};
3870  """  """
3871         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3872    
    def test_generate_Point(self):  
        d=GMSHDesign(dim=2, element_size=0.01)  
        d.addItems(Point(1.,2.,3.,local_scale=9.))  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {1.0 , 2.0, 3.0 , 0.09 };  
 """  
        self.failUnless(scrpt == ref )  
     
3873    
3874     def test_generate_Spline(self):     def test_generate_Spline(self):
3875         d=GMSHDesign(dim=2, element_size=0.01)         d=GMSHDesign(dim=2, element_size=0.01)
# Line 3931  Point(1) = {1.0 , 2.0, 3.0 , 0.09 }; Line 3883  Point(1) = {1.0 , 2.0, 3.0 , 0.09 };
3883         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3884         ref = \         ref = \
3885  """// generated by esys.pycad  """// generated by esys.pycad
3886    General.Terminal = 1;
3887  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
3888  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
3889  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
3890  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };
3891  Spline(5) = {1, 2, 3, 4};  Spline(5) = {1, 2, 3, 4};
3892    Physical Line(6) = {5};
3893  """  """
3894         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3895    
# Line 3952  Spline(5) = {1, 2, 3, 4}; Line 3906  Spline(5) = {1, 2, 3, 4};
3906         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3907         ref = \         ref = \
3908  """// generated by esys.pycad  """// generated by esys.pycad
3909    General.Terminal = 1;
3910  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
3911  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
3912  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
3913  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };
3914  Spline(5) = {1, 2, 3, 4};  Spline(5) = {1, 2, 3, 4};
3915    Physical Line(6) = {5};
3916  """  """
3917         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3918    
# Line 3972  Spline(5) = {1, 2, 3, 4}; Line 3928  Spline(5) = {1, 2, 3, 4};
3928         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3929         ref = \         ref = \
3930  """// generated by esys.pycad  """// generated by esys.pycad
3931    General.Terminal = 1;
3932  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
3933  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
3934  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
3935  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };
3936  Bezier(5) = {1, 2, 3, 4};  Bezier(5) = {1, 2, 3, 4};
3937    Physical Line(6) = {5};
3938  """  """
3939         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3940    
# Line 3993  Bezier(5) = {1, 2, 3, 4}; Line 3951  Bezier(5) = {1, 2, 3, 4};
3951         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3952         ref = \         ref = \
3953  """// generated by esys.pycad  """// generated by esys.pycad
3954    General.Terminal = 1;
3955  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
3956  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
3957  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
3958  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };
3959  BSpline(5) = {1, 2, 3, 4};  BSpline(5) = {1, 2, 3, 4};
3960    Physical Line(6) = {5};
3961  """  """
3962         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3963    
# Line 4015  BSpline(5) = {1, 2, 3, 4}; Line 3975  BSpline(5) = {1, 2, 3, 4};
3975         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3976         ref = \         ref = \
3977  """// generated by esys.pycad  """// generated by esys.pycad
3978    General.Terminal = 1;
3979  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
3980  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
3981  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
3982  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  Point(4) = {3.0 , 3.0, 3.0 , 0.004 };
3983  BSpline(6) = {1, 2, 3, 4};  BSpline(6) = {1, 2, 3, 4};
3984    Physical Line(7) = {6};
3985  """  """
3986         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
3987    
# Line 4033  BSpline(6) = {1, 2, 3, 4}; Line 3995  BSpline(6) = {1, 2, 3, 4};
3995         scrpt=d.getScriptString()         scrpt=d.getScriptString()
3996         ref = \         ref = \
3997  """// generated by esys.pycad  """// generated by esys.pycad
3998    General.Terminal = 1;
3999  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4000  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4001  Line(3) = {1, 2};  Line(3) = {1, 2};
4002    Physical Line(4) = {3};
4003  """  """
4004         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4005    
# Line 4050  Line(3) = {1, 2}; Line 4014  Line(3) = {1, 2};
4014         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4015         ref = \         ref = \
4016  """// generated by esys.pycad  """// generated by esys.pycad
4017    General.Terminal = 1;
4018  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4019  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4020  Line(3) = {1, 2};  Line(3) = {1, 2};
4021    Physical Line(4) = {3};
4022  """  """
4023         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4024    
# Line 4067  Line(3) = {1, 2}; Line 4033  Line(3) = {1, 2};
4033         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4034         ref = \         ref = \
4035  """// generated by esys.pycad  """// generated by esys.pycad
4036    General.Terminal = 1;
4037  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4038  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4039  Point(3) = {1.0 , 2.0, 3.0 , 0.01 };  Point(3) = {1.0 , 2.0, 3.0 , 0.01 };
4040  Circle(4) = {2, 1, 3};  Circle(4) = {2, 1, 3};
4041    Physical Line(5) = {4};
4042  """  """
4043         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4044    
# Line 4086  Circle(4) = {2, 1, 3}; Line 4054  Circle(4) = {2, 1, 3};
4054         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4055         ref = \         ref = \
4056  """// generated by esys.pycad  """// generated by esys.pycad
4057    General.Terminal = 1;
4058  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4059  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4060  Point(3) = {1.0 , 2.0, 3.0 , 0.01 };  Point(3) = {1.0 , 2.0, 3.0 , 0.01 };
4061  Circle(4) = {2, 1, 3};  Circle(4) = {2, 1, 3};
4062    Physical Line(5) = {4};
4063  """  """
4064         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4065         return         return
# Line 4106  Circle(4) = {2, 1, 3}; Line 4076  Circle(4) = {2, 1, 3};
4076         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4077         ref = \         ref = \
4078  """// generated by esys.pycad  """// generated by esys.pycad
4079    General.Terminal = 1;
4080  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4081  Point(2) = {0.0 , 1.0, 0.0 , 0.001 };  Point(2) = {0.0 , 1.0, 0.0 , 0.001 };
4082  Point(3) = {1.0 , 1.0, 1.0 , 0.002 };  Point(3) = {1.0 , 1.0, 1.0 , 0.002 };
4083  Point(4) = {1.0 , 2.0, 3.0 , 0.01 };  Point(4) = {1.0 , 2.0, 3.0 , 0.01 };
4084  Ellipse(5) = {3, 1, 2, 4};  Ellipse(5) = {3, 1, 2, 4};
4085    Physical Line(6) = {5};
4086  """  """
4087         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4088    
# Line 4127  Ellipse(5) = {3, 1, 2, 4}; Line 4099  Ellipse(5) = {3, 1, 2, 4};
4099         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4100         ref = \         ref = \
4101  """// generated by esys.pycad  """// generated by esys.pycad
4102    General.Terminal = 1;
4103  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4104  Point(2) = {0.0 , 1.0, 0.0 , 0.001 };  Point(2) = {0.0 , 1.0, 0.0 , 0.001 };
4105  Point(3) = {1.0 , 1.0, 1.0 , 0.002 };  Point(3) = {1.0 , 1.0, 1.0 , 0.002 };
4106  Point(4) = {1.0 , 2.0, 3.0 , 0.01 };  Point(4) = {1.0 , 2.0, 3.0 , 0.01 };
4107  Ellipse(5) = {3, 1, 2, 4};  Ellipse(5) = {3, 1, 2, 4};
4108  """  Physical Line(6) = {5};
        self.failUnless(scrpt == ref )  
   
    def test_generate_CurveLoop(self):  
        d=GMSHDesign(dim=2, element_size=0.01)  
        p0=Point(0,0,0,0.1)  
        p1=Point(1,1,1,0.2)  
        p2=Point(2,2,2,0.3)  
        p3=Point(3,3,3,0.4)  
        p4=Point(1,2,3)  
   
        l01=Line(p0,p1)  
        l12=Arc(p3,p1,p2)  
        l20=Spline(p2,p4,p0)  
   
        lx=Line(p2,p3)  
        ly=Line(p3,p1)  
   
        d.addItems(CurveLoop(l01,l12,l20))  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  
 Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  
 Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  
 Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  
 Point(5) = {1.0 , 2.0, 3.0 , 0.01 };  
 Line(6) = {1, 2};  
 Circle(7) = {2, 4, 3};  
 Spline(8) = {3, 5, 1};  
 Line Loop(11) = {6, 7, 8};  
 """  
        self.failUnless(scrpt == ref )  
   
         
    def test_generate_ReverseCurveLoop(self):  
        d=GMSHDesign(dim=2, element_size=0.01)  
        p0=Point(0,0,0,0.1)  
        p1=Point(1,1,1,0.2)  
        p2=Point(2,2,2,0.3)  
        p3=Point(3,3,3,0.4)  
        p4=Point(1,2,3)  
   
        l01=Line(p0,p1)  
        l12=Arc(p3,p1,p2)  
        l20=Spline(p2,p4,p0)  
   
        lx=Line(p2,p3)  
        ly=Line(p3,p1)  
   
        CC0=CurveLoop(l01,l20,l12)  
        d.addItems(-CC0)  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  
 Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  
 Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  
 Point(4) = {3.0 , 3.0, 3.0 , 0.004 };  
 Point(5) = {1.0 , 2.0, 3.0 , 0.01 };  
 Line(6) = {1, 2};  
 Circle(7) = {2, 4, 3};  
 Spline(8) = {3, 5, 1};  
 Line Loop(11) = {6, 8, 7};  
4109  """  """
4110         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4111    
# Line 4226  Line Loop(11) = {6, 8, 7}; Line 4134  Line Loop(11) = {6, 8, 7};
4134         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4135         ref = \         ref = \
4136  """// generated by esys.pycad  """// generated by esys.pycad
4137    General.Terminal = 1;
4138  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4139  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4140  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
# Line 4236  Circle(8) = {2, 4, 3}; Line 4145  Circle(8) = {2, 4, 3};
4145  Spline(12) = {3, 5, 1};  Spline(12) = {3, 5, 1};
4146  Line Loop(13) = {7, 8, 12};  Line Loop(13) = {7, 8, 12};
4147  Ruled Surface(16) = {13};  Ruled Surface(16) = {13};
4148    Physical Surface(17) = {16};
4149  """  """
4150         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4151    
# Line 4265  Ruled Surface(16) = {13}; Line 4175  Ruled Surface(16) = {13};
4175         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4176         ref = \         ref = \
4177  """// generated by esys.pycad  """// generated by esys.pycad
4178    General.Terminal = 1;
4179  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  Point(1) = {0.0 , 0.0, 0.0 , 0.001 };
4180  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };  Point(2) = {1.0 , 1.0, 1.0 , 0.002 };
4181  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };  Point(3) = {2.0 , 2.0, 2.0 , 0.003 };
# Line 4275  Circle(8) = {2, 4, 3}; Line 4186  Circle(8) = {2, 4, 3};
4186  Spline(12) = {3, 5, 1};  Spline(12) = {3, 5, 1};
4187  Line Loop(13) = {7, 8, 12};  Line Loop(13) = {7, 8, 12};
4188  Ruled Surface(16) = {13};  Ruled Surface(16) = {13};
4189    Physical Surface(17) = {16};
4190  """  """
4191         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4192    
# Line 4319  Ruled Surface(16) = {13}; Line 4231  Ruled Surface(16) = {13};
4231         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4232         ref = \         ref = \
4233  """// generated by esys.pycad  """// generated by esys.pycad
4234    General.Terminal = 1;
4235  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };
4236  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };
4237  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };
# Line 4336  Line(18) = {7, 5}; Line 4249  Line(18) = {7, 5};
4249  Line Loop(23) = {10, 11, 12, 13};  Line Loop(23) = {10, 11, 12, 13};
4250  Line Loop(24) = {16, 17, 18};  Line Loop(24) = {16, 17, 18};
4251  Plane Surface(29) = {23, 24};  Plane Surface(29) = {23, 24};
4252    Physical Surface(30) = {29};
4253  """  """
4254         self.failUnless(scrpt == ref)         self.failUnless(scrpt == ref)
4255    
# Line 4360  Plane Surface(29) = {23, 24}; Line 4274  Plane Surface(29) = {23, 24};
4274         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4275         ref = \         ref = \
4276  """// generated by esys.pycad  """// generated by esys.pycad
4277    General.Terminal = 1;
4278  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };
4279  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };
4280  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };
# Line 4376  Line Loop(9) = {5, 6, 7, 8}; Line 4291  Line Loop(9) = {5, 6, 7, 8};
4291  Plane Surface(10) = {9};  Plane Surface(10) = {9};
4292  Transfinite Surface{10} = {4,1,2,3} Left;  Transfinite Surface{10} = {4,1,2,3} Left;
4293  Recombine Surface {10} = 30.0;  Recombine Surface {10} = 30.0;
4294    Physical Surface(11) = {10};
4295    
4296  """  """
4297         self.failUnless(scrpt.strip() == ref.strip())         self.failUnless(scrpt.strip() == ref.strip())
4298    
    def test_generate_SurfaceLoop(self):  
        d=GMSHDesign(dim=3, element_size=0.01)  
        p0=Point( 0, 0, 0,0.1)  
        p1=Point(10, 0, 0,0.1)  
        p2=Point( 0,10, 0,0.1)  
        p3=Point(10,10, 0,0.1)  
        p4=Point( 0, 0,10,0.1)  
        p5=Point(10, 0,10,0.1)  
        p6=Point( 0,10,10,0.1)  
        p7=Point(10,10,10,0.1)  
   
        q0=Point( 4, 0, 4,0.1)  
        q1=Point( 6, 0, 4,0.1)  
        q2=Point( 4,10, 4,0.1)  
        q3=Point( 6,10, 4,0.1)  
        q4=Point( 4, 0, 6,0.1)  
        q5=Point( 6, 0, 6,0.1)  
        q6=Point( 4,10, 6,0.1)  
        q7=Point( 6,10, 6,0.1)  
   
        l01=Line(p0,p1)  
        l15=Line(p1,p5)  
        l54=Line(p5,p4)  
        l04=Line(p4,p0)  
   
        l13=Line(p1,p3)  
        l37=Line(p3,p7)  
        l75=Line(p7,p5)  
        l67=Line(p6,p7)  
        l26=Line(p2,p6)  
        l32=Line(p3,p2)  
        l20=Line(p2,p0)  
        l46=Line(p4,p6)  
   
        m01=Line(q0,q1)  
        m15=Line(q1,q5)  
        m54=Line(q5,q4)  
        m40=Line(q4,q0)  
        m23=Line(q2,q3)  
        m37=Line(q3,q7)  
        m76=Line(q7,q6)  
        m62=Line(q6,q2)  
   
        m02=Line(q0,q2)  
        m13=Line(q1,q3)  
        m46=Line(q4,q6)  
        m57=Line(q5,q7)  
   
        cl_l1=CurveLoop(l01,l15,l54,l04)  
        cl_m1=CurveLoop(m01,m15,m54,m40)  
        s1=PlaneSurface(cl_l1,holes=[cl_m1])  
        s1_v=PlaneSurface(cl_l1)  
   
        cl_l2=CurveLoop(-l15,l13,l37,l75)  
        s2=PlaneSurface(cl_l2)  
   
        cl_l3=CurveLoop(l32,-l37,l67,l26)  
        cl_m3=CurveLoop(-m23,-m37,-m76,-m62)  
        s3=PlaneSurface(cl_l3,holes=[cl_m3])  
        s3_v=PlaneSurface(cl_l3)  
       
       
        cl_l4=CurveLoop(l20,-l26,l46,-l04)  
        s4=PlaneSurface(cl_l4)  
   
        cl_l5=CurveLoop(l32,l20,l01,l13)  
        s5=PlaneSurface(-cl_l5)  
   
        cl_l6=CurveLoop(l67,l75,l54,l46)  
        s6=PlaneSurface(-cl_l6)  
   
        cl_m7=CurveLoop(m13,m37,-m57,-m15)  
        s7=PlaneSurface(cl_m7)  
           
        cl_m8=CurveLoop(m57,m76,-m46,-m54)  
        s8=PlaneSurface(cl_m8)  
   
        cl_m9=CurveLoop(m46,m62,-m02,-m40)  
        s9=PlaneSurface(cl_m9)  
   
        cl_m10=CurveLoop(-m01,m02,m23,-m13)  
        s10=PlaneSurface(cl_m10)  
   
        d.addItems(SurfaceLoop(s1,s2,s3,s4,s5,s6,-s7,-s8,-s9,-s10))  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  
 Point(2) = {10.0 , 0.0, 0.0 , 0.001 };  
 Point(3) = {0.0 , 10.0, 0.0 , 0.001 };  
 Point(4) = {10.0 , 10.0, 0.0 , 0.001 };  
 Point(5) = {0.0 , 0.0, 10.0 , 0.001 };  
 Point(6) = {10.0 , 0.0, 10.0 , 0.001 };  
 Point(7) = {0.0 , 10.0, 10.0 , 0.001 };  
 Point(8) = {10.0 , 10.0, 10.0 , 0.001 };  
 Point(9) = {4.0 , 0.0, 4.0 , 0.001 };  
 Point(10) = {6.0 , 0.0, 4.0 , 0.001 };  
 Point(11) = {4.0 , 10.0, 4.0 , 0.001 };  
 Point(12) = {6.0 , 10.0, 4.0 , 0.001 };  
 Point(13) = {4.0 , 0.0, 6.0 , 0.001 };  
 Point(14) = {6.0 , 0.0, 6.0 , 0.001 };  
 Point(15) = {4.0 , 10.0, 6.0 , 0.001 };  
 Point(16) = {6.0 , 10.0, 6.0 , 0.001 };  
 Line(17) = {1, 2};  
 Line(18) = {2, 6};  
 Line(19) = {6, 5};  
 Line(20) = {5, 1};  
 Line(21) = {2, 4};  
 Line(22) = {4, 8};  
 Line(23) = {8, 6};  
 Line(24) = {7, 8};  
 Line(25) = {3, 7};  
 Line(26) = {4, 3};  
 Line(27) = {3, 1};  
 Line(28) = {5, 7};  
 Line(29) = {9, 10};  
 Line(30) = {10, 14};  
 Line(31) = {14, 13};  
 Line(32) = {13, 9};  
 Line(33) = {11, 12};  
 Line(34) = {12, 16};  
 Line(35) = {16, 15};  
 Line(36) = {15, 11};  
 Line(37) = {9, 11};  
 Line(38) = {10, 12};  
 Line(39) = {13, 15};  
 Line(40) = {14, 16};  
 Line Loop(41) = {17, 18, 19, 20};  
 Line Loop(42) = {29, 30, 31, 32};  
 Plane Surface(43) = {41, 42};  
 Line Loop(45) = {-18, 21, 22, 23};  
 Plane Surface(46) = {45};  
 Line Loop(47) = {26, -22, 24, 25};  
 Line Loop(48) = {-33, -34, -35, -36};  
 Plane Surface(49) = {47, 48};  
 Line Loop(51) = {27, -25, 28, -20};  
 Plane Surface(52) = {51};  
 Line Loop(53) = {26, 27, 17, 21};  
 Plane Surface(54) = {-53};  
 Line Loop(55) = {24, 23, 19, 28};  
 Plane Surface(56) = {-55};  
 Line Loop(57) = {38, 34, -40, -30};  
 Plane Surface(58) = {57};  
 Line Loop(59) = {40, 35, -39, -31};  
 Plane Surface(60) = {59};  
 Line Loop(61) = {39, 36, -37, -32};  
 Plane Surface(62) = {61};  
 Line Loop(63) = {-29, 37, 33, -38};  
 Plane Surface(64) = {63};  
 Surface Loop(65) = {43, 46, 49, 52, 54, 56, -58, -60, -62, -64};  
 """  
        self.failUnless(scrpt == ref )  
   
    def test_generate_ReverseSurfaceLoop(self):  
        d=GMSHDesign(dim=3, element_size=0.01)  
        p0=Point( 0, 0, 0,0.1)  
        p1=Point(10, 0, 0,0.1)  
        p2=Point( 0,10, 0,0.1)  
        p3=Point(10,10, 0,0.1)  
        p4=Point( 0, 0,10,0.1)  
        p5=Point(10, 0,10,0.1)  
        p6=Point( 0,10,10,0.1)  
        p7=Point(10,10,10,0.1)  
   
        q0=Point( 4, 0, 4,0.1)  
        q1=Point( 6, 0, 4,0.1)  
        q2=Point( 4,10, 4,0.1)  
        q3=Point( 6,10, 4,0.1)  
        q4=Point( 4, 0, 6,0.1)  
        q5=Point( 6, 0, 6,0.1)  
        q6=Point( 4,10, 6,0.1)  
        q7=Point( 6,10, 6,0.1)  
   
        l01=Line(p0,p1)  
        l15=Line(p1,p5)  
        l54=Line(p5,p4)  
        l04=Line(p4,p0)  
   
        l13=Line(p1,p3)  
        l37=Line(p3,p7)  
        l75=Line(p7,p5)  
        l67=Line(p6,p7)  
        l26=Line(p2,p6)  
        l32=Line(p3,p2)  
        l20=Line(p2,p0)  
        l46=Line(p4,p6)  
   
        m01=Line(q0,q1)  
        m15=Line(q1,q5)  
        m54=Line(q5,q4)  
        m40=Line(q4,q0)  
        m23=Line(q2,q3)  
        m37=Line(q3,q7)  
        m76=Line(q7,q6)  
        m62=Line(q6,q2)  
   
        m02=Line(q0,q2)  
        m13=Line(q1,q3)  
        m46=Line(q4,q6)  
        m57=Line(q5,q7)  
   
        cl_l1=CurveLoop(l01,l15,l54,l04)  
        cl_m1=CurveLoop(m01,m15,m54,m40)  
        s1=PlaneSurface(cl_l1,holes=[cl_m1])  
        s1_v=PlaneSurface(cl_l1)  
   
        cl_l2=CurveLoop(-l15,l13,l37,l75)  
        s2=PlaneSurface(cl_l2)  
   
        cl_l3=CurveLoop(l32,-l37,l67,l26)  
        cl_m3=CurveLoop(-m23,-m37,-m76,-m62)  
        s3=PlaneSurface(cl_l3,holes=[cl_m3])  
        s3_v=PlaneSurface(cl_l3)  
       
       
        cl_l4=CurveLoop(l20,-l26,l46,-l04)  
        s4=PlaneSurface(cl_l4)  
   
        cl_l5=CurveLoop(l32,l20,l01,l13)  
        s5=PlaneSurface(-cl_l5)  
   
        cl_l6=CurveLoop(l67,l75,l54,l46)  
        s6=PlaneSurface(-cl_l6)  
   
        cl_m7=CurveLoop(m13,m37,-m57,-m15)  
        s7=PlaneSurface(cl_m7)  
           
        cl_m8=CurveLoop(m57,m76,-m46,-m54)  
        s8=PlaneSurface(cl_m8)  
   
        cl_m9=CurveLoop(m46,m62,-m02,-m40)  
        s9=PlaneSurface(cl_m9)  
   
        cl_m10=CurveLoop(-m01,m02,m23,-m13)  
        s10=PlaneSurface(cl_m10)  
   
        CC0=SurfaceLoop(s1,s2,s3,s4,s5,s6,-s7,-s8,-s9,-s10)  
        s=-CC0  
        d.addItems(-CC0)  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {0.0 , 0.0, 0.0 , 0.001 };  
 Point(2) = {10.0 , 0.0, 0.0 , 0.001 };  
 Point(3) = {0.0 , 10.0, 0.0 , 0.001 };  
 Point(4) = {10.0 , 10.0, 0.0 , 0.001 };  
 Point(5) = {0.0 , 0.0, 10.0 , 0.001 };  
 Point(6) = {10.0 , 0.0, 10.0 , 0.001 };  
 Point(7) = {0.0 , 10.0, 10.0 , 0.001 };  
 Point(8) = {10.0 , 10.0, 10.0 , 0.001 };  
 Point(9) = {4.0 , 0.0, 4.0 , 0.001 };  
 Point(10) = {6.0 , 0.0, 4.0 , 0.001 };  
 Point(11) = {4.0 , 10.0, 4.0 , 0.001 };  
 Point(12) = {6.0 , 10.0, 4.0 , 0.001 };  
 Point(13) = {4.0 , 0.0, 6.0 , 0.001 };  
 Point(14) = {6.0 , 0.0, 6.0 , 0.001 };  
 Point(15) = {4.0 , 10.0, 6.0 , 0.001 };  
 Point(16) = {6.0 , 10.0, 6.0 , 0.001 };  
 Line(17) = {1, 2};  
 Line(18) = {2, 6};  
 Line(19) = {6, 5};  
 Line(20) = {5, 1};  
 Line(21) = {2, 4};  
 Line(22) = {4, 8};  
 Line(23) = {8, 6};  
 Line(24) = {7, 8};  
 Line(25) = {3, 7};  
 Line(26) = {4, 3};  
 Line(27) = {3, 1};  
 Line(28) = {5, 7};  
 Line(29) = {9, 10};  
 Line(30) = {10, 14};  
 Line(31) = {14, 13};  
 Line(32) = {13, 9};  
 Line(33) = {11, 12};  
 Line(34) = {12, 16};  
 Line(35) = {16, 15};  
 Line(36) = {15, 11};  
 Line(37) = {9, 11};  
 Line(38) = {10, 12};  
 Line(39) = {13, 15};  
 Line(40) = {14, 16};  
 Line Loop(41) = {17, 18, 19, 20};  
 Line Loop(42) = {29, 30, 31, 32};  
 Plane Surface(43) = {41, 42};  
 Line Loop(45) = {-18, 21, 22, 23};  
 Plane Surface(46) = {45};  
 Line Loop(47) = {26, -22, 24, 25};  
 Line Loop(48) = {-33, -34, -35, -36};  
 Plane Surface(49) = {47, 48};  
 Line Loop(51) = {27, -25, 28, -20};  
 Plane Surface(52) = {51};  
 Line Loop(53) = {26, 27, 17, 21};  
 Plane Surface(54) = {-53};  
 Line Loop(55) = {24, 23, 19, 28};  
 Plane Surface(56) = {-55};  
 Line Loop(57) = {38, 34, -40, -30};  
 Plane Surface(58) = {57};  
 Line Loop(59) = {40, 35, -39, -31};  
 Plane Surface(60) = {59};  
 Line Loop(61) = {39, 36, -37, -32};  
 Plane Surface(62) = {61};  
 Line Loop(63) = {-29, 37, 33, -38};  
 Plane Surface(64) = {63};  
 Surface Loop(65) = {43, 46, 49, 52, 54, 56, -58, -60, -62, -64};  
 """  
        self.failUnless(scrpt == ref )  
4299    
4300     def test_generate_Volume(self):     def test_generate_Volume(self):
4301         d=GMSHDesign(dim=3, element_size=0.01)         d=GMSHDesign(dim=3, element_size=0.01)
# Line 4765  Surface Loop(65) = {43, 46, 49, 52, 54, Line 4372  Surface Loop(65) = {43, 46, 49, 52, 54,
4372         scrpt=d.getScriptString();         scrpt=d.getScriptString();
4373         ref = \         ref = \
4374  """// generated by esys.pycad  """// generated by esys.pycad
4375    General.Terminal = 1;
4376  Point(1) = {-2.0 , -2.0, -2.0 , 0.001 };  Point(1) = {-2.0 , -2.0, -2.0 , 0.001 };
4377  Point(2) = {2.0 , -2.0, -2.0 , 0.001 };  Point(2) = {2.0 , -2.0, -2.0 , 0.001 };
4378  Point(3) = {-2.0 , 2.0, -2.0 , 0.001 };  Point(3) = {-2.0 , 2.0, -2.0 , 0.001 };
# Line 4832  Line Loop(64) = {-44, 51, 48, -53}; Line 4440  Line Loop(64) = {-44, 51, 48, -53};
4440  Plane Surface(65) = {-64};  Plane Surface(65) = {-64};
4441  Surface Loop(66) = {55, 57, 59, 61, 63, 65};  Surface Loop(66) = {55, 57, 59, 61, 63, 65};
4442  Volume(67) = {33, 66};  Volume(67) = {33, 66};
4443    Physical Volume(68) = {67};
4444  """  """
4445         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4446    
    def test_generate_PropertySet0D(self):  
        d=GMSHDesign(dim=2, element_size=0.01)  
        p0=Point(1.,2.,3.,local_scale=9.)  
        p1=Point(0.,0.,0.,local_scale=9.)  
        p3=Point(8.,6,6,local_scale=9.)  
        p4=Point(8.,6,-6,local_scale=9.)  
         
        d.addItems(PropertySet("test0",p0, p1, p3, p4))  
   
        scrpt=d.getScriptString()  
        ref = \  
 """// generated by esys.pycad  
 Point(1) = {1.0 , 2.0, 3.0 , 0.09 };  
 Point(2) = {0.0 , 0.0, 0.0 , 0.09 };  
 Point(3) = {8.0 , 6.0, 6.0 , 0.09 };  
 Point(4) = {8.0 , 6.0, -6.0 , 0.09 };  
 Physical Point(5) = {1, 2, 3, 4};  
 """  
        self.failUnless(scrpt == ref )  
4447                
4448     def test_generate_PropertySet1D(self):     def test_generate_PropertySet1D(self):
4449         d=GMSHDesign(dim=2, element_size=0.01)         d=GMSHDesign(dim=2, element_size=0.01)
# Line 4871  Physical Point(5) = {1, 2, 3, 4}; Line 4461  Physical Point(5) = {1, 2, 3, 4};
4461         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4462         ref = \         ref = \
4463  """// generated by esys.pycad  """// generated by esys.pycad
4464    General.Terminal = 1;
4465  Point(1) = {1.0 , 2.0, 3.0 , 0.09 };  Point(1) = {1.0 , 2.0, 3.0 , 0.09 };
4466  Point(2) = {0.0 , 0.0, 0.0 , 0.09 };  Point(2) = {0.0 , 0.0, 0.0 , 0.09 };
4467  Point(3) = {8.0 , 6.0, 6.0 , 0.09 };  Point(3) = {8.0 , 6.0, 6.0 , 0.09 };
# Line 4914  Physical Line(8) = {5, 6, 7}; Line 4505  Physical Line(8) = {5, 6, 7};
4505         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4506         ref = \         ref = \
4507  """// generated by esys.pycad  """// generated by esys.pycad
4508    General.Terminal = 1;
4509  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };  Point(1) = {0.0 , 0.0, 0.0 , 0.01 };
4510  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };  Point(2) = {10.0 , 0.0, 0.0 , 0.02 };
4511  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };  Point(3) = {10.0 , 10.0, 0.0 , 0.03 };
# Line 5013  Physical Surface(18) = {17}; Line 4605  Physical Surface(18) = {17};
4605         scrpt=d.getScriptString()         scrpt=d.getScriptString()
4606         ref = \         ref = \
4607  """// generated by esys.pycad  """// generated by esys.pycad
4608    General.Terminal = 1;
4609  Point(1) = {-2.0 , -2.0, -2.0 , 0.001 };  Point(1) = {-2.0 , -2.0, -2.0 , 0.001 };
4610  Point(2) = {2.0 , -2.0, -2.0 , 0.001 };  Point(2) = {2.0 , -2.0, -2.0 , 0.001 };
4611  Point(3) = {-2.0 , 2.0, -2.0 , 0.001 };  Point(3) = {-2.0 , 2.0, -2.0 , 0.001 };

Legend:
Removed from v.2699  
changed lines
  Added in v.2700

  ViewVC Help
Powered by ViewVC 1.1.26