H2Lib  3.0
oclbem3d.h
Go to the documentation of this file.
1 /* ------------------------------------------------------------
2  This is the file "oclbem3d.h" of the H2Lib package.
3  All rights reserved, Sven Christophersen 2015
4  ------------------------------------------------------------ */
5 
12 #ifndef LIBRARY_OCLBEM3D_H_
13 #define LIBRARY_OCLBEM3D_H_
14 
15 #ifdef USE_OPENCL
16 #ifdef USE_OPENMP
17 
26 /* C STD LIBRARY */
27 #include <string.h>
28 /* CORE 0 */
29 #include "opencl.h"
30 /* CORE 1 */
31 /* CORE 2 */
32 /* CORE 3 */
33 /* SIMPLE */
34 /* PARTICLES */
35 /* BEM */
36 #include "bem3d.h"
37 
43 struct _bem3d_ocl {
45  cl_uint num_kernels;
47  cl_kernel *kernels;
51  cl_mem *mem_q_xw;
55  cl_mem *mem_q2_xw;
57  cl_mem *mem_gr_x;
61  cl_mem *mem_gr_t;
63  cl_mem *mem_N;
65  cl_mem *mem_ridx;
67  cl_mem *mem_cidx;
68 };
69 
73 typedef struct _bem3d_ocl bem3d_ocl;
74 
79 
83 enum _op_type {
84  SLP,
85  DLP
86 };
87 
91 typedef enum _op_type op_type;
92 
97 struct _op_callbacks {
98  void (*dist)(void*);
99  void (*vert)(void*);
100  void (*edge)(void*);
101  void (*iden)(void*);
102  void (*sing_cpu)(void*);
103 };
104 
109 
115  const uint *ridx;
116  const uint *cidx;
117  bool dist;
119  bool ntrans;
121 };
122 
127 
134  field *N;
137  bool *trans;
138 
143  size_t pos;
145 };
146 
151 
156 extern bem3d_ocl ocl_bem3d;
157 
161 extern ptaskgroup nf;
165 extern omp_lock_t nf_lock;
166 
170 extern ptaskgroup nf_dist;
174 extern omp_lock_t nf_dist_lock;
175 
179 extern ptaskgroup nf_vert;
183 extern omp_lock_t nf_vert_lock;
184 
188 extern ptaskgroup nf_edge;
192 extern omp_lock_t nf_edge_lock;
193 
197 extern ptaskgroup nf_iden;
201 extern omp_lock_t nf_iden_lock;
202 
206 extern op_callbacks op_cb;
207 
214 HEADER_PREFIX size_t
215 getsize_nf(void *data);
216 
222 HEADER_PREFIX void
223 cleanup_nf_task(void *data);
224 
230 HEADER_PREFIX void
231 cleanup_nf_merge(void *data);
232 
240 HEADER_PREFIX void
241 split_nf_task(void *data, void ***split, uint * n);
242 
249 HEADER_PREFIX size_t
250 getsize_nf_sing(void *data);
251 
257 HEADER_PREFIX void
258 cleanup_nf_sing_task(void *data);
259 
265 HEADER_PREFIX void
266 cleanup_nf_sing_merge(void *data);
267 
275 HEADER_PREFIX void
276 split_nf_sing_task(void *data, void ***split, uint * n);
277 
282 HEADER_PREFIX void
284 
289 HEADER_PREFIX void
291 
296 HEADER_PREFIX void
298 
303 HEADER_PREFIX void
305 
312 HEADER_PREFIX void
313 merge_nf_sing(ptaskgroup tg, void **data);
314 
321 HEADER_PREFIX void
322 distribute_nf_sing(ptaskgroup tg, void *data);
323 
336 HEADER_PREFIX void
337 add_nf_entry(pcbem3d bem, op_callbacks *op_cb, uint c, uint tt, uint ss,
338  bool trans, field * entry);
339 
344 HEADER_PREFIX void
345 close_nf(ptaskgroup tg);
346 
353 HEADER_PREFIX void
354 merge_nf(ptaskgroup tg, void **data);
355 
362 HEADER_PREFIX void
363 distribute_nf(ptaskgroup tg, void *data);
364 
369 #endif
370 #endif
371 
372 #endif /* LIBRARY_OCLBEM3D_H_ */
void close_nf(ptaskgroup tg)
Close collection of task for nearfield calculations.
bem3d_ocl * pbem3d_ocl
Abbreviation for a pointer to a bem3d_ocl object.
Definition: oclbem3d.h:78
ptaskgroup nf
Global variable for general nearfield tasks.
field * N
Matrix to store all matrix coefficients.
Definition: oclbem3d.h:134
enum _op_type op_type
Abbreviation for enum _op_type.
Definition: oclbem3d.h:91
uint * cidx
Array of all column indices.
Definition: oclbem3d.h:136
cl_uint num_kernels
Definition: oclbem3d.h:45
pcbem3d bem
bem3d object.
Definition: oclbem3d.h:133
void merge_nf(ptaskgroup tg, void **data)
Merge a list of nearfield computation tasks into a single object.
const uint * cidx
Array of column indices.
Definition: oclbem3d.h:116
cl_mem * mem_gr_t
Definition: oclbem3d.h:61
void merge_nf_sing(ptaskgroup tg, void **data)
Merge a list of singular nearfield computation tasks into a single object.
void distribute_nf(ptaskgroup tg, void *data)
Distribute computational results to their correct positions in memory.
void cleanup_nf_merge(void *data)
Cleanup intermediate storage from a nearfield computation merge task.
bool ntrans
Flag that indicates the entries are stored in normal or in transposed manner.
Definition: oclbem3d.h:119
bool dist
Flag that indices if triangle are disjoint or not.
Definition: oclbem3d.h:117
field ** addr
Array of memory addresses, that point to the locations where every single entry has to be stored...
Definition: oclbem3d.h:142
unsigned uint
Unsigned integer type.
Definition: settings.h:70
omp_lock_t nf_vert_lock
OpenMP lock for nf_vert.
Struct of callback functions for different quadrature cases that arise in the nearfield computation...
Definition: oclbem3d.h:97
const uint * ridx
Array of row indices.
Definition: oclbem3d.h:115
void close_nf_dist(ptaskgroup tg)
Close collection of task for disjoint triangle pairs.
ptaskgroup nf_dist
Global variable for distant triangle pairs.
DLP Double layer potential.
Definition: oclbem3d.h:85
double _Complex field
Field type.
Definition: settings.h:171
void close_nf_edge(ptaskgroup tg)
Close collection of task for triangle pairs with common edge.
pcbem3d bem
bem3d object
Definition: oclbem3d.h:118
size_t pos
current fill position in all above mentioned arrays.
Definition: oclbem3d.h:143
uint triangles
Definition: oclbem3d.h:59
omp_lock_t nf_lock
OpenMP lock for nf.
cl_kernel * kernels
Definition: oclbem3d.h:47
SLP Single layer potential.
Definition: oclbem3d.h:84
void close_nf_iden(ptaskgroup tg)
Close collection of task for identical triangle pairs.
uint nq
Definition: oclbem3d.h:49
_op_type
Simple Enum to distinguish between different boundary integral operators.
Definition: oclbem3d.h:83
Struct to store input data for multiple calls to nearfield integration routine.
Definition: oclbem3d.h:132
omp_lock_t nf_dist_lock
OpenMP lock for nf_dist.
bool * trans
Array of all &#39;trans&#39; flags.
Definition: oclbem3d.h:137
omp_lock_t nf_edge_lock
OpenMP lock for nf_edge.
ptaskgroup nf_iden
Global variable for identical triangle pairs.
This structure contains geometry information for the OpenCL computation aswell as all OpenCL kernels ...
Definition: oclbem3d.h:43
op_callbacks * op_cb
Set of callback functions for the current operator.
Definition: oclbem3d.h:144
void add_nf_entry(pcbem3d bem, op_callbacks *op_cb, uint c, uint tt, uint ss, bool trans, field *entry)
Adds a single singular entry to the corresponding list.
size_t getsize_nf_sing(void *data)
returns the current size of taskgroup for singular nearfield computations.
bem3d_ocl ocl_bem3d
Static variable that contains OpenCL buffers and kernels for bem computations.
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
uint * ridx
Array of all row indices.
Definition: oclbem3d.h:135
cl_mem * mem_q2_xw
Definition: oclbem3d.h:55
ptaskgroup nf_edge
Global variable for common edge triangle pairs.
cl_mem * mem_N
Definition: oclbem3d.h:63
void split_nf_task(void *data, void ***split, uint *n)
Splits a neafield computation task into smaller tasks.
pamatrix N
The matrix where the value should be stored in.
Definition: oclbem3d.h:120
void cleanup_nf_sing_task(void *data)
Cleanup intermediate storage for singular nearfield computation task.
void split_nf_sing_task(void *data, void ***split, uint *n)
Splits a singular neafield computation task into smaller tasks.
void cleanup_nf_sing_merge(void *data)
Cleanup intermediate storage from a singular nearfield computation merge task.
Struct to store the parameters of the nearfield integration routine.
Definition: oclbem3d.h:114
size_t getsize_nf(void *data)
returns the current size of taskgroup for nearfield computations.
void cleanup_nf_task(void *data)
Cleanup intermediate storage for nearfield computation task.
void close_nf_vert(ptaskgroup tg)
Close collection of task for triangle pairs with common vertex.
Main container object for computation of BEM related matrices and vectors.
Definition: bem3d.h:290
cl_mem * mem_q_xw
Definition: oclbem3d.h:51
omp_lock_t nf_iden_lock
OpenMP lock for nf_iden.
Representation of a matrix as an array in column-major order.
Definition: amatrix.h:43
A collection of tasks for the same callback function.
Definition: opencl.h:204
op_callbacks op_cb
Global variable for integral operator callback functions.
cl_mem * mem_gr_x
Definition: oclbem3d.h:57
uint nq2
Definition: oclbem3d.h:53
cl_mem * mem_cidx
Definition: oclbem3d.h:67
ptaskgroup nf_vert
Global variable for common vertex triangle pairs.
cl_mem * mem_ridx
Definition: oclbem3d.h:65
void distribute_nf_sing(ptaskgroup tg, void *data)
Distribute computational results to their correct positions in memory.