Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scalegrd.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  IMPLICIT NONE
24  INTEGER, PARAMETER :: double = selected_real_kind(p=14,r=30)
25  real(kind=double), allocatable :: x(:),y(:),z(:)
26  INTEGER, allocatable :: blockdims(:,:)
27  character*50 infile,outfile
28  real(kind=double) scalefactor
29  INTEGER numblocks, numnodes, blocks, i, j, k
30 
31  Write(*,*) "**********************************************************"
32  Write(*,*) "This program is designed to take a GRIDGEN-generated text"
33  Write(*,*) "grid file (.grd), and multiply every x, y, and z in the "
34  Write(*,*) "file by a uniform factor. It was written to translate a "
35  Write(*,*) "grid in millimeters to one in meters. "
36  Write(*,*) "**********************************************************"
37 
38  write(*,*)'Enter Input File Name:'
39  read(*,*)infile
40  write(*,*)'Enter Output File Name:'
41  read(*,*)outfile
42  write(*,*)'Enter Multiplicative Scale Factor for all x,y,z:'
43  read(*,*)scalefactor
44 
45  open(unit=10,file=infile,form='formatted',action="read")
46  open(unit=11,file=outfile,form='formatted',action="write")
47 
48  WRITE(*,*) "Ready to read numBlocks"
49  READ(10,*) numblocks
50  WRITE(*,*) "numblocks = ", numblocks
51  allocate (blockdims(numblocks, 3))
52 
53  WRITE(*,*) "Read block dimensions."
54  do blocks = 1, numblocks
55  READ(10,*) blockdims(blocks, 1), blockdims(blocks, 2), blockdims(blocks, 3)
56  enddo
57 
58  WRITE(*,*) "Write new block header in new file."
59  WRITE(11,102) numblocks
60  do blocks = 1, numblocks
61  WRITE(11,102) blockdims(blocks, 1), blockdims(blocks, 2), blockdims(blocks, 3)
62  enddo
63 
64  WRITE(*,*) "Read and write block data."
65  do blocks = 1,numblocks
66 
67  WRITE(*,*) "Processing block:", blocks, " out of ", numblocks, " block(s)"
68 
69  numnodes = blockdims(blocks, 1)*blockdims(blocks, 2)*blockdims(blocks, 3)
70 
71  allocate (x(numnodes), y(numnodes), z(numnodes))
72 
73  READ(10,*) (x(i), i=1, numnodes)
74  READ(10,*) (y(j), j=1, numnodes)
75  READ(10,*) (z(k), k=1, numnodes)
76 
77  WRITE(11,101) (x(i)*scalefactor, i=1, numnodes)
78  WRITE(11,101) (y(j)*scalefactor, j=1, numnodes)
79  WRITE(11,101) (z(k)*scalefactor, k=1, numnodes)
80 
81  DEALLOCATE(x, y, z)
82 
83  enddo
84 
85  close (10)
86  close (11)
87 
88 101 format(4(es19.11))
89 102 format(i8, 1x, i8, 1x, i8)
90 
91  stop
92  end
93 
94 
95 
96 
97 
98 
unsigned char r() const
Definition: Color.h:68
j indices k indices k
Definition: Indexing.h:6
void int int REAL REAL * y
Definition: read.cpp:74
const std::string & unit() const
Obtain the unit of the attribute.
Definition: Attribute.h:200
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
**********************************************************************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
bool blocks
Input data is block-structured grid.
Definition: hdf2pltV2.C:51
Action * action()
Definition: Scheduler.h:71
j indices j
Definition: Indexing.h:6