Changeset 4888 for anuga_core/source/anuga/pmesh
- Timestamp:
- Dec 17, 2007, 4:39:16 PM (17 years ago)
- Location:
- anuga_core/source/anuga/pmesh
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/pmesh/mesh.py
r4831 r4888 731 731 self.userVertices.append(v) 732 732 733 def add_hole_from_polygon(self, polygon, tags=None, geo_reference=None): 733 def add_hole_from_polygon(self, polygon, segment_tags=None, 734 geo_reference=None): 734 735 """ 735 736 Add a polygon with tags to the current mesh, as a region. … … 748 749 it they can. 749 750 """ 750 return self._add_area_from_polygon(polygon, tags=tags, 751 return self._add_area_from_polygon(polygon, 752 segment_tags=segment_tags, 751 753 hole=True, 752 754 geo_reference=geo_reference … … 754 756 755 757 756 def add_region_from_polygon(self, polygon, tags=None, 757 max_triangle_area=None, geo_reference=None): 758 def add_region_from_polygon(self, polygon, segment_tags=None, 759 max_triangle_area=None, geo_reference=None, 760 region_tag=None): 758 761 """ 759 762 Add a polygon with tags to the current mesh, as a region. … … 767 770 polygon a list of points, in meters that describe the polygon 768 771 (e.g. [[x1,y1],[x2,y2],...] 769 tags (e.g.{'wall':[0,1,3],'ocean':[2]}) 772 segment_tags (e.g.{'wall':[0,1,3],'ocean':[2]}) add tags to the 773 segements of the region 774 region_tags - add a tag to all of the triangles in the region. 770 775 771 776 This returns the region instance (if a max_triangle_area is given), … … 777 782 create_region = True 778 783 779 region = self._add_area_from_polygon(polygon, tags=tags, 784 region = self._add_area_from_polygon(polygon, 785 segment_tags=segment_tags, 780 786 geo_reference=geo_reference, 781 787 region=create_region) 782 788 if max_triangle_area is not None: 783 789 region.setMaxArea(max_triangle_area) 790 if region_tag is not None: 791 region.setTag(region_tag) 792 793 784 794 return region 785 795 786 796 787 def _add_area_from_polygon(self, polygon, tags=None,797 def _add_area_from_polygon(self, polygon, segment_tags=None, 788 798 geo_reference=None, 789 799 hole=False, … … 800 810 polygon a list of points, in meters that describe the polygon 801 811 (e.g. [[x1,y1],[x2,y2],...] 802 tags (e.g.{'wall':[0,1,3],'ocean':[2]}) 812 segment_tags (e.g.{'wall':[0,1,3],'ocean':[2]})add tags to the 813 segements of the region. 803 814 804 815 This returns the region instance, so if the user whats to modify … … 831 842 segments.append( [lo, hi] ) 832 843 region_dict['segments'] = segments 833 region_dict['segment_tags'] = self._tag_dict2list( tags, N)844 region_dict['segment_tags'] = self._tag_dict2list(segment_tags, N) 834 845 835 846 … … 903 914 tags = {tag:range(segment_count)} 904 915 905 return self._add_area_from_polygon(polygon, tags=tags,916 return self._add_area_from_polygon(polygon, segment_tags=tags, 906 917 region=region, hole=hole, 907 918 geo_reference=center_geo_reference) -
anuga_core/source/anuga/pmesh/mesh_interface.py
r4738 r4888 229 229 # Do bounding polygon 230 230 m.add_region_from_polygon(bounding_polygon, 231 tags=boundary_tags,231 segment_tags=boundary_tags, 232 232 geo_reference=poly_geo_reference) 233 233 -
anuga_core/source/anuga/pmesh/test_mesh.py
r4831 r4888 1905 1905 m=Mesh() 1906 1906 region = m.add_region_from_polygon([[0,0],[1,0],[0,1]], 1907 max_triangle_area = 88) 1907 max_triangle_area = 88, 1908 region_tag='cassady') 1908 1909 self.failUnless(len(m.regions)==1, 1909 1910 'FAILED!') … … 1913 1914 'FAILED!') 1914 1915 self.failUnless(len(m.userVertices)==3, 1916 'FAILED!') 1917 self.failUnless(region.getTag()=='cassady', 1915 1918 'FAILED!') 1916 1919 … … 2137 2140 #m.export_mesh_file("aaat.msh") 2138 2141 2139 def FIXMEtest_auto_set_geo_reference(self):2142 def NOTIMPLEMENTEDtest_auto_set_geo_reference(self): 2140 2143 x=50000 2141 2144 y=1000
Note: See TracChangeset
for help on using the changeset viewer.