Changeset 2813


Ignore:
Timestamp:
May 5, 2006, 8:47:05 PM (18 years ago)
Author:
steve
Message:

Moving ghosts into domain.py

Location:
inundation
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/parallel_advection.py

    r1588 r2813  
    2323    pass
    2424
    25 from advection import *
     25from pyvolution.advection import *
    2626from Numeric import zeros, Float, Int, ones, allclose, array
    2727import pypar
     
    3030class Parallel_Domain(Domain):
    3131
    32     def __init__(self, coordinates, vertices, boundary = None,
    33                  full_send_dict = None, ghost_recv_dict = None,
     32    def __init__(self,
     33                 coordinates,
     34                 vertices,
     35                 boundary = None,
     36                 full_send_dict = None,
     37                 ghost_recv_dict = None,
    3438                 velocity = None):
    3539
    36         self.processor = pypar.rank()
    37         self.numproc   = pypar.size()
    38 
    39         Domain.__init__(self, coordinates, vertices, boundary,
    40                         velocity = velocity)
     40        Domain.__init__(self,
     41                        coordinates,
     42                        vertices,
     43                        boundary,
     44                        velocity = velocity,
     45                        full_send_dict=full_send_dict,
     46                        ghost_recv_dict=ghost_recv_dict,
     47                        processor=pypar.rank(),
     48                        numproc=pypar.size()
     49                        )
    4150
    4251        N = self.number_of_elements
    4352
    44         self.processor = pypar.rank()
    45         self.numproc   = pypar.size()
    46 
    47 
    48         # Setup Communication Buffers
    49         self.nsys = 1
    50         for key in full_send_dict:
    51             buffer_shape = full_send_dict[key][0].shape[0]
    52             full_send_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
    53 
    54 
    55         for key in ghost_recv_dict:
    56             buffer_shape = ghost_recv_dict[key][0].shape[0]
    57             ghost_recv_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
    58 
    59         self.full_send_dict  = full_send_dict
    60         self.ghost_recv_dict = ghost_recv_dict
    6153
    6254        self.communication_time = 0.0
    6355        self.communication_reduce_time = 0.0
     56
     57
     58        print 'processor',self.processor
     59        print 'numproc',self.numproc
    6460
    6561    def check_integrity(self):
  • inundation/parallel/parallel_shallow_water.py

    r2090 r2813  
    3434                 full_send_dict = None, ghost_recv_dict = None):
    3535
    36         self.processor = pypar.rank()
    37         self.numproc   = pypar.size()
    38 
    39         Domain.__init__(self, coordinates, vertices, boundary)
     36        Domain.__init__(self,
     37                        coordinates,
     38                        vertices,
     39                        boundary,
     40                        full_send_dict=full_send_dict,
     41                        ghost_recv_dict=ghost_recv_dict,
     42                        processor=pypar.rank(),
     43                        numproc=pypar.size())
    4044
    4145        N = self.number_of_elements
    4246
    43         self.processor = pypar.rank()
    44         self.numproc   = pypar.size()
    45 
    46         # Setup Communication Buffers
    47         self.nsys = 3
    48         for key in full_send_dict:
    49             buffer_shape = full_send_dict[key][0].shape[0]
    50             full_send_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
    51 
    52 
    53         for key in ghost_recv_dict:
    54             buffer_shape = ghost_recv_dict[key][0].shape[0]
    55             ghost_recv_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
    56 
    57         self.full_send_dict  = full_send_dict
     47#        self.processor = pypar.rank()
     48#        self.numproc   = pypar.size()
     49#
     50#        # Setup Communication Buffers
     51#        self.nsys = 3
     52#        for key in full_send_dict:
     53#            buffer_shape = full_send_dict[key][0].shape[0]
     54#            full_send_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
     55#
     56#
     57#        for key in ghost_recv_dict:
     58#            buffer_shape = ghost_recv_dict[key][0].shape[0]
     59#            ghost_recv_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float))
     60#
     61#        self.full_send_dict  = full_send_dict
    5862        self.ghost_recv_dict = ghost_recv_dict
    5963
     
    96100            #print 'P%d calling broadcast from %d' %(self.processor, pid)
    97101            self.local_timestep[0] = self.timestep
    98             pypar.broadcast(self.local_timestep, pid, bypass=True)           
     102            pypar.broadcast(self.local_timestep, pid, bypass=True)
    99103            self.local_timesteps[pid] = self.local_timestep[0]
    100104
  • inundation/parallel/run_parallel_sw_rectangle.py

    r2769 r2813  
    3434from parallel_meshes import parallel_rectangle
    3535
    36 
    37 <<<<<<< .mine
    38 =======
    39 #from pmesh_divide import pmesh_divide, pmesh_divide_steve
    40 
    41 >>>>>>> .r2768
    42 # read in the processor information
    4336
    4437numprocs = pypar.size()
     
    8073
    8174
    82 domain.default_order = 2
     75domain.default_order = 1
    8376
    8477#Boundaries
     
    9689    """
    9790
    98     def __init__(self, x0=0.25, x1=0.5, y0=0.0, y1=1.0, h=1.0):
     91    def __init__(self, x0=0.25, x1=0.75, y0=0.0, y1=1.0, h=5.0):
    9992        self.x0 = x0
    10093        self.x1 = x1
     
    111104    import time
    112105    t0 = time.time()
     106
     107
     108# Turn on the visualisation
     109
     110rect = [0.0, 0.0, 1.0, 1.0]
     111domain.initialise_visualiser()
    113112
    114113yieldstep = 0.005
  • inundation/pyvolution/advection.py

    r2494 r2813  
    4040class Domain(Generic_domain):
    4141
    42     def __init__(self, coordinates, vertices, boundary = None,
    43                  tagged_elements = None, geo_reference = None,
    44                  use_inscribed_circle=False, velocity = None):
     42    def __init__(self,
     43                 coordinates,
     44                 vertices,
     45                 boundary = None,
     46                 tagged_elements = None,
     47                 geo_reference = None,
     48                 use_inscribed_circle=False,
     49                 velocity = None,
     50                 full_send_dict=None,
     51                 ghost_recv_dict=None,
     52                 processor=0,
     53                 numproc=1
     54                 ):
    4555
    4656        conserved_quantities = ['stage']
    4757        other_quantities = []
    48         Generic_domain.__init__(self, coordinates, vertices, boundary,
    49                                 conserved_quantities, other_quantities,
    50                                 tagged_elements, geo_reference,
    51                                 use_inscribed_circle)
     58        Generic_domain.__init__(self,
     59                                source=coordinates,
     60                                triangles=vertices,
     61                                boundary=boundary,
     62                                conserved_quantities=conserved_quantities,
     63                                other_quantities=other_quantities,
     64                                tagged_elements=tagged_elements,
     65                                geo_reference=geo_reference,
     66                                use_inscribed_circle=use_inscribed_circle,
     67                                full_send_dict=full_send_dict,
     68                                ghost_recv_dict=ghost_recv_dict,
     69                                processor=processor,
     70                                numproc=numproc)
    5271
    5372
     
    343362               yieldstep = None,
    344363               finaltime = None,
    345                duration = None,               
     364               duration = None,
    346365               skip_initial_step = False):
    347        
     366
    348367        """Specialisation of basic evolve method from parent class
    349368        """
     
    365384                                       duration=duration,
    366385                                       skip_initial_step=skip_initial_step):
    367            
     386
    368387
    369388
  • inundation/pyvolution/domain.py

    r2808 r2813  
    2929                 mesh_filename=None,
    3030                 use_cache=False,
    31                  verbose=False):
     31                 verbose=False
     32                 ):
    3233       
    3334        """Instantiate generic computational Domain.
  • inundation/pyvolution/netherlands.py

    r2731 r2813  
    1212#rpdb.set_active()
    1313
    14 from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
     14from shallow_water_vtk import Domain, Reflective_boundary, Dirichlet_boundary,\
    1515     Transmissive_boundary, Constant_height, Constant_stage
    1616
Note: See TracChangeset for help on using the changeset viewer.