Ignore:
Timestamp:
Nov 2, 2007, 5:18:29 PM (17 years ago)
Author:
duncan
Message:

reduce memory use in quantity.set_value. fit_to_mesh can now use an existing mesh instance, which it does in quantity.set_value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/general_fit_interpolate.py

    r4739 r4779  
    4444   
    4545    def __init__(self,
    46                  vertex_coordinates,
    47                  triangles,
     46                 vertex_coordinates=None,
     47                 triangles=None,
     48                 mesh=None,
    4849                 mesh_origin=None,
    4950                 verbose=False,
     
    5455        function values at vertices to function values at data points
    5556
     57        Pass in a mesh instance or vertex_coordinates and triangles
     58        and optionally mesh_origin
     59       
    5660        Inputs:
    5761
     
    6468          triangles: List of 3-tuples (or a Numeric array) of
    6569              integers representing indices of all vertices in the mesh.
     70
     71        mesh: A mesh instance describing the mesh.
    6672
    6773          mesh_origin: A geo_reference object or 3-tuples consisting of
     
    7985        if max_vertices_per_cell == None:
    8086            max_vertices_per_cell = MAX_VERTICES_PER_CELL
    81        
    82         #Convert input to Numeric arrays
    83         triangles = ensure_numeric(triangles, Int)
    84         vertex_coordinates = ensure_absolute(vertex_coordinates,
    85                                              geo_reference = mesh_origin)
    8687
    87         #Don't pass geo_reference to mesh.  It doesn't work. (Still??)
    88        
    89         if verbose: print 'FitInterpolate: Building mesh'       
    90         self.mesh = Mesh(vertex_coordinates, triangles)
    91         self.mesh.check_integrity()
     88        if mesh is None:
     89            # Fixme (DSG) Throw errors if triangles or vertex_coordinates
     90            # are None
     91           
     92            #Convert input to Numeric arrays
     93            triangles = ensure_numeric(triangles, Int)
     94            vertex_coordinates = ensure_absolute(vertex_coordinates,
     95                                                 geo_reference = mesh_origin)
     96
     97            if verbose: print 'FitInterpolate: Building mesh'       
     98            self.mesh = Mesh(vertex_coordinates, triangles)
     99            self.mesh.check_integrity()
     100        else:
     101            self.mesh = mesh
    92102       
    93103        if verbose: print 'FitInterpolate: Building quad tree'
Note: See TracChangeset for help on using the changeset viewer.