00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _SLICESPEC_H_ 00012 #define _SLICESPEC_H_ 00013 00014 #include "NamespaceHeader.H" 00015 00016 // 00017 // Implementation note for multidim mode. Obviously, the same SliceSpec class 00018 // will work fine for all dimensions, so in multidim programming (e.g. in 00019 // lib/src/MultiDim) it might seem weird to have to specify a dimensioned 00020 // version, e.g. D1::SliceSpec. Yet this is exactly what we have to do, the 00021 // way multidim programming works now; we #include "SliceSpec.H.multidim", and 00022 // that in turn declares a Chombo::D1::SliceSpec, a Chombo::D2::SliceSpec, etc 00023 // but no plain old Chombo::SliceSpec. One way around this is to #define 00024 // something like "CH_DIMENSIONLESS" at the top of SliceSpec.H, add SliceSpec.H 00025 // to the list in lib/src/BoxTools/multidim/dim-independent-headers.txt, and 00026 // add code to NamespaceHeader.H and NamespaceFooter.H to handle it all. 00027 // I considered that option and decided against it: on the grounds that it adds 00028 // a complexity and, for people learning to write multidim programs, a confusing 00029 // exception to the rule that "all regular Chombo classes are in a D<n>:: 00030 // namespace". It's not so hard to type "D1::" or "D2::". And in templated 00031 // code (like that in lib/src/MultiDim/Slicing.H) we can specify the "right" 00032 // dimension of SliceSpec by using a trait. 00033 // 00034 00035 /** 00036 Specifies the slice we want out of an IntVect, Box, BaseFab, etc. 00037 For IntVect and Box slicing, only the direction matters. For IntVect it 00038 refers to the element we are to remove. For Box it refers to the dimension 00039 we are to remove. 00040 */ 00041 struct SliceSpec 00042 { 00043 SliceSpec( int d, int p ) : direction(d), position(p) 00044 { 00045 } 00046 00047 public: 00048 int direction; 00049 int position; 00050 }; 00051 00052 #include "NamespaceFooter.H" 00053 00054 #endif // _SLICESPEC_H_