Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WRITE_OUTPUT.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53  SUBROUTINE write_output
55 
56  IMPLICIT NONE
57 
58  ! If the current file number is less than 10,
59  ! then put a '.00' before the number in the file extension
60  IF (i .LT. 10) THEN
61  OPEN(35, file = prefix(1:length(prefix))//'.00'//scaleid(1:length(scaleid)), &
62  status = 'UNKNOWN')
63  ! else if the # is greater than 10 but less than 100 put a '.0' before the # in the extension
64  ELSE IF ((i .GE. 10).AND.(i .LT. 100)) THEN
65  OPEN(35, file = prefix(1:length(prefix))//'.0'//scaleid(1:length(scaleid)), &
66  status = 'UNKNOWN')
67  ! Else if the # is greater than or equal to 100, just add the '.' in front of the extension
68  ELSE IF (i .GE. 100) THEN
69  OPEN(35, file = prefix(1:length(prefix))//'.'//scaleid(1:length(scaleid)), &
70  status = 'UNKNOWN')
71  END IF
72 
73  ! Writing first record: <# of elements> <# of nodes> <Number of sister nodes>
74  WRITE(35,*) numel, numnp, numscale_np
75 
76  ! Record #2: <Node ID> < X > < Y > < Z >
77  DO l = 1, numnp
78  WRITE(35,'(I8,3F15.8)') l, node(l)%coord(1:3)
79  ENDDO
80 
81  ! Record #3: <# of Boundary nodes>
82  WRITE(35,*) numbndnp
83 
84  ! Record #4: <Boundary node ID> <marker>
85  bnplist => firstnode
86  DO WHILE(associated(bnplist%next))
87  WRITE(35,*) bnplist%ID, bnplist%marker
88  bnplist => bnplist%next
89  END DO
90 
91  ! Record #5: <# of Boundary faces (w/flags)>
92  WRITE(35,*) numbndfaces
93 
94  ! Record #6: <faceID> <face connectivity> <marker>
95  facelist => firstface
96  DO WHILE(associated(facelist%next))
97  WRITE(35,*) facelist%ID, facelist%conn(1:3), facelist%marker
98  facelist => facelist%next
99  END DO
100 
101  ! Record #7: <element ID> <element connectivity> <marker>
102  DO l = 1, numel
103  WRITE(35,*) l, element(l)%conn(1:4), element(l)%marker
104  END DO
105 
106  frontnode => first_front_node
107  backnode => first_back_node
108 
109 100 FORMAT(i4,1x,$) ! for the file ID write statement (used only once per list)
110 110 FORMAT(i8,1x,$) ! for the nodelist (used numscale_np/2 times)
111  ! If this is the first file to be written, Then only write information for one other file
112  IF (count .EQ. 1) THEN
113  frontfile = 2
114  ! Record #8: <current file #> <the mesh file next> <Number of invlolved sister nodes>
115  WRITE(35,*) i, frontfile, numscale_np/2
116  ! Record #9: <current fileID> <1:numscale/2 nodes>
117  WRITE(35,100) i
118  DO WHILE(associated(frontnode%next))
119  WRITE(35,110) frontnode%ID
120  frontnode => frontnode%next
121  END DO
122  WRITE(35,*) ! ends the current record being written
123 
124  frontnode => first_front_node
125  ! Record #10: <next fileID> <1:numscale/2 sister nodes>
126  WRITE(35,100) frontfile
127  DO WHILE(associated(frontnode%next))
128  WRITE(35,110) frontnode%sister%ID
129  frontnode => frontnode%next
130  END DO
131 
132  ! Else if writing the last file, Then only write the current and last file information
133  ELSE IF (count .EQ. scale) THEN
134  backfile = scale - 1
135  ! Record #8: <current file #> <the previous fileID> <# of involved sister nodes>
136  WRITE(35,*) i, backfile, numscale_np/2
137 
138  ! Record #9: <current fileID> <1:numscale/2 nodes>
139  WRITE(35,100) i
140  DO WHILE(associated(backnode%next))
141  WRITE(35,110) backnode%ID
142  backnode => backnode%next
143  END DO
144  WRITE(35,*) ! ends the current record being written
145 
146  backnode => first_back_node
147  ! Record #10: <next fileID> <1:numscale/2 sister nodes>
148  WRITE(35,100) backfile
149  DO WHILE(associated(backnode%next))
150  WRITE(35,110) backnode%sister%ID
151  backnode => backnode%next
152  END DO
153 
154  ! Else if writing a middle file, Then write both back and front file information
155  ELSE
156  backfile = i - 1
157  frontfile = i + 1
158  ! Record #8: <current file #> <previous fileID> <next fileID> <# of involved sister nodes>
159  WRITE(35,*) i, backfile, frontfile, numscale_np/2
160 
161  backnode => first_back_node
162  ! Record #9: <current fileID> <1:numscale/2 nodes>
163  WRITE(35,100) i
164  DO WHILE(associated(backnode%next))
165  WRITE(35,110) backnode%ID
166  backnode => backnode%next
167  END DO
168  WRITE(35,*) ! ends the current record being written
169 
170  backnode => first_back_node
171  ! Record #10: <next fileID> <1:numscale/2 sister nodes>
172  WRITE(35,100) backfile
173  DO WHILE(associated(backnode%next))
174  WRITE(35,110) backnode%sister%ID
175  backnode => backnode%next
176  END DO
177  WRITE(35,*) ! ends the current record being written
178 
179  frontnode => first_front_node
180  ! Record #11: <current fileID> <1:numscale/2 nodes>
181  WRITE(35,100) i
182  DO WHILE(associated(frontnode%next))
183  WRITE(35,110) frontnode%ID
184  frontnode => frontnode%next
185  END DO
186  WRITE(35,*) ! ends the current record being written
187 
188  frontnode => first_front_node
189  ! Record #12: <next fileID> <1:numscale/2 nodes>
190  WRITE(35,100) frontfile
191  DO WHILE(associated(frontnode%next))
192  WRITE(35,110) frontnode%sister%ID
193  frontnode => frontnode%next
194  END DO
195 
196  END IF
197 
198  count = count + 1
199  CLOSE(35)
200 
201  END SUBROUTINE write_output
202 
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
Definition: adj.h:150
void scale(const Real &a, Nodal_data &x)
subroutine write_output
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74