Chombo + EB + MF  3.2
SliceSpec.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _SLICESPEC_H_
12 #define _SLICESPEC_H_
13 
14 #include "NamespaceHeader.H"
15 
16 //
17 // Implementation note for multidim mode. Obviously, the same SliceSpec class
18 // will work fine for all dimensions, so in multidim programming (e.g. in
19 // lib/src/MultiDim) it might seem weird to have to specify a dimensioned
20 // version, e.g. D1::SliceSpec. Yet this is exactly what we have to do, the
21 // way multidim programming works now; we #include "SliceSpec.H.multidim", and
22 // that in turn declares a Chombo::D1::SliceSpec, a Chombo::D2::SliceSpec, etc
23 // but no plain old Chombo::SliceSpec. One way around this is to #define
24 // something like "CH_DIMENSIONLESS" at the top of SliceSpec.H, add SliceSpec.H
25 // to the list in lib/src/BoxTools/multidim/dim-independent-headers.txt, and
26 // add code to NamespaceHeader.H and NamespaceFooter.H to handle it all.
27 // I considered that option and decided against it: on the grounds that it adds
28 // a complexity and, for people learning to write multidim programs, a confusing
29 // exception to the rule that "all regular Chombo classes are in a D<n>::
30 // namespace". It's not so hard to type "D1::" or "D2::". And in templated
31 // code (like that in lib/src/MultiDim/Slicing.H) we can specify the "right"
32 // dimension of SliceSpec by using a trait.
33 //
34 
35 /**
36  Specifies the slice we want out of an IntVect, Box, BaseFab, etc.
37  For IntVect and Box slicing, only the direction matters. For IntVect it
38  refers to the element we are to remove. For Box it refers to the dimension
39  we are to remove.
40 */
41 struct SliceSpec
42 {
43  SliceSpec( int d, int p ) : direction(d), position(p)
44  {
45  }
46 
47 public:
48  int direction;
49  int position;
50 };
51 
52 #include "NamespaceFooter.H"
53 
54 #endif // _SLICESPEC_H_
Definition: SliceSpec.H:41
int position
Definition: SliceSpec.H:49
SliceSpec(int d, int p)
Definition: SliceSpec.H:43
int direction
Definition: SliceSpec.H:48