<s> import alg3dpy <EOL> from mapy . reader import user_setattr <EOL> class Loads ( object ) : <EOL> def __init__ ( self ) : <EOL> self . subcases = { } <EOL> def rebuild ( self ) : <EOL> pass <EOL> def add2model ( self , model ) : <EOL> self . model = model <EOL> model . loadcount += <NUM_LIT:1> <EOL> self . loadcount = model . loadcount <EOL> model . loaddict [ model . loadcount ] = self <EOL> def set_subcase ( self , subcase ) : <EOL> self . subcases [ subcase . id ] = subcase <EOL> if self . __class__ . __name__ . find ( '<STR_LIT>' ) > - <NUM_LIT:1> : <EOL> for combloadid in self . loads : <EOL> for load in self . model . loaddict . values ( ) : <EOL> if load . id == combloadid : <EOL> load . set_subcase ( subcase ) <EOL> def add2grid ( self ) : <EOL> if self . __class__ . __name__ . find ( '<STR_LIT>' ) > - <NUM_LIT:1> : <EOL> return False <EOL> if self . __class__ . __name__ . find ( '<STR_LIT>' ) > - <NUM_LIT:1> : <EOL> ref = <NUM_LIT:3> <EOL> else : <EOL> ref = <NUM_LIT:0> <EOL> grid = self . model . griddict [ int ( self . gridid ) ] <EOL> for sub in self . subcases . values ( ) : <EOL> if not sub . loadid in self . model . loaddict . keys ( ) : <EOL> lf = <NUM_LIT:1.> <EOL> else : <EOL> load = self . model . loaddict [ sub . loadid ] <EOL> if load . __class__ . __name__ . find ( '<STR_LIT>' ) > - <NUM_LIT:1> : <EOL> lf = load . scaledict [ self . id ] <EOL> else : <EOL> lf = <NUM_LIT:1.> <EOL> grid . add_load ( sub . id , ref + <NUM_LIT:1> , lf * float ( self . x1 ) ) <EOL> grid . add_load ( sub . id , ref + <NUM_LIT:2> , lf * float ( self . x2 ) ) <EOL> grid . add_load ( sub . id , ref + <NUM_LIT:3> , lf * float ( self . x3 ) ) <EOL> return True <EOL> class Force ( Loads ) : <EOL> def __init__ ( self , inputs ) : <EOL> Loads . __init__ ( self ) <EOL> self = user_setattr ( self , inputs ) <EOL> self . lf = { } <EOL> self . lf [ self . id ] = <NUM_LIT:1.> <EOL> def rebuild ( self ) : <EOL> if getattr ( self , '<STR_LIT>' , False ) < > False : <EOL> g1id = int ( self . g1id ) <EOL> g2id = int ( self . g2id ) <EOL> self . g1obj = self . model . griddict [ g1id ] <EOL> self . g2obj = self . model . griddict [ g2id ] <EOL> self . calc_x1_x2_x3 ( model ) <EOL> else : <EOL> self . x1 = float ( self . f ) * float ( self . x1 ) <EOL> self . x2 = float ( self . f ) * float ( self . x2 ) <EOL> self . x3 = float ( self . f ) * float ( self . x3 ) <EOL> def calc_x1_x2_x3 ( self ) : <EOL> self . vec = alg3dpy . Vec ( self . g1obj , self . g2obj ) <EOL> cosbeta , cosgama = self . vec . cosines_GLOBAL ( ) <EOL> senbeta = ( <NUM_LIT:1> - cosbeta ** <NUM_LIT:2> ) ** <NUM_LIT:0.5> <EOL> sengama = ( <NUM_LIT:1> - cosgama ** <NUM_LIT:2> ) ** <NUM_LIT:0.5> <EOL> self . x1 = float ( self . f ) * cosgama * cosbeta <EOL> self . x2 = float ( self . f ) * sengama <EOL> self . x3 = float ( self . f ) * cosgama * senbeta <EOL> class Moment ( Loads ) : <EOL> def __init__ ( self , inputs ) : <EOL> Loads . __init__ ( self ) <EOL> self = user_setattr ( self , inputs ) <EOL> def rebuild ( self ) : <EOL> self . x1 = float ( self . f ) * float ( self . x1 ) <EOL> self . x2 = float ( self . f ) * float ( self . x2 ) <EOL> self . x3 = float ( self . f ) * float ( self . x3 ) <EOL> class Load ( Loads ) : <EOL> def __init__ ( self , inputs ) : <EOL> Loads . __init__ ( self ) <EOL> self = user_setattr ( self , inputs ) <EOL> self . loads = [ int ( i ) for i in self . loads ] <EOL> self . scales = [ float ( i ) for i in self . scales ] <EOL> self . scale_overall = float ( self . scale_overall ) <EOL> def rebuild ( self ) : <EOL> self . scaledict = { } <EOL> for i in xrange ( len ( self . loads ) ) : <EOL> self . scaledict [ self . loads [ i ] ] = self . scales [ i ] * self . scale_overall </s>
