/[escript]/branches/stage3.1/pycad/test/python/run_pycad_test.py
ViewVC logotype

Diff of /branches/stage3.1/pycad/test/python/run_pycad_test.py

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

revision 2944 by jfenwick, Thu Feb 4 01:42:47 2010 UTC revision 2945 by jfenwick, Wed Feb 24 00:17:46 2010 UTC
# Line 1  Line 1 
1    # -*- coding: utf-8 -*-
2    
3  ########################################################  ########################################################
4  #  #
# Line 3336  class Test_PyCAD_Primitives(unittest.Tes Line 3337  class Test_PyCAD_Primitives(unittest.Tes
3337          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.")
3338          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.")
3339    
3340            # transfinite meshing
3341            v=Volume(s_out)
3342            # l01=Line(p0,p1)
3343            # l15=Line(p1,p5)
3344            # l54=Line(p5,p4)
3345            # l40=Line(p4,p0)
3346            # l23=Line(p2,p3)
3347            # l37=Line(p3,p7)
3348            # l76=Line(p7,p6)
3349            # l62=Line(p6,p2)
3350            # l13=Line(p1,p3)
3351            # l57=Line(p5,p7)
3352            # l02=Line(p0,p2)
3353            # l46=Line(p4,p6)
3354            self.failUnlessRaises(ValueError,v.setRecombination,-10*DEG)
3355            self.failUnless(v.getTransfiniteMeshing() == None, "transfinite meshing set.")
3356            
3357            v.setElementDistribution(6)
3358            self.failUnless( l01.getElementDistribution()[0] == 6 , "element distribution wrong")
3359            self.failUnless( l15.getElementDistribution()[0] == 6 , "element distribution wrong")
3360            self.failUnless( l54.getElementDistribution()[0] == 6 , "element distribution wrong")
3361            self.failUnless( l40.getElementDistribution()[0] == 6 , "element distribution wrong")
3362            self.failUnless( l23.getElementDistribution()[0] == 6 , "element distribution wrong")
3363            self.failUnless( l37.getElementDistribution()[0] == 6 , "element distribution wrong")
3364            self.failUnless( l76.getElementDistribution()[0] == 6 , "element distribution wrong")
3365            self.failUnless( l62.getElementDistribution()[0] == 6 , "element distribution wrong")
3366            self.failUnless( l13.getElementDistribution()[0] == 6 , "element distribution wrong")
3367            self.failUnless( l57.getElementDistribution()[0] == 6 , "element distribution wrong")
3368            self.failUnless( l02.getElementDistribution()[0] == 6 , "element distribution wrong")
3369            self.failUnless( l46.getElementDistribution()[0] == 6 , "element distribution wrong")
3370    
3371            v.setRecombination(30*DEG)
3372            self.failUnless(s1.getRecombination() == 30*DEG, "recombination parameter wrong.")
3373            self.failUnless(s2.getRecombination() == 30*DEG, "recombination parameter wrong.")
3374            self.failUnless(s3.getRecombination() == 30*DEG, "recombination parameter wrong.")
3375            self.failUnless(s4.getRecombination() == 30*DEG, "recombination parameter wrong.")
3376            self.failUnless(s5.getRecombination() == 30*DEG, "recombination parameter wrong.")
3377            self.failUnless(s6.getRecombination() == 30*DEG, "recombination parameter wrong.")
3378            # now the same but without holes:
3379            self.failUnlessRaises(ValueError,v.setTransfiniteMeshing,orientation="X")
3380            v.setTransfiniteMeshing(RuledSurface.RIGHT)
3381            q=v.getTransfiniteMeshing()
3382            self.failUnless(not q == None, "transfinite meshing not set.")
3383            self.failUnless(not s1.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3384            self.failUnless(s1.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3385            self.failUnless(not s2.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3386            self.failUnless(s2.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3387            self.failUnless(not s3.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3388            self.failUnless(s3.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3389            self.failUnless(not s4.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3390            self.failUnless(s4.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3391            self.failUnless(not s5.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3392            self.failUnless(s5.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3393            self.failUnless(not s6.getTransfiniteMeshing() == None, "recombination parameter wrong.")
3394            self.failUnless(s6.getTransfiniteMeshing()[1] == RuledSurface.RIGHT, "orientation is wrong.")
3395     def test_PropertySet1D(self):     def test_PropertySet1D(self):
3396         p0=Point(1.,2.,3.,local_scale=9.)         p0=Point(1.,2.,3.,local_scale=9.)
3397         p1=Point(0.,0.,0.,local_scale=9.)         p1=Point(0.,0.,0.,local_scale=9.)
# Line 4444  Physical Volume(68) = {67}; Line 4500  Physical Volume(68) = {67};
4500  """  """
4501         self.failUnless(scrpt == ref )         self.failUnless(scrpt == ref )
4502    
4503       def test_generate_VolumeTransfinite(self):
4504           d=GMSHDesign(dim=3, element_size=0.01)
4505           p0=Point(-2,-2,-2,0.1)
4506           p1=Point(2,-2,-2,0.1)
4507           p2=Point(-2,2,-2,0.1)
4508           p3=Point(2,2,-2,0.1)
4509           p4=Point(-2,-2,2,0.1)
4510           p5=Point(2,-2,2,0.1)
4511           p6=Point(-2,2,2,0.1)
4512           p7=Point(2,2,2,0.1)
4513           l01=Line(p0,p1)
4514           l15=Line(p1,p5)
4515           l54=Line(p5,p4)
4516           l40=Line(p4,p0)
4517           l23=Line(p2,p3)
4518           l37=Line(p3,p7)
4519           l76=Line(p7,p6)
4520           l62=Line(p6,p2)
4521           l13=Line(p1,p3)
4522           l57=Line(p5,p7)
4523           l02=Line(p0,p2)
4524           l46=Line(p4,p6)
4525           cl1=CurveLoop(l01,l15,l54,l40)
4526           s1=PlaneSurface(cl1)
4527           cl2=CurveLoop(l23,l37,l76,l62)
4528           s2=PlaneSurface(-cl2)
4529           cl3=CurveLoop(l13,l37,-l57,-l15)
4530           s3=PlaneSurface(cl3)
4531           cl4=CurveLoop(l46,l62,-l02,-l40)
4532           s4=PlaneSurface(-cl4)
4533           cl5=CurveLoop(-l01,l02,l23,-l13)
4534           s5=PlaneSurface(-cl5)
4535           cl6=CurveLoop(-l54,l57,l76,-l46)
4536           s6=PlaneSurface(-cl6)
4537           s_out=SurfaceLoop(s1,s2,s3,s4,s5,s6)
4538    
4539           v=Volume(s_out)
4540           v.setElementDistribution(5)
4541           v.setRecombination()
4542           v.setTransfiniteMeshing()
4543           d.addItems(v)
4544    
4545           scrpt=d.getScriptString();
4546           ref = \
4547    """// generated by esys.pycad
4548    General.Terminal = 1;
4549    Point(1) = {-2.0 , -2.0, -2.0 , 0.001 };
4550    Point(2) = {2.0 , -2.0, -2.0 , 0.001 };
4551    Point(3) = {-2.0 , 2.0, -2.0 , 0.001 };
4552    Point(4) = {2.0 , 2.0, -2.0 , 0.001 };
4553    Point(5) = {-2.0 , -2.0, 2.0 , 0.001 };
4554    Point(6) = {2.0 , -2.0, 2.0 , 0.001 };
4555    Point(7) = {-2.0 , 2.0, 2.0 , 0.001 };
4556    Point(8) = {2.0 , 2.0, 2.0 , 0.001 };
4557    Line(9) = {1, 2};
4558    Transfinite Line{9} = 5 Using Progression 1;
4559    Line(10) = {2, 6};
4560    Transfinite Line{10} = 5 Using Progression 1;
4561    Line(11) = {6, 5};
4562    Transfinite Line{11} = 5 Using Progression 1;
4563    Line(12) = {5, 1};
4564    Transfinite Line{12} = 5 Using Progression 1;
4565    Line(13) = {3, 4};
4566    Transfinite Line{13} = 5 Using Progression 1;
4567    Line(14) = {4, 8};
4568    Transfinite Line{14} = 5 Using Progression 1;
4569    Line(15) = {8, 7};
4570    Transfinite Line{15} = 5 Using Progression 1;
4571    Line(16) = {7, 3};
4572    Transfinite Line{16} = 5 Using Progression 1;
4573    Line(17) = {2, 4};
4574    Transfinite Line{17} = 5 Using Progression 1;
4575    Line(18) = {6, 8};
4576    Transfinite Line{18} = 5 Using Progression 1;
4577    Line(19) = {1, 3};
4578    Transfinite Line{19} = 5 Using Progression 1;
4579    Line(20) = {5, 7};
4580    Transfinite Line{20} = 5 Using Progression 1;
4581    Line Loop(21) = {9, 10, 11, 12};
4582    Plane Surface(22) = {21};
4583    Transfinite Surface{22} = {5,1,2,6} Left;
4584    Recombine Surface {22} = 45.0;
4585    Line Loop(23) = {13, 14, 15, 16};
4586    Plane Surface(24) = {-23};
4587    Transfinite Surface{24} = {8,4,3,7} Left;
4588    Recombine Surface {24} = 45.0;
4589    Line Loop(25) = {17, 14, -18, -10};
4590    Plane Surface(26) = {25};
4591    Transfinite Surface{26} = {6,2,4,8} Left;
4592    Recombine Surface {26} = 45.0;
4593    Line Loop(27) = {20, 16, -19, -12};
4594    Plane Surface(28) = {-27};
4595    Transfinite Surface{28} = {3,7,5,1} Left;
4596    Recombine Surface {28} = 45.0;
4597    Line Loop(29) = {-9, 19, 13, -17};
4598    Plane Surface(30) = {-29};
4599    Transfinite Surface{30} = {3,1,2,4} Left;
4600    Recombine Surface {30} = 45.0;
4601    Line Loop(31) = {-11, 18, 15, -20};
4602    Plane Surface(32) = {-31};
4603    Transfinite Surface{32} = {8,6,5,7} Left;
4604    Recombine Surface {32} = 45.0;
4605    Surface Loop(33) = {22, 24, 26, 28, 30, 32};
4606    Volume(34) = {33};
4607    Transfinite Volume{34};
4608    Physical Volume(35) = {34};
4609    """
4610           self.failUnless(scrpt == ref )
4611                
4612     def test_generate_PropertySet1D(self):     def test_generate_PropertySet1D(self):
4613         d=GMSHDesign(dim=2, element_size=0.01)         d=GMSHDesign(dim=2, element_size=0.01)

Legend:
Removed from v.2944  
changed lines
  Added in v.2945

  ViewVC Help
Powered by ViewVC 1.1.26