Package mbdyn :: Module law
[hide private]

Source Code for Module mbdyn.law

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # This file is part of MBDyn sim suite. 
 5  # Copyright (C) 2007 André ESPAZE, as part of a Master thesis supervised by 
 6  # Martin O.L.Hansen (DTU) and Nicolas Chauvat (Logilab) 
 7   
 8  # MBDyn sim suite is free software; you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public License as published by 
10  # the Free Software Foundation; either version 2 of the License, or 
11  # (at your option) any later version. 
12  # 
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17  # 
18  # You should have received a copy of the GNU General Public License 
19  # along with this program; if not, write to the Free Software 
20  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
21  # 
22  """The constitutive laws available in the MBDyn package. 
23  Use only for the beam elements until now. 
24  """ 
25  from mbdyn.common import MANAGER, BasicObject 
26  from mbdyn.references import NONE_REF 
27   
28   
29 -class LinearElasticGeneric(BasicObject):
30 """The linear elastic generic constitutive law. 31 """ 32
33 - def __init__(self, name="linear elastic generic"):
34 BasicObject.__init__(self, name) 35 self.arg_names += ["type", "stiffness_matrix"] 36 MANAGER.add_argument(self, "type", "linear elastic generic") 37 self.written_in_a_block = False 38 self.dimension = None 39 self.ref = NONE_REF
40
41 - def set_key_name(self, name, com=None):
42 """Set the name of the law""" 43 self.written_in_a_block = True 44 if self.dimension != None: 45 indice = self.arg_names.index("dimension") 46 else: 47 indice = self.arg_names.index("type") 48 self.arg_names.insert(indice, "key_name") 49 mbdyn_name = "name, %s" % name 50 MANAGER.add_argument(self, "key_name", name, com, mbdyn_name)
51
52 - def set_dimension(self, value, com=None):
53 """Set the dimension of the constitutive law""" 54 self.written_in_a_block = True 55 indice = self.arg_names.index("type") 56 self.arg_names.insert(indice, "dimension") 57 MANAGER.add_argument(self, "dimension", value, com)
58
59 - def set_stiffness(self, *args, **kargs):
60 """Add the stiffness law matrix""" 61 MANAGER.add_matrix(self, "stiffness_matrix", args, kargs)
62