Changeset 2808


Ignore:
Timestamp:
May 5, 2006, 5:01:16 PM (19 years ago)
Author:
ole
Message:

Domain from meshfile, set storage of unique vertex values etc

Location:
inundation
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/documentation/report.tex

    r2767 r2808  
    2020\documentclass{manual}
    2121
    22 \usepackage{url}
     22%\usepackage{url} %Already defined in manual
    2323\usepackage{graphicx}
    2424
  • inundation/pyvolution/domain.py

    r2793 r2808  
    2727                 tagged_elements=None, geo_reference=None,
    2828                 use_inscribed_circle=False,
    29                  mesh_filename=None):
     29                 mesh_filename=None,
     30                 use_cache=False,
     31                 verbose=False):
     32       
    3033        """Instantiate generic computational Domain.
     34       
    3135        Input:
    32           source:    Either a mesh filename or coordinates of mesh vertices. If it is a
    33                      filename values specified for triangles will be overridden.
     36          source:    Either a mesh filename or coordinates of mesh vertices.
     37                     If it is a filename values specified for triangles will
     38                     be overridden.
    3439          triangles: Mesh connectivity (see mesh.py for more information)
    3540          boundary:  See mesh.py for more information
    3641
    37           conserved_quantities: List of quantity names entering the conservation equations
     42          conserved_quantities: List of quantity names entering the
     43                                conservation equations
    3844          other_quantities:     List of other quantity names
    3945
     
    5561            coordinates, triangles, boundary, vertex_quantity_dict, \
    5662                         tagged_elements, geo_reference = \
    57                          pmesh_to_domain(file_name=mesh_filename)
     63                         pmesh_to_domain(file_name=mesh_filename,
     64                                         use_cache=use_cache,
     65                                         verbose=verbose)
    5866
    5967           
  • inundation/pyvolution/general_mesh.py

    r2778 r2808  
    302302            #Register the vertices v as lists of
    303303            #(triangle_id, vertex_id) tuples associated with them
    304             #This is used for smoothing
     304            #This is used for averaging multiple vertex values.
    305305            for vertex_id, v in enumerate([a,b,c]):
    306306                if vertexlist[v] is None:
  • inundation/pyvolution/pmesh2domain.py

    r2607 r2808  
    114114
    115115
    116 
    117116def pmesh_to_domain(file_name=None,
    118                     mesh_instance=None):
     117                    mesh_instance=None,
     118                    use_cache=False,
     119                    verbose=False):
     120    """
     121    Convert a pmesh file or a pmesh mesh instance to a bunch of lists
     122    that can be used to instanciate a domain object.
     123
     124    use_cache: True means that caching is attempted for the computed domain.   
     125    """
     126 
     127    if use_cache is True:
     128        from caching import cache
     129        result = cache(_pmesh_to_domain, (file_name, mesh_instance),
     130                       dependencies = [file_name],                     
     131                       verbose = verbose)
     132
     133    else:
     134        result = apply(_pmesh_to_domain, (file_name, mesh_instance))       
     135       
     136    return result
     137
     138
     139def _pmesh_to_domain(file_name=None,
     140                    mesh_instance=None,
     141                    use_cache=False,
     142                    verbose=False):
    119143    """
    120144    Convert a pmesh file or a pmesh mesh instance to a bunch of lists
  • inundation/pyvolution/shallow_water.py

    r2731 r2808  
    101101        self.store = True
    102102        self.format = 'sww'
    103         self.smooth = True
     103        self.set_store_vertices_uniquely(False)
     104
     105        self.quantities_to_be_stored = ['stage','xmomentum','ymomentum']
     106       
     107
     108    def set_store_vertices_uniquely(self, flag, reduction=None):
     109        """Decide whether vertex values should be stored uniquely as
     110        computed in the model or whether they should be reduced to one
     111        value per vertex using self.reduction.
     112        """
     113        self.smooth = not flag
    104114
    105115        #Reduction operation for get_vertex_values
    106         self.reduction = mean
    107         #self.reduction = min  #Looks better near steep slopes
    108 
    109         self.quantities_to_be_stored = ['stage','xmomentum','ymomentum']
    110 
     116        if reduction is None:
     117            self.reduction = mean
     118            #self.reduction = min  #Looks better near steep slopes
     119       
     120       
     121       
    111122
    112123    def set_quantities_to_be_stored(self, q):
  • inundation/pyvolution/util.py

    r2799 r2808  
    504504
    505505
    506 from pylab import *
    507506   
    508507def sww2timeseries(swwfile,
     
    585584                     
    586585    """
     586
     587   
    587588    k = _sww2timeseries(swwfile,
    588589                        gauge_filename,
     
    606607                    title_on = None,
    607608                    verbose = False):
     609
     610    from pylab import * #FIXME (Ole): List actual functions used rather than *
     611   
    608612
    609613    assert type(swwfile) == type(''),\
Note: See TracChangeset for help on using the changeset viewer.