Changeset 2778
- Timestamp:
- Apr 27, 2006, 3:44:41 PM (19 years ago)
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pmesh/mesh.py
r2525 r2778 840 840 for seg,seg_tag in map(None,outlineDict['segments'], 841 841 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])] ) 844 844 if not seg_tag == '': 845 845 segObject.set_tag(seg_tag) … … 1331 1331 for seg,marker in map(None,genDict['generatedsegmentlist'], 1332 1332 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 ) 1335 1335 segObject.index = index 1336 1336 index +=1 … … 1339 1339 index = 0 1340 1340 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])] ) 1344 1344 tObject.index = index 1345 1345 index +=1 … … 1368 1368 for neighbor in triangle: 1369 1369 if ( neighbor != -1): 1370 ObjectNeighbor.append(self.meshTriangles[ neighbor])1370 ObjectNeighbor.append(self.meshTriangles[int(neighbor)]) 1371 1371 else: 1372 1372 ObjectNeighbor.append(None) … … 1410 1410 for seg,tag in map(None,genDict['segmentlist'], 1411 1411 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 ) 1414 1414 #segObject.index = index 1415 1415 #index +=1 … … 2143 2143 index = 0 2144 2144 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 ) 2147 2147 segObject.index = index 2148 2148 index +=1 … … 2151 2151 index = 0 2152 2152 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])] ) 2156 2156 tObject.index = index 2157 2157 index +=1 … … 2180 2180 for neighbor in triangle: 2181 2181 if ( neighbor != -1): 2182 ObjectNeighbor.append(self.meshTriangles[ neighbor])2182 ObjectNeighbor.append(self.meshTriangles[int(neighbor)]) 2183 2183 else: 2184 2184 ObjectNeighbor.append(None) … … 2215 2215 for seg,tag in map(None,genDict['outline_segments'], 2216 2216 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 ) 2219 2220 #segObject.index = index 2220 2221 #index +=1 -
inundation/pmesh/test_mesh.py
r2396 r2778 1915 1915 #------------------------------------------------------------- 1916 1916 if __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') 1919 1919 runner = unittest.TextTestRunner() #verbosity=2) 1920 1920 runner.run(suite) -
inundation/pypar_dist/compile.py
r123 r2778 149 149 if os.name == 'posix' and os.uname()[4] == 'x86_64': 150 150 #Extra flags for 64 bit architectures 151 #s += ' -fPIC -m64' #gcc152 s += ' -fPIC -tp amd64' #pgcc151 s += ' -fPIC -m64' #gcc 152 #s += ' -fPIC -tp amd64' #pgcc 153 153 154 154 … … 169 169 if os.name == 'posix' and os.uname()[4] == 'x86_64': 170 170 #Extra flags for 64 bit architectures using Portland compilers 171 s += ' -mcmodel=medium'171 #s += ' -mcmodel=medium' 172 172 173 173 if verbose: -
inundation/pypar_dist/setup.py
r127 r2778 86 86 def get_mpi_flags(): 87 87 output = _get_mpi_cmd() 88 print output 88 89 if not output: 89 90 if sys.platform=='win32': #From Simon Frost -
inundation/pyvolution/general_mesh.py
r2694 r2778 63 63 """ 64 64 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 69 70 70 71 # FIXME: this stores a geo_reference, but when coords are returned … … 90 91 91 92 #FIXME: Maybe move to statistics? 93 92 94 xy_extent = [ min(self.coordinates[:,0]), min(self.coordinates[:,1]) , 93 95 max(self.coordinates[:,0]), max(self.coordinates[:,1]) ] … … 103 105 #Get x,y coordinates for all triangles and store 104 106 self.vertex_coordinates = V = self.compute_vertex_coordinates() 107 105 108 106 109 #Initialise each triangle … … 152 155 self.edgelengths[i, :] = [l0, l1, l2] 153 156 157 154 158 #Build vertex list 155 159 self.build_vertexlist() -
inundation/pyvolution/least_squares.py
r2764 r2778 24 24 25 25 #from general_mesh import General_mesh 26 from Numeric import zeros, array, Float, Int, dot,transpose, concatenate, ArrayType, NewAxis26 from Numeric import zeros, array, Float, Int, transpose, concatenate, ArrayType, NewAxis 27 27 from pyvolution.mesh import Mesh 28 28 29 from Numeric import zeros, take, compress, array, Float, Int, dot, transpose, concatenate, ArrayType29 from Numeric import dot, zeros, take, compress, array, Float, Int, transpose, concatenate, ArrayType 30 30 from utilities.sparse import Sparse, Sparse_CSR 31 31 from utilities.cg_solve import conjugate_gradient, VectorShapeError … … 36 36 37 37 import time 38 39 40 38 41 39 DEFAULT_ALPHA = 0.001 … … 437 435 else: 438 436 geo = Geo_reference(mesh_origin[0],mesh_origin[1],mesh_origin[2]) 437 438 439 439 self.mesh = Mesh(vertex_coordinates, triangles, 440 440 geo_reference = geo) … … 653 653 is_more_elements = True 654 654 655 655 656 element_found, sigma0, sigma1, sigma2, k = \ 656 self.search_triangles_of_vertices(candidate_vertices, x)657 self.search_triangles_of_vertices(candidate_vertices, x) 657 658 first_expansion = True 658 659 while not element_found and is_more_elements and expand_search: … … 702 703 703 704 def search_triangles_of_vertices(self, candidate_vertices, x): 705 706 704 707 #Find triangle containing x: 705 708 element_found = False -
inundation/pyvolution/mesh.py
r2709 r2778 73 73 from Numeric import array, zeros, Int, Float, maximum, sqrt, sum 74 74 75 75 76 General_mesh.__init__(self, coordinates, triangles, geo_reference) 76 77 -
inundation/pyvolution/shallow_water_vtk.py
r2334 r2778 48 48 49 49 50 def evolve(self, yieldstep = None, finaltime = None, 50 def evolve(self, 51 yieldstep = None, 52 finaltime = None, 53 duration = None, 51 54 skip_initial_step = False): 52 55 """Specialisation of basic evolve method from parent class … … 87 90 88 91 #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): 91 97 #Real time viz 92 98 if self.visualise is True: -
inundation/pyvolution/test_least_squares.py
r2753 r2778 37 37 data = [ [2.0/3, 2.0/3] ] #Use centroid as one data point 38 38 39 39 40 interp = Interpolation(points, vertices, data) 40 41 assert allclose(interp.get_A(), [[1./3, 1./3, 1./3]]) … … 1919 1920 if __name__ == "__main__": 1920 1921 #suite = unittest.makeSuite(Test_Least_Squares,'test_smooth_attributes_to_mesh_function') 1922 #suite = unittest.makeSuite(Test_Least_Squares,'test_datapoint_at_centroid') 1921 1923 suite = unittest.makeSuite(Test_Least_Squares,'test') 1922 1924 -
inundation/utilities/compile.py
r2756 r2778 179 179 utilities_include_dir = None 180 180 for pathdir in sys.path: 181 181 182 utilities_include_dir = pathdir + os.sep + 'utilities' 182 183 #print pathdir 184 #print utilities_include_dir 183 185 try: 184 186 os.stat(utilities_include_dir) … … 188 190 #print 'Found %s to be used as include dir' %utilities_include_dir 189 191 break 190 191 192 192 193 -
inundation/utilities/numerical_tools.py
r2710 r2778 197 197 return array(A) #FIXME: Shouldn't this just return A? 198 198 else: 199 return A.astype(typecode)199 return array(A,typecode) 200 200 else: 201 return array(A ).astype(typecode)201 return array(A,typecode) 202 202 203 203 -
inundation/utilities/test_numerical_tools.py
r2709 r2778 5 5 from Numeric import zeros, array, allclose 6 6 from math import sqrt, pi 7 from pyvolution.config import epsilon7 from config import epsilon 8 8 9 9 from numerical_tools import *
Note: See TracChangeset
for help on using the changeset viewer.