Skip to content

material_card

converter.converter.fluka.cards.material_card

MaterialsCard dataclass

Class representing description of materials in Fluka input. Every material is represented by one line: codwed - "MATERIAL" what(1) - atomic number what(2) - empty, computed according to what(1) what(3) - density in g/cm^3 what(4) - empty, we are using name-based input what(5) - ignored what(6) - default, natural composition of the what(1) element sdum - Name of the material documentation: https://flukafiles.web.cern.ch/manual/chapters/description_input/description_options/material.html#material # skipcq: FLK-W505

Source code in yaptide/converter/converter/fluka/cards/material_card.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@dataclass
class MaterialsCard:
    """
    Class representing description of materials in Fluka input.
    Every material is represented by one line:
        codwed - "MATERIAL"
        what(1) - atomic number
        what(2) - empty, computed according to what(1)
        what(3) - density in g/cm^3
        what(4) - empty, we are using name-based input
        what(5) - ignored
        what(6) - default, natural composition of the what(1) element
        sdum - Name of the material
    documentation: https://flukafiles.web.cern.ch/manual/chapters/description_input/description_options/material.html#material # skipcq: FLK-W505
    """

    data: list[FlukaMaterial] = field(default_factory=list)
    codewd: str = "MATERIAL"

    def __str__(self) -> str:
        """Return card as string."""
        result = ""
        for material in self.data:
            what = [material.Z, "", material.density, "", "", ""]
            sdum = material.fluka_name
            result += str(Card(self.codewd, what, sdum)) + "\n"
        return result.strip()

codewd class-attribute instance-attribute

codewd = 'MATERIAL'

data class-attribute instance-attribute

data = field(default_factory=list)

__init__

__init__(data=list(), codewd='MATERIAL')

__str__

__str__()

Return card as string.

Source code in yaptide/converter/converter/fluka/cards/material_card.py
25
26
27
28
29
30
31
32
def __str__(self) -> str:
    """Return card as string."""
    result = ""
    for material in self.data:
        what = [material.Z, "", material.density, "", "", ""]
        sdum = material.fluka_name
        result += str(Card(self.codewd, what, sdum)) + "\n"
    return result.strip()