Ignore:
Timestamp:
Dec 14, 2004, 12:59:59 PM (20 years ago)
Author:
duncan
Message:

fixed bug in least_squares algorithm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/least_squares.py

    r641 r705  
    245245            #Find vertices near x
    246246            candidate_vertices = root.search(x[0], x[1])
    247 
    248247            is_more_elements = True
    249             if candidate_vertices == []:
    250                 # The point isn't even within the root cell!
    251                 is_more_elements = False
    252                 element_found = False
    253             else:
    254                 element_found, sigma0, sigma1, sigma2, k = \
    255                     self.search_triangles_of_vertices(candidate_vertices, x)
    256 
     248           
     249            element_found, sigma0, sigma1, sigma2, k = \
     250                self.search_triangles_of_vertices(candidate_vertices, x)
    257251            while not element_found and is_more_elements:
    258                 candidate_vertices = root.expand_search()
    259                 if candidate_vertices == []:
    260                     # All the triangles have been searched.
     252                candidate_vertices, branch = root.expand_search()
     253                if branch == []:
     254                    # Searching all the verts from the root cell that haven't
     255                    # been searched.  This is the last try
     256                    element_found, sigma0, sigma1, sigma2, k = \
     257                      self.search_triangles_of_vertices(candidate_vertices, x)
    261258                    is_more_elements = False
    262259                else:
    263260                    element_found, sigma0, sigma1, sigma2, k = \
    264261                      self.search_triangles_of_vertices(candidate_vertices, x)
    265                    
    266                
     262                     
    267263           
    268264            #Update interpolation matrix A if necessary     
     
    301297            sigma0 = -10.0
    302298            sigma1 = -10.0
     299            k = -10.0
    303300
    304301            #For all vertices in same cell as point x
     
    317314                    #print "PDSG - xi1", xi1
    318315                    #print "PDSG - xi2", xi2
    319                     #print "PDSG element %i verts((%f, %f),(%f, %f),(%f, %f))" \
    320                     #      % (k, xi0[0], xi0[1], xi1[0], xi1[1], xi2[0], xi2[1])
     316                   #print "PDSG element %i verts((%f, %f),(%f, %f),(%f, %f))" \
     317                    #   % (k, xi0[0], xi0[1], xi1[0], xi1[1], xi2[0], xi2[1])
    321318                   
    322319                    #Get the three normals
Note: See TracChangeset for help on using the changeset viewer.