Block-Structured AMR Software Framework
AMReX_ArrayLim.H
Go to the documentation of this file.
1 #ifndef AMREX_ARRAYLIM_H_
2 #define AMREX_ARRAYLIM_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_REAL.H>
6 
7 #ifdef __cplusplus
8 
9 #include <AMReX_Array.H>
10 
11 #if AMREX_SPACEDIM==1
12 #define AMREX_ARLIM_P(x) const int&
13 #define AMREX_ARLIM(x) (x)[0]
14 #define AMREX_BCREC_3D(x) amrex::GpuArray<int,6>{(x)[0], 0, 0, (x)[1], 0, 0}.data()
15 #define AMREX_BCREC_ANYD(x) amrex::GpuArray<int,6>{(x)[0], 0, 0, (x)[1], 0, 0}.data()
16 #define AMREX_ARLIM_3D(x) amrex::GpuArray<int,3>{(x)[0], 0, 0}.data()
17 #define AMREX_ARLIM_ANYD(x) amrex::GpuArray<int,3>{(x)[0], 0, 0}.data()
18 #define AMREX_ZFILL(x) amrex::GpuArray<amrex::Real,3>{(x)[0], 0., 0.}.data()
19 #define AMREX_ARLIM_ARG(x) AMREX_ARLIM_3D(x)
20 #elif AMREX_SPACEDIM==2
21 #define AMREX_ARLIM_P(x) const int&,const int&
22 #define AMREX_ARLIM(x) (x)[0],(x)[1]
23 #define AMREX_BCREC_3D(x) amrex::GpuArray<int,6>{(x)[0], (x)[1], 0, (x)[2], (x)[3], 0}.data()
24 #define AMREX_BCREC_ANYD(x) amrex::GpuArray<int,6>{(x)[0], (x)[1], 0, (x)[2], (x)[3], 0}.data()
25 #define AMREX_ARLIM_3D(x) amrex::GpuArray<int,3>{(x)[0], (x)[1], 0}.data()
26 #define AMREX_ARLIM_ANYD(x) amrex::GpuArray<int,3>{(x)[0], (x)[1], 0}.data()
27 #define AMREX_ZFILL(x) amrex::GpuArray<amrex::Real,3>{(x)[0], (x)[1], 0.}.data()
28 #define AMREX_ARLIM_ARG(x) AMREX_ARLIM_3D(x)
29 #elif AMREX_SPACEDIM==3
30 #define AMREX_ARLIM_P(x) const int&,const int&,const int&
31 #define AMREX_ARLIM(x) (x)[0],(x)[1],(x)[2]
32 #define AMREX_ARLIM_3D(x) x
33 #define AMREX_ARLIM_ANYD(x) x
34 #define AMREX_ZFILL(x) x
35 #define AMREX_BCREC_3D(x) x
36 #define AMREX_BCREC_ANYD(x) x
37 #define AMREX_ARLIM_ARG(x) AMREX_ARLIM_3D(x)
38 #endif
39 
40 #define AMREX_INT_ANYD(x) AMREX_ARLIM_ANYD(x)
41 
42 #define BL_TO_FORTRAN(x) (x).dataPtr(), AMREX_ARLIM ((x).loVect()), AMREX_ARLIM ((x).hiVect())
43 #define BL_TO_FORTRAN_3D(x) (x).dataPtr(), AMREX_ARLIM_3D ((x).loVect()), AMREX_ARLIM_3D ((x).hiVect())
44 #define BL_TO_FORTRAN_ANYD(x) (x).dataPtr(), AMREX_ARLIM_ANYD((x).loVect()), AMREX_ARLIM_ANYD((x).hiVect())
45 #define BL_TO_FORTRAN_FAB(x) (x).dataPtr(), AMREX_ARLIM_3D ((x).loVect()), AMREX_ARLIM_3D ((x).hiVect()), (x).nCompPtr()
46 
47 #define BL_TO_FORTRAN_N(x,n) (x).dataPtr(n), AMREX_ARLIM ((x).loVect()), AMREX_ARLIM ((x).hiVect())
48 #define BL_TO_FORTRAN_N_3D(x,n) (x).dataPtr(n), AMREX_ARLIM_3D ((x).loVect()), AMREX_ARLIM_3D ((x).hiVect())
49 #define BL_TO_FORTRAN_N_ANYD(x,n) (x).dataPtr(n), AMREX_ARLIM_ANYD((x).loVect()), AMREX_ARLIM_ANYD((x).hiVect())
50 
51 #define BL_TO_FORTRAN_BOX(x) AMREX_ARLIM_3D((x).loVect()), AMREX_ARLIM_3D((x).hiVect())
52 
53 #endif /* __cplusplus */
54 
55 #endif /* AMREX_ARRAYLIM_H_ */