"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "eas3pkg/eas3/coviseio.h" of archive eas3pkg_v1.6.3.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /*-------------------------------------------------------------------------------------------------------*/
    2 /* EAS3 License                                                                                          */
    3 /*                                                                                                       */
    4 /* Copyright (c) 2006 Institut fuer Aerodynamik und Gasdynamik, Universitaet Stuttgart                   */
    5 /*                                                                                                       */
    6 /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and     */
    7 /* associated documentation files (the "Software"), to deal in the Software without restriction,         */
    8 /* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, */
    9 /* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, */
   10 /* subject to the following conditions:                                                                  */
   11 /*                                                                                                       */
   12 /* The above copyright notice and this permission notice shall be included in all copies or substantial  */
   13 /* portions of the Software.										 */
   14 /*                                                                                                       */
   15 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT */
   16 /* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   */
   17 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER          */
   18 /* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */
   19 /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                       */
   20 /*-------------------------------------------------------------------------------------------------------*/
   21 /* ----------------------------------------------------------------------
   22  * project: coviseio (EAS3)
   23  * file:    coviseio.h
   24  * author:  Kai Augustin <augustin@iag.uni-stuttgart.de>
   25  *          Juli 2000
   26  * ----------------------------------------------------------------------
   27  * Header fuer alle Routinen der coviseio-Bibliothek <libcovise.a>
   28  * ----------------------------------------------------------------------
   29  */
   30 
   31 #include "c_in_fortran.h"
   32 
   33 #ifndef COVISEIO_H
   34 
   35 #define COVISEIO_H
   36 
   37 #endif
   38 
   39 /* Art der COVISE-Daten, die mit write auf die Datei
   40    geschrieben werden */
   41 
   42 #define COV_ISSTRING 1
   43 #define COV_ISINT    2
   44 #define COV_ISFLOAT  3
   45 
   46 /* Interfaces abhaengig vom Maschinentyp */
   47 
   48 /* sgi 32bit und 64bit Workstations */
   49 #if defined(SGI32) || defined(SGI64)
   50 
   51 /* Interface */
   52 # define C_COVOPEN         c_covopen_
   53 # define C_COVGRID         c_covgrid_
   54 # define C_COVSCAL         c_covscal_
   55 # define C_COVVEC          c_covvec_
   56 # define C_COVCLOSE        c_covclose_
   57 
   58 /* IA64 64bit and IA32 32-bit Workstations */
   59 #elif defined(IA64) || defined(IA32)
   60 
   61 /* Interface */
   62 # define C_COVOPEN         c_covopen_
   63 # define C_COVGRID         c_covgrid_
   64 # define C_COVSCAL         c_covscal_
   65 # define C_COVVEC          c_covvec_
   66 # define C_COVCLOSE        c_covclose_
   67 
   68 #elif defined(SX4EW8)      /* NEC SX4 */
   69 
   70 /* Interface */
   71 # define C_COVOPEN         c_covopen_
   72 # define C_COVGRID         c_covgrid_
   73 # define C_COVSCAL         c_covscal_
   74 # define C_COVVEC          c_covvec_
   75 # define C_COVCLOSE        c_covclose_
   76 
   77 #elif defined(HPV64)       /* HP V-Class */
   78 
   79 /* Interface */
   80 # define C_COVOPEN         c_covopen_
   81 # define C_COVGRID         c_covgrid_
   82 # define C_COVSCAL         c_covscal_
   83 # define C_COVVEC          c_covvec_
   84 # define C_COVCLOSE        c_covclose_
   85 
   86 #elif defined(T3E)         /* Cray T3E */
   87 
   88 /* kein Covise Support auf T3E, hier nur implementiert, */
   89 /* damit auf T3E weiterhin compilierbar */
   90 
   91 /* Interface */
   92 # define C_COVOPEN         C_COVOPEN
   93 # define C_COVGRID         C_COVGRID
   94 # define C_COVSCAL         C_COVSCAL
   95 # define C_COVVEC          C_COVVEC
   96 # define C_COVCLOSE        C_COVCLOSE
   97 
   98 #endif
   99 
  100 /* Ausgabe von Debug Messages */
  101 
  102 #if defined(DEBUG)
  103 
  104 # define PRINTMESSAGE (Int32) 1
  105 
  106 #else
  107 
  108 # define PRINTMESSAGE (Int32) 0
  109 
  110 #endif
  111 
  112 /* Maximale Anzahl Dateien */
  113 
  114 #define MAXFILES 128
  115 
  116 /* Default Filemode fuer das schreiben der Dateien */
  117 
  118 #define FMODE 0660
  119 
  120 /************************************************************************
  121  * C_COV : STRUCT HEADER                                                *
  122  * struct fuer den Header, der in den binary files vor jedem Datensatz  *
  123  * stehen muss                                                          *
  124  ************************************************************************/
  125 typedef struct
  126 {
  127   int xs;
  128   int ys;
  129   int zs;
  130 } header;
  131 
  132 /************************************************************************
  133  * C_COV : FILEDATENHEADER                                              *
  134  * struct fuer den Header einer jeden Datendatei                        *
  135  ************************************************************************/
  136 typedef struct
  137 {
  138   int nzs ;                   /* Anzahl Zeitschritte */
  139   int writegrid ;             /* Wird Gridfile geschrieben ? */
  140   int ftype ;                 /* Welche Art Datei (Scal=0,Vec=1) ? */
  141   int fpdat, fpgrid ;         /* Fileptr Datenfile */
  142   char *datfile, *gridfile ;  /* Dateinamen fuer Datendateien */
  143   int wdat, wgrid ;           /* Geschriebene Datensaetze */
  144 			      /* = -1 Datei ungeoeffnet */
  145 } dathead ;
  146 
  147 /* Interface */
  148 
  149 /************************************************************************
  150  * C_COV : C_COVOPEN                                                    *
  151  * Anlegen der zu schreibenden COVISE Datei(en)                         *
  152  ************************************************************************/
  153 void C_COVOPEN(const Int64 *buf, const char *fname, const Int64 *nzs,
  154 	       const Int64 *ftype, const Int64 *writegrid, Int64 *status);
  155 
  156 /************************************************************************
  157  * C_COV : C_COVGRID                                                    *
  158  * Schreibe ein Gitter nzs-mal in die geoffnete Gitterdatei             *
  159  ************************************************************************/
  160 void C_COVGRID(const Int64 *buf,
  161 	       const Int64 *dim1, const Int64 *dim2, const Int64 *dim3,
  162 	       const Float64 *xcoord, const Float64 *ycoord,
  163 	       const Float64 *zcoord, Int64 *status) ;
  164 
  165 /************************************************************************
  166  * C_COV : C_COVSCAL                                                    *
  167  * Schreibe ein einziges Skalardatenfeld in die Datendatei              *
  168  ************************************************************************/
  169 void C_COVSCAL(const Int64 *buf,
  170 	       const Int64 *dim1, const Int64 *dim2, const Int64 *dim3,
  171 	       const Float64 *data, Int64 *status) ;
  172 
  173 /************************************************************************
  174  * C_COV : C_COVVEC                                                     *
  175  * Schreibt die drei Komponenten eines Vektordatenfeldes                *
  176  ************************************************************************/
  177 void C_COVVEC(const Int64 *buf,
  178 	      const Int64 *dim1, const Int64 *dim2, const Int64 *dim3,
  179 	      const Float64 *xvec, const Float64 *yvec,
  180 	      const Float64 *zvec, Int64 *status) ;
  181 
  182 /************************************************************************
  183  * C_COV : C_COVCLOSE                                                   *
  184  * Anlegen der zu schreibenden COVISE Dateien                           *
  185  ************************************************************************/
  186 void C_COVCLOSE(const Int64 *buf, Int64 *status) ;
  187 
  188 /* Funktionen ohne Interfacefunktion */
  189 
  190 /************************************************************************
  191  * C_COV : cov_debug                                                    *
  192  * Ausgabe von Debug/Errormessage, wenn PRINTMESSAGE = 1 definiert      *
  193  ************************************************************************/
  194 void cov_debug(int nptrs, ...) ;
  195 
  196 /************************************************************************
  197  * C_COV : cov_calloc                                                   *
  198  * Speicher allokieren, Abbruch bei Fehlerausgabe                       *
  199  ************************************************************************/
  200 void *cov_calloc(const int nelem, const int elsize,
  201                  const char *file, const int line) ;
  202 
  203 /************************************************************************
  204  * C_COV : cov_getsingle                                                *
  205  * Ein double Precision float-Feld in ein single Precision float-Feld   *
  206  * verwandeln                                                           *
  207  * Speicher allokieren, Overflow abchecken                              *
  208  * bei indata[i]<1E-37 => outdata[i] = 0                                *
  209  * bei indata[i]>1E37 => outdata[i] = 1E37                              *
  210  ************************************************************************/
  211 float *cov_getsingle(const Float64 *indata, const int nelem,
  212 		     const char *file, const int line, int *status) ;
  213 
  214 
  215 /************************************************************************
  216  * C_COV : cov_writetofile                                              *
  217  * Wrapper zum Ausfuehren des Schreibbefehls in die Datei cov_fildes    *
  218  * cov_kind ist entweder COV_ISSTRING, COV_ISINT, COV_ISFLOAT           *
  219  * Schreiben von numele Elemente aus dem Puffer databuf in die Datei    *
  220  * Ggf. Little Endian -> Big Endian Konversion                          *
  221  ************************************************************************/
  222 long cov_writetofile(const int cov_fildes,
  223 		    const int cov_kind,
  224 		    const void *databuf,
  225 		    size_t numele) ;