Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

FORT_PROTO.H

Go to the documentation of this file.
00001 /*   _______              __
00002     / ___/ /  ___  __ _  / /  ___
00003    / /__/ _ \/ _ \/  V \/ _ \/ _ \
00004    \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy).  All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners.  Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051 
00052 #ifndef _FORT_PROTO_H_
00053 #define _FORT_PROTO_H_
00054 
00055 #include "REAL.H"
00056 #include "SPACE.H"
00057 
00058 #ifdef DOXYGEN
00059 
00060 
00063 #define FORTRAN_NAME( NAME ,name )
00064 
00066 
00100 #define CHF_MULTIDO(box, i, j, k)
00101 
00103 #define CHF_ENDDO
00104 
00105 #else
00106 
00107 #ifdef CH_FORT_UPPERCASE
00108   #ifdef CH_FORT_UNDERSCORE
00109      #define FORTRAN_NAME( NAME ,name ) NAME ## _
00110   #else
00111      #define FORTRAN_NAME( NAME ,name ) NAME
00112   #endif
00113 #else
00114   #ifdef CH_FORT_UNDERSCORE
00115      #define FORTRAN_NAME( NAME ,name ) name ## _
00116   #else
00117      #define FORTRAN_NAME( NAME ,name ) name
00118   #endif
00119 #endif
00120 
00121 class chfptr {
00122 public:
00123   int i ;
00124   //XXX for debugging
00125   //XXXchfptr(int a):i(a){std::cout << "constructing chfptr " << &i << std::endl;}
00126   //XXX~chfptr() {std::cout << "destructing chfptr " << &i << std::endl;}
00127   chfptr(int a):i(a){}
00128   operator const int*() const {return &i;}
00129 };
00130 
00131 #endif
00132 
00133 // ChomboFortran declaration macros for Application code
00134 
00135 // primitive data types
00136 
00138 #define CHF_INT( i ) &i
00139 
00140 #define CHF_CONST_INT( i ) &i
00141 
00142 #define CHF_REAL( r ) &r
00143 
00144 #define CHF_CONST_REAL( r ) &r
00145 
00146 #define CHF_COMPLEX( c ) &c
00147 
00148 #define CHF_CONST_COMPLEX( c ) &c
00149 
00150 #define CHF_I1D(       ia,dimen ) ia,(const int*)chfptr(dimen-1)
00151 
00152 #define CHF_CONST_I1D( ia,dimen ) ia,(const int*)chfptr(dimen-1)
00153 
00154 #define CHF_R1D(       ra,dimen ) ra,(const int*)chfptr(dimen-1)
00155 
00156 #define CHF_CONST_R1D( ra,dimen ) ra,(const int*)chfptr(dimen-1)
00157 
00158 #define CHF_C1D(       ra,dimen ) ra,(const int*)chfptr(dimen-1)
00159 
00160 #define CHF_CONST_C1D( ra,dimen ) ra,(const int*)chfptr(dimen-1)
00161 
00162 // Chombo data types
00163 
00165 #define CHF_INTVECT( a ) a.dataPtr( )
00166 
00167 #define CHF_CONST_INTVECT( a ) a.dataPtr( )
00168 
00169 #define CHF_REALVECT( a ) a.dataPtr( )
00170 
00171 #define CHF_CONST_REALVECT( a ) a.dataPtr( )
00172 
00173 #define CHF_COMPLEXVECT( a ) a.dataPtr( )
00174 
00175 #define CHF_CONST_COMPLEXVECT( a ) a.dataPtr( )
00176 
00177 #define CHF_VI(       v ) &v[0],(const int*)chfptr(v.size()-1)
00178 
00179 #define CHF_CONST_VI( v ) &v[0],(const int*)chfptr(v.size()-1)
00180 
00181 #define CHF_VR(       v ) &v[0],(const int*)chfptr(v.size()-1)
00182 
00183 #define CHF_CONST_VR( v ) &v[0],(const int*)chfptr(v.size()-1)
00184 
00185 #define CHF_VC(       v ) &v[0],(const int*)chfptr(v.size()-1)
00186 
00187 #define CHF_CONST_VC( v ) &v[0],(const int*)chfptr(v.size()-1)
00188 
00190 #define CHF_BOX( b ) D_DECL( &b.loVect()[0] \
00191                             ,&b.loVect()[1] \
00192                             ,&b.loVect()[2] ) \
00193                     ,D_DECL( &b.hiVect()[0] \
00194                             ,&b.hiVect()[1] \
00195                             ,&b.hiVect()[2] )
00196 
00198 #define CHF_FIA( a ) a.dataPtr( 0 ) \
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                      ,a.nCompPtr()
00206 
00208 #define CHF_FRA( a ) a.dataPtr( 0 ) \
00209                      ,D_DECL( &a.loVect()[0] \
00210                              ,&a.loVect()[1] \
00211                              ,&a.loVect()[2] ) \
00212                      ,D_DECL( &a.hiVect()[0] \
00213                              ,&a.hiVect()[1] \
00214                              ,&a.hiVect()[2] ) \
00215                      ,a.nCompPtr()
00216 
00218 #define CHF_FCA( a ) a.dataPtr( 0 ) \
00219                      ,D_DECL( &a.loVect()[0] \
00220                              ,&a.loVect()[1] \
00221                              ,&a.loVect()[2] ) \
00222                      ,D_DECL( &a.hiVect()[0] \
00223                              ,&a.hiVect()[1] \
00224                              ,&a.hiVect()[2] ) \
00225                      ,a.nCompPtr()
00226 
00228 #define CHF_CONST_FIA( a ) a.dataPtr( 0 ) \
00229                      ,D_DECL( &a.loVect()[0] \
00230                              ,&a.loVect()[1] \
00231                              ,&a.loVect()[2] ) \
00232                      ,D_DECL( &a.hiVect()[0] \
00233                              ,&a.hiVect()[1] \
00234                              ,&a.hiVect()[2] ) \
00235                      ,a.nCompPtr()
00236 
00238 #define CHF_CONST_FRA( a ) a.dataPtr( 0 ) \
00239                      ,D_DECL( &a.loVect()[0] \
00240                              ,&a.loVect()[1] \
00241                              ,&a.loVect()[2] ) \
00242                      ,D_DECL( &a.hiVect()[0] \
00243                              ,&a.hiVect()[1] \
00244                              ,&a.hiVect()[2] ) \
00245                      ,a.nCompPtr()
00246 
00248 #define CHF_CONST_FCA( a ) a.dataPtr( 0 ) \
00249                      ,D_DECL( &a.loVect()[0] \
00250                              ,&a.loVect()[1] \
00251                              ,&a.loVect()[2] ) \
00252                      ,D_DECL( &a.hiVect()[0] \
00253                              ,&a.hiVect()[1] \
00254                              ,&a.hiVect()[2] ) \
00255                      ,a.nCompPtr()
00256 
00258 #define CHF_FIA1( a,n ) a.dataPtr( n ) \
00259                      ,D_DECL( &a.loVect()[0] \
00260                              ,&a.loVect()[1] \
00261                              ,&a.loVect()[2] ) \
00262                      ,D_DECL( &a.hiVect()[0] \
00263                              ,&a.hiVect()[1] \
00264                              ,&a.hiVect()[2] )
00265 
00267 #define CHF_FRA1( a,n ) a.dataPtr( n ) \
00268                      ,D_DECL( &a.loVect()[0] \
00269                              ,&a.loVect()[1] \
00270                              ,&a.loVect()[2] ) \
00271                      ,D_DECL( &a.hiVect()[0] \
00272                              ,&a.hiVect()[1] \
00273                              ,&a.hiVect()[2] )
00274 
00276 #define CHF_FCA1( a,n ) a.dataPtr( n ) \
00277                      ,D_DECL( &a.loVect()[0] \
00278                              ,&a.loVect()[1] \
00279                              ,&a.loVect()[2] ) \
00280                      ,D_DECL( &a.hiVect()[0] \
00281                              ,&a.hiVect()[1] \
00282                              ,&a.hiVect()[2] )
00283 
00285 #define CHF_CONST_FIA1( a,n ) a.dataPtr( n ) \
00286                      ,D_DECL( &a.loVect()[0] \
00287                              ,&a.loVect()[1] \
00288                              ,&a.loVect()[2] ) \
00289                      ,D_DECL( &a.hiVect()[0] \
00290                              ,&a.hiVect()[1] \
00291                              ,&a.hiVect()[2] )
00292 
00294 #define CHF_CONST_FRA1( a,n ) a.dataPtr( n ) \
00295                      ,D_DECL( &a.loVect()[0] \
00296                              ,&a.loVect()[1] \
00297                              ,&a.loVect()[2] ) \
00298                      ,D_DECL( &a.hiVect()[0] \
00299                              ,&a.hiVect()[1] \
00300                              ,&a.hiVect()[2] )
00301 
00303 #define CHF_CONST_FCA1( a,n ) a.dataPtr( n ) \
00304                      ,D_DECL( &a.loVect()[0] \
00305                              ,&a.loVect()[1] \
00306                              ,&a.loVect()[2] ) \
00307                      ,D_DECL( &a.hiVect()[0] \
00308                              ,&a.hiVect()[1] \
00309                              ,&a.hiVect()[2] )
00310 
00311 // Macros used in automatically-generated Chombo Fortran prototypes
00312 
00313 // primitive data types
00314 
00315 #define CHFp_INT( i ) int* const i
00316 #define CHFp_CONST_INT( i ) const int* const i
00317 #define CHFp_REAL( r ) Real* const r
00318 #define CHFp_CONST_REAL( r ) const Real* const r
00319 #define CHFp_COMPLEX( c ) Complex* const c
00320 #define CHFp_CONST_COMPLEX( c ) const Complex* const c
00321 //[NOTE: the *1D macros has 2 args in C++, but just 1 in Fortran]
00322 #define CHFp_I1D(       ia,dimen )        int* const ia, const int* const i ## ia ## hi0
00323 #define CHFp_CONST_I1D( ia,dimen ) const  int* const ia, const int* const i ## ia ## hi0
00324 #define CHFp_R1D(       ra,dimen )       Real* const ra, const int* const i ## ra ## hi0
00325 #define CHFp_CONST_R1D( ra,dimen ) const Real* const ra, const int* const i ## ra ## hi0
00326 #define CHFp_C1D(       ra,dimen )       Complex* const ra, const int* const i ## ra ## hi0
00327 #define CHFp_CONST_C1D( ra,dimen ) const Complex* const ra, const int* const i ## ra ## hi0
00328 
00329 // Chombo data types
00330 
00331 #define CHFp_INTVECT( r ) int* const r
00332 #define CHFp_CONST_INTVECT( r ) const int* const r
00333 #define CHFp_REALVECT( r )  Real* const r
00334 #define CHFp_CONST_REALVECT( r ) const Real* const r
00335 #define CHFp_COMPLEXVECT( r )  Complex* const r
00336 #define CHFp_CONST_COMPLEXVECT( r ) const Complex* const r
00337 #define CHFp_VI(       v )        int * const v, const int* const i ## v ## hi0
00338 #define CHFp_CONST_VI( v ) const  int * const v, const int* const i ## v ## hi0
00339 #define CHFp_VR(       v )       Real * const v, const int* const i ## v ## hi0
00340 #define CHFp_CONST_VR( v ) const Real * const v, const int* const i ## v ## hi0
00341 #define CHFp_VC(       v )       Complex * const v, const int* const i ## v ## hi0
00342 #define CHFp_CONST_VC( v ) const Complex * const v, const int* const i ## v ## hi0
00343 
00344 #define CHFp_BOX( b ) D_DECL( const int* const i ## b ## lo0 \
00345                              ,const int* const i ## b ## lo1 \
00346                              ,const int* const i ## b ## lo2 ) \
00347                      ,D_DECL( const int* const i ## b ## hi0 \
00348                              ,const int* const i ## b ## hi1 \
00349                              ,const int* const i ## b ## hi2 )
00350 
00351 #define CHFp_FIA( a ) int *const a \
00352                      ,D_DECL( const int* const i ## a ## lo0 \
00353                              ,const int* const i ## a ## lo1 \
00354                              ,const int* const i ## a ## lo2 ) \
00355                      ,D_DECL( const int* const i ## a ## hi0 \
00356                              ,const int* const i ## a ## hi1 \
00357                              ,const int* const i ## a ## hi2 ) \
00358                              ,const int* const n ## a ## comp
00359 #define CHFp_FRA( a ) Real *const a \
00360                      ,D_DECL( const int* const i ## a ## lo0 \
00361                              ,const int* const i ## a ## lo1 \
00362                              ,const int* const i ## a ## lo2 ) \
00363                      ,D_DECL( const int* const i ## a ## hi0 \
00364                              ,const int* const i ## a ## hi1 \
00365                              ,const int* const i ## a ## hi2 ) \
00366                              ,const int* const n ## a ## comp
00367 #define CHFp_FCA( a ) Complex *const a \
00368                      ,D_DECL( const int* const i ## a ## lo0 \
00369                              ,const int* const i ## a ## lo1 \
00370                              ,const int* const i ## a ## lo2 ) \
00371                      ,D_DECL( const int* const i ## a ## hi0 \
00372                              ,const int* const i ## a ## hi1 \
00373                              ,const int* const i ## a ## hi2 ) \
00374                              ,const int* const n ## a ## comp
00375 #define CHFp_CONST_FIA( a ) const int *const a \
00376                      ,D_DECL( const int* const i ## a ## lo0 \
00377                              ,const int* const i ## a ## lo1 \
00378                              ,const int* const i ## a ## lo2 ) \
00379                      ,D_DECL( const int* const i ## a ## hi0 \
00380                              ,const int* const i ## a ## hi1 \
00381                              ,const int* const i ## a ## hi2 ) \
00382                              ,const int* const n ## a ## comp
00383 #define CHFp_CONST_FRA( a ) const Real *const a \
00384                      ,D_DECL( const int* const i ## a ## lo0 \
00385                              ,const int* const i ## a ## lo1 \
00386                              ,const int* const i ## a ## lo2 ) \
00387                      ,D_DECL( const int* const i ## a ## hi0 \
00388                              ,const int* const i ## a ## hi1 \
00389                              ,const int* const i ## a ## hi2 ) \
00390                              ,const int* const n ## a ## comp
00391 #define CHFp_CONST_FCA( a ) const Complex *const a \
00392                      ,D_DECL( const int* const i ## a ## lo0 \
00393                              ,const int* const i ## a ## lo1 \
00394                              ,const int* const i ## a ## lo2 ) \
00395                      ,D_DECL( const int* const i ## a ## hi0 \
00396                              ,const int* const i ## a ## hi1 \
00397                              ,const int* const i ## a ## hi2 ) \
00398                              ,const int* const n ## a ## comp
00399 #define CHFp_FIA1( a ) int *const a \
00400                      ,D_DECL( const int* const i ## a ## lo0 \
00401                              ,const int* const i ## a ## lo1 \
00402                              ,const int* const i ## a ## lo2 ) \
00403                      ,D_DECL( const int* const i ## a ## hi0 \
00404                              ,const int* const i ## a ## hi1 \
00405                              ,const int* const i ## a ## hi2 )
00406 #define CHFp_FRA1( a ) Real *const a \
00407                      ,D_DECL( const int* const i ## a ## lo0 \
00408                              ,const int* const i ## a ## lo1 \
00409                              ,const int* const i ## a ## lo2 ) \
00410                      ,D_DECL( const int* const i ## a ## hi0 \
00411                              ,const int* const i ## a ## hi1 \
00412                              ,const int* const i ## a ## hi2 )
00413 #define CHFp_FCA1( a ) Complex *const a \
00414                      ,D_DECL( const int* const i ## a ## lo0 \
00415                              ,const int* const i ## a ## lo1 \
00416                              ,const int* const i ## a ## lo2 ) \
00417                      ,D_DECL( const int* const i ## a ## hi0 \
00418                              ,const int* const i ## a ## hi1 \
00419                              ,const int* const i ## a ## hi2 )
00420 #define CHFp_CONST_FIA1( a ) const int *const a \
00421                      ,D_DECL( const int* const i ## a ## lo0 \
00422                              ,const int* const i ## a ## lo1 \
00423                              ,const int* const i ## a ## lo2 ) \
00424                      ,D_DECL( const int* const i ## a ## hi0 \
00425                              ,const int* const i ## a ## hi1 \
00426                              ,const int* const i ## a ## hi2 )
00427 #define CHFp_CONST_FRA1( a ) const Real *const a \
00428                      ,D_DECL( const int* const i ## a ## lo0 \
00429                              ,const int* const i ## a ## lo1 \
00430                              ,const int* const i ## a ## lo2 ) \
00431                      ,D_DECL( const int* const i ## a ## hi0 \
00432                              ,const int* const i ## a ## hi1 \
00433                              ,const int* const i ## a ## hi2 )
00434 #define CHFp_CONST_FCA1( a ) const Complex *const a \
00435                      ,D_DECL( const int* const i ## a ## lo0 \
00436                              ,const int* const i ## a ## lo1 \
00437                              ,const int* const i ## a ## lo2 ) \
00438                      ,D_DECL( const int* const i ## a ## hi0 \
00439                              ,const int* const i ## a ## hi1 \
00440                              ,const int* const i ## a ## hi2 )
00441 
00442 #endif

Generated on Wed Oct 5 13:52:08 2005 for Chombo&AMRSelfGravity by  doxygen 1.4.1