Ignore:
Timestamp:
Mar 5, 2009, 10:57:08 AM (15 years ago)
Author:
rwilson
Message:

Modified General_mesh.get_node(absolute=True) to return a copy if modifying the object node data.

Location:
branches/numpy/anuga/abstract_2d_finite_volumes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/abstract_2d_finite_volumes/general_mesh.py

    r6428 r6463  
     1import copy
    12import numpy as num
    23
     
    252253        Default is False as many parts of ANUGA expects relative coordinates.
    253254        (To see which, switch to default absolute=True and run tests).
     255
     256        Note: This method returns a modified _copy_ of the nodes slice if
     257              absolute is True.  If absolute is False, just return the slice.
     258              This is related to the ensure_numeric() returning a copy problem.
    254259        """
    255260
     
    257262        if absolute is True:
    258263            if not self.geo_reference.is_absolute():
     264                # get a copy so as not to modify the internal self.nodes array
     265                V = copy.copy(V)
    259266                V += num.array([self.geo_reference.get_xllcorner(),
    260267                                self.geo_reference.get_yllcorner()], num.float)
  • branches/numpy/anuga/abstract_2d_finite_volumes/test_general_mesh.py

    r6441 r6463  
    311311        self.failUnless(num.alltrue(nodes_absolute[2] == node), msg)
    312312       
    313         # repeat get_node(absolute=True), see if result same
     313        # repeat get_node(2, absolute=True), see if result same
    314314        node = domain.get_node(2, absolute=True)     
    315315        msg = ('\nnodes_absolute[2]=%s\nnode=%s'
Note: See TracChangeset for help on using the changeset viewer.