Changeset 2866


Ignore:
Timestamp:
May 15, 2006, 2:26:21 PM (19 years ago)
Author:
ole
Message:

Implemented Domain(meshfile) variant widely, updated documentation and added more statistics

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • development/okushiri_2005/lwru2.py

    r2864 r2866  
    9999    print 'Creating domain from', project.mesh_filename
    100100
    101     domain = cache(pmesh_to_domain_instance,
    102                    (project.mesh_filename, Domain),
    103                    dependencies = [project.mesh_filename])
     101    domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
    104102
    105103else:
     
    122120domain.store = True    #Store for visualisation purposes
    123121
    124 domain.check_integrity()
     122#domain.check_integrity()
    125123print 'Number of triangles = ', len(domain)
    126124print 'The extent is ', domain.get_extent()
  • development/stochastic_study/run_model.py

    r2535 r2866  
    4444print 'Creating domain from', project.mesh_filename
    4545
    46 domain = pmesh_to_domain_instance(project.mesh_filename, Domain,
    47                                   use_cache=True,
    48                                   verbose=True)
     46#domain = pmesh_to_domain_instance(project.mesh_filename, Domain,
     47#                                  use_cache=True,
     48#                                  verbose=True)
     49
     50domain = Domain(project.mesh_filename,
     51                use_cache=True,
     52                verbose=True)               
     53               
    4954
    5055print 'Number of triangles = ', len(domain)
  • documentation/user_manual/anuga_user_manual.tex

    r2861 r2866  
    788788
    789789
    790 \emph{NOTE: Will be replaced by domain=Domain(meshname, use_cache=True, verbose=True)}
    791 
    792 
    793790{\small \begin{verbatim}
    794     domain = pmesh_to_domain_instance(meshname,
    795     Domain, use_cache = True, verbose = True)
     791    domain = Domain(meshname, use_cache=True, verbose=True)
    796792\end{verbatim}}
    797793
    798 The function \function{pmesh\_to\_domain\_instance} converts a meshfile
     794Providing a filename instead of the lists used in bedslopephysical
     795above causes Domain to convert a meshfile
    799796\code{meshname} into an instance of the data structure
    800797\code{domain}, allowing us to use methods like \method{set\_quantity}
    801 to set quantities and to apply other operations. (In principle, the
    802 second argument of \function{pmesh\_to\_domain\_instance} can be any
    803 subclass of \class{Domain}, but for applications involving the
    804 shallow-water wave equation, the second argument of
    805 \function{pmesh\_to\_domain\_instance} can always be set simply to
    806 \class{Domain}.)
     798to set quantities and to apply other operations.
     799
     800%(In principle, the
     801%second argument of \function{pmesh\_to\_domain\_instance} can be any
     802%subclass of \class{Domain}, but for applications involving the
     803%shallow-water wave equation, the second argument of
     804%\function{pmesh\_to\_domain\_instance} can always be set simply to
     805%\class{Domain}.)
    807806
    808807The following statements specify a basename and data directory, and
     
    819818
    820819\subsection{Initial Conditions}
    821 Quantities for \file{run\_sydney\_smf.py} are set
     820Quantities for \file{runsydney.py} are set
    822821using similar methods to those in \file{bedslopephysical.py}. However,
    823822in this case, many of the values are read from the auxiliary file
     
    857856{\small \begin{verbatim}
    858857    domain.set_quantity('elevation',
    859                     filename = project.combineddemname + '.pts',
    860                     use_cache = True,
    861                     verbose = True)
     858                        filename = project.combineddemname + '.pts',
     859                        use_cache = True,
     860                        verbose = True)
    862861\end{verbatim}}
    863862
  • documentation/user_manual/examples/runsydney.py

    r2805 r2866  
    7676
    7777#Create shallow water domain
    78 domain = pmesh_to_domain_instance(meshname, Domain,
    79                                   use_cache = True,
    80                                   verbose = True)
    81 #domain = Domain(meshname)
     78
     79domain = Domain(meshname,
     80                use_cache = True,
     81                verbose = True)                                 
    8282
    8383
  • inundation/examples/beach.py

    r2620 r2866  
    1515#sys.path.append('..'+sep+'pyvolution')
    1616
    17 from pyvolution.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
     17from pyvolution.shallow_water import Domain, Reflective_boundary,\
     18     Dirichlet_boundary,\
    1819     Transmissive_boundary, Time_boundary, Wind_stress
    1920
     
    2829name = 'beach'
    2930print 'Creating domain from %s.tsh' %name
    30 #domain = pmesh_to_domain_instance(name + '.tsh', Domain)
    31 domain = Domain(mesh_filename = name + '.tsh')
     31domain = Domain(mesh_filename = name + '.tsh',
     32                use_cache=True, verbose=True)
    3233
    3334domain.store = True
  • inundation/pyvolution/domain.py

    r2852 r2866  
    7676        # Initialise underlying mesh structure
    7777        Mesh.__init__(self, coordinates, triangles, boundary,
    78                       tagged_elements, geo_reference, use_inscribed_circle)
    79 
     78                      tagged_elements, geo_reference, use_inscribed_circle,
     79                      verbose=verbose)
     80
     81        if verbose: print 'Initialising Domain'       
    8082        from Numeric import zeros, Float, Int
    8183        from quantity import Quantity, Conserved_quantity
     
    123125
    124126        # Setup Communication Buffers
     127           
     128        if verbose: print 'Domain: Set up communication buffers (parallel)'
    125129        self.nsys = len(self.conserved_quantities)
    126130        for key in self.full_send_dict:
     
    179183            # If the mesh file passed any quantity values
    180184            # , initialise with these values.
     185            if verbose: print 'Domain: Initialising quantity values'
    181186            self.set_quantity_vertices_dict(vertex_quantity_dict)
    182187
     188           
     189        if verbose: print 'Domain: Done'
     190
     191           
    183192
    184193
  • inundation/pyvolution/general_mesh.py

    r2808 r2866  
    5353    #input
    5454    def __init__(self, coordinates, triangles,
    55                  geo_reference=None):
     55                 geo_reference=None,
     56                 verbose=False):
    5657        """
    5758        Build triangles from x,y coordinates (sequence of 2-tuples or
     
    6263        If specified coordinates are assumed to be relative to this origin.
    6364        """
     65
     66        if verbose: print 'General_mesh: Building basic mesh structure'
    6467
    6568        from Numeric import array, zeros, Int, Float, sqrt, sum
     
    108111
    109112        #Initialise each triangle
     113        if verbose:
     114            print 'General_mesh: Computing areas, normals and edgelenghts'
     115           
    110116        for i in range(N):
    111             #if i % (N/10) == 0: print '(%d/%d)' %(i, N)
     117            if verbose and i % ((N+10)/10) == 0: print '(%d/%d)' %(i, N)
     118           
    112119
    113120            x0 = V[i, 0]; y0 = V[i, 1]
     
    157164       
    158165        #Build vertex list
     166        if verbose: print 'Building vertex list'         
    159167        self.build_vertexlist()
    160168
  • inundation/pyvolution/mesh.py

    r2778 r2866  
    6060
    6161
    62     def __init__(self, coordinates, triangles, boundary = None,
    63                  tagged_elements = None, geo_reference = None,
    64                  use_inscribed_circle = False):
     62    def __init__(self, coordinates, triangles,
     63                 boundary=None,
     64                 tagged_elements=None,
     65                 geo_reference=None,
     66                 use_inscribed_circle=False,
     67                 verbose=False):
    6568        """
    6669        Build triangles from x,y coordinates (sequence of 2-tuples or
     
    7376        from Numeric import array, zeros, Int, Float, maximum, sqrt, sum
    7477
    75        
    76         General_mesh.__init__(self, coordinates, triangles, geo_reference)
     78        General_mesh.__init__(self, coordinates, triangles,
     79                              geo_reference, verbose=verbose)
     80
     81        if verbose: print 'Initialising mesh'         
    7782
    7883        N = self.number_of_elements
     
    9499
    95100        #Initialise each triangle
     101        if verbose: print 'Mesh: Computing centroids and radii'       
    96102        for i in range(N):
    97             #if i % (N/10) == 0: print '(%d/%d)' %(i, N)
     103            if verbose and i % ((N+10)/10) == 0: print '(%d/%d)' %(i, N)
    98104
    99105            x0 = V[i, 0]; y0 = V[i, 1]
     
    144150
    145151        #Build neighbour structure
     152        if verbose: print 'Mesh: Building neigbour structure'               
    146153        self.build_neighbour_structure()
    147154
    148155        #Build surrogate neighbour structure
     156        if verbose: print 'Mesh: Building surrogate neigbour structure'
    149157        self.build_surrogate_neighbour_structure()
    150158
    151159        #Build boundary dictionary mapping (id, edge) to symbolic tags
     160        if verbose: print 'Mesh: Building boundary dictionary'
    152161        self.build_boundary_dictionary(boundary)
    153162
    154163        #Build tagged element  dictionary mapping (tag) to array of elements
     164        if verbose: print 'Mesh: Building tagged elements dictionary'       
    155165        self.build_tagged_elements_dictionary(tagged_elements)
    156166
     
    159169
    160170        #FIXME check integrity?
     171        if verbose: print 'Mesh: Done'               
    161172
    162173    def __repr__(self):
Note: See TracChangeset for help on using the changeset viewer.