Main Page   File List   File Members  

AMRData.h

Go to the documentation of this file.
00001 /*
00002    compiling instructions:   cc -o AMRData.o AMRData.c
00003    pretty simple.  Straight ANSI C  add whatever optimizations work good for
00004    your compiler.
00005 */
00006 
00007 /* multi-include guard */
00008 #ifndef AMRdata_h
00009 #define AMRdata_h
00010 
00011 
00012 /* AMR - CCA Forum interface proposal.  V 0.5  */
00013 /* Follows MPI-ish naming convention */
00014 
00055 /*
00056   exception handling ?   we could have an error handler be
00057   registered, so C++ people or others can choose to raise
00058   exceptions on error.  not critical though, in my opinion.
00059   In the absence of an error handler, we can just abort.
00060   or do the HDF5 and MPI thing of returning an error code.
00061   
00062   In practice, I have found that I prefer the code to DIE
00063   when an error occurs, which lets me send the debugger
00064   right to where the process went wrong.  bailing with an
00065   error code or exception handle or handler function makes
00066   debugging just too bothersome.  The code manages to "get away"
00067   from where the problem occured.  
00068 
00069   This touches on an old argument I have been making for years:
00070   exception handling only makes any sense in an environment where
00071   exceptions can be handled and there is some logical meaning to
00072   "continuing".  In Scientific computing codes, I have never
00073   encountered this paradigm done successfully.  Science is reproducible
00074   and excpetions are, by definition, exceptional behaviour.
00075 
00076 */
00077 /* Keep C++ compilers from getting confused */
00078 #if defined(__cplusplus)
00079 #define CONST const
00080 extern "C" {
00081 #else
00082 #define CONST
00083 #endif
00084 
00088 
00089   /* ========= Client side functions ======================*/
00090 
00091 void AMR_Create(int MPI_communicator,
00092                 int components,
00093                 int dimension,
00094                 int centering,
00095                 int type,
00096                 int ordering,
00097                 int* levelhandle);
00098 /* how to handle the situation where MPI_Comm exists or not ? 
00099    many people compile and use AMR packages without MPI on their
00100    system.  Perhaps different ways of compiling it ?  I've
00101    given my proposal here. */
00102 
00103 
00106 void AMR_AddPatchInt(   int levelhandle, 
00107                         CONST int* loRange, CONST int* hiRange,
00108                         CONST int* loValid, CONST int* hiValid,
00109                         CONST int* dataPtr);
00110 
00113 void AMR_AddPatchFloat( int levelhandle, 
00114                         CONST int* loRange, CONST int* hiRange,
00115                         CONST int* loValid, CONST int* hiValid,
00116                         CONST float* dataPtr);
00117 
00120 void AMR_AddPatchDouble(int levelhandle, 
00121                         CONST int* loRange, CONST int* hiRange,
00122                         CONST int* loValid, CONST int* hiValid,
00123                         CONST double* dataPtr);
00124 
00127 void AMR_AddPatchLong(  int levelhandle, 
00128                         CONST int* loRange, CONST int* hiRange,
00129                         CONST int* loValid, CONST int* hiValid,
00130                         CONST long* dataPtr);
00131 
00133 void AMR_Close(int levelhandle);
00134 
00136 void AMR_Delete(int levelhandle);
00137 
00144 
00145   /* ============ Server side functions =====================*/
00146 
00147 void AMR_GetInfo(int levelhandle,
00148                  int* MPI_communicator,
00149                  int* nComponents,
00150                  int* dimension,
00151                  int* centering,
00152                  int* type,
00153                  int* ordering,
00154                  int* localcount);
00155 
00156 
00158 void AMR_GetPatchInfo(   int levelhandle, int patch,
00159                          int* loRange, int* hiRange,
00160                          int* loValid, int* hiValid);
00161 
00162 void AMR_GetPatchInt(    int levelhandle, int patch, int**    dataPtr);
00163 void AMR_GetPatchFloat(  int levelhandle, int patch, float**  dataPtr);
00164 void AMR_GetPatchDouble( int levelhandle, int patch, double** dataPtr);
00165 void AMR_GetPatchLong(   int levelhandle, int patch, long**   dataPtr);
00166 
00167 
00173 
00174   /*============Fortran friendly bindings for these functions=========*/
00175 
00177 void amrcreate_(int* MPI_communicator,
00178                 int* components,
00179                 int* dimension,
00180                 int* centering,
00181                 int* type,
00182                 int* ordering,
00183                 int* levelhandle);
00184 
00185 void amraddpatchint_(   int* levelhandle, 
00186                        int* loRange,  int* hiRange,
00187                          int* loValid,  int* hiValid,
00188                          int* dataPtr);
00189 
00190 void amraddpatchfloat_( int* levelhandle, 
00191                          int* loRange,  int* hiRange,
00192                          int* loValid,  int* hiValid,
00193                          float* dataPtr);
00194 
00195 
00196 void amraddpatchdouble_(int* levelhandle, 
00197                          int* loRange,  int* hiRange,
00198                          int* loValid,  int* hiValid,
00199                          double* dataPtr);
00200 
00201 
00202 void amraddpatchlong_(  int* levelhandle, 
00203                          int* loRange,  int* hiRange,
00204                          int* loValid,  int* hiValid,
00205                          long* dataPtr);
00206 
00207 
00208 void amrclose_(int* levelhandle);
00209 
00210 
00211 void amrdelete_(int* levelhandle);
00212 
00213 
00214 
00215 
00216 void amrgetinfo_(int* levelhandle,
00217                  int*  MPI_communicator,
00218                  int*  nComponents,
00219                  int*  dimension,
00220                  int*  centering,
00221                  int*  type,
00222                  int*  ordering,
00223                  int*  localcount);
00224 
00225 void amrgetpatchinfo_(   int* levelhandle, int* patch,
00226                          int*  loRange, int*  hiRange,
00227                          int*  loValid, int*  hiValid);
00228 
00229 void amrgetpatchint_(    int* levelhandle, int* patch, int*    data);
00230 void amrgetpatchfloat_(  int* levelhandle, int* patch, float*  data);
00231 void amrgetpatchdouble_( int* levelhandle, int* patch, double* data);
00232 void amrgetpatchlong_(   int* levelhandle, int* patch, long*   data);
00233 
00236   /*
00237 error handling functions.  These are optional.  can override
00238 the function called on error conditions.  Thus a user can
00239 protect stderr output, or raise an exception in their own
00240 system.  default handler prints message to stderr and
00241 calls abort()
00242   */
00243 void AMR_setErrorHandler(void (*e)(char*));
00244 
00245 void (*AMR_getErrorHandler())(char*);
00246 
00247 #if defined(__cplusplus)
00248 }
00249 #endif
00250 
00251 
00252 
00253 #endif

Generated on Wed Apr 16 14:57:22 2003 for AMRInteroperability by doxygen1.2.16