Skip to content
Snippets Groups Projects
Select Git revision
  • 652224b32eb75508d93c197546ca5c7343d9c3b3
  • master default protected
  • report
  • dev
4 results

dispatch.h

Blame
  • baptiste.coudray's avatar
    baptiste.coudray authored
    f7506cb4
    History
    dispatch.h 2.38 KiB
    #ifndef _DISPATCH_H_
    #define _DISPATCH_H_
    
    #include "../lattice_boltzmann/lbm.h"
    //#include "../game_of_life/gol.h"
    //#include "../elementary/elementary.h"
    #include "chunk_info.h"
    //#include "envelope.h"
    
    #define FUTHARK_I8  "  i8"
    #define FUTHARK_U8  "  i8"
    #define FUTHARK_I16 " i16"
    #define FUTHARK_U16 " i16"
    #define FUTHARK_I32 " i32"
    #define FUTHARK_U32 " i32"
    #define FUTHARK_I64 " i64"
    #define FUTHARK_U64 " i64"
    #define FUTHARK_F32 " f32"
    #define FUTHARK_F64 " f64"
    
    #define NB_SIDES 6
    #define NB_CHUNKS 9
    
    #define INDEX_SIDE_BACK 0
    #define INDEX_SIDE_BOTTOM 1
    #define INDEX_SIDE_FRONT 2
    #define INDEX_SIDE_LEFT 3
    #define INDEX_SIDE_RIGHT 4
    #define INDEX_SIDE_TOP 5
    
    #define INDEX_CHUNK_NORTH_WEST 0
    #define INDEX_CHUNK_WEST 1
    #define INDEX_CHUNK_SOUTH_WEST 2
    #define INDEX_CHUNK_SOUTH 3
    #define INDEX_CHUNK_SOUTH_EAST 4
    #define INDEX_CHUNK_EAST 5
    #define INDEX_CHUNK_NORTH_EAST 6
    #define INDEX_CHUNK_NORTH 7
    #define INDEX_CHUNK_SURFACE 8
    
    struct dispatch_context;
    
    typedef struct side_envelope {
        chunk_info_t chunks[NB_CHUNKS];
        chunk_info_t *north_west;
        chunk_info_t *north;
        chunk_info_t *north_east;
        chunk_info_t *east;
        chunk_info_t *south;
        chunk_info_t *south_east;
        chunk_info_t *west;
        chunk_info_t *south_west;
        chunk_info_t *surface;
    } side_envelope_t;
    
    typedef struct envelope {
        side_envelope_t sides[NB_SIDES];
        side_envelope_t *back;
        side_envelope_t *bottom;
        side_envelope_t *front;
        side_envelope_t *left;
        side_envelope_t *right;
        side_envelope_t *top;
    } envelope_t;
    
    extern struct dispatch_context *dispatch_context_new(const int *dimensions, MPI_Datatype datatype, int n_dimensions);
    
    extern void dispatch_context_print(struct dispatch_context *dc);
    
    extern envelope_t *get_inner_envelope(struct dispatch_context *dc, struct futhark_context *fc, int thickness);
    
    extern envelope_t *get_outer_envelope(struct dispatch_context *dc, struct futhark_context *fc, int thickness);
    
    extern void *
    futhark_outer_envelope_new(struct dispatch_context *dc, struct futhark_context *fc, envelope_t *outer_envelope,
                               void *f(struct futhark_context *, const void *), char *futhark_type);
    
    extern chunk_info_t get_chunk_info(struct dispatch_context *dc);
    
    extern void *get_data(struct dispatch_context *dc);
    
    extern void dispatch_context_free(struct dispatch_context *dc);
    
    extern void envelope_free(envelope_t *envelope);
    
    #endif //_DISPATCH_H_