Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
READ_FILES.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 read_files
55 
56  IMPLICIT NONE
57 
58  ! The following statements are because etype not user defined
59  etype = 4 ! Element type (4-node tetrahedra)
60  ftype = 3 ! Face type (3-node triangles)
61 
62 !-----------------------------------------------------------------------------------------!
63 ! 1.0) .noboite READ SECTION !
64 !-----------------------------------------------------------------------------------------!
65 
66  OPEN(unit = 10, file = prefix(1:length(prefix))//'.noboite', status = 'OLD', err = 1001)
67 
68 write(6,*) " ! Reading record #1 of .noboite file"
69  READ(10,*) numel, & ! Number of elements
70  numnp, & ! Number of nodes
71  npfixed ! Number of original nodes (from surface mesh)
72 
73  ALLOCATE(element(numel))
74  ALLOCATE(node(numnp))
75 
76  DO i = 1, numel
77  ALLOCATE(element(i)%conn(etype))
78  ENDDO
79 
80  ! Reading record #2 of .noboite file (element connectivity array)
81  WRITE(6,*) "Reading record #2 of .noboite file (element connectivity array)"
82  READ(10,*) (element(i)%conn(1:etype), i = 1, numel)
83 
84  ! Reading record #3 of .noboite file (node coordinates)
85  WRITE(6,*) "Reading record #3 of .noboite file (node coordinates)"
86  READ(10,*) (node(i)%coord(1:3), i = 1, numnp)
87 
88  ! Reading the number of subregions designated by Tetmesh
89  READ (10,*) numsub
90 
91  ! Reading the subregion triplets (faces located within the region)
92  ! This information is not needed and is bypassed
93  WRITE(6,*) "Reading the subregion triplets (faces located within the region)"
94  READ (10,*)
95 
96  IF (numsub .EQ. 1) THEN
97  DO i = 1, numel
98  element(i)%marker = 1
99  ENDDO
100  ELSE IF (numsub .NE. 1) THEN
101  ! Reading in the assigned subregion numbers given to each element
102  WRITE(6,*) "Reading in the assigned subregion numbers given to each element"
103  READ(10,*) (element(i)%marker, i = 1, numel)
104  write(6,*) "finished reading subregion number information"
105  ENDIF
106 
107  ! Closing .noboite file
108  CLOSE(10)
109 
110 !-----------------------------------------------------------------------------------------!
111 ! 1.2) .faces READ SECTION !
112 !-----------------------------------------------------------------------------------------!
113 
114  OPEN(unit = 20, file = prefix(1:length(prefix))//'.faces', status = 'OLD', err = 1002)
115 
116  READ(20,*) numfaces ! Number of faces
117 
118  ! Initializes the face linked list
119  ALLOCATE(facelist); nullify(facelist%next)
120  firstface => facelist; numbndfaces = 0
121  ALLOCATE(facelist%conn(ftype))
122 
123  ! Reads through all surface faces and assigns corresponding connectivity and flags
124  DO i = 1, numfaces
125  READ(20,*) facelist%ID, facelist%conn(1:ftype), facelist%marker
126 
127  IF (facelist%marker .NE. 0) THEN
128  ALLOCATE(facelist%next); facelist => facelist%next; nullify(facelist%next)
129  ALLOCATE(facelist%conn(ftype))
130  numbndfaces = numbndfaces + 1
131  ENDIF
132  ENDDO
133 
134  ! Closing .faces file
135  CLOSE(20)
136 
137 !-----------------------------------------------------------------------------------------!
138 ! 1.3) .points READ SECTION !
139 !-----------------------------------------------------------------------------------------!
140 
141  OPEN(unit = 30, file = prefix(1:length(prefix))//'.points', status = 'OLD', err = 1003)
142 
143  ALLOCATE(frontnode); nullify(frontnode%next)
144  first_front_node => frontnode; numscale_np = 0
145 
146  ALLOCATE(backnode); nullify(backnode%next)
147  first_back_node => backnode; numscale_np = 0
148 
149  ALLOCATE(bnplist); nullify(bnplist%next)
150  firstnode => bnplist; numbndnp = 0
151 
152  numscale_bk = 0
153  numscale_ft = 0
154  ! Reading node marker information from .points file
155  READ(30,*) ! npfixed... this information was already acquired in the .noboite file
156  WRITE(6,*) "Reading node marker information from .points file"
157  DO i = 1, npfixed
158  READ(30,*) xyz(1:3), mark
159 
160  ! If the marker is '1' then they are assigned to the backnode list
161  IF (mark .EQ. 1) THEN
162  backnode%ID = i
163  backnode%coord(1:3) = xyz(1:3)
164  backnode%marker = mark
165  ALLOCATE(backnode%next); backnode => backnode%next; nullify(backnode%next)
166  numscale_np = numscale_np + 1
167  numscale_bk = numscale_bk + 1
168  ! Else if the marker is '2' then they are assigned to the frontnode list
169  ELSE IF (mark .EQ. 2) THEN
170  frontnode%ID = i
171  frontnode%coord(1:3) = xyz(1:3)
172  frontnode%marker = mark
173  ALLOCATE(frontnode%next); frontnode => frontnode%next; nullify(frontnode%next)
174  numscale_np = numscale_np + 1
175  numscale_ft = numscale_ft + 1
176  ! Else if the marker is other than '0' then they are assigned to the boundary node list
177  ELSE IF (mark .NE. 0) THEN
178  numbndnp = numbndnp + 1
179  bnplist%ID = i
180  bnplist%marker = mark
181  ALLOCATE(bnplist%next); bnplist => bnplist%next; nullify(bnplist%next)
182  END IF
183  ! All nodes are added to the general list
184  node(i)%coord(1:3) = xyz(1:3)
185  node(i)%marker = mark
186  ENDDO
187 
188  ! Closing .points file
189  CLOSE(30)
190 
191 1000 goto 1010
192 
193 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
194 !!!!! ERROR STATEMENTS !!!!!
195 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
196 
197 1001 WRITE(6,*) "AN ERROR OCCURRED WHILE OPENING ", prefix(1:length(prefix))//'.noboite'
198  WRITE(6,*) "FILE DOES NOT EXIST."
199  stop
200 1002 WRITE(6,*) "AN ERROR OCCURRED WHILE OPENING ", prefix(1:length(prefix))//'.faces'
201  WRITE(6,*) "FILE DOES NOT EXIST."
202  stop
203 1003 WRITE(6,*) "AN ERROR OCCURRED WHILE OPENING ", prefix(1:length(prefix))//'.points'
204  WRITE(6,*) "FILE DOES NOT EXIST."
205  stop
206 
207 
208 1010 END SUBROUTINE read_files
209 
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
Definition: adj.h:150
const std::string & unit() const
Obtain the unit of the attribute.
Definition: Attribute.h:200
blockLoc i
Definition: read.cpp:79
void mark(Halfedge *h) const
Definition: HDS_accessor.h:295
subroutine read_files
Definition: READ_FILES.f90:53