pyNastran  0.5.0
pyNastran BDF Reader/Writer, OP2 Parser, and GUI
mass.py
Go to the documentation of this file.
00001 ## GNU Lesser General Public License
00002 ## 
00003 ## Program pyNastran - a python interface to NASTRAN files
00004 ## Copyright (C) 2011-2012  Steven Doyle, Al Danial
00005 ## 
00006 ## Authors and copyright holders of pyNastran
00007 ## Steven Doyle <mesheb82@gmail.com>
00008 ## Al Danial    <al.danial@gmail.com>
00009 ## 
00010 ## This file is part of pyNastran.
00011 ## 
00012 ## pyNastran is free software: you can redistribute it and/or modify
00013 ## it under the terms of the GNU Lesser General Public License as published by
00014 ## the Free Software Foundation, either version 3 of the License, or
00015 ## (at your option) any later version.
00016 ## 
00017 ## pyNastran is distributed in the hope that it will be useful,
00018 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 ## GNU General Public License for more details.
00021 ## 
00022 ## You should have received a copy of the GNU Lesser General Public License
00023 ## along with pyNastran.  If not, see <http://www.gnu.org/licenses/>.
00024 ## 
00025 # pylint: disable=C0103,R0902,R0904,R0914
00026 
00027 from __future__ import division, print_function
00028 
00029 from pyNastran.bdf.cards.baseCard import Property
00030 
00031 class PointProperty(Property):
00032     type = 'PointProperty'
00033     def __init__(self, card, data):
00034         Property.__init__(self, card, data)
00035 
00036     def crossReference(self, model):
00037         pass
00038 
00039 class NSM(PointProperty):
00040     """
00041     Defines a set of non structural mass.
00042     """
00043     ## Set points to either Property entries or Element entries.
00044     ## Properties are:
00045     validProperties = [
00046         'PSHELL', 'PCOMP', 'PBAR',  'PBARL', 'PBEAM',  'PBEAML', 'PBCOMP',
00047         'PROD', 'CONROD', 'PBEND', 'PSHEAR','PTUBE', 'PCONEAX','PRAC2D']
00048     def __init__(self, card=None, nOffset=0, data=None):
00049         PointProperty.__init__(self, card, data)
00050         if card:
00051             nOffset *= 2
00052             self.sid   = card.field(1)
00053             self.Type  = card.field(2)
00054             self.id    = card.field(3+nOffset)
00055             self.value = card.field(4+nOffset)
00056         else:
00057             self.sid   = data[0]
00058             #sid=9  propSet=PBEA ID=538976333 value=0.0
00059             #sid=10 propSet=PDUM ID=538976312 value=2.80259692865e-45
00060             #sid=10 propSet=ELEM ID=542395973 value=0.0
00061             self.Type  = data[1]
00062             self.id    = data[2]
00063             self.value = data[3]
00064         ###
00065 
00066     def rawFields(self):
00067         #nodes = self.nodeIDs()
00068         fields = ['NSM', self.sid, self.Type, self.id, self.value]
00069         return fields
00070 
00071     def reprFields(self):
00072         return self.rawFields()
00073 
00074 class PMASS(PointProperty):
00075     def __init__(self, card=None, nOffset=0, data=None):
00076         PointProperty.__init__(self, card, data)
00077         if card:
00078             nOffset *= 2
00079             ## Property ID
00080             self.pid  = card.field(1+nOffset)
00081             self.mass = card.field(2+nOffset, 0.)
00082         else:
00083             self.pid = data[0]
00084             self.mass = data[1]
00085         ###
00086 
00087     def Mass(self):
00088         return self.mass
00089 
00090     def rawFields(self):
00091         fields = ['PMASS', self.pid, self.mass]
00092         return fields
00093 
00094     def reprFields(self):
00095         return self.rawFields()
 All Classes Namespaces Files Functions Variables