Dear mecej4 et al.
The Harrison (1973) Structures program you helped with last year is going great guns. Interestingly I read a recent article by a group who had also recently used the work in some structural analysis. Old Fortran never dies (I hope no one's mug has broken).
The change I am making now is to allow other than completely fixed joints and the standard for a long time is a set of six binary numbers so
000000 is free 1111111 is fixed 111000 is pinned. There are 64 combinations and I got tired of typing the 6 digits when I can use a decimal like 63 to mean 111111. Neat clean and saves a lot of useless typing.
subroutine NodeSet(n,a,b,c,d,e,f) Integer n,a,b,c,d,e,f a = 0 b = 0 c = 0 d = 0 e = 0 f = 0 select case(n) case(1) f = 1 case(2) e = 1 case(3) e = 1 f = 1 case(4) d = 1 case(5) d = 1 f = 1 case(6) d = 1 e = 1 case(7) d = 1 e = 1 f = 1 case(8) c = 1 case(9) c = 1 f = 1 case(10) c = 1 e = 1 case(11) c = 1 e = 1 f = 1 case(12) c = 1 d = 1 case(13) c = 1 d = 1 f = 1 case(14) c = 1 d = 1 e = 1 case(15) c = 1 d = 1 e = 1 f = 1 case(16) b = 1 case(17) b = 1 f = 1 case(18) b = 1 e = 1 case(19) b = 1 e = 1 f = 1 case(20) b = 1 d = 1 case(21) b = 1 d = 1 f = 1 case(22) b = 1 d = 1 e = 1 case(23) b = 1 d = 1 e = 1 f = 1 case(24) b = 1 c = 1 case(25) b = 1 c = 1 f = 1 case(26) b = 1 c = 1 e = 1 case(27) b = 1 c = 1 e = 1 f = 1 case(28) b = 1 c = 1 d = 1 case(29) b = 1 c = 1 d = 1 f = 1 case(30) b = 1 c = 1 d = 1 e = 1 case(31) b = 1 c = 1 d = 1 e = 1 f = 1 case(32) a = 1 case(33) a = 1 f = 1 case(34) a = 1 e = 1 case(35) a = 1 e = 1 f = 1 case(36) a = 1 d = 1 case(37) a = 1 d = 1 f = 1 case(38) a = 1 d = 1 e = 1 case(39) a = 1 d = 1 e = 1 f = 1 case(40) a = 1 c = 1 case(41) a = 1 c = 1 f = 1 case(42) a = 1 c = 1 e = 1 case(43) a = 1 c = 1 e = 1 f = 1 case(44) a = 1 c = 1 d = 1 case(45) a = 1 c = 1 d = 1 f = 1 case(46) a = 1 c = 1 d = 1 e = 1 case(47) a = 1 c = 1 d = 1 e = 1 f = 1 case(48) a = 1 b = 1 case(49) a = 1 b = 1 f = 1 case(50) a = 1 b = 1 e = 1 case(51) a = 1 b = 1 e = 1 f = 1 case(52) a = 1 b = 1 d = 1 case(53) a = 1 b = 1 d = 1 f = 1 case(54) a = 1 b = 1 d = 1 e = 1 case(55) a = 1 b = 1 d = 1 e = 1 f = 1 case(56) a = 1 b = 1 c = 1 case(57) a = 1 b = 1 c = 1 f = 1 case(58) a = 1 b = 1 c = 1 e = 1 case(59) a = 1 b = 1 c = 1 e = 1 f = 1 case(60) a = 1 b = 1 c = 1 d = 1 case(61) a = 1 b = 1 c = 1 d = 1 f = 1 case(62) a = 1 b = 1 c = 1 d = 1 e = 1 case(63) a = 1 b = 1 c = 1 d = 1 e = 1 f = 1 end select return end subroutine
I hard coded it for the quick change in the program last year, but now I would ask is there a way to get a 6 digit binary array from a decimal from 0 to 63.
Thanks
John
Elemental Intrinsic Function (Generic): Extracts a sequence of bits (a bit field).
result = IBITS (i, pos, len)
i |
(Input) Must be of type integer. |
pos |
(Input) Must be of type integer. It must not be negative and pos+ len must be less than or equal to BIT_SIZE(i). The rightmost (least significant) bit of i is in position 0. |
len |
(Input) Must be of type integer. It must not be negative. |
The result type and kind is the same as i. The result has the value of the sequence of len bits in i, beginning at pos, right-adjusted and with all other bits zero.
As Andrew suggested, if b() is an array with a dimension of 6, and n is an integer number from 0 to 63, you can write
b=ibits(n,[0,1,2,3,4,5],1)
and when this statement is executed, b(1) will contain the least significant bit of n, b(2) the next bit, and so on.
Dear Coders:
Thanks -- that should make it a bit simpler in the code -- I should have thought of that when I dreamed up using the integers.
John,
Don't forget to revise your NodeSet
subroutine NodeSet(n,a,b,c,d,e,f) Integer n,a,b,c,d,e,f a = ibits(n,0,1) b = ibits(n,1,1) c = ibits(n,2,1) d = ibits(n,3,1) e = ibits(n,4,1) f = ibits(n,5,1) return end subroutine
Jim Dempsey
You could number the 6 node freedoms 1 to 6 then provide a fixity code for only those freedoms that are restrained. So : 123456 is fully fixed, 123 is pinned or 3 for direction 3 only is restrained (a direction 3 prop).
Order becomes unimportant, so 123 or 231 or 321 all imply a pinned restraint.
With this syntax you only have to deal with 6 cases.
The restraint code scheme that you suggest has some advantages, but also some drawbacks. It may be advantageous, if such an unordered set of digits is used to represent restraints in a 3-D structural frame, if the composite number is regarded as hexadecimal or octal. That is, Z'123' instead of 123 to represent "no translation allowed".
Some disadvantages: a) 18 or 20 bits to store the constraints on one joint, instead of 6; b) need to inspect multiple bits to query if a joint is restrained against, say, y-displacement; c) need to guard against restraint codes in input data such as 221 or 120.
On the other hand, once a scheme is adapted and comes into common use, it may be difficult to get users to accept replacing it with a better scheme. Which is the most widely used scheme, in your experience?
mecej4,
If you are commenting on the alternative scheme I described; it's two main advantages are that it simplifies the data approach (compared to the original post) and also the coding can be easier to read. For example comparing direction 2 vs direction 3 restraint, the old coding is 10000 vs 1000, while the new approach is 2 vs 3. This is much easier to check when reading. For error checking, "221" can be given a warning, but with the old approach how do you interpret " 11 1" ? As "011001" or "111" ? ( BZ or BN )
Regarding the storage of the restraint coding as binary, hexadecimal or octal; this is not an issue as often the restraint coding is replaced by an equation mapping, so there is no saving. Just use integer fixity(6,*).
For more complete information about compiler optimizations, see our Optimization Notice.