Changeset 2778


Ignore:
Timestamp:
Apr 27, 2006, 3:44:41 PM (19 years ago)
Author:
steve
Message:

On our 64 bit machine, ran into problem in pmesh/mesh.py where seg[0], seg[1], triangle,
and neighbor where not seen as integers. Had to wrap them in int(..)

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • inundation/pmesh/mesh.py

    r2525 r2778  
    840840        for seg,seg_tag in map(None,outlineDict['segments'],
    841841                       outlineDict['segment_tags']):
    842             segObject = Segment( localUserVertices[seg[0]],
    843                            localUserVertices[seg[1]] )
     842            segObject = Segment( localUserVertices[int(seg[0])],
     843                           localUserVertices[int(seg[1])] )
    844844            if not seg_tag == '':
    845845                segObject.set_tag(seg_tag)
     
    13311331        for seg,marker in map(None,genDict['generatedsegmentlist'],
    13321332                              genDict['generatedsegmentmarkerlist']):
    1333             segObject = Segment( self.meshVertices[seg[0]],
    1334                            self.meshVertices[seg[1]], tag = marker )
     1333            segObject = Segment( self.meshVertices[int(seg[0])],
     1334                           self.meshVertices[int(seg[1])], tag = marker )
    13351335            segObject.index = index
    13361336            index +=1
     
    13391339        index = 0
    13401340        for triangle in genDict['generatedtrianglelist']:
    1341             tObject =Triangle( self.meshVertices[triangle[0]],
    1342                         self.meshVertices[triangle[1]],
    1343                         self.meshVertices[triangle[2]] )
     1341            tObject =Triangle( self.meshVertices[int(triangle[0])],
     1342                        self.meshVertices[int(triangle[1])],
     1343                        self.meshVertices[int(triangle[2])] )
    13441344            tObject.index = index
    13451345            index +=1
     
    13681368            for neighbor in triangle:
    13691369                if ( neighbor != -1):
    1370                     ObjectNeighbor.append(self.meshTriangles[neighbor])
     1370                    ObjectNeighbor.append(self.meshTriangles[int(neighbor)])
    13711371                else:
    13721372                    ObjectNeighbor.append(None)
     
    14101410        for seg,tag in map(None,genDict['segmentlist'],
    14111411                           genDict['segmenttaglist']):
    1412             segObject = Segment( self.userVertices[seg[0]],
    1413                            self.userVertices[seg[1]], tag = tag )
     1412            segObject = Segment( self.userVertices[int(seg[0])],
     1413                           self.userVertices[int(seg[1])], tag = tag )
    14141414            #segObject.index = index
    14151415            #index +=1
     
    21432143        index = 0
    21442144        for seg,tag in map(None,genDict['segments'],genDict['segment_tags']):
    2145             segObject = Segment( self.meshVertices[seg[0]],
    2146                            self.meshVertices[seg[1]], tag = tag )
     2145            segObject = Segment( self.meshVertices[int(seg[0])],
     2146                           self.meshVertices[int(seg[1])], tag = tag )
    21472147            segObject.index = index
    21482148            index +=1
     
    21512151        index = 0
    21522152        for triangle in genDict['triangles']:
    2153             tObject =Triangle( self.meshVertices[triangle[0]],
    2154                         self.meshVertices[triangle[1]],
    2155                         self.meshVertices[triangle[2]] )
     2153            tObject =Triangle( self.meshVertices[int(triangle[0])],
     2154                        self.meshVertices[int(triangle[1])],
     2155                        self.meshVertices[int(triangle[2])] )
    21562156            tObject.index = index
    21572157            index +=1
     
    21802180            for neighbor in triangle:
    21812181                if ( neighbor != -1):
    2182                     ObjectNeighbor.append(self.meshTriangles[neighbor])
     2182                    ObjectNeighbor.append(self.meshTriangles[int(neighbor)])
    21832183                else:
    21842184                    ObjectNeighbor.append(None)
     
    22152215        for seg,tag in map(None,genDict['outline_segments'],
    22162216                           genDict['outline_segment_tags']):
    2217             segObject = Segment( self.userVertices[seg[0]],
    2218                            self.userVertices[seg[1]], tag = tag )
     2217
     2218            segObject = Segment( self.userVertices[int(seg[0])],
     2219                           self.userVertices[int(seg[1])], tag = tag )
    22192220            #segObject.index = index
    22202221            #index +=1
  • inundation/pmesh/test_mesh.py

    r2396 r2778  
    19151915#-------------------------------------------------------------
    19161916if __name__ == "__main__":
    1917     suite = unittest.makeSuite(meshTestCase,'test')
    1918     #suite = unittest.makeSuite(meshTestCase,'test_asciiFile')
     1917    #suite = unittest.makeSuite(meshTestCase,'test')
     1918    suite = unittest.makeSuite(meshTestCase,'test_import_mesh')
    19191919    runner = unittest.TextTestRunner() #verbosity=2)
    19201920    runner.run(suite)
  • inundation/pypar_dist/compile.py

    r123 r2778  
    149149    if os.name == 'posix' and os.uname()[4] == 'x86_64':
    150150      #Extra flags for 64 bit architectures
    151       #s += ' -fPIC -m64' #gcc
    152       s += ' -fPIC -tp amd64' #pgcc
     151      s += ' -fPIC -m64' #gcc
     152      #s += ' -fPIC -tp amd64' #pgcc
    153153     
    154154   
     
    169169  if os.name == 'posix' and os.uname()[4] == 'x86_64':
    170170      #Extra flags for 64 bit architectures using Portland compilers
    171       s += ' -mcmodel=medium'
     171      #s += ' -mcmodel=medium'
    172172 
    173173  if verbose:
  • inundation/pypar_dist/setup.py

    r127 r2778  
    8686def get_mpi_flags():
    8787    output = _get_mpi_cmd()
     88    print output
    8889    if not output:
    8990        if sys.platform=='win32': #From Simon Frost
  • inundation/pyvolution/general_mesh.py

    r2694 r2778  
    6363        """
    6464
    65         from Numeric import array, zeros, Int, Float, maximum, sqrt, sum
    66 
    67         self.triangles = array(triangles).astype(Int)
    68         self.coordinates = array(coordinates)
     65        from Numeric import array, zeros, Int, Float, sqrt, sum
     66
     67        self.triangles = array(triangles,Int)
     68        self.coordinates = array(coordinates,Float)
     69       
    6970
    7071        # FIXME: this stores a geo_reference, but when coords are returned
     
    9091
    9192        #FIXME: Maybe move to statistics?
     93
    9294        xy_extent = [ min(self.coordinates[:,0]), min(self.coordinates[:,1]) ,
    9395                      max(self.coordinates[:,0]), max(self.coordinates[:,1]) ]
     
    103105        #Get x,y coordinates for all triangles and store
    104106        self.vertex_coordinates = V = self.compute_vertex_coordinates()
     107
    105108
    106109        #Initialise each triangle
     
    152155            self.edgelengths[i, :] = [l0, l1, l2]
    153156
     157       
    154158        #Build vertex list
    155159        self.build_vertexlist()
  • inundation/pyvolution/least_squares.py

    r2764 r2778  
    2424
    2525#from general_mesh import General_mesh
    26 from Numeric import zeros, array, Float, Int, dot, transpose, concatenate, ArrayType, NewAxis
     26from Numeric import zeros, array, Float, Int, transpose, concatenate, ArrayType, NewAxis
    2727from pyvolution.mesh import Mesh
    2828
    29 from Numeric import zeros, take, compress, array, Float, Int, dot, transpose, concatenate, ArrayType
     29from Numeric import dot, zeros, take, compress, array, Float, Int, transpose, concatenate, ArrayType
    3030from utilities.sparse import Sparse, Sparse_CSR
    3131from utilities.cg_solve import conjugate_gradient, VectorShapeError
     
    3636
    3737import time
    38 
    39 
    4038
    4139DEFAULT_ALPHA = 0.001
     
    437435        else:
    438436            geo = Geo_reference(mesh_origin[0],mesh_origin[1],mesh_origin[2])
     437
     438               
    439439        self.mesh = Mesh(vertex_coordinates, triangles,
    440440                         geo_reference = geo)
     
    653653            is_more_elements = True
    654654
     655
    655656            element_found, sigma0, sigma1, sigma2, k = \
    656                 self.search_triangles_of_vertices(candidate_vertices, x)
     657                           self.search_triangles_of_vertices(candidate_vertices, x)
    657658            first_expansion = True
    658659            while not element_found and is_more_elements and expand_search:
     
    702703
    703704    def search_triangles_of_vertices(self, candidate_vertices, x):
     705
     706           
    704707            #Find triangle containing x:
    705708            element_found = False
  • inundation/pyvolution/mesh.py

    r2709 r2778  
    7373        from Numeric import array, zeros, Int, Float, maximum, sqrt, sum
    7474
     75       
    7576        General_mesh.__init__(self, coordinates, triangles, geo_reference)
    7677
  • inundation/pyvolution/shallow_water_vtk.py

    r2334 r2778  
    4848
    4949
    50     def evolve(self, yieldstep = None, finaltime = None,
     50    def evolve(self,
     51               yieldstep = None,
     52               finaltime = None,
     53               duration = None,
    5154               skip_initial_step = False):
    5255        """Specialisation of basic evolve method from parent class
     
    8790
    8891        #Call basic machinery from parent class
    89         for t in Generic_Domain.evolve(self, yieldstep, finaltime,
    90                                        skip_initial_step):
     92        for t in Generic_Domain.evolve(self,
     93                                       yieldstep=yieldstep,
     94                                       finaltime = finaltime,
     95                                       duration = duration,
     96                                       skip_initial_step = skip_initial_step):
    9197            #Real time viz
    9298            if self.visualise is True:
  • inundation/pyvolution/test_least_squares.py

    r2753 r2778  
    3737        data = [ [2.0/3, 2.0/3] ] #Use centroid as one data point
    3838
     39       
    3940        interp = Interpolation(points, vertices, data)
    4041        assert allclose(interp.get_A(), [[1./3, 1./3, 1./3]])
     
    19191920if __name__ == "__main__":
    19201921    #suite = unittest.makeSuite(Test_Least_Squares,'test_smooth_attributes_to_mesh_function')
     1922    #suite = unittest.makeSuite(Test_Least_Squares,'test_datapoint_at_centroid')
    19211923    suite = unittest.makeSuite(Test_Least_Squares,'test')
    19221924
  • inundation/utilities/compile.py

    r2756 r2778  
    179179  utilities_include_dir = None
    180180  for pathdir in sys.path:
     181
    181182    utilities_include_dir = pathdir + os.sep + 'utilities'
    182 
     183    #print pathdir
     184    #print utilities_include_dir
    183185    try:
    184186      os.stat(utilities_include_dir)
     
    188190      #print 'Found %s to be used as include dir' %utilities_include_dir
    189191      break
    190 
    191192     
    192193
  • inundation/utilities/numerical_tools.py

    r2710 r2778  
    197197                return array(A)  #FIXME: Shouldn't this just return A?
    198198            else:
    199                 return A.astype(typecode)
     199                return array(A,typecode)
    200200        else:
    201             return array(A).astype(typecode)
     201            return array(A,typecode)
    202202
    203203
  • inundation/utilities/test_numerical_tools.py

    r2709 r2778  
    55from Numeric import zeros, array, allclose
    66from math import sqrt, pi
    7 from pyvolution.config import epsilon
     7from config import epsilon
    88
    99from numerical_tools import *
Note: See TracChangeset for help on using the changeset viewer.