Changeset 4095


Ignore:
Timestamp:
Dec 19, 2006, 3:30:43 PM (18 years ago)
Author:
nick
Message:

add number of trigs in mesh

Location:
anuga_core/source/anuga
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r4061 r4095  
    610610    def split(self, factor=0.5):
    611611        """Returns two geospatial_data object, first is size of the 'factor'
    612         smaller the original one and the second is the remainer. The two new
     612        smaller the original and the second is the remainer. The two new
    613613        object are disjoin set of each other.
    614614       
  • anuga_core/source/anuga/utilities/polygon.py

    r3803 r4095  
    732732    return point
    733733
     734def number_mesh_triangles(interior_regions, bounding_poly, remainder_res):
     735    """Calcalutes the approximate number of triangles inside the bounding polygon
     736    and the other interior regions
     737    FIXME: Add tests for this function
     738    """
     739    import polygon_area
     740   
     741    # TO DO check if any of the regions fall inside one another
     742    no_triangles = 0.0
     743    area = polygon_area(bounding_poly)
     744    for i,j in interior_regions:
     745        this_area = polygon_area(i)
     746        no_triangles += this_area/j
     747        area -= this_area
     748        #convert to square Kms
     749        print 'area of ',j, this_area/1000000., area/1000000.
     750    no_triangles += area/remainder_res
     751    return int(no_triangles/0.7)
     752
    734753
    735754
Note: See TracChangeset for help on using the changeset viewer.