Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_OpenPostInfo.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: Open file with information for post processor.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! global Global pointer
31 ! fileStatus Status of file to be opened
32 !
33 ! Output:
34 ! fileExists Logical flag indicating whether file exists or not
35 !
36 ! Notes:
37 ! 1. Need special treatment of file opening because in rflupost the file is
38 ! opened without knowing whether it exists or not, and need to be able to
39 ! handle latter case gracefully.
40 !
41 ! ******************************************************************************
42 !
43 ! $Id: RFLU_OpenPostInfo.F90,v 1.6 2008/12/06 08:44:12 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2002-2004 by the University of Illinois
46 !
47 ! ******************************************************************************
48 
49 SUBROUTINE rflu_openpostinfo(global,fileStatus,fileExists)
50 
51  USE moddatatypes
52  USE moderror
53  USE modglobal, ONLY: t_global
54  USE modmpi
55  USE modparameters
56 
58 
59  IMPLICIT NONE
60 
61 ! ******************************************************************************
62 ! Declarations and definitions
63 ! ******************************************************************************
64 
65 ! ==============================================================================
66 ! Arguments
67 ! ==============================================================================
68 
69  LOGICAL, INTENT(OUT) :: fileexists
70  INTEGER, INTENT(IN) :: filestatus
71  TYPE(t_global), POINTER :: global
72 
73 ! ==============================================================================
74 ! Locals
75 ! ==============================================================================
76 
77  CHARACTER(CHRLEN) :: ifilename,rcsidentstring
78  INTEGER :: errorflag
79 
80 ! ******************************************************************************
81 ! Start
82 ! ******************************************************************************
83 
84  rcsidentstring = '$RCSfile: RFLU_OpenPostInfo.F90,v $ $Revision: 1.6 $'
85 
86  CALL registerfunction(global,'RFLU_OpenPostInfo',&
87  'RFLU_OpenPostInfo.F90')
88 
89  IF ( global%myProcid == masterproc .AND. &
90  global%verbLevel > verbose_none ) THEN
91  WRITE(stdout,'(A,1X,A)') solver_name,'Opening post-processor info file...'
92  END IF ! global%verbLevel
93 
94 ! ******************************************************************************
95 ! Open file
96 ! ******************************************************************************
97 
98  IF ( global%myProcid == masterproc ) THEN
99  CALL buildfilenameplain(global,filedest_outdir,'.pin',ifilename)
100 
101  IF ( filestatus == file_status_unknown ) THEN
102  OPEN(if_postinfo,file=ifilename,form='FORMATTED',status='UNKNOWN', &
103  iostat=errorflag)
104  global%error = errorflag
105  IF ( global%error /= 0 ) THEN
106  CALL errorstop(global,err_file_open,__line__,'File: '//trim(ifilename))
107  END IF ! global%error
108 
109  fileexists = .true.
110  ELSE IF ( filestatus == file_status_old ) THEN
111  INQUIRE(file=ifilename,exist=fileexists)
112 
113  IF ( fileexists .EQV. .true. ) THEN
114  OPEN(if_postinfo,file=ifilename,form='FORMATTED',status='OLD', &
115  iostat=errorflag)
116  global%error = errorflag
117  IF ( global%error /= 0 ) THEN
118  CALL errorstop(global,err_file_open,__line__, &
119  'File: '//trim(ifilename))
120  END IF ! global%error
121  END IF ! file
122  END IF ! fileStatus
123  END IF ! global%myProcid
124 
125 ! ******************************************************************************
126 ! End
127 ! ******************************************************************************
128 
129  IF ( global%myProcid == masterproc .AND. &
130  global%verbLevel > verbose_none ) THEN
131  WRITE(stdout,'(A,1X,A)') solver_name, &
132  'Opening post-processor info file done.'
133  END IF ! global%verbLevel
134 
135  CALL deregisterfunction(global)
136 
137 END SUBROUTINE rflu_openpostinfo
138 
139 ! ******************************************************************************
140 !
141 ! RCS Revision history:
142 !
143 ! $Log: RFLU_OpenPostInfo.F90,v $
144 ! Revision 1.6 2008/12/06 08:44:12 mtcampbe
145 ! Updated license.
146 !
147 ! Revision 1.5 2008/11/19 22:17:25 mtcampbe
148 ! Added Illinois Open Source License/Copyright
149 !
150 ! Revision 1.4 2006/04/07 15:19:16 haselbac
151 ! Removed tabs
152 !
153 ! Revision 1.3 2004/10/19 19:24:43 haselbac
154 ! Changed file extension to pin
155 !
156 ! Revision 1.2 2004/06/16 20:00:20 haselbac
157 ! Added use of ModBuildFileNames, cosmetics
158 !
159 ! Revision 1.1 2003/06/04 22:24:29 haselbac
160 ! Initial revision
161 !
162 ! ******************************************************************************
163 
164 
165 
166 
167 
168 
169 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine buildfilenameplain(global, dest, ext, fileName)
subroutine rflu_openpostinfo(global, fileStatus, fileExists)
**********************************************************************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