Changeset 5394


Ignore:
Timestamp:
Jun 5, 2008, 1:42:01 PM (14 years ago)
Author:
ole
Message:

Cosmetics as per style guide

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py

    r5306 r5394  
    5656        self.domain = domain
    5757
    58         #Allocate space for other quantities
     58        # Allocate space for other quantities
    5959        self.centroid_values = zeros(N, Float)
    6060        self.edge_values = zeros((N, 3), Float)
    6161
    62         #Allocate space for Gradient
     62        # Allocate space for Gradient
    6363        self.x_gradient = zeros(N, Float)
    6464        self.y_gradient = zeros(N, Float)
    6565
    66         #Allocate space for Limiter Phi
     66        # Allocate space for Limiter Phi
    6767        self.phi = zeros(N, Float)       
    6868
    69         #Intialise centroid and edge_values
     69        # Intialise centroid and edge_values
    7070        self.interpolate()
    7171
    72         #Allocate space for boundary values
     72        # Allocate space for boundary values
    7373        L = len(domain.boundary)
    7474        self.boundary_values = zeros(L, Float)
    7575
    76         #Allocate space for updates of conserved quantities by
    77         #flux calculations and forcing functions
    78 
    79         #Allocate space for update fields
     76        # Allocate space for updates of conserved quantities by
     77        # flux calculations and forcing functions
     78
     79        # Allocate space for update fields
    8080        self.explicit_update = zeros(N, Float )
    8181        self.semi_implicit_update = zeros(N, Float )
     
    8686
    8787
    88     #Methods for operator overloading
     88    # Methods for operator overloading
    8989    def __len__(self):
    9090        return self.centroid_values.shape[0]
     
    247247
    248248    def interpolate_from_vertices_to_edges(self):
    249         #Call correct module function
    250         #(either from this module or C-extension)
     249        # Call correct module function
     250        # (either from this module or C-extension)
    251251        interpolate_from_vertices_to_edges(self)
    252252
    253253    def interpolate_from_edges_to_vertices(self):
    254         #Call correct module function
    255         #(either from this module or C-extension)
     254        # Call correct module function
     255        # (either from this module or C-extension)
    256256        interpolate_from_edges_to_vertices(self)
    257257
     
    526526
    527527
    528     #Specific functions for setting values
     528    # Specific functions for setting values
    529529    def set_values_from_constant(self, X,
    530530                                 location, indices, verbose):
     
    787787                                        verbose = False,
    788788                                        use_cache = False):
    789         #FIXME: Use this function for the time being. Later move code in here
     789        # FIXME: Use this function for the time being. Later move code in here
    790790
    791791        points = geospatial_data.get_data_points(absolute = False)
     
    11401140                indices=range(self.domain.number_of_nodes)
    11411141            vert_values = []
    1142             #Go through list of unique vertices
     1142           
     1143            # Go through list of unique vertices
    11431144            for unique_vert_id in indices:
    11441145                triangles = self.domain.get_triangles_and_vertices_per_node(node=unique_vert_id)
    11451146                   
    1146                 #In case there are unused points
     1147                # In case there are unused points
    11471148                if len(triangles) == 0:
    11481149                    msg = 'Unique vertex not associated with triangles'
     
    11771178        from Numeric import array, Float
    11781179
    1179         #Assert that A can be converted to a Numeric array of appropriate dim
    1180         A = array(A, Float)
    1181 
    1182         #print 'SHAPE A', A.shape
     1180        # Assert that A can be converted to a Numeric array of appropriate dim
     1181        A = ensure_numeric(A, Float)
     1182
     1183        # print 'SHAPE A', A.shape
    11831184        assert len(A.shape) == 1
    11841185
     
    11901191            vertex_list = indices
    11911192
    1192         #Go through list of unique vertices
    1193        
     1193        # Go through list of unique vertices
    11941194        for i_index, unique_vert_id in enumerate(vertex_list):
    11951195
     
    11971197            triangles = self.domain.get_triangles_and_vertices_per_node(node=unique_vert_id)
    11981198                   
    1199             #In case there are unused points
     1199            # In case there are unused points
    12001200            if len(triangles) == 0: continue
    12011201
    1202             #Go through all triangle, vertex pairs
    1203             #touching vertex unique_vert_id and set corresponding vertex value
     1202            # Go through all triangle, vertex pairs
     1203            # touching vertex unique_vert_id and set corresponding vertex value
    12041204            for triangle_id, vertex_id in triangles:
    12051205                self.vertex_values[triangle_id, vertex_id] = A[i_index]
    12061206
    1207         #Intialise centroid and edge_values
     1207        # Intialise centroid and edge_values
    12081208        self.interpolate()
    12091209
     
    13741374
    13751375    def update(self, timestep):
    1376         #Call correct module function
    1377         #(either from this module or C-extension)
     1376        # Call correct module function
     1377        # (either from this module or C-extension)
    13781378        return update(self, timestep)
    13791379
    13801380    def compute_gradients(self):
    1381         #Call correct module function
    1382         #(either from this module or C-extension)
     1381        # Call correct module function
     1382        # (either from this module or C-extension)
    13831383        return compute_gradients(self)
    13841384
    13851385    def limit(self):
    1386         #Call correct module depending on whether
    1387         #basing limit calculations on edges or vertices
     1386        # Call correct module depending on whether
     1387        # basing limit calculations on edges or vertices
    13881388        limit_old(self)
    13891389
    13901390    def limit_vertices_by_all_neighbours(self):
    1391         #Call correct module function
    1392         #(either from this module or C-extension)
     1391        # Call correct module function
     1392        # (either from this module or C-extension)
    13931393        limit_vertices_by_all_neighbours(self)
    13941394
    13951395    def limit_edges_by_all_neighbours(self):
    1396         #Call correct module function
    1397         #(either from this module or C-extension)
     1396        # Call correct module function
     1397        # (either from this module or C-extension)
    13981398        limit_edges_by_all_neighbours(self)
    13991399
    14001400    def limit_edges_by_neighbour(self):
    1401         #Call correct module function
    1402         #(either from this module or C-extension)
     1401        # Call correct module function
     1402        # (either from this module or C-extension)
    14031403        limit_edges_by_neighbour(self)               
    14041404
    14051405    def extrapolate_second_order(self):
    1406         #Call correct module function
    1407         #(either from this module or C-extension)
     1406        # Call correct module function
     1407        # (either from this module or C-extension)
    14081408        compute_gradients(self)
    14091409        extrapolate_from_gradient(self)
    14101410       
    14111411    def extrapolate_second_order_and_limit_by_edge(self):
    1412         #Call correct module function
    1413         #(either from this module or C-extension)
     1412        # Call correct module function
     1413        # (either from this module or C-extension)
    14141414        extrapolate_second_order_and_limit_by_edge(self)
    14151415
    14161416
    14171417    def extrapolate_second_order_and_limit_by_vertex(self):
    1418         #Call correct module function
    1419         #(either from this module or C-extension)
     1418        # Call correct module function
     1419        # (either from this module or C-extension)
    14201420        extrapolate_second_order_and_limit_by_vertex(self)
    14211421
    14221422    def bound_vertices_below_by_constant(self, bound):
    1423         #Call correct module function
    1424         #(either from this module or C-extension)
     1423        # Call correct module function
     1424        # (either from this module or C-extension)
    14251425        bound_vertices_below_by_constant(self, bound)
    14261426
    14271427    def bound_vertices_below_by_quantity(self, quantity):
    1428         #Call correct module function
    1429         #(either from this module or C-extension)
    1430 
    1431         #check consistency
     1428        # Call correct module function
     1429        # (either from this module or C-extension)
     1430
     1431        # check consistency
    14321432        assert self.domain == quantity.domain
    14331433        bound_vertices_below_by_quantity(self, quantity)                       
    14341434
    14351435    def backup_centroid_values(self):
    1436         #Call correct module function
    1437         #(either from this module or C-extension)
     1436        # Call correct module function
     1437        # (either from this module or C-extension)
    14381438        backup_centroid_values(self)
    14391439
    14401440    def saxpy_centroid_values(self,a,b):
    1441         #Call correct module function
    1442         #(either from this module or C-extension)
     1441        # Call correct module function
     1442        # (either from this module or C-extension)
    14431443        saxpy_centroid_values(self,a,b)
    14441444   
Note: See TracChangeset for help on using the changeset viewer.