pynucastro.networks.base_cxx_network module#

Support for a pure C++ reaction network. These functions will write the C++ code necessary to integrate a reaction network comprised of the rates that are passed in.

class pynucastro.networks.base_cxx_network.BaseCxxNetwork(*args, **kwargs)[source]#

Bases: ABC, RateCollection

Base class for a C++ network. This takes the same arguments as RateCollection and interprets the collection of rates and nuclei to produce the C++ code needed to integrate the network.

compose_jacobian()[source]#

Create the Jacobian matrix, df/dY, where f is a dY/dt and Y is a molar fraction

The Jacobian is stored as a list with each entry representing a Jacobian element. We also store whether the entry is null.

compose_ydot()[source]#

Create the expressions for dY/dt for each nucleus, where Y is the molar fraction.

This stores the result in a dict where the key is a Nucleus, and the value is a list of tuples, with the forward-reverse pairs of a rate

get_indent_amt(l, k)[source]#

Determine the amount of spaces to indent a line. This looks for a string of the form “<key>(#)”, where # is the a number that is the amount of indent.

Parameters:
  • l (str) – a line from a template file to check for an indent

  • k (str) – a keyword of the form “<key>” that appears in the line

Return type:

int