Changeset 8500


Ignore:
Timestamp:
Aug 8, 2012, 7:47:34 PM (13 years ago)
Author:
steve
Message:

Making create domain a bit faster (getting rid of few for loops)

Location:
trunk/anuga_core/source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py

    r8416 r8500  
    6464                 triangles,
    6565                 geo_reference=None,
     66                 use_inscribed_circle=False,
    6667                 verbose=False):
    6768        """Build triangular 2d mesh from nodes and triangle information
     
    8283        """
    8384
    84         if verbose: log.critical('General_mesh: Building basic mesh structure '
    85                                  'in ANUGA domain')
     85        if verbose: log.critical('General_mesh: Building basic mesh structure')
     86
     87        self.use_inscribed_circle = use_inscribed_circle
    8688         
    8789        self.triangles = num.array(triangles, num.int)
     
    130132
    131133        # Get x,y coordinates for all triangle vertices and store
     134        self.centroid_coordinates = num.zeros((N, 2), num.float)
     135
     136        #Allocate space for geometric quantities
     137        self.radii = num.zeros(N, num.float)
     138
     139        # Get x,y coordinates for all triangle vertices and store
    132140        self.vertex_coordinates = V = self.compute_vertex_coordinates()
    133141
     
    137145        # Initialise each triangle
    138146        if verbose:
    139             log.critical('General_mesh: Computing areas, normals '
    140                          'and edgelengths')
    141 
    142         for i in range(N):
    143             if verbose and i % ((N+10)/10) == 0: log.critical('(%d/%d)' % (i, N))
    144 
    145             x0, y0 = V[3*i, :]
    146             x1, y1 = V[3*i+1, :]
    147             x2, y2 = V[3*i+2, :]
    148 
    149 
    150             i0 = self.triangles[i][0]
    151             i1 = self.triangles[i][1]
    152             i2 = self.triangles[i][2]
    153 
    154             assert x0 == self.nodes[i0][0]
    155             assert y0 == self.nodes[i0][1]
    156 
    157             assert x1 == self.nodes[i1][0]
    158             assert y1 == self.nodes[i1][1]
    159 
    160             assert x2 == self.nodes[i2][0]
    161             assert y2 == self.nodes[i2][1]
    162            
    163             # Area
    164             self.areas[i] = abs((x1*y0-x0*y1) + (x2*y1-x1*y2) + (x0*y2-x2*y0))/2
    165 
    166             msg = 'Triangle %g (%f,%f), (%f,%f), (%f, %f)' % (i,x0,y0,x1,y1,x2,y2)
    167             msg += ' is degenerate:  area == %f' % self.areas[i]
    168             assert self.areas[i] > 0.0, msg
    169 
    170             # Normals
    171             # The normal vectors
    172             #   - point outward from each edge
    173             #   - are orthogonal to the edge
    174             #   - have unit length
    175             #   - Are enumerated according to the opposite corner:
    176             #     (First normal is associated with the edge opposite
    177             #     the first vertex, etc)
    178             #   - Stored as six floats n0x,n0y,n1x,n1y,n2x,n2y per triangle
    179             n0 = num.array([x2-x1, y2-y1], num.float)
    180             l0 = num.sqrt(num.sum(n0**2))
    181 
    182             n1 = num.array([x0-x2, y0-y2], num.float)
    183             l1 = num.sqrt(num.sum(n1**2))
    184 
    185             n2 = num.array([x1-x0, y1-y0], num.float)
    186             l2 = num.sqrt(num.sum(n2**2))
    187 
    188             # Normalise
    189             n0 /= l0
    190             n1 /= l1
    191             n2 /= l2
    192 
    193             # Compute and store
    194             self.normals[i, :] = [n0[1], -n0[0],
    195                                   n1[1], -n1[0],
    196                                   n2[1], -n2[0]]
    197 
    198             # Edgelengths
    199             self.edgelengths[i, :] = [l0, l1, l2]
     147            log.critical('General_mesh: Computing areas, normals, '
     148                         'edgelengths, centroids and radii')
     149
     150
     151        # Calculate Areas
     152        V0 = V[0:3*N:3, :]
     153        V1 = V[1:3*N:3, :]
     154        V2 = V[2:3*N:3, :]
     155
     156
     157        # Area
     158        x0 = V0[:,0]
     159        y0 = V0[:,1]
     160        x1 = V1[:,0]
     161        y1 = V1[:,1]
     162        x2 = V2[:,0]
     163        y2 = V2[:,1]
     164
     165        self.areas[:] = num.abs( (x1*y0-x0*y1) + (x2*y1-x1*y2) + (x0*y2-x2*y0))/2
     166
     167        msg = 'Degenerate Triangle'
     168        assert num.all(self.areas > 0.0), msg
     169        #print V.shape, V0.shape, V1.shape, V2.shape
     170
     171#        #print E.shape, E[0:3*M:3, :].shape, E[1:3*M:3, :].shape, E[2:3*M:3, :].shape
     172#        E[0:3*M:3, :] = 0.5*(V1+V2)
     173#        E[1:3*M:3, :] = 0.5*(V2+V0)
     174#        E[2:3*M:3, :] = 0.5*(V0+V1)
     175
     176        i0 = self.triangles[:,0]
     177        i1 = self.triangles[:,1]
     178        i2 = self.triangles[:,2]
     179
     180        assert num.allclose( x0, self.nodes[i0,0] )
     181        assert num.allclose( y0, self.nodes[i0,1] )
     182
     183        assert num.allclose( x1, self.nodes[i1,0] )
     184        assert num.allclose( y1, self.nodes[i1,1] )
     185
     186        assert num.allclose( x2, self.nodes[i2,0] )
     187        assert num.allclose( y2, self.nodes[i2,1] )
     188
     189
     190        xn0 = x2-x1
     191        yn0 = y2-y1
     192        l0 = num.sqrt(xn0**2 + yn0**2)
     193
     194        xn0 /= l0
     195        yn0 /= l0
     196
     197        xn1 = x0-x2
     198        yn1 = y0-y2
     199        l1 = num.sqrt(xn1**2 + yn1**2)
     200
     201        xn1 /= l1
     202        yn1 /= l1
     203
     204        xn2 = x1-x0
     205        yn2 = y1-y0
     206        l2 = num.sqrt(xn2**2 + yn2**2)
     207
     208        xn2 /= l2
     209        yn2 /= l2
     210
     211        # Compute and store
     212
     213        self.normals[:,0] =  yn0
     214        self.normals[:,1] = -xn0
     215
     216        self.normals[:,2] =  yn1
     217        self.normals[:,3] = -xn1
     218
     219        self.normals[:,4] =  yn2
     220        self.normals[:,5] = -xn2
     221       
     222        self.edgelengths[:,0] = l0
     223        self.edgelengths[:,1] = l1
     224        self.edgelengths[:,2] = l2
     225
     226        self.centroid_coordinates[:,0] = (x0 + x1 + x2)/3
     227        self.centroid_coordinates[:,1] = (y0 + y1 + y2)/3
     228
     229
     230
     231        if self.use_inscribed_circle == False:
     232            #OLD code. Computed radii may exceed that of an
     233            #inscribed circle
     234
     235            #Midpoints
     236            xm0 = (x1 + x2)/2
     237            ym0 = (y1 + y2)/2
     238
     239            xm1 = (x2 + x0)/2
     240            ym1 = (y2 + y0)/2
     241
     242            xm2 = (x0 + x1)/2
     243            ym2 = (y0 + y1)/2
     244
     245
     246            #The radius is the distance from the centroid of
     247            #a triangle to the midpoint of the side of the triangle
     248            #closest to the centroid
     249
     250            d0 = num.sqrt((self.centroid_coordinates[:,0] - xm0)**2 + (self.centroid_coordinates[:,1] - ym0)**2)
     251            d1 = num.sqrt((self.centroid_coordinates[:,0] - xm1)**2 + (self.centroid_coordinates[:,1] - ym1)**2)
     252            d2 = num.sqrt((self.centroid_coordinates[:,0] - xm2)**2 + (self.centroid_coordinates[:,1] - ym2)**2)
     253
     254
     255            self.radii[:] = num.minimum(num.minimum(d0, d1), d2)
     256
     257        else:
     258            #NEW code added by Peter Row. True radius
     259            #of inscribed circle is computed
     260
     261            a = num.sqrt((x0-x1)**2+(y0-y1)**2)
     262            b = num.sqrt((x1-x2)**2+(y1-y2)**2)
     263            c = num.sqrt((x2-x0)**2+(y2-y0)**2)
     264
     265            self.radii[:]=2.0*self.areas/(a+b+c)
     266
     267
     268
     269#        for i in range(N):
     270#            if verbose and i % ((N+10)/10) == 0: log.critical('(%d/%d)' % (i, N))
     271#
     272#            x0, y0 = V[3*i, :]
     273#            x1, y1 = V[3*i+1, :]
     274#            x2, y2 = V[3*i+2, :]
     275#
     276#
     277#            i0 = self.triangles[i][0]
     278#            i1 = self.triangles[i][1]
     279#            i2 = self.triangles[i][2]
     280#
     281##            assert x0 == self.nodes[i0][0]
     282##            assert y0 == self.nodes[i0][1]
     283##
     284##            assert x1 == self.nodes[i1][0]
     285##            assert y1 == self.nodes[i1][1]
     286##
     287##            assert x2 == self.nodes[i2][0]
     288##            assert y2 == self.nodes[i2][1]
     289#
     290##            # Area
     291##            self.areas[i] = abs((x1*y0-x0*y1) + (x2*y1-x1*y2) + (x0*y2-x2*y0))/2
     292##
     293##            msg = 'Triangle %g (%f,%f), (%f,%f), (%f, %f)' % (i,x0,y0,x1,y1,x2,y2)
     294##            msg += ' is degenerate:  area == %f' % self.areas[i]
     295##            assert self.areas[i] > 0.0, msg
     296#
     297#            # Normals
     298#            # The normal vectors
     299#            #   - point outward from each edge
     300#            #   - are orthogonal to the edge
     301#            #   - have unit length
     302#            #   - Are enumerated according to the opposite corner:
     303#            #     (First normal is associated with the edge opposite
     304#            #     the first vertex, etc)
     305#            #   - Stored as six floats n0x,n0y,n1x,n1y,n2x,n2y per triangle
     306#            n0 = num.array([x2-x1, y2-y1], num.float)
     307#            l0 = num.sqrt(num.sum(n0**2))
     308#
     309#            n1 = num.array([x0-x2, y0-y2], num.float)
     310#            l1 = num.sqrt(num.sum(n1**2))
     311#
     312#            n2 = num.array([x1-x0, y1-y0], num.float)
     313#            l2 = num.sqrt(num.sum(n2**2))
     314#
     315#            # Normalise
     316#            n0 /= l0
     317#            n1 /= l1
     318#            n2 /= l2
     319#
     320##            # Compute and store
     321##            self.normals[i, :] = [n0[1], -n0[0],
     322##                                  n1[1], -n1[0],
     323##                                  n2[1], -n2[0]]
     324#
     325#            # Edgelengths
     326#            #self.edgelengths[i, :] = [l0, l1, l2]
     327#
     328#
     329#
     330#            #Compute centroid
     331##            centroid = num.array([(x0 + x1 + x2)/3, (y0 + y1 + y2)/3], num.float)
     332###            self.centroid_coordinates[i] = centroid
     333##
     334##
     335##            if self.use_inscribed_circle == False:
     336##                #OLD code. Computed radii may exceed that of an
     337##                #inscribed circle
     338##
     339##                #Midpoints
     340##                m0 = num.array([(x1 + x2)/2, (y1 + y2)/2], num.float)
     341##                m1 = num.array([(x0 + x2)/2, (y0 + y2)/2], num.float)
     342##                m2 = num.array([(x1 + x0)/2, (y1 + y0)/2], num.float)
     343##
     344##                #The radius is the distance from the centroid of
     345##                #a triangle to the midpoint of the side of the triangle
     346##                #closest to the centroid
     347##                d0 = num.sqrt(num.sum( (centroid-m0)**2 ))
     348##                d1 = num.sqrt(num.sum( (centroid-m1)**2 ))
     349##                d2 = num.sqrt(num.sum( (centroid-m2)**2 ))
     350##
     351##                #self.radii[i] = min(d0, d1, d2)
     352##
     353##            else:
     354##                #NEW code added by Peter Row. True radius
     355##                #of inscribed circle is computed
     356##
     357##                a = num.sqrt((x0-x1)**2+(y0-y1)**2)
     358##                b = num.sqrt((x1-x2)**2+(y1-y2)**2)
     359##                c = num.sqrt((x2-x0)**2+(y2-y0)**2)
     360##
     361##                self.radii[i]=2.0*self.areas[i]/(a+b+c)
     362
    200363
    201364        # Build structure listing which triangles belong to which node.
     
    348511        M = self.number_of_triangles
    349512        vertex_coordinates = num.zeros((3*M, 2), num.float)
     513
     514#        k0 = self.triangles[:,0]
     515#        k1 = self.triangles[:,1]
     516#        k2 = self.triangles[:,2]
     517#
     518#        vertex_coordinates[3*k0,:]   = self.nodes[k0,:]
     519#        vertex_coordinates[3*k1+1,:] = self.nodes[k1,:]
     520#        vertex_coordinates[3*k2+2,:] = self.nodes[k2,:]
    350521
    351522        for i in range(M):
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py

    r8486 r8500  
    8282            coordinates = source
    8383
     84        if verbose: log.critical('Domain: Initialising')
     85
    8486        # In case a filename has been specified, extract content
    8587        if mesh_filename is not None:
     
    131133        self.geo_reference = self.mesh.geo_reference
    132134
    133         if verbose: log.critical('Initialising Domain')
     135
    134136
    135137        # List of quantity names entering the conservation equations
     
    13471349        # Update centroid values of conserved quantites to satisfy
    13481350        # special conditions
    1349         self.update_special_conditions()
     1351        #self.update_special_conditions()
    13501352
    13511353        # Update ghosts to ensure all centroid values are available
     
    14011403            # Update time
    14021404            self.set_time(initial_time + self.timestep)
     1405
     1406            # Update ghosts
     1407            self.update_ghosts()
    14031408
    14041409            # Update vertex and edge values
     
    14741479        self.update_conserved_quantities()
    14751480
    1476 
    14771481        # Update special conditions
    1478         self.update_special_conditions()
     1482        #self.update_special_conditions()
    14791483
    14801484        # Update ghosts
    1481         self.update_ghosts()
     1485        #self.update_ghosts()
    14821486
    14831487
     
    15091513
    15101514        # Update special conditions
    1511         self.update_special_conditions()
     1515        #self.update_special_conditions()
    15121516
    15131517        # Update ghosts
     
    15481552
    15491553        # Update special conditions
    1550         self.update_special_conditions()
     1554        #self.update_special_conditions()
    15511555
    15521556        # Update ghosts
    1553         self.update_ghosts()
     1557        #self.update_ghosts()
    15541558
    15551559
     
    15821586
    15831587        # Update special conditions
    1584         self.update_special_conditions()
     1588        #self.update_special_conditions()
    15851589
    15861590        # Update ghosts
     
    16221626
    16231627        # Update special conditions
    1624         self.update_special_conditions()
     1628        #self.update_special_conditions()
    16251629
    16261630        # Update ghosts
     
    16591663
    16601664        # Update special conditions
    1661         self.update_special_conditions()
     1665        #self.update_special_conditions()
    16621666       
    1663         # Update ghosts
    1664         self.update_ghosts()
    16651667
    16661668        # Set new time
    16671669        self.set_time(initial_time + self.timestep)
     1670
     1671        # Update ghosts
     1672        #self.update_ghosts()
    16681673
    16691674
     
    17861791
    17871792
    1788 #        for i, ((vol_id, edge_id), B) in enumerate(self.boundary_objects):
    1789 #            if B is None:
    1790 #                log.critical('WARNING: Ignored boundary segment (None)')
    1791 #            else:
    1792 #                q_bdry = B.evaluate(vol_id, edge_id)
    1793 #
    1794 #                if len(q_bdry) == len(self.evolved_quantities):
    1795 #                    # conserved and evolved quantities are the same
    1796 #                    q_evol = q_bdry
    1797 #                elif len(q_bdry) == len(self.conserved_quantities):
    1798 #                    # boundary just returns conserved quantities
    1799 #                    # Need to calculate all the evolved quantities
    1800 #                    # Use default conversion
    1801 #
    1802 #                    q_evol = self.get_evolved_quantities(vol_id, edge = edge_id)
    1803 #
    1804 #                    q_evol = self.conserved_values_to_evolved_values \
    1805 #                                                            (q_bdry, q_evol)
    1806 #                else:
    1807 #                    msg = 'Boundary must return array of either conserved'
    1808 #                    msg += ' or evolved quantities'
    1809 #                    raise Exception(msg)
    1810 #
    1811 #                for j, name in enumerate(self.evolved_quantities):
    1812 #                    Q = self.quantities[name]
    1813 #                    Q.boundary_values[i] = q_evol[j]
    1814 
    1815 
    18161793    def update_boundary(self):
    18171794        """Go through list of boundary objects and update boundary values
     
    18231800        """
    18241801
    1825 
    18261802        for tag in self.tag_boundary_cells:
    18271803
     
    18381814       
    18391815
    1840 
    18411816    def compute_fluxes(self):
    18421817        msg = 'Method compute_fluxes must be overridden by Domain subclass'
     
    18481823        for operator in self.fractional_step_operators:
    18491824            operator()
    1850 
    18511825
    18521826
     
    19721946                num.put(Q_cv, Idg, num.take(Q_cv, Idf, axis=0))
    19731947
    1974     def update_special_conditions(self):
    1975         """There may be a need to change the values of the conserved
    1976         quantities to satisfy special conditions at the very lowest level
    1977         the fluid flow calculation
    1978         """
    1979        
    1980         pass
     1948#    def update_special_conditions(self):
     1949#        """There may be a need to change the values of the conserved
     1950#        quantities to satisfy special conditions at the very lowest level
     1951#        the fluid flow calculation
     1952#        """
     1953#
     1954#        pass
    19811955
    19821956
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py

    r8455 r8500  
    8585        General_mesh.__init__(self, coordinates, triangles,
    8686                              geo_reference=geo_reference,
     87                              use_inscribed_circle=use_inscribed_circle,
    8788                              verbose=verbose)
    8889
    89         if verbose: log.critical('Initialising mesh')
     90        if verbose: log.critical('Mesh: Initialising')
    9091
    9192        N = len(self) #Number_of_triangles
    9293
    93         self.use_inscribed_circle = use_inscribed_circle
    94 
    95         #Allocate space for geometric quantities
    96         self.centroid_coordinates = num.zeros((N, 2), num.float)
    97 
    98         self.radii = num.zeros(N, num.float)
    99 
    100         self.neighbours = num.zeros((N, 3), num.int)
    101         self.neighbour_edges = num.zeros((N, 3), num.int)
     94        # Allocate arrays for neighbour data
     95
     96        self.neighbours = -1*num.ones((N, 3), num.int)
     97        self.neighbour_edges = -1*num.ones((N, 3), num.int)
    10298        self.number_of_boundaries = num.zeros(N, num.int)
    10399        self.surrogate_neighbours = num.zeros((N, 3), num.int)
     
    106102        V = self.vertex_coordinates # Relative coordinates
    107103
    108         #Initialise each triangle
    109         if verbose: log.critical('Mesh: Computing centroids and radii')
    110         for i in range(N):
    111             if verbose and i % ((N+10)/10) == 0: log.critical('(%d/%d)' % (i, N))
    112 
    113             x0, y0 = V[3*i, :]
    114             x1, y1 = V[3*i+1, :]
    115             x2, y2 = V[3*i+2, :]
    116 
    117             #x0 = V[i, 0]; y0 = V[i, 1]
    118             #x1 = V[i, 2]; y1 = V[i, 3]
    119             #x2 = V[i, 4]; y2 = V[i, 5]
    120 
    121             #Compute centroid
    122             centroid = num.array([(x0 + x1 + x2)/3, (y0 + y1 + y2)/3], num.float)
    123             self.centroid_coordinates[i] = centroid
    124 
    125 
    126             if self.use_inscribed_circle == False:
    127                 #OLD code. Computed radii may exceed that of an
    128                 #inscribed circle
    129 
    130                 #Midpoints
    131                 m0 = num.array([(x1 + x2)/2, (y1 + y2)/2], num.float)
    132                 m1 = num.array([(x0 + x2)/2, (y0 + y2)/2], num.float)
    133                 m2 = num.array([(x1 + x0)/2, (y1 + y0)/2], num.float)
    134 
    135                 #The radius is the distance from the centroid of
    136                 #a triangle to the midpoint of the side of the triangle
    137                 #closest to the centroid
    138                 d0 = num.sqrt(num.sum( (centroid-m0)**2 ))
    139                 d1 = num.sqrt(num.sum( (centroid-m1)**2 ))
    140                 d2 = num.sqrt(num.sum( (centroid-m2)**2 ))
    141 
    142                 self.radii[i] = min(d0, d1, d2)
    143 
    144             else:
    145                 #NEW code added by Peter Row. True radius
    146                 #of inscribed circle is computed
    147 
    148                 a = num.sqrt((x0-x1)**2+(y0-y1)**2)
    149                 b = num.sqrt((x1-x2)**2+(y1-y2)**2)
    150                 c = num.sqrt((x2-x0)**2+(y2-y0)**2)
    151 
    152                 self.radii[i]=2.0*self.areas[i]/(a+b+c)
    153 
    154 
    155             #Initialise Neighbours (-1 means that it is a boundary neighbour)
    156             self.neighbours[i, :] = [-1, -1, -1]
    157 
    158             #Initialise edge ids of neighbours
    159             #In case of boundaries this slot is not used
    160             self.neighbour_edges[i, :] = [-1, -1, -1]
     104#        #Initialise each triangle
     105#        if verbose: log.critical('Mesh: Computing centroids and radii')
     106#        for i in range(N):
     107#            if verbose and i % ((N+10)/10) == 0: log.critical('(%d/%d)' % (i, N))
     108#
     109#            x0, y0 = V[3*i, :]
     110#            x1, y1 = V[3*i+1, :]
     111#            x2, y2 = V[3*i+2, :]
     112#
     113#            #x0 = V[i, 0]; y0 = V[i, 1]
     114#            #x1 = V[i, 2]; y1 = V[i, 3]
     115#            #x2 = V[i, 4]; y2 = V[i, 5]
     116#
     117#            #Compute centroid
     118#            centroid = num.array([(x0 + x1 + x2)/3, (y0 + y1 + y2)/3], num.float)
     119#            self.centroid_coordinates[i] = centroid
     120#
     121#
     122#            if self.use_inscribed_circle == False:
     123#                #OLD code. Computed radii may exceed that of an
     124#                #inscribed circle
     125#
     126#                #Midpoints
     127#                m0 = num.array([(x1 + x2)/2, (y1 + y2)/2], num.float)
     128#                m1 = num.array([(x0 + x2)/2, (y0 + y2)/2], num.float)
     129#                m2 = num.array([(x1 + x0)/2, (y1 + y0)/2], num.float)
     130#
     131#                #The radius is the distance from the centroid of
     132#                #a triangle to the midpoint of the side of the triangle
     133#                #closest to the centroid
     134#                d0 = num.sqrt(num.sum( (centroid-m0)**2 ))
     135#                d1 = num.sqrt(num.sum( (centroid-m1)**2 ))
     136#                d2 = num.sqrt(num.sum( (centroid-m2)**2 ))
     137#
     138#                self.radii[i] = min(d0, d1, d2)
     139#
     140#            else:
     141#                #NEW code added by Peter Row. True radius
     142#                #of inscribed circle is computed
     143#
     144#                a = num.sqrt((x0-x1)**2+(y0-y1)**2)
     145#                b = num.sqrt((x1-x2)**2+(y1-y2)**2)
     146#                c = num.sqrt((x2-x0)**2+(y2-y0)**2)
     147#
     148#                self.radii[i]=2.0*self.areas[i]/(a+b+c)
     149#
     150#
     151#            #Initialise Neighbours (-1 means that it is a boundary neighbour)
     152#            self.neighbours[i, :] = [-1, -1, -1]
     153#
     154#            #Initialise edge ids of neighbours
     155#            #In case of boundaries this slot is not used
     156#            self.neighbour_edges[i, :] = [-1, -1, -1]
    161157
    162158
  • trunk/anuga_core/source/anuga/operators/erosion_operators.py

    r8492 r8500  
    6868
    6969        #-----------------------------------------
    70         # Some stras for reporting
     70        # Some extras for reporting
    7171        #-----------------------------------------
    7272        self.max_change = 0
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r8486 r8500  
    240240        self.alpha_balance = alpha_balance
    241241        self.tight_slope_limiters = tight_slope_limiters
    242         self.optimise_dry_cells = int(optimise_dry_cells)
     242       
     243        self.set_use_optimise_dry_cells(optimise_dry_cells)
    243244        self.set_extrapolate_velocity(extrapolate_velocity_second_order)
    244245
     
    503504        elif flag is False:
    504505            self.use_edge_limiter = False
     506
     507    def set_use_optimise_dry_cells(self, flag=True):
     508        """ Try to optimize calculations where region is dry
     509        """
     510
     511        if flag is True:
     512            self.optimise_dry_cells = int(True)
     513        elif flag is False:
     514            self.optimise_dry_cells = int(False)
     515
     516
    505517
    506518
  • trunk/anuga_core/source/pypar_dist/source/pypar.py

    r8494 r8500  
    898898         reduce_array,\
    899899         allreduce_array,\
    900         bsend_string, bsend_array, \
    901          mpi_alloc_and_attach, mpi_detach_and_dealloc, \
    902          mpi_alloc, mpi_dealloc, mpi_attach, mpi_detach, \
    903          string_push_for_alloc_and_attach, array_push_for_alloc_and_attach, \
     900        bsend_string, bsend_array, \
     901             mpi_alloc_and_attach, mpi_detach_and_dealloc, \
     902             mpi_alloc, mpi_dealloc, mpi_attach, mpi_detach, \
     903             string_push_for_alloc_and_attach, array_push_for_alloc_and_attach, \
    904904         MPI_ANY_TAG as any_tag, MPI_TAG_UB as max_tag,\
    905905         MPI_ANY_SOURCE as any_source,\
Note: See TracChangeset for help on using the changeset viewer.