Blame view

SRC/GENERAL_MODULES/plot_geometry.F90 5.19 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
!
! This file is part of SACAMOS, State of the Art CAble MOdels in Spice. 
! It was developed by the University of Nottingham and the Netherlands Aerospace 
! Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
! 
! Copyright (C) 2016-2017 University of Nottingham
! 
! SACAMOS is free software: you can redistribute it and/or modify it under the 
! terms of the GNU General Public License as published by the Free Software 
! Foundation, either version 3 of the License, or (at your option) any later 
! version.
! 
! SACAMOS is distributed in the hope that it will be useful, but 
! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
! for more details.
! 
! A copy of the GNU General Public License version 3 can be found in the 
! file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
! 
! SACAMOS uses the EISPACK library (in /SRC/EISPACK). EISPACK is subject to 
! the GNU Lesser General Public License. A copy of the GNU Lesser General Public 
! License version can be found in the file GNU_LGPL in the root of EISPACK 
! (/SRC/EISPACK ) or at <http://www.gnu.org/licenses/>.
! 
! The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
!
! FILE CONTENTS:
!SUBROUTINE write_circle
!SUBROUTINE write_rectangle
!SUBROUTINE write_Dshape
!
!SUBROUTINE write_circle
!
! NAME
!     SUBROUTINE write_circle
!
! DESCRIPTION
!     write a circle with specified x,y centre and radius to file for plotting with gnuplot
!
!     
! COMMENTS
!     return the extent of the plotting area...
!
! HISTORY
!
!     started 10/05/2013 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_circle(x,y,r,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,r                 ! centre x and y coordinates and radius
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax   ! extent of the plotting area
  integer, intent(IN)    :: unit                  ! unit to write to  
  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
  
! START

  CALL generate_circle_points(npts,shape_x,shape_y,x,y,r)
  
  do i=1,npts
    
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_circle
!
!SUBROUTINE write_rectangle
!
! NAME
!     SUBROUTINE write_rectangle
!
! DESCRIPTION
!     write a rectangle with specified x,y centre, width, height and angle to file for plotting with gnuplot
!
!     
! COMMENTS
!     return the extent of the plotting area...
!
! HISTORY
!
!     started 23/9/2016 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_rectangle(x,y,w,h,theta,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,w,h,theta         ! centre x and y coordinates, width, height and angle of rectangle
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax   ! extent of the plotting area
  integer, intent(IN)    :: unit                  ! unit to write to  
  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
 
! START

  CALL generate_rectangle_points(npts,shape_x,shape_y,x,y,theta,w,h)
  
  do i=1,npts
  
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_rectangle

!
! NAME
!     SUBROUTINE write_Dshape
!
! DESCRIPTION
!     write a Dshape with specified x,y centre, width1, width2, conductor separation, shell offset and angle to file for plotting with gnuplot
!
!     
! COMMENTS
!     Also return the extent of the plotting area
!
! HISTORY
!
!     started 15/11/2016 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_Dshape(x,y,w1,w2,s,r,theta,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,w1,w2,s,r,theta  ! centre x and y coordinates, width1, width2, separation of wire rows, offset of D shapeand angle
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax  ! extent of the plotting area
  integer, intent(IN)    :: unit                 ! unit to write to  
  
! local variables  

  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
 
! START

  CALL generate_Dshape_points(npts,shape_x,shape_y,x,y,w1,w2,s,r,theta)
  
  do i=1,npts
  
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_Dshape