API topLevel - GeneralizedNuclearData/SG43 GitHub Wiki

Application Programming Interface (API) for Generalized Nuclear Database Structure (GNDS)

Introduction: this document will capture the classes and methods used to extract data from a GNDS file. It focuses on the top-level hierarchy, while other documents (TODO: provide links) document the APIs for interacting with low-level data containers and particle data.

This document is expected to change rapidly as SG43 expands the API. All members of SG43 are welcome to make changes and comments!

The document is organized by class, listing class methods (like a header file but omitting class members). In general, we start at the 'top' of the GNDS hierarchy and proceed down. Note that the document is currently incomplete! Some parts of this API refer to the 'node' class, which serve as an intermediate layer between the actual file access (i.e. xml parser or HDF5 reader) and the high-level API.

ReactionSuite

The ReactionSuite (or Protare) describes an evaluation of all reactions involving a projectile/target combination.

ReactionSuite(std::string const &fileName, PoPs::database const &pops); // construct from a file
ReactionSuite(node const &RSnode, PoPs::database const &pops); // construct from a node

std::string fileName(); // return file name

std::string projectile(); // return projectile particle id
std::string target(); // return target particle id
std::string evaluation(); // return evaluation label, i.e. 'ENDF-VII.1'

std::string projectileFrame(); // return 'lab' or 'centerOfMass'
//FIXME should return value be an enum instead?

StyleSuite const &styles(); // return
Style const &getStyle( std::string const label ); // return specified style
// FIXME throw exception if not found or return null?

int numberOfReactions();
int numberOfUnassociatedProducts(); // mainly used for MT=3 gammas

Reaction const *operator[](std::size_t index); // get reaction by index
Reaction const *unassociatedProduct(std::size_t index); // return unassociated product reaction by index

Reaction const findReactionByLabel(std::string const label);
Reaction const findReactionByMT(int ENDF_MT);

std::vector<std::string> findReactions(std::string globpattern);
// Search for reactions matching a pattern, i.e. "(n,p*)" to find every reaction that emits a proton.
// Potentially very useful, but still not fully fleshed out. API needs to document what kinds of
// glob patterns are supported.

bool hasFission();

// May include more helper functions, for example to extract the total cross section
// or total multiplicity for a given product

StyleSuite

The StyleSuite contains a description of all styles of data in the ReactionSuite. Each Style in the StyleSuite has a unique label that can be used to find data associated with that style. Note that the StyleSuite can probably inherit from a general-purpose 'Suite' class

StyleSuite();  // construct empty StyleSuite
StyleSuite(node const &SSnode);  // read in from a node

std::size_t size();  // return number of Styles in the suite
typedef forms::iterator iterator;
typedef forms::const_iterator const_iterator;

iterator begin(); // iterate from start of list
const_iterator begin();
iterator end();
const_iterator end();

int operator[]( std::string const label ); // return index of item with requested label
template<typename T> T const *get( std::size_t index ); // get Style by index
template<typename T> T const *get( std::string const label ); // get Style by label

const_iterator find( std::string const globpattern ); // find styles whose names match pattern 
const_iterator findEvaluated(); // return all evaluated styles
const_iterator findHeated(); // return all heated styles
const_iterator findGrouped(); // return all grouped styles

Style

The Style describes one type of data that appears in the file. Examples include 'evaluated', 'crossSectionReconstructed', 'heated', 'grouped', etc. Styles can be derived from other styles, for example 'evaluated' <-- 'crossSectionReconstructed' <-- 'heated' <-- 'grouped'. Here we actually describe the base class for all Styles (derived styles will contain more information)

Style(node const &Snode); // read in from a node

std::string const &date(); // date when this style was added to the ReactionSuite
double temperature(); // return temperature in K
// FIXME support other temperature units like MeV/k?

std::string const &derivedStyle();  // return label of parent style (that this one is derived from)
Style const *getDerivedStyle(); // return pointer to parent style

Reaction

Describes a single reaction, including a cross section and output channel with list of products.

Reaction(node const &Rnode); // read in from a node
std::string const label();
int ENDF_MT(); // return MT, or -1 if reaction doesn't match any MT number

OutputChannel const *outputChannel();
bool isFission();
CrossSectionSuite const &crossSection();

template<typename T> T const findCrossSectionStyle(std::string const label); // get specified cross section style

CrossSectionSuite

Contains all styles of cross section. Methods are the same as the StyleSuite

Inside the CrossSectionSuite, data styles are instances of classes like XYs1d, Regions1d or Gridded1d. These will be described in a separate API for low-level data containers (FIXME add link)

⚠️ **GitHub.com Fallback** ⚠️