Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ReadDataFile.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: read in real or integer data from a file (grid or solution).
26 !
27 ! Description: file contains the following subroutines:
28 !
29 ! - RFLO_ReadDataFileReal = real variable
30 ! - RFLO_ReadDataFileInt = integer variable
31 !
32 ! Input: fileId = I/O channel
33 ! form = type of file (ASCII, binary)
34 ! nDim1/2 = 1st and 2nd dimension of var.
35 !
36 ! Output: var = real variable to read
37 ! ivar = integer variable to read.
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: RFLO_ReadDataFile.F90,v 1.3 2008/12/06 08:44:07 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2001 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE rflo_readdatafileint( global,fileId,form,nDim1,nDim2,ivar )
50 
51  USE moddatatypes
52  USE modglobal, ONLY : t_global
53  USE moderror
54  USE modparameters
55  IMPLICIT NONE
56 
57 ! ... parameters
58  INTEGER :: fileid, form, ndim1, ndim2
59 
60  INTEGER :: ivar(:,:)
61 
62  TYPE(t_global), POINTER :: global
63 
64 ! ... loop variables
65  INTEGER :: i1, i2
66 
67 !******************************************************************************
68 
69  CALL registerfunction( global,'RFLO_ReadDataFileInt',&
70  'RFLO_ReadDataFile.F90' )
71 
72 ! read
73 
74  IF (form == format_ascii) THEN
75  READ(fileid,*,err=10,end=10) ((ivar(i1,i2), i2=1,ndim2), i1=1,ndim1)
76  ELSE IF (form == format_binary) THEN
77  READ(fileid,err=10,end=10) ((ivar(i1,i2), i2=1,ndim2), i1=1,ndim1)
78  ELSE
79  CALL errorstop( global,err_unknown_format,&
80  __line__ )
81  ENDIF
82 
83 ! finalize, handle errors
84 
85  CALL deregisterfunction( global )
86  goto 999
87 
88 10 CONTINUE
89  CALL errorstop( global,err_file_read,&
90  __line__ )
91 
92 999 CONTINUE
93 END SUBROUTINE rflo_readdatafileint
94 
95 ! #############################################################################
96 ! #############################################################################
97 
98 SUBROUTINE rflo_readdatafilereal( global,fileId,form,nDim1,nDim2,var )
99 
100  USE moddatatypes
101  USE modglobal, ONLY : t_global
102  USE moderror
103  USE modparameters
104  IMPLICIT NONE
105 
106 ! ... parameters
107  INTEGER :: fileid, form, ndim1, ndim2
108 
109  REAL(RFREAL) :: var(:,:)
110 
111  TYPE(t_global), POINTER :: global
112 
113 ! ... loop variables
114  INTEGER :: i1, i2
115 
116 !******************************************************************************
117 
118  CALL registerfunction( global,'RFLO_ReadDataFileReal',&
119  'RFLO_ReadDataFile.F90' )
120 
121 ! read
122 
123  IF (form == format_ascii) THEN
124  READ(fileid,*,err=10,end=10) ((var(i1,i2), i2=1,ndim2), i1=1,ndim1)
125  ELSE IF (form == format_binary) THEN
126  READ(fileid,err=10,end=10) ((var(i1,i2), i2=1,ndim2), i1=1,ndim1)
127  ELSE
128  CALL errorstop( global,err_unknown_format,&
129  __line__ )
130  ENDIF
131 
132 ! finalize, handle errors
133 
134  CALL deregisterfunction( global )
135  goto 999
136 
137 10 CONTINUE
138  CALL errorstop( global,err_file_read,&
139  __line__ )
140 
141 999 CONTINUE
142 END SUBROUTINE rflo_readdatafilereal
143 
144 !******************************************************************************
145 !
146 ! RCS Revision history:
147 !
148 ! $Log: RFLO_ReadDataFile.F90,v $
149 ! Revision 1.3 2008/12/06 08:44:07 mtcampbe
150 ! Updated license.
151 !
152 ! Revision 1.2 2008/11/19 22:17:21 mtcampbe
153 ! Added Illinois Open Source License/Copyright
154 !
155 ! Revision 1.1 2004/11/29 21:25:16 wasistho
156 ! lower to upper case
157 !
158 ! Revision 1.4 2003/05/15 02:57:01 jblazek
159 ! Inlined index function.
160 !
161 ! Revision 1.3 2002/10/23 18:43:24 jblazek
162 ! Changed temporary pointer arrays into allocatable arrays
163 ! in grid and solution I/O routines.
164 !
165 ! Revision 1.2 2002/09/05 17:40:19 jblazek
166 ! Variable global moved into regions().
167 !
168 ! Revision 1.1 2002/06/07 16:40:36 jblazek
169 ! Grid & solution for all regions in one file.
170 !
171 !******************************************************************************
172 
173 
174 
175 
176 
177 
178 
179 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_readdatafileint(global, fileId, form, nDim1, nDim2, ivar)
**********************************************************************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 deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_readdatafilereal(global, fileId, form, nDim1, nDim2, var)