Public Member Functions | |
def | __init__ |
def | __str__ |
def | addConstituent |
def | getMass |
def | getRealValues |
def | getSimValues |
Public Attributes | |
theComment | |
theConstituents | |
theDescription | |
theMcVolume | |
theName |
Definition at line 23 of file twikiExport.py.
def twikiExport::Material::__init__ | ( | self, | |
matString, | |||
comment | |||
) |
Definition at line 24 of file twikiExport.py.
00025 : 00026 if matString == "" or not matString[0] == "#": 00027 raise StandardError , "not a valid material Definition: "+matString 00028 line = matString[1:] 00029 00030 if len( line.split('"') ) < 5 or len( line.split('"')[4].split() ) < 2: 00031 raise StandardError , "not a well formed Material Definition: "+matString 00032 self.theDescription = line.split('"')[1] 00033 self.theName = line.split('"')[3] 00034 self.theMcVolume = float(line.split('"')[4].split()[0]) 00035 self.theComment = comment 00036 self.theConstituents = []
def twikiExport::Material::__str__ | ( | self | ) |
Definition at line 83 of file twikiExport.py.
def twikiExport::Material::addConstituent | ( | self, | |
constString, | |||
predefinedMaterials | |||
) |
Definition at line 73 of file twikiExport.py.
00074 : 00075 if constString == "" or not constString[0] == "*": 00076 raise StandardError , "not a valid Constituent: "+constString 00077 line = constString[1:] 00078 self.theConstituents.append( Constituent(line, predefinedMaterials) ) 00079 00080 number = int( line.split('"')[0].split()[0] ) 00081 if not len(self.theConstituents) == number: 00082 raise StandardError, "Constituent Number mismatch for "+str(len(self.theConstituents))+" in: "+line
def twikiExport::Material::getMass | ( | self | ) |
Definition at line 67 of file twikiExport.py.
def twikiExport::Material::getRealValues | ( | self | ) |
Definition at line 37 of file twikiExport.py.
00038 : 00039 result = {} 00040 result["Volume"] = 0 00041 result["X0"] = 0 00042 result["L0"] = 0 00043 00044 totMass = self.getMass() 00045 invX0 = 0 00046 invL0 = 0 00047 for con in self.theConstituents: 00048 pWeight = con.theVolume * con.theDensity / totMass 00049 invX0 += pWeight / con.theX0 00050 invL0 += pWeight / con.theL0 00051 result["Volume"] += con.theVolume 00052 result["Density"] = self.getMass() / result["Volume"] 00053 result["X0"] = 1 / ( invX0 * result["Density"] ) 00054 result["L0"] = 1 / ( invL0 * result["Density"] ) 00055 00056 return result
def twikiExport::Material::getSimValues | ( | self | ) |
Definition at line 57 of file twikiExport.py.
Definition at line 24 of file twikiExport.py.
Definition at line 24 of file twikiExport.py.
Definition at line 24 of file twikiExport.py.
Definition at line 24 of file twikiExport.py.
Definition at line 24 of file twikiExport.py.