pyg4ometry.fluka.reader

Attributes

Classes

Reader

Class to read a FLUKA file.

RegionVisitor

A visitor class for accumulating the region definitions. The body

SensitiveErrorListener

ANTLR4 by default is very passive regarding parsing errors, it will

Functions

_getConstituentMaterialNamesFromCompound(compoundCards)

_make_body(body_parts, expansion_stack, ...)

main(filein)

Module Contents

pyg4ometry.fluka.reader._BODY_NAMES
class pyg4ometry.fluka.reader.Reader(filename)

Class to read a FLUKA file.

filename
flukaregistry
cards = []
getRegistry()

Get the fluka registry

_load()

Load the FLUKA input file

_findLines()
_parseBodies()
_parseRegions()
_parseCards()
_parseRotDefinis()
_parseGeometryDirective(line_parts, expansion_stack, translation_stack, transform_stack)
_parseMaterialAssignments()
_parseLattice()
_parseMaterials()
_splitMaterialCards()

Return a tuple as (Elements, Compounds, Matprop (not yet implemented)). Each is keyed with the name of the material, and the value corresponds to the card (Element) or cards (Compounds) that define the material.

pyg4ometry.fluka.reader._getConstituentMaterialNamesFromCompound(compoundCards)
pyg4ometry.fluka.reader._make_body(body_parts, expansion_stack, translation_stack, transform_stack, flukareg)
class pyg4ometry.fluka.reader.RegionVisitor(flukaregistry)

Bases: pyg4ometry.fluka.RegionExpression.RegionParserVisitor

A visitor class for accumulating the region definitions. The body instances are provided at instatiation, and then these are used when traversing the tree to build up a dictionary of region name and pyfluka.geometry.Region instances.

flukaregistry
region_name = None
subzone_counter = 0
visitSimpleRegion(ctx)
visitComplexRegion(ctx)
visitUnaryAndBoolean(ctx)
visitUnaryExpression(ctx)
visitUnaryAndSubZone(ctx)
visitSingleUnion(ctx)
visitMultipleUnion(ctx)
visitMultipleUnion2(ctx)
visitSubZone(ctx)
visitZoneExpr(ctx)
visitZoneSubZone(ctx)
visitZoneBody(ctx)
class pyg4ometry.fluka.reader.SensitiveErrorListener

Bases: antlr4.error.ErrorListener.ErrorListener

ANTLR4 by default is very passive regarding parsing errors, it will just carry on parsing and potentially build a nonsense-tree. This is not ideal as pyfluka has a very convoluted syntax; we want to be very strict about what our parser can and can’t do. For that reason this is a very sensitive error listener, throwing exceptions readily.

syntaxError(recognizer, offendingSymbol, line, column, msg, e)
pyg4ometry.fluka.reader.main(filein)