EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Public Member Functions | List of all members
EGS_InputStruct Class Reference

A class to represent an egsinp input structure. More...

#include <egs_input_struct.h>

Public Member Functions

shared_ptr< EGS_BlockInputaddBlockInput (string blockTit, bool isReq=false)
 Add an input block named blockTit.
 
shared_ptr< EGS_BlockInputaddBlockInput (shared_ptr< EGS_BlockInput > block)
 Add an input block that is already defined as block.
 
void addBlockInputs (vector< shared_ptr< EGS_BlockInput >> blocks)
 Add a list of input blocks that are already defined as blocks.
 
void removeBlockInput (string blockTitle)
 Remove the input block named blockTitle.
 
void removeBlockInputByApp (string appName)
 Removes block inputs in input struct based on name of app variable.
 
vector< shared_ptr< EGS_BlockInput > > getBlockInputs ()
 Get the list of input blocks.
 
shared_ptr< EGS_BlockInputgetBlockInput (string title, string parentTitle="")
 Get the input block named title.
 
shared_ptr< EGS_BlockInputgetLibraryBlock (string blockTitle, string libraryName)
 Get the input block blockTitle that contains the library libraryName.
 
vector< string > getLibraryOptions (string blockTitle)
 Get the possible values for the library tag for the block blockTitle.
 

Detailed Description

A class to represent an egsinp input structure.

The EGS_InputStruct class is used to represent the top level of the egsinp file structure.

Example from egs_cylinders.cpp:

static void setInputs() {
    inputSet = true;

    // Get the inputs common to all geometries (name, library, media)
    // Builds on the global geometry input block geomBlockInput
    setBaseGeometryInputs();

    // Get the 'library' input, and set the valid values to be only 'EGS_Cylinders'
    geomBlockInput->getSingleInput("library")->setValues({"EGS_Cylinders"});

    // Add the 'type' input, required, and set the valid options for it.
    // Note that we save a reference to this input 'typePtr'.
    auto typePtr = geomBlockInput->addSingleInput("type", true, "The type of cylinder.", {"EGS_XCylinders", "EGS_YCylinders", "EGS_ZCylinders", "EGS_Cylinders"});

    // Add other inputs, 'radii' and 'midpoint'
    geomBlockInput->addSingleInput("radii", true, "A list of cylinder radii, must be in increasing order");
    geomBlockInput->addSingleInput("midpoint", false, "The position of the midpoint of the cylinder (x, y, z)");

    // Add the 'axis' input, and save a reference to it 'inpPtr'
    auto inpPtr = geomBlockInput->addSingleInput("axis", true, "The unit vector defining the axis along the length of the cylinder.");

    // Set a dependency for 'inpPtr' on 'typePrt' being set to the value 'EGS_Cylinders'. This makes it so that 'axis' is only required if 'type = EGS_Cylinders'.
    inpPtr->addDependency(typePtr, "EGS_Cylinders");
}

Definition at line 270 of file egs_input_struct.h.


The documentation for this class was generated from the following files: