def add_main_body(self, section): b = HAWC2MainBody() b = self.set_entry(b, section, 'body_name', h2name='name', required=True) copy = section.get_entry('copy_main_body') if copy is not None: b.copy_main_body = copy return b b = self.set_entry(b, section, 'body_type', h2name='type') b = self.set_entry(b, section, 'nbodies') b = self.set_entry(b, section, 'node_distribution') d_ani = section.get_entry('damping_aniso') if d_ani is not None: b.damping_aniso = d_ani b.damping_type = 'ani' else: b = self.set_entry(b, section, 'damping_posdef') b = self.set_entry(b, section, 'type') cm = section.get_entry('concentrated_mass') if cm is not None: if isinstance(cm[0], (int, float)): cm = [cm] b.concentrated_mass = cm timo = section.get_entry('timoschenko_input') st_type = timo.get_entry('becas') if st_type is not None: stdic = read_hawc2_stKfull_file(timo.get_entry('filename')) b.st_input_type = st_type for stset in stdic: st = HAWC2BeamStructureFullK() for k, w in stset.iteritems(): setattr(st, k, w) b.beam_structure.append(st) else: stdic = read_hawc2_st_file(timo.get_entry('filename')) for stset in stdic: st = HAWC2BeamStructure() b.st_input_type = 0 for k, w in stset.iteritems(): setattr(st, k, w) b.beam_structure.append(st) b.body_set = timo.get_entry('set') c2def = section.get_entry('c2_def') b.c12axis = np.array(c2def.get_entry('sec'))[:, 1:5] return b
def stfile2beamvt(filename): """read HAWC2 st file and return list of BeamStructureVT's""" from fusedwind.turbine.structure_vt import BeamStructureVT sts = [] stdic = read_hawc2_st_file(filename) for stset in stdic: st = BeamStructureVT() for k, w in stset.iteritems(): fused_name = k if k == 'K': fused_name = 'G' try: setattr(st, fused_name, w) except: print 'key error', k sts.append(st) return sts