FEDEM Solver  R8.0
Source code of the dynamics solver
FFaIO.H
Go to the documentation of this file.
1 /* SPDX-FileCopyrightText: 2023 SAP SE
2  *
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * This file is part of FEDEM - https://openfedem.org
6  */
15 #ifndef FFA_IO_H
16 #define FFA_IO_H
17 
18 # if defined(irix)
19 # define Fopen fopen
20 # define Fclose fclose
21 # define Ftell ftell64
22 # define Fseek fseek64
23 # define long_int long long int
24 # elif defined(hpux)
25 # define Fopen fopen64
26 # define Fclose fclose
27 # define Ftell ftello64
28 # define Fseek fseeko64
29 # define long_int off64_t
30 # elif defined(win64)
31 # define Fopen fopen
32 # define Fclose fclose
33 # define Ftell _ftelli64
34 # define Fseek _fseeki64
35 # define long_int __int64
36 # else
38 # define Fopen fopen
40 # define Fclose fclose
42 # define Ftell ftell
44 # define Fseek fseek
46 # define long_int long int
47 # endif
48 
49 /* Special treatment required for Windows, use of low-level IO-functions */
50 
51 # ifdef FT_USE_LOWLEVEL_IO
52 
53 # include <io.h>
54 # include <fcntl.h>
55 # include <sys/stat.h>
56 
57 # ifdef __cplusplus
58 extern "C" {
59 # endif
60  int _ft_open(const char* name, int flag);
61  int _ft_close(int fp);
62  int _ft_getc(int fp);
63  int _ft_ungetc(int c, int fp);
64  char* _ft_gets(char* buf, int n, int fp);
65  size_t _ft_read(char* buf, size_t n, size_t m, int fp);
66  size_t _ft_write(const char* buf, size_t n, size_t m, int fp);
67  size_t _ft_setbuf(size_t bufsiz);
68 # ifdef __cplusplus
69 }
70 # endif
71 
72 # define FT_rb _O_BINARY | _O_RDONLY
73 # define FT_wb _O_BINARY | _O_WRONLY | _O_CREAT | _O_TRUNC
74 # define FT_ab _O_BINARY | _O_WRONLY | _O_APPEND
75 # define FT_rbp _O_BINARY | _O_RDWR
76 # define FT_wbp _O_BINARY | _O_RDWR | _O_CREAT | _O_TRUNC
77 # define FT_tmp _O_BINARY | _O_RDWR | _O_CREAT | _O_TEMPORARY
78 # define FT_open _ft_open
79 # define FT_close _ft_close
80 # define FT_tell _telli64
81 # define FT_seek _lseeki64
82 # define FT_read(buf,n,m,f) _ft_read((char*)buf,n,m,f)
83 # define FT_write(buf,n,m,f) _ft_write((char*)buf,n,m,f)
84 # define FT_setbuf(n) _ft_setbuf(n)
85 # define FT_flush _commit
86 # define FT_getc _ft_getc
87 # define FT_ungetc _ft_ungetc
88 # define FT_gets _ft_gets
89 # define FT_eof _eof
90 # define FT_int __int64
91 # define FT_FILE int
92 
93 # else
94 
95 # include <stdio.h>
96 
98 # define FT_rb "rb"
100 # define FT_wb "wb"
102 # define FT_ab "ab"
104 # define FT_rbp "rb+"
106 # define FT_wbp "wb+"
108 # define FT_tmp "wb+"
110 # define FT_open Fopen
112 # define FT_close Fclose
114 # define FT_tell Ftell
116 # define FT_seek Fseek
118 # define FT_read(buf,n,m,f) fread((void*)buf,n,m,f)
120 # define FT_write(buf,n,m,f) fwrite((void*)buf,n,m,f)
122 # define FT_setbuf(n) false
124 # define FT_flush fflush
126 # define FT_getc fgetc
128 # define FT_ungetc ungetc
130 # define FT_gets fgets
132 # define FT_eof feof
134 # define FT_int long_int
136 # define FT_FILE FILE*
137 
138 # endif
139 
140 #endif
real(dp), dimension(:,:), allocatable c
Definition: inverseModule.f90:39
real(dp), dimension(:,:), allocatable m
Definition: inverseModule.f90:38