Changeset 5931


Ignore:
Timestamp:
Nov 10, 2008, 4:44:39 PM (15 years ago)
Author:
duncan
Message:

example of adding segments and vertices to a mesh file, from a points file.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/pmesh/mesh.py

    r5673 r5931  
    884884           
    885885        """
    886         #make sure the points are absolute
     886        # make sure the points are absolute
     887        # Since addVertsSegs will deal with georeferencing.
    887888        points = ensure_absolute(points)
    888889
  • anuga_work/debug/will_power_example/make_mesh.py

    r5764 r5931  
    1 """ This Script shows how a bad mesh can be generated causing
    2 excessive values for stage and momentum.
     1""" This Script shows how exta points and segments can be added to a msh file.
    32
     3# WARNING #
     4* this doesn't have tests assosiated with it.  For example that the
     5resolutions stay as described in create_mesh_from_regions is not tested
     6* Also, this code causes the mesh to be generated twice, so it is not
     7an efficient way of doing this.
     8
     9If this is used a lot you may want to wrap the functionality into a function.
    410"""
    511
     
    3642file.write("x,y\n\
    3743304200.0, 6185300.0\n\
    38 304250.0, 6185350.0\n\
    39 304300.0, 6185400.0\n")
     44304300.0, 6185400.0\n\
     45304400.0, 6185500.0\n")
    4046file.close()
    4147
     
    6773m = importMeshFromFile(meshname)
    6874
    69 m.add_vertices([(W +500,S +500),(W +1000,S +1000) ])
     75#m.add_vertices([(W +500,S +500),(W +1000,S +1000) ])
    7076
    7177# load points from a points file
    72 m.add_vertices(Geospatial_data(ptfile))
     78#m.add_vertices(Geospatial_data(ptfile))
    7379
    7480p1 = (W +500,N - 500)
    7581p2 = (W +1000,N - 1000)
    7682p3 = (W +1000,N - 1500)
    77 m.add_points_and_segments([p1,p2,p3], [[0,1],[1,2]])
     83#m.add_points_and_segments([p1,p2,p3], [[0,1],[1,2]])
    7884
    7985# add points and segments, where the segments are automatically added.
     
    8389p2 = (E -1000,N - 1500)
    8490#m.add_points_and_segments([p1,p2])
     91
     92# load points from a points file
     93m.add_points_and_segments(Geospatial_data(ptfile))
    8594
    8695m.generate_mesh()
Note: See TracChangeset for help on using the changeset viewer.