← Back to team overview

dolfin team mailing list archive

Re: Fwd: [Merge] lp:~evanlezar/dolfin/elezar into lp:dolfin

 

Yes, I will look at it later.

--
Anders


On Sat, Jul 09, 2011 at 12:30:13PM +0900, Evan Lezar wrote:
> Hi,
>
> There has been no response on my earlier merge request, so I thought I would
> just ping the list as well.
>
> Would someone be able to merge these changes that extend the gmsh physical
> region support of mesh-converter.py.
>
> Thanks
> Evan

> === modified file 'site-packages/dolfin_utils/meshconvert.py'
> --- site-packages/dolfin_utils/meshconvert.py	2011-07-01 15:46:37 +0000
> +++ site-packages/dolfin_utils/meshconvert.py	2011-07-07 11:01:36 +0000
> @@ -472,7 +472,7 @@
>
>              data = [int(0*k) for k in range(len(facets_to_check)) ]
>              for i, physical_region in enumerate(physical_regions):
> -                nodes = [n-1 for n in vertices_used_for_dim[highest_dim-1][2*i:(2*i+highest_dim)]]
> +                nodes = [n-1 for n in vertices_used_for_dim[highest_dim-1][highest_dim*i:(highest_dim*i+highest_dim)]]
>                  nodes.sort()
>
>                  if physical_region != 0:
>
> === added file 'test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.geo'
> --- test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.geo	1970-01-01 00:00:00 +0000
> +++ test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.geo	2011-07-07 11:01:36 +0000
> @@ -0,0 +1,39 @@
> +cl1 = 1;
> +Point(1) = {0, 0, 0, cl1};
> +Point(2) = {1, 0, 0, cl1};
> +Point(3) = {1, 1, 0, cl1};
> +Point(4) = {0, 1, 0, cl1};
> +Point(5) = {0, 0, 1, cl1};
> +Point(6) = {1, 0, 1, cl1};
> +Point(7) = {1, 1, 1, cl1};
> +Point(8) = {0, 1, 1, cl1};
> +Line(1) = {1, 2};
> +Line(2) = {2, 3};
> +Line(3) = {3, 4};
> +Line(4) = {4, 1};
> +Line(5) = {5, 6};
> +Line(6) = {6, 7};
> +Line(7) = {7, 8};
> +Line(8) = {8, 5};
> +Line(9) = {1, 5};
> +Line(10) = {2, 6};
> +Line(11) = {3, 7};
> +Line(12) = {4, 8};
> +Line Loop(15) = {1, 2, 3, 4};
> +Plane Surface(15) = {15};
> +Line Loop(17) = {5, 6, 7, 8};
> +Plane Surface(17) = {17};
> +Line Loop(19) = {10, -5, -9, 1};
> +Plane Surface(19) = {19};
> +Line Loop(21) = {2, 11, -6, -10};
> +Plane Surface(21) = {21};
> +Line Loop(22) = {7, -12, -3, 11};
> +Plane Surface(22) = {22};
> +Line Loop(24) = {4, 9, -8, -12};
> +Plane Surface(24) = {24};
> +Surface Loop(26) = {17, 19, 21, 15, 22, 24};
> +Volume(26) = {26};
> +PEC = 999;
> +Physical Surface(PEC) = {17};
> +cl1 = 0;
> +Physical Volume(cl1) = {26};
>
> === added file 'test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.msh'
> --- test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.msh	1970-01-01 00:00:00 +0000
> +++ test/unit/meshconvert/python/data/gmsh_test_facet_regions_3D_1.msh	2011-07-07 11:01:36 +0000
> @@ -0,0 +1,51 @@
> +$MeshFormat
> +2.2 0 8
> +$EndMeshFormat
> +$Nodes
> +14
> +1 0 0 0
> +2 1 0 0
> +3 1 1 0
> +4 0 1 0
> +5 0 0 1
> +6 1 0 1
> +7 1 1 1
> +8 0 1 1
> +9 0.5 0.5 0
> +10 0.5 0.5 1
> +11 0.5 0 0.5
> +12 1 0.5 0.5
> +13 0.5 1 0.5
> +14 0 0.5 0.5
> +$EndNodes
> +$Elements
> +28
> +1 2 2 999 17 5 6 10
> +2 2 2 999 17 7 8 10
> +3 2 2 999 17 10 6 7
> +4 2 2 999 17 10 8 5
> +5 4 2 0 26 14 8 5 10
> +6 4 2 0 26 3 9 13 4
> +7 4 2 0 26 9 12 13 10
> +8 4 2 0 26 6 11 5 10
> +9 4 2 0 26 12 13 10 7
> +10 4 2 0 26 14 9 13 10
> +11 4 2 0 26 6 12 10 7
> +12 4 2 0 26 12 9 2 11
> +13 4 2 0 26 6 12 11 10
> +14 4 2 0 26 14 11 5 1
> +15 4 2 0 26 6 12 2 11
> +16 4 2 0 26 13 8 10 7
> +17 4 2 0 26 12 3 13 7
> +18 4 2 0 26 14 8 13 4
> +19 4 2 0 26 11 9 1 14
> +20 4 2 0 26 9 14 4 1
> +21 4 2 0 26 8 14 13 10
> +22 4 2 0 26 11 14 5 10
> +23 4 2 0 26 12 9 11 10
> +24 4 2 0 26 14 9 4 13
> +25 4 2 0 26 2 9 1 11
> +26 4 2 0 26 12 9 3 2
> +27 4 2 0 26 12 9 13 3
> +28 4 2 0 26 11 9 14 10
> +$EndElements
>
> === modified file 'test/unit/meshconvert/python/test.py'
> --- test/unit/meshconvert/python/test.py	2011-06-24 09:25:10 +0000
> +++ test/unit/meshconvert/python/test.py	2011-07-07 11:01:36 +0000
> @@ -242,7 +242,7 @@
>          1 edge marked
>          """
>          marked_facets = [7]
> -        self._facet_marker_driver(1, marked_facets, 8)
> +        self._facet_marker_driver(2, 1, marked_facets, 8)
>
>      def test_2D_facet_markings_2 (self):
>          """
> @@ -250,7 +250,7 @@
>          2 edges marked
>          """
>          marked_facets = [2,5]
> -        self._facet_marker_driver(2, marked_facets, 8)
> +        self._facet_marker_driver(2, 2, marked_facets, 8)
>
>      def test_2D_facet_markings_3 (self):
>          """
> @@ -258,7 +258,7 @@
>          3 edges marked
>          """
>          marked_facets = [5,6,7]
> -        self._facet_marker_driver(3, marked_facets, 8)
> +        self._facet_marker_driver(2, 3, marked_facets, 8)
>
>      def test_2D_facet_markings_4 (self):
>          """
> @@ -266,20 +266,35 @@
>          4 edges marked
>          """
>          marked_facets = [2,5,6,7]
> -        self._facet_marker_driver(4, marked_facets, 8)
> -
> -    def _facet_marker_driver (self, id, marked_facets, size ):
> -        handler = self.__convert("gmsh_test_facet_regions_2D_%d.msh" % id, DataHandler.CellType_Triangle, 2)
> +        self._facet_marker_driver(2, 4, marked_facets, 8)
> +
> +    def test_3D_facet_markings_1 (self):
> +        """
> +        Test the marking of 3D facets
> +        Unit cube, 1 Face marked
> +        """
> +#         [0, 0, 0, 999, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 999, 0, 0, 0, 0, 0, 0, 0, 0, 999, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 999,
> +# 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
> +        marked_facets = [3, 15, 24, 39,]
> +        self._facet_marker_driver(3, 1, marked_facets, 60)
> +
> +    def _facet_marker_driver (self, dim, id, marked_facets, size ):
> +        if dim == 2:
> +            cell_type = DataHandler.CellType_Triangle
> +        elif dim == 3:
> +            cell_type = DataHandler.CellType_Tetrahedron
> +
> +        handler = self.__convert("gmsh_test_facet_regions_%dD_%d.msh" % (dim, id), cell_type, dim)
>
>          free_facets = range(size)
>
>          for i in marked_facets:
>              free_facets.remove(i)
>
> -        dim, sz, entries, ended = handler.functions["facet_region"]
> +        function_dim, sz, entries, ended = handler.functions["facet_region"]
>
>          # the dimension of the meshfunction should be 1
> -        self.assertEqual(dim, 1)
> +        self.assertEqual(function_dim, dim-1)
>          # There should be 8 edges in the mesh function
>          self.assertEqual(len(entries), size)
>          self.assertEqual(sz, size)
>

> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



References