Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SPACE.H

Go to the documentation of this file.
00001 #ifndef CH_SPACE_H
00002 #define CH_SPACE_H
00003 
00004 #ifdef CH_LANG_CC
00005 /* _______              __
00006   / ___/ /  ___  __ _  / /  ___
00007  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00008  \___/_//_/\___/_/_/_/_.__/\___/ 
00009 */
00010 //
00011 // This software is copyright (C) by the Lawrence Berkeley
00012 // National Laboratory.  Permission is granted to reproduce
00013 // this software for non-commercial purposes provided that
00014 // this notice is left intact.
00015 // 
00016 // It is acknowledged that the U.S. Government has rights to
00017 // this software under Contract DE-AC03-765F00098 between
00018 // the U.S.  Department of Energy and the University of
00019 // California.
00020 //
00021 // This software is provided as a professional and academic
00022 // contribution for joint exchange. Thus it is experimental,
00023 // is provided ``as is'', with no warranties of any kind
00024 // whatsoever, no support, no promise of updates, or printed
00025 // documentation. By using this software, you acknowledge
00026 // that the Lawrence Berkeley National Laboratory and
00027 // Regents of the University of California shall have no
00028 // liability with respect to the infringement of other
00029 // copyrights by any part of this software.
00030 //
00031 
00032 //
00033 // $Id: SPACE.H,v 1.3 2001/06/20 02:56:58 ligocki Exp $
00034 //
00035 #endif
00036 
00037 #if ! defined(CH_SPACEDIM)
00038 #error CH_SPACEDIM must be defined
00039 #endif
00040 
00041 #if (CH_SPACEDIM != 1 && CH_SPACEDIM !=2 && CH_SPACEDIM != 3)
00042 #error CH_SPACEDIM must be either 1, 2, or 3
00043 #endif
00044 
00045 #if !defined(CH_LANG_FORT) || defined(CH_LANG_CC)
00046 
00047 /*@ManDoc:
00048   The SpaceDim C++ integer constant specifies the dimension of the
00049   Chombo library to be built.  It is initialized to the value of
00050   the macro CH\_SPACEDIM.  Hence it will have one of the values 1, 2, or 3.
00051 
00052   C++ code that depends on the dimensionality of the problem that
00053   you're trying to solve should be cast in terms of this constant,
00054   instead of the CH\_SPACEDIM macro, if possible, as constants are
00055   visible to debuggers while macros are not.
00056 */
00057    const int SpaceDim = CH_SPACEDIM;
00058 #endif
00059 
00060 #if CH_SPACEDIM==1
00061 
00062 /*@ManDoc:
00063   The D\_EXPR(a,b,c) macro expands to a comma expression that will
00064   evaluate SpaceDim of its arguments, counting from the left; i.e.
00065   CH\_SPACEDIM==1 implies only `a' is evaluated, CH\_SPACEDIM==2
00066   implies both `a' and `b', and CH\_SPACEDIM==3 implies all three
00067   arguments are evaluated.  This macro can be used to enhance
00068   the portability of code that works with structures whose size
00069   depends on CH\_SPACEDIM.
00070            
00071   For example:
00072 
00073      D\_EXPR(vect[0] *= s, vect[1] *= s, vect[2] *= s);
00074 
00075   More explicitly, this macro evaluates to one of
00076 
00077      ((void)((a),0))
00078 
00079      ((void)((a),(b),0))
00080 
00081      ((void)((a),(b),(c),0))
00082 
00083   corresponding to CH\_SPACEDIM values of 1, 2, or 3.
00084 */
00085 #  define D_EXPR(a,b,c) ((void)((a),0))
00086 
00087 /*@ManDoc:
00088   The D\_DECL(a,b,c) macro expands to a comma-separated list of
00089   1, 2, or all 3 of the arguments of the call, depending on the
00090   value of CH\_SPACEDIM.  This can be used to write portable
00091   function calls that depend on 1, 2, or 3 arguments, corresponding
00092   to the value of CH\_SPACEDIM.
00093 
00094   For example:
00095 
00096      return IntVect(D\_DECL(p[0] + s, p[1] + s, p[2] + s));
00097 
00098   More explicitly, this macro evaluates to one of
00099 
00100      a
00101 
00102      a,b
00103 
00104      a,b,c
00105 
00106   corresponding to CH\_SPACEDIM values of 1, 2, or 3.
00107 */
00108 #  define D_DECL(a,b,c) a
00109 
00110 /*@ManDoc:
00111   The D\_TERM(a,b,c) macro expands to a whitespace-separated list of
00112   1, 2, or all 3 of the arguments of the call, depending on the value
00113   of CH\_SPACEDIM.  This can be used to write program logic
00114   that depend on 1, 2, or 3 arguments, corresponding to
00115   the value of CH\_SPACEDIM.
00116 
00117   For example:
00118 
00119      return D\_TERM(len[0], *len[1], *len[2]);
00120 
00121   More explicitly, this macro evaluates to one of
00122 
00123      a
00124 
00125      a b
00126 
00127      a b c
00128 
00129   corresponding to CH\_SPACEDIM values of 1, 2, or 3.
00130 */
00131 #  define D_TERM(a,b,c) a
00132 #elif CH_SPACEDIM==2
00133 #  define D_EXPR(a,b,c) ((void)((a),(b),0))
00134 #  define D_DECL(a,b,c) a,b
00135 #  define D_TERM(a,b,c) a b
00136 #elif CH_SPACEDIM==3
00137 #  define D_EXPR(a,b,c) ((void)((a),(b),(c),0))
00138 #  define D_DECL(a,b,c) a,b,c
00139 #  define D_TERM(a,b,c) a b c
00140 #endif
00141 
00142 #endif /*CH_SPACE_H*/

Generated on Thu Aug 29 11:05:46 2002 for Chombo&INS by doxygen1.2.16