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

FORT_PROTO.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef _FORT_PROTO_H_
00029 #define _FORT_PROTO_H_
00030 
00031 #include "REAL.H"
00032 #include "SPACE.H"
00033 
00034 #ifdef DOXYGEN
00035 
00036 
00039 #define FORTRAN_NAME( NAME ,name ) 
00040 
00042 
00076 #define CHF_MULTIDO(box, i, j, k)
00077 
00079 #define CHF_ENDDO
00080 
00081 #else
00082 
00083 #ifdef CH_FORT_UPPERCASE
00084   #ifdef CH_FORT_UNDERSCORE
00085      #define FORTRAN_NAME( NAME ,name ) NAME ## _
00086   #else
00087      #define FORTRAN_NAME( NAME ,name ) NAME
00088   #endif
00089 #else
00090   #ifdef CH_FORT_UNDERSCORE
00091      #define FORTRAN_NAME( NAME ,name ) name ## _
00092   #else
00093      #define FORTRAN_NAME( NAME ,name ) name
00094   #endif
00095 #endif
00096 
00097 class chfptr {
00098 public:
00099   int i ;
00100   //XXX for debugging
00101   //XXXchfptr(int a):i(a){std::cout << "constructing chfptr " << &i << std::endl;}
00102   //XXX~chfptr() {std::cout << "destructing chfptr " << &i << std::endl;}
00103   chfptr(int a):i(a){}
00104   operator const int*() const {return &i;}
00105 };
00106 
00107 #endif
00108 
00109 // ChomboFortran declaration macros for Application code
00110 
00111 // primitive data types
00112 
00114 #define CHF_INT( i ) &i
00115 
00116 #define CHF_CONST_INT( i ) &i
00117 
00118 #define CHF_REAL( r ) &r
00119 
00120 #define CHF_CONST_REAL( r ) &r
00121 
00122 #define CHF_I1D(       ia,dimen ) ia,(const int*)chfptr(dimen-1)
00123 
00124 #define CHF_CONST_I1D( ia,dimen ) ia,(const int*)chfptr(dimen-1)
00125 
00126 #define CHF_R1D(       ra,dimen ) ra,(const int*)chfptr(dimen-1)
00127 
00128 #define CHF_CONST_R1D( ra,dimen ) ra,(const int*)chfptr(dimen-1)
00129 
00130 // Chombo data types
00131 
00133 #define CHF_INTVECT( a ) a.dataPtr( ) 
00134 
00135 #define CHF_CONST_INTVECT( a ) a.dataPtr( ) 
00136 
00137 #define CHF_REALVECT( a ) a.dataPtr( ) 
00138 
00139 #define CHF_CONST_REALVECT( a ) a.dataPtr( ) 
00140 
00141 #define CHF_VI(       v ) &v[0],(const int*)chfptr(v.size()-1)
00142 
00143 #define CHF_CONST_VI( v ) &v[0],(const int*)chfptr(v.size()-1)
00144 
00145 #define CHF_VR(       v ) &v[0],(const int*)chfptr(v.size()-1)
00146 
00147 #define CHF_CONST_VR( v ) &v[0],(const int*)chfptr(v.size()-1)
00148 
00150 #define CHF_BOX( b ) D_DECL( &b.loVect()[0] \
00151                             ,&b.loVect()[1] \
00152                             ,&b.loVect()[2] ) \
00153                     ,D_DECL( &b.hiVect()[0] \
00154                             ,&b.hiVect()[1] \
00155                             ,&b.hiVect()[2] ) 
00156 
00158 #define CHF_FIA( a ) a.dataPtr( 0 ) \
00159                      ,D_DECL( &a.loVect()[0] \
00160                              ,&a.loVect()[1] \
00161                              ,&a.loVect()[2] ) \
00162                      ,D_DECL( &a.hiVect()[0] \
00163                              ,&a.hiVect()[1] \
00164                              ,&a.hiVect()[2] ) \
00165                      ,a.nCompPtr()
00166 
00168 #define CHF_FRA( a ) a.dataPtr( 0 ) \
00169                      ,D_DECL( &a.loVect()[0] \
00170                              ,&a.loVect()[1] \
00171                              ,&a.loVect()[2] ) \
00172                      ,D_DECL( &a.hiVect()[0] \
00173                              ,&a.hiVect()[1] \
00174                              ,&a.hiVect()[2] ) \
00175                      ,a.nCompPtr()
00176 
00178 #define CHF_CONST_FIA( a ) a.dataPtr( 0 ) \
00179                      ,D_DECL( &a.loVect()[0] \
00180                              ,&a.loVect()[1] \
00181                              ,&a.loVect()[2] ) \
00182                      ,D_DECL( &a.hiVect()[0] \
00183                              ,&a.hiVect()[1] \
00184                              ,&a.hiVect()[2] ) \
00185                      ,a.nCompPtr()
00186 
00188 #define CHF_CONST_FRA( a ) a.dataPtr( 0 ) \
00189                      ,D_DECL( &a.loVect()[0] \
00190                              ,&a.loVect()[1] \
00191                              ,&a.loVect()[2] ) \
00192                      ,D_DECL( &a.hiVect()[0] \
00193                              ,&a.hiVect()[1] \
00194                              ,&a.hiVect()[2] ) \
00195                      ,a.nCompPtr()
00196 
00198 #define CHF_FIA1( a,n ) a.dataPtr( n ) \
00199                      ,D_DECL( &a.loVect()[0] \
00200                              ,&a.loVect()[1] \
00201                              ,&a.loVect()[2] ) \
00202                      ,D_DECL( &a.hiVect()[0] \
00203                              ,&a.hiVect()[1] \
00204                              ,&a.hiVect()[2] )
00205 
00207 #define CHF_FRA1( a,n ) a.dataPtr( n ) \
00208                      ,D_DECL( &a.loVect()[0] \
00209                              ,&a.loVect()[1] \
00210                              ,&a.loVect()[2] ) \
00211                      ,D_DECL( &a.hiVect()[0] \
00212                              ,&a.hiVect()[1] \
00213                              ,&a.hiVect()[2] )
00214 
00216 #define CHF_CONST_FIA1( a,n ) a.dataPtr( n ) \
00217                      ,D_DECL( &a.loVect()[0] \
00218                              ,&a.loVect()[1] \
00219                              ,&a.loVect()[2] ) \
00220                      ,D_DECL( &a.hiVect()[0] \
00221                              ,&a.hiVect()[1] \
00222                              ,&a.hiVect()[2] )
00223 
00225 #define CHF_CONST_FRA1( a,n ) a.dataPtr( n ) \
00226                      ,D_DECL( &a.loVect()[0] \
00227                              ,&a.loVect()[1] \
00228                              ,&a.loVect()[2] ) \
00229                      ,D_DECL( &a.hiVect()[0] \
00230                              ,&a.hiVect()[1] \
00231                              ,&a.hiVect()[2] )
00232 
00233 
00234 // Macros used in automatically-generated Chombo Fortran prototypes
00235 
00236 // primitive data types
00237 
00238 #define CHFp_INT( i ) int* const i
00239 #define CHFp_CONST_INT( i ) const int* const i
00240 #define CHFp_REAL( r ) Real* const r
00241 #define CHFp_CONST_REAL( r ) const Real* const r
00242 //[NOTE: the *1D macros has 2 args in C++, but just 1 in Fortran]
00243 #define CHFp_I1D(       ia,dimen )        int* const ia, const int* const i ## ia ## hi0
00244 #define CHFp_CONST_I1D( ia,dimen ) const  int* const ia, const int* const i ## ia ## hi0
00245 #define CHFp_R1D(       ra,dimen )       Real* const ra, const int* const i ## ra ## hi0
00246 #define CHFp_CONST_R1D( ra,dimen ) const Real* const ra, const int* const i ## ra ## hi0
00247 
00248 // Chombo data types
00249 
00250 #define CHFp_INTVECT( r ) int* const r
00251 #define CHFp_CONST_INTVECT( r ) const int* const r
00252 #define CHFp_REALVECT( r )  Real* const r
00253 #define CHFp_CONST_REALVECT( r ) const Real* const r
00254 #define CHFp_VI(       v )        int * const v, const int* const i ## v ## hi0
00255 #define CHFp_CONST_VI( v ) const  int * const v, const int* const i ## v ## hi0
00256 #define CHFp_VR(       v )       Real * const v, const int* const i ## v ## hi0
00257 #define CHFp_CONST_VR( v ) const Real * const v, const int* const i ## v ## hi0
00258 
00259 #define CHFp_BOX( b ) D_DECL( const int* const i ## b ## lo0 \
00260                              ,const int* const i ## b ## lo1 \
00261                              ,const int* const i ## b ## lo2 ) \
00262                      ,D_DECL( const int* const i ## b ## hi0 \
00263                              ,const int* const i ## b ## hi1 \
00264                              ,const int* const i ## b ## hi2 ) 
00265 
00266 #define CHFp_FIA( a ) int *const a \
00267                      ,D_DECL( const int* const i ## a ## lo0 \
00268                              ,const int* const i ## a ## lo1 \
00269                              ,const int* const i ## a ## lo2 ) \
00270                      ,D_DECL( const int* const i ## a ## hi0 \
00271                              ,const int* const i ## a ## hi1 \
00272                              ,const int* const i ## a ## hi2 ) \
00273                              ,const int* const n ## a ## comp
00274 #define CHFp_FRA( a ) Real *const a \
00275                      ,D_DECL( const int* const i ## a ## lo0 \
00276                              ,const int* const i ## a ## lo1 \
00277                              ,const int* const i ## a ## lo2 ) \
00278                      ,D_DECL( const int* const i ## a ## hi0 \
00279                              ,const int* const i ## a ## hi1 \
00280                              ,const int* const i ## a ## hi2 ) \
00281                              ,const int* const n ## a ## comp
00282 #define CHFp_CONST_FIA( a ) const int *const a \
00283                      ,D_DECL( const int* const i ## a ## lo0 \
00284                              ,const int* const i ## a ## lo1 \
00285                              ,const int* const i ## a ## lo2 ) \
00286                      ,D_DECL( const int* const i ## a ## hi0 \
00287                              ,const int* const i ## a ## hi1 \
00288                              ,const int* const i ## a ## hi2 ) \
00289                              ,const int* const n ## a ## comp
00290 #define CHFp_CONST_FRA( a ) const Real *const a \
00291                      ,D_DECL( const int* const i ## a ## lo0 \
00292                              ,const int* const i ## a ## lo1 \
00293                              ,const int* const i ## a ## lo2 ) \
00294                      ,D_DECL( const int* const i ## a ## hi0 \
00295                              ,const int* const i ## a ## hi1 \
00296                              ,const int* const i ## a ## hi2 ) \
00297                              ,const int* const n ## a ## comp
00298 #define CHFp_FIA1( a ) int *const a \
00299                      ,D_DECL( const int* const i ## a ## lo0 \
00300                              ,const int* const i ## a ## lo1 \
00301                              ,const int* const i ## a ## lo2 ) \
00302                      ,D_DECL( const int* const i ## a ## hi0 \
00303                              ,const int* const i ## a ## hi1 \
00304                              ,const int* const i ## a ## hi2 )
00305 #define CHFp_FRA1( a ) Real *const a \
00306                      ,D_DECL( const int* const i ## a ## lo0 \
00307                              ,const int* const i ## a ## lo1 \
00308                              ,const int* const i ## a ## lo2 ) \
00309                      ,D_DECL( const int* const i ## a ## hi0 \
00310                              ,const int* const i ## a ## hi1 \
00311                              ,const int* const i ## a ## hi2 )
00312 #define CHFp_CONST_FIA1( a ) const int *const a \
00313                      ,D_DECL( const int* const i ## a ## lo0 \
00314                              ,const int* const i ## a ## lo1 \
00315                              ,const int* const i ## a ## lo2 ) \
00316                      ,D_DECL( const int* const i ## a ## hi0 \
00317                              ,const int* const i ## a ## hi1 \
00318                              ,const int* const i ## a ## hi2 )
00319 #define CHFp_CONST_FRA1( a ) const Real *const a \
00320                      ,D_DECL( const int* const i ## a ## lo0 \
00321                              ,const int* const i ## a ## lo1 \
00322                              ,const int* const i ## a ## lo2 ) \
00323                      ,D_DECL( const int* const i ## a ## hi0 \
00324                              ,const int* const i ## a ## hi1 \
00325                              ,const int* const i ## a ## hi2 )
00326 
00327 #endif

Generated on Wed Jun 2 13:53:33 2004 for Chombo&INSwithParticles by doxygen 1.3.2