-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPrBeamSmiscMax.mac
123 lines (104 loc) · 3.23 KB
/
PrBeamSmiscMax.mac
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
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!PrBeamSmiscMax.mac
!B.Guest - [email protected]
!DESCRIPTION: This macro prints out the smisc values
! for each of the currently selected beam real types
!PRECONDITIONS:
! ARG1: 0 -> All 12 SMISC Values
! 1 -> Max of SMISC1/7,SMISC2/8,ect.
!POSTCONDITONS:
! OUT_MaxSmisc.out contains maximum smisc values
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
cm,temp_elem,elem
! Get a list of all element types
*get,elemCount,elem,,count
allElem = $ *vget,allElem,elem,,elist
elemReals= $ *vget,elemReals,elem,,attr,real !Get list of elements real numbers
*get,maxReal,rcon,,num,max
realMask= $ *dim,realMask,array,maxReal
*vfill,realMask,data,0.0
!Create Mask Of Real Numbers and number of real of real numbers
! realCount = 0
! *do,i,1,elemCount,
! *if,realMask(elemReals(i)),eq,0,then
! realMask(elemReals(i)) = 1
! realCount = realCount + 1
! *endif
! *enddo
realCount = 0
*do,i,1,elemCount
*get,elemRealNum,elem,allElem(i),ATTR,REAL,
*if,realMask(elemRealNum),eq,0,then
realMask(elemRealNum) = 1
realCount = realCount + 1
*endif
*enddo
!Fill out real number array
realNumbers = $ *dim,realNumbers,array,realCount
realIndex = 1
*do,i,1,maxReal,
*if,realMask(i),eq,1,then
realNumbers(realIndex) = i
realIndex = realIndex + 1
*endif
*enddo
!Open File to write to
*if,arg2,eq,1,then
*cfopen,OUT_BeamSmiscMax,out,,APPEND
!Doesn't print header when appended
*else
*cfopen,OUT_BeamSmiscMax,out
*if,arg1,eq,1,then
*vwrite
Element Type SMISC1/7 SMISC2/8 SMISC3/9 SMISC4/10 SMISC5/11 SMISC6/12
*else
*vwrite
Element Type SMISC1 SMISC2 SMISC3 SMISC4 SMISC5 SMISC6 SMISC7 SMISC8 SMISC9 SMISC10 SMISC11 SMISC12
*endif
*endif
!For the selected elements, for each element type
! get the selected element types and print their smisc
*do,realIdx,1,realCount
!Select elements
cmsel,s,temp_elem
esel,r,real,,realNumbers(realIdx)
!Get elemens and number of elements
currentElem = $ *vget,currentElem,elem,,elist
*get,curElemCount,elem,0,count
!Alocate arrays
*do,i,1,12
smisc%i% = $ *dim,smisc%i%,array,curElemCount
*enddo
!For each element for each smisc number, get
! value and put it into an array
*do,elemIdx,1,curElemCount,
*do,i,1,12,
*get,tempSmisc,elem,currentElem(elemIdx),smisc,i,
smisc%i%(elemIdx) = tempSmisc
*enddo
*enddo
*do,i,1,12,
*vscfun,smiscMax%i%,max,smisc%i%
*vscfun,smiscMin%i%,min,smisc%i%
smiscMax%i% = max(abs(smiscMin%i%),abs(smiscMax%i%))
*enddo
! If sould get maximum of 1/7
*if,arg1,eq,1,then
*do,i,1,6,
smiscMax%i% = max(smiscMax%i%,smiscMax%i+6%)
*enddo
*endif
!Print out smisc data
realNum = realNumbers(realIdx)
*if,arg1,eq,1,then ! If sould get maximum of 1/7
*vwrite,realNum,smiscMax1,smiscMax2,smiscMax3,smiscMax4,smiscMax5,smiscMax6,
%I %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G
*else
*vwrite,realNum,smiscMax1,smiscMax2,smiscMax3,smiscMax4,smiscMax5,smiscMax6,smiscMax7,smiscMax8,smiscMax9,smiscMax10,smiscMax11,smiscMax12
%I %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G %16.5G
*endif
*enddo
*cfclos
cmsel,s,temp_elem
!======THE--END========THE--END========THE--END=========
!ITS THE END OF THE MACRO AS WE KNOW IT, AND I FEEL FINE