aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetSlab/src/mapping.hh
blob: c2e319f2dd13ed9cc5eb0d525abc422a699a1e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// $Header$

#ifndef CARPETSLAB_MAPPING_HH
#define CARPETSLAB_MAPPING_HH

#include <vector>

#include "cctk.h"

namespace CarpetSlab {
  
  
  
  // Mapping object
  // (just store the mapping)
  struct mapping {
    int vindex;
    int hdim;
    vector<int> origin;         // [vdim]
    vector<int> dirs;           // [hdim]
    vector<int> stride;         // [hdim]
    vector<int> length;         // [hdim]
  };
  
  
  
  int StoreMapping (mapping * const mp);
  
  mapping * RetrieveMapping (int const table);
  
  void DeleteMapping (int const table);
    
    
    
  typedef CCTK_INT
  (* conversion_fn_ptr) (CCTK_INT const nelems,
                         CCTK_INT const src_stride,
                         CCTK_INT const dst_stride,
                         CCTK_INT const src_type,
                         CCTK_INT const dst_type,
                         CCTK_POINTER_TO_CONST const from,
                         CCTK_POINTER const to);
  
  extern "C" CCTK_INT
  CarpetSlab_LocalMappingByIndex (CCTK_POINTER_TO_CONST const cctkGH,
                                  CCTK_INT const vindex,
                                  CCTK_INT const hdim,
                                  CCTK_INT const * const direction,
                                  CCTK_INT const * const origin,
                                  CCTK_INT const * const extent,
                                  CCTK_INT const * const downsample,
                                  CCTK_INT const table_handle,
                                  conversion_fn_ptr const conversion_fn,
                                  CCTK_INT * const hsize_local,
                                  CCTK_INT * const hsize_global,
                                  CCTK_INT * const hoffset_global);
  
  extern "C" CCTK_INT
  CarpetSlab_GlobalMappingByIndex (CCTK_POINTER_TO_CONST const cctkGH,
                                   CCTK_INT const vindex,
                                   CCTK_INT const hdim,
                                   CCTK_INT const * const direction,
                                   CCTK_INT const * const origin,
                                   CCTK_INT const * const extent,
                                   CCTK_INT const * const downsample,
                                   CCTK_INT const table_handle,
                                   conversion_fn_ptr const conversion_fn,
                                   CCTK_INT * const hsize);
  
  extern "C" CCTK_INT
  CarpetSlab_FreeMapping (CCTK_INT const mapping_handle);
  
  
  
} // namespace CarpetSlab

#endif // !defined(CARPETSLAB_MAPPING_HH)