Changeset 9166


Ignore:
Timestamp:
Jun 16, 2014, 11:38:55 PM (10 years ago)
Author:
davies
Message:

Updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/riverwall.py

    r9165 r9166  
    465465        """
    466466         Get indices of vertices corresponding to edges at index riverwalledgeInds
     467   
    467468         Since each edge has 2 vertices, use V1 and V2
    468          We have to work to compute these, I can't see a simple formula
     469       
     470         There is indeed a simple relationship between the vertex and edge indices
    469471        """
    470472
     
    473475        riverwallCentInds=self.get_centroids_corresponding_to_edgeInds(riverwalledgeInds)
    474476
    475         rwV0Inds=3*riverwallCentInds #+((resid+1)%3)
    476         rwV1Inds=3*riverwallCentInds+1 #((resid+2)%3)
    477         rwV2Inds=3*riverwallCentInds+2 #((resid+2)%3)
    478 
    479         # Find which 2 vertices have the edge value, by testing the
    480         # coordinates
    481         X01=0.5*(domain.vertex_coordinates[rwV0Inds,0]+domain.vertex_coordinates[rwV1Inds,0])
    482         Y01=0.5*(domain.vertex_coordinates[rwV0Inds,1]+domain.vertex_coordinates[rwV1Inds,1])
    483         k01=(abs(X01- domain.edge_coordinates[riverwalledgeInds,0])+abs(Y01-domain.edge_coordinates[riverwalledgeInds,1])<tol)
    484         X12=0.5*(domain.vertex_coordinates[rwV2Inds,0]+domain.vertex_coordinates[rwV1Inds,0])
    485         Y12=0.5*(domain.vertex_coordinates[rwV2Inds,1]+domain.vertex_coordinates[rwV1Inds,1])
    486         k12=(abs(X12 - domain.edge_coordinates[riverwalledgeInds,0])+abs(Y12-domain.edge_coordinates[riverwalledgeInds,1])<tol)
    487         X02=0.5*(domain.vertex_coordinates[rwV2Inds,0]+domain.vertex_coordinates[rwV0Inds,0])
    488         Y02=0.5*(domain.vertex_coordinates[rwV2Inds,1]+domain.vertex_coordinates[rwV0Inds,1])
    489         k02=(abs(X02 - domain.edge_coordinates[riverwalledgeInds,0])+abs(Y02-domain.edge_coordinates[riverwalledgeInds,1])<tol)
    490 
    491         riverwallV2Inds=riverwallCentInds*0
    492         riverwallV1Inds=riverwallCentInds*0
    493      
    494         t1=(k01==1).nonzero()[0]
    495         riverwallV2Inds[t1]=rwV0Inds[t1]
    496         riverwallV1Inds[t1]=rwV1Inds[t1]
    497        
    498         t1=(k12==1).nonzero()[0]
    499         riverwallV2Inds[t1]=rwV2Inds[t1]
    500         riverwallV1Inds[t1]=rwV1Inds[t1]
    501        
    502         t1=(k02==1).nonzero()[0]
    503         riverwallV2Inds[t1]=rwV0Inds[t1]
    504         riverwallV1Inds[t1]=rwV2Inds[t1]
     477        rwEI_mod3=riverwalledgeInds%3
     478
     479        # Figure out the difference between each vertex index and the edge index. Is either
     480        # -2, -1, 1, 2
     481        rwV1_adjustment= -2*(rwEI_mod3==2) -1*(rwEI_mod3==1) +1*(rwEI_mod3==0)
     482        rwV2_adjustment= -1*(rwEI_mod3==2) +1*(rwEI_mod3==1) +2*(rwEI_mod3==0)
     483        riverwallV1Inds=riverwalledgeInds+rwV1_adjustment
     484        riverwallV2Inds=riverwalledgeInds+rwV2_adjustment
    505485
    506486        return riverwallV1Inds, riverwallV2Inds
     
    538518            # Get their corresponding vertices
    539519            riverwallV1Inds, riverwallV2Inds = rwd.get_vertices_corresponding_to_edgeInds(riverwalledgeInds, tol=tol)
     520
     521            #import pdb
     522            #pdb.set_trace()
    540523
    541524            # With discontinuous triangles, we expect edges to occur twice
Note: See TracChangeset for help on using the changeset viewer.