source: trunk/anuga_work/anuga_cuda/src/anuga_HMPP/set_boundary.c @ 9017

Last change on this file since 9017 was 9017, checked in by steve, 12 years ago

Adding in Zhe (John) Weng's anuga_cuda code as obtained from googlecode https://code.google.com/p/anuga-cuda

File size: 1000 bytes
Line 
1#include "hmpp_fun.h"
2
3
4
5#ifdef USING_LOCAL_DIRECTIVES
6#pragma hmpp setBoundaryE codelet, target=CUDA args[*].transfer=atcall
7#endif
8void set_boundary_values_from_edges(
9        int Nb,
10        int N3,
11        long vol_id[Nb],
12        long edge_id[Nb],
13        double boundary_values[Nb],
14        double edge_values[N3])
15{
16    int k, id;
17   
18    /* Original function in quantity.py
19       
20        def set_boundary_values_from_edges(self):
21            vol_id = self.domain.boundary_cells
22            edge_id = self.domain.boundary_edges
23
24            self.boundary_values =(self.edge_values.flat)[3*vol_id +edge_id]
25
26
27        # Equals to below:
28
29
30        for j in range(self.boundary_length):
31            vol_id = self.domain.boundary_cells[j]
32            edge_id = self.domain.boundary_edges[j]
33            self.boundary_values[j] = self.edge_values[vol_id, edge_id]
34    */
35
36    for(k=0; k<Nb; k++)
37    {
38        id= 3*vol_id[k] + edge_id[k];
39
40        boundary_values[k] = edge_values[id];
41    }
42}
Note: See TracBrowser for help on using the repository browser.