Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_WriteDataFile.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: write real or integer data to a file (grid or solution).
26 !
27 ! Description: file contains the following subroutines:
28 !
29 ! - RFLO_WriteDataFileReal = real variable
30 ! - RFLO_WriteDataFileInt = integer variable
31 !
32 ! Input: fileId = I/O channel
33 ! form = type of file (ASCII, binary, HDF)
34 ! nDim1/2 = 1st and 2nd dimension of var.
35 ! var = real variable to read
36 ! ivar = integer variable to read.
37 !
38 ! Output: to file.
39 !
40 ! Notes: none.
41 !
42 !******************************************************************************
43 !
44 ! $Id: RFLO_WriteDataFile.F90,v 1.3 2008/12/06 08:44:07 mtcampbe Exp $
45 !
46 ! Copyright: (c) 2001 by the University of Illinois
47 !
48 !******************************************************************************
49 
50 SUBROUTINE rflo_writedatafileint( global,fileId,form,nDim1,nDim2,ivar )
51 
52  USE moddatatypes
53  USE modglobal, ONLY : t_global
54  USE moderror
55  USE modparameters
56  IMPLICIT NONE
57 
58 ! ... parameters
59  INTEGER :: fileid, form, ndim1, ndim2
60 
61  INTEGER :: ivar(:,:)
62 
63  TYPE(t_global), POINTER :: global
64 
65 ! ... loop variables
66  INTEGER :: i1, i2
67 
68 !******************************************************************************
69 
70  CALL registerfunction( global,'RFLO_WriteDataFileInt',&
71  'RFLO_WriteDataFile.F90' )
72 
73 ! write
74 
75  IF (form == format_ascii) THEN
76  WRITE(fileid,*,err=10) ((ivar(i1,i2), i2=1,ndim2), i1=1,ndim1)
77  ELSE IF (form == format_binary) THEN
78  WRITE(fileid,err=10) ((ivar(i1,i2), i2=1,ndim2), i1=1,ndim1)
79  ELSE
80  CALL errorstop( global,err_unknown_format,&
81  __line__ )
82  ENDIF
83 
84 ! finalize, handle errors
85 
86  CALL deregisterfunction( global )
87  goto 999
88 
89 10 CONTINUE
90  CALL errorstop( global,err_file_write,&
91  __line__ )
92 
93 999 CONTINUE
94 END SUBROUTINE rflo_writedatafileint
95 
96 ! #############################################################################
97 ! #############################################################################
98 
99 SUBROUTINE rflo_writedatafilereal( global,fileId,form,nDim1,nDim2,var )
100 
101  USE moddatatypes
102  USE modglobal, ONLY : t_global
103  USE moderror
104  USE modparameters
105  IMPLICIT NONE
106 
107 ! ... parameters
108  INTEGER :: fileid, form, ndim1, ndim2
109 
110  REAL(RFREAL) :: var(:,:)
111 
112  TYPE(t_global), POINTER :: global
113 
114 ! ... loop variables
115  INTEGER :: i1, i2
116 
117 !******************************************************************************
118 
119  CALL registerfunction( global,'RFLO_WriteDataFileReal',&
120  'RFLO_WriteDataFile.F90' )
121 
122 ! write
123 
124  IF (form == format_ascii) THEN
125  WRITE(fileid,*,err=10) ((var(i1,i2), i2=1,ndim2), i1=1,ndim1)
126  ELSE IF (form == format_binary) THEN
127  WRITE(fileid,err=10) ((var(i1,i2), i2=1,ndim2), i1=1,ndim1)
128  ELSE
129  CALL errorstop( global,err_unknown_format,&
130  __line__ )
131  ENDIF
132 
133 ! finalize, handle errors
134 
135  CALL deregisterfunction( global )
136  goto 999
137 
138 10 CONTINUE
139  CALL errorstop( global,err_file_write,&
140  __line__ )
141 
142 999 CONTINUE
143 END SUBROUTINE rflo_writedatafilereal
144 
145 !******************************************************************************
146 !
147 ! RCS Revision history:
148 !
149 ! $Log: RFLO_WriteDataFile.F90,v $
150 ! Revision 1.3 2008/12/06 08:44:07 mtcampbe
151 ! Updated license.
152 !
153 ! Revision 1.2 2008/11/19 22:17:21 mtcampbe
154 ! Added Illinois Open Source License/Copyright
155 !
156 ! Revision 1.1 2004/11/29 21:25:17 wasistho
157 ! lower to upper case
158 !
159 ! Revision 1.4 2003/05/15 02:57:01 jblazek
160 ! Inlined index function.
161 !
162 ! Revision 1.3 2002/10/23 18:43:24 jblazek
163 ! Changed temporary pointer arrays into allocatable arrays
164 ! in grid and solution I/O routines.
165 !
166 ! Revision 1.2 2002/09/05 17:40:19 jblazek
167 ! Variable global moved into regions().
168 !
169 ! Revision 1.1 2002/06/07 16:40:36 jblazek
170 ! Grid & solution for all regions in one file.
171 !
172 !******************************************************************************
173 
174 
175 
176 
177 
178 
179 
180 
subroutine rflo_writedatafileint(global, fileId, form, nDim1, nDim2, ivar)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE form
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine rflo_writedatafilereal(global, fileId, form, nDim1, nDim2, var)
subroutine deregisterfunction(global)
Definition: ModError.F90:469