1 | PROGRAM gebaeude |
---|
2 | |
---|
3 | |
---|
4 | IMPLICIT NONE |
---|
5 | |
---|
6 | INTEGER:: i, j, k, nx, ny, nx1, ny1 |
---|
7 | INTEGER:: geb, beginni, endei |
---|
8 | INTEGER:: beginnj, endej |
---|
9 | |
---|
10 | REAL:: dx, dy, building_len_x, building_len_y, building_height_z |
---|
11 | REAL:: building_wall_l !< position of the left wall of the building |
---|
12 | REAL:: building_wall_s !< position of the southern wall of the building |
---|
13 | REAL:: positionx, positiony |
---|
14 | REAL:: diff, building_wall_l_neu |
---|
15 | |
---|
16 | CHARACTER(len=40):: anzeige |
---|
17 | character(len=99) :: jobname |
---|
18 | |
---|
19 | INTEGER,DIMENSION(:,:),ALLOCATABLE:: geb3d |
---|
20 | |
---|
21 | LOGICAL:: rotation !< Rotation of the building by 45 degrees (only works with square buildings) |
---|
22 | |
---|
23 | !--------------------------------------------------------------------------- |
---|
24 | jobname = 'a4-2' |
---|
25 | |
---|
26 | OPEN(1,FILE=trim(jobname)//'_topo') |
---|
27 | |
---|
28 | |
---|
29 | SELECT CASE(jobname) |
---|
30 | CASE("a1-1","a1-2","a2","a3-2") |
---|
31 | nx = 335 |
---|
32 | ny = 83 |
---|
33 | dx = 2.5 |
---|
34 | dy = 2.5 |
---|
35 | building_len_x = 25. |
---|
36 | building_len_y = 210. |
---|
37 | building_height_z = 25. |
---|
38 | building_wall_l = 217.5 |
---|
39 | building_wall_s = 0. |
---|
40 | rotation = .FALSE. |
---|
41 | CASE("a4-1") |
---|
42 | nx = 335 |
---|
43 | ny = 83 |
---|
44 | dx = 2.5 |
---|
45 | dy = 2.5 |
---|
46 | building_len_x = 25. |
---|
47 | building_len_y = 25. |
---|
48 | building_height_z = 25. |
---|
49 | building_wall_l = 400. |
---|
50 | building_wall_s = 92.5 |
---|
51 | rotation = .FALSE. |
---|
52 | CASE("a4-2") |
---|
53 | nx = 671 |
---|
54 | ny = 167 |
---|
55 | dx = 1.25 |
---|
56 | dy = 1.25 |
---|
57 | building_len_x = 25. |
---|
58 | building_len_y = 25. |
---|
59 | building_height_z = 25. |
---|
60 | building_wall_l = 400. |
---|
61 | building_wall_s = 92.5 |
---|
62 | rotation = .FALSE. |
---|
63 | CASE("a5-1","a5-2") |
---|
64 | nx = 356 |
---|
65 | ny = 383 |
---|
66 | dx = 2.5 |
---|
67 | dy = 2.5 |
---|
68 | building_len_x = 25. |
---|
69 | building_len_y = 25. |
---|
70 | building_height_z = 25. |
---|
71 | building_wall_l = 150. |
---|
72 | building_wall_s = 150. |
---|
73 | SELECT CASE(jobname) |
---|
74 | CASE("a5-1") |
---|
75 | rotation = .FALSE. |
---|
76 | CASE("a5-2") |
---|
77 | rotation = .TRUE. |
---|
78 | END SELECT |
---|
79 | END SELECT |
---|
80 | |
---|
81 | |
---|
82 | ALLOCATE(geb3d(0:nx,0:ny)) |
---|
83 | |
---|
84 | nx1 = nx+1 |
---|
85 | ny1 = ny+1 |
---|
86 | |
---|
87 | geb3d(:,:)=0. |
---|
88 | |
---|
89 | IF( .NOT. rotation ) THEN |
---|
90 | |
---|
91 | DO i = 0,nx |
---|
92 | DO j = 0,ny |
---|
93 | |
---|
94 | positionx=i*dx |
---|
95 | positiony=j*dy |
---|
96 | |
---|
97 | IF( positionx .GE. building_wall_l .AND. positionx .LE. building_wall_l+building_len_x-1 & |
---|
98 | .AND. positiony .GE. building_wall_s .AND. positiony .LE. building_wall_s+building_len_y-1 ) THEN |
---|
99 | geb=INT(building_height_z) |
---|
100 | ELSE |
---|
101 | geb=0 |
---|
102 | ENDIF |
---|
103 | |
---|
104 | geb3d(i,j)=geb |
---|
105 | |
---|
106 | ENDDO |
---|
107 | ENDDO |
---|
108 | ENDIF |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | IF( rotation ) THEN |
---|
113 | diff=(SQRT(building_len_x**2.+building_len_x**2.)-building_len_x)/2. |
---|
114 | building_wall_l_neu=building_wall_l-diff |
---|
115 | geb=INT(building_height_z) |
---|
116 | |
---|
117 | beginni=INT(building_wall_l_neu/dx)+1 |
---|
118 | endei=INT((building_wall_l_neu+SQRT(building_len_x**2.+building_len_x**2.))/dx) |
---|
119 | |
---|
120 | beginnj=INT((building_wall_s+building_len_y/2.)/dy) |
---|
121 | endej=beginnj |
---|
122 | |
---|
123 | DO i = 0,nx |
---|
124 | positionx=i*dx |
---|
125 | |
---|
126 | IF( positionx .GE. building_wall_l_neu .AND. positionx .LE. & |
---|
127 | building_wall_l_neu+SQRT(building_len_x**2.+building_len_x**2.)/2. ) THEN |
---|
128 | |
---|
129 | |
---|
130 | DO j = beginnj,endej |
---|
131 | geb3d(i,j)=geb |
---|
132 | ENDDO |
---|
133 | |
---|
134 | beginnj=beginnj-1 |
---|
135 | endej=endej+1 |
---|
136 | ENDIF |
---|
137 | |
---|
138 | IF( positionx .EQ. building_wall_l_neu+SQRT(building_len_x**2.+building_len_x**2.)/2. ) THEN |
---|
139 | beginnj=beginnj+1 |
---|
140 | endej=endej-1 |
---|
141 | ENDIF |
---|
142 | |
---|
143 | |
---|
144 | IF( positionx .GT. building_wall_l_neu+SQRT(building_len_x**2.+building_len_x**2.)/2. & |
---|
145 | .AND. positionx .LE. building_wall_l_neu+SQRT(building_len_x**2.+building_len_x**2.) ) THEN |
---|
146 | |
---|
147 | beginnj=beginnj+1 |
---|
148 | endej=endej-1 |
---|
149 | |
---|
150 | DO j = beginnj,endej |
---|
151 | geb3d(i,j)=geb |
---|
152 | ENDDO |
---|
153 | |
---|
154 | ENDIF |
---|
155 | |
---|
156 | ENDDO |
---|
157 | |
---|
158 | ENDIF |
---|
159 | |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | WRITE(anzeige,*) nx1 |
---|
164 | |
---|
165 | |
---|
166 | DO j = ny,0,-1 |
---|
167 | WRITE(1,'('//adjustl(anzeige)//'(I4))') ( geb3d(i,j), i=0,nx) |
---|
168 | ENDDO |
---|
169 | |
---|
170 | |
---|
171 | |
---|
172 | |
---|
173 | END PROGRAM gebaeude |
---|