Esempio n. 1
0
def sort_domain_check(domain2):
    """Check the sorted domain information."""

    from anuga_cuda.merimbula_data.generate_domain import domain_create

    domain1 = domain_create()

    for k in range(domain1.number_of_elements):
        b = [0,1,2]
        spe_bubble_sort(b, domain1.neighbours[k], k)
        for i in range(3):
            if domain1.neighbours[k][b[i]] != domain2.neighbours[k][i]:
                print "###### tri: %ld, edge: %d - %d " % (k, b[i], i)
                continue
            
            if domain1.surrogate_neighbours[k][ b[i] ] != domain2.surrogate_neighbours[k][i]:
                print "tri: %ld, edge: %d - %d @ surrogate_neighbours " % (k, b[i], i)
                
            if domain1.normals[k][ b[i]*2] != domain2.normals[k][i*2] or\
                     domain1.normals[k][ b[i]*2+1] != domain2.normals[k][i*2+1]:
                print "tri: %ld, edge: %ld - %d @ normals " % (k, b[i], i)

            if domain1.edgelengths[k][ b[i] ] != domain2.edgelengths[k][i]:
                print "tri: %ld, edge: %ld - %d @ edgelengths " % (k, b[i], i)


            if domain1.vertex_coordinates[k*3+b[i]][0] != domain2.vertex_coordinates[k*3+i][0] or\
                     domain1.vertex_coordinates[k*3+b[i]][1] != domain2.vertex_coordinates[k*3+i][1]:
                print "tri: %ld, edge: %ld - %d @ vertex_coordinates " % (k, b[i], i)

            if domain1.edge_coordinates[k*3+b[i]][0] != domain2.edge_coordinates[k*3+i][0] or\
                     domain1.edge_coordinates[k*3+b[i]][1] != domain2.edge_coordinates[k*3+i][1]:
                print "tri: %ld, edge: %ld - %d @ edge_coordinates " % (k, b[i], i)


            if domain1.quantities['stage'].edge_values[k][ b[i] ] != \
                    domain2.quantities['stage'].edge_values[k][i]:
                print "tri: %ld, edge: %ld - %d @ stage_edge_values " % (k, b[i], i)
    
            if domain1.quantities['xmomentum'].edge_values[k][ b[i] ] != \
                    domain2.quantities['xmomentum'].edge_values[k][i]:
                print "tri: %ld, edge: %ld - %d @ xmom_edge_values " % (k, b[i], i)

            if domain1.quantities['ymomentum'].edge_values[k][ b[i] ] != \
                    domain2.quantities['ymomentum'].edge_values[k][i]:
                print "tri: %ld, edge: %ld - %d @ ymom_edge_values " % (k, b[i], i)

            if domain1.quantities['elevation'].edge_values[k][ b[i] ] != \
                    domain2.quantities['elevation'].edge_values[k][i]:
                print "tri: %ld, edge: %ld - %d @ bed_edge_values " % (k, b[i], i)


            if domain1.quantities['stage'].vertex_values[k][ b[i] ] != \
                    domain2.quantities['stage'].vertex_values[k][i]:
                print "tri: %ld, vertex: %ld - %d @ stage_vertex_values " % (k, b[i], i)
    
            if domain1.quantities['xmomentum'].vertex_values[k][ b[i] ] != \
                    domain2.quantities['xmomentum'].vertex_values[k][i]:
                print "tri: %ld, vertex: %ld - %d @ xmom_vertex_values " % (k, b[i], i)

            if domain1.quantities['ymomentum'].vertex_values[k][ b[i] ] != \
                    domain2.quantities['ymomentum'].vertex_values[k][i]:
                print "tri: %ld, vertex: %ld - %d @ ymom_vertex_values " % (k, b[i], i)

            if domain1.quantities['elevation'].vertex_values[k][ b[i] ] != \
                    domain2.quantities['elevation'].vertex_values[k][i]:
                print "tri: %ld, vertex: %ld - %d @ bed_vertex_values " % (k, b[i], i)
Esempio n. 2
0
import numpy
from anuga_cuda.merimbula_data.generate_domain import domain_create
domain1 = domain_create()
domain2 = domain_create()


from shallow_water_ext import compute_fluxes_ext_central_structure
domain1.flux_timestep = compute_fluxes_ext_central_structure(domain1)

import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
from anuga_cuda import kernel_path as kp
compute_fluxes_mod = SourceModule(
    open(kp["compute_fluxes_dir"]+"compute_fluxes.cu").read() )
compute_fluxes_central_function = compute_fluxes_mod.get_function(
    "compute_fluxes_central_structure_CUDA")

from anuga_cuda.compute_fluxes.compute_fluxes import \
    compute_fluxes_central_structure_single as cs


N = domain2.number_of_elements
W1 = 32
W2 = 1
W3 = 1

domain = domain2
timestep_array = numpy.zeros( 
        (domain.number_of_elements) , 
        dtype=numpy.float64)
Esempio n. 3
0
import numpy
from anuga_cuda.merimbula_data.generate_domain import domain_create
domain1 = domain_create()
domain2 = domain_create()

from shallow_water_ext import compute_fluxes_ext_central_structure
domain1.flux_timestep = compute_fluxes_ext_central_structure(domain1)

import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
from anuga_cuda import kernel_path as kp
compute_fluxes_mod = SourceModule(
    open(kp["compute_fluxes_dir"] + "compute_fluxes.cu").read())
compute_fluxes_central_function = compute_fluxes_mod.get_function(
    "compute_fluxes_central_structure_CUDA")

from anuga_cuda.compute_fluxes.compute_fluxes import \
    compute_fluxes_central_structure_single as cs

N = domain2.number_of_elements
W1 = 32
W2 = 1
W3 = 1

domain = domain2
timestep_array = numpy.zeros((domain.number_of_elements), dtype=numpy.float64)
for i in range(N):
    timestep_array[i] = domain.evolve_max_timestep
compute_fluxes_central_function(
    numpy.uint(domain.number_of_elements),