<ahref="engine__graph_8cpp.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aid="l00001"name="l00001"></a><spanclass="lineno"> 1</span><spanclass="preprocessor">#include "<aclass="code"href="engine__graph_8h.html">gridfire/engine/engine_graph.h</a>"</span></div>
<divclass="line"><aid="l00073"name="l00073"></a><spanclass="lineno"> 73</span><spanclass="keyword">auto</span> it = fourdst::atomic::species.find(std::string(name));</div>
<divclass="line"><aid="l00078"name="l00078"></a><spanclass="lineno"> 78</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Species '{}' not found in global atomic species database."</span>, name);</div>
<divclass="line"><aid="l00080"name="l00080"></a><spanclass="lineno"> 80</span><spanclass="keywordflow">throw</span> std::runtime_error(<spanclass="stringliteral">"Species not found in global atomic species database: "</span> + std::string(name));</div>
<divclass="line"><aid="l00092"name="l00092"></a><spanclass="lineno"> 92</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Populated {} reactions in the reaction ID map."</span>, <aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a5d6cc63b99b467c2a976d1fbaaa1dfa3">m_reactionIDMap</a>.size());</div>
<divclass="line"><aid="l00103"name="l00103"></a><spanclass="lineno"> 103</span><spanclass="comment">// The implementation of this function (and others) constrains this nuclear network to a constant temperature and density during</span></div>
<divclass="line"><aid="l00104"name="l00104"></a><spanclass="lineno"> 104</span><spanclass="comment">// each evaluation.</span></div>
<divclass="line"><aid="l00114"name="l00114"></a><spanclass="lineno"> 114</span><spanclass="comment">// Returns a constant reference to the vector of unique species in the network.</span></div>
<divclass="line"><aid="l00115"name="l00115"></a><spanclass="lineno"> 115</span> LOG_TRACE_L3(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Providing access to network species vector. Size: {}."</span>, <aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a92d26068ba139e47d335f5fe9e2814cc">m_networkSpecies</a>.size());</div>
<divclass="line"><aid="l00120"name="l00120"></a><spanclass="lineno"> 120</span><spanclass="comment">// Returns a constant reference to the set of reactions in the network.</span></div>
<divclass="line"><aid="l00126"name="l00126"></a><spanclass="lineno"> 126</span><spanclass="comment">// Checks if a given species is present in the network's species map for efficient lookup.</span></div>
<divclass="line"><aid="l00127"name="l00127"></a><spanclass="lineno"> 127</span><spanclass="keyword">const</span><spanclass="keywordtype">bool</span> found = <aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a30e09ed0bce6aa5fc89beaa316a7b827">m_networkSpeciesMap</a>.contains(species.name());</div>
<divclass="line"><aid="l00128"name="l00128"></a><spanclass="lineno"> 128</span> LOG_DEBUG(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Checking if species '{}' is involved in the network: {}."</span>, species.name(), found ? <spanclass="stringliteral">"Yes"</span> : <spanclass="stringliteral">"No"</span>);</div>
<divclass="line"><aid="l00134"name="l00134"></a><spanclass="lineno"> 134</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Validating mass (A) and charge (Z) conservation across all reactions in the network."</span>);</div>
<divclass="line"><aid="l00142"name="l00142"></a><spanclass="lineno"> 142</span><spanclass="comment">// Calculate total A and Z for reactants</span></div>
<divclass="line"><aid="l00149"name="l00149"></a><spanclass="lineno"> 149</span><spanclass="comment">// This scenario indicates a severe data integrity issue:</span></div>
<divclass="line"><aid="l00150"name="l00150"></a><spanclass="lineno"> 150</span><spanclass="comment">// a reactant is part of a reaction but not in the network's species map.</span></div>
<divclass="line"><aid="l00151"name="l00151"></a><spanclass="lineno"> 151</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"CRITICAL ERROR: Reactant species '{}' in reaction '{}' not found in network species map during conservation validation."</span>,</div>
<divclass="line"><aid="l00157"name="l00157"></a><spanclass="lineno"> 157</span><spanclass="comment">// Calculate total A and Z for products</span></div>
<divclass="line"><aid="l00164"name="l00164"></a><spanclass="lineno"> 164</span><spanclass="comment">// Similar critical error for product species</span></div>
<divclass="line"><aid="l00165"name="l00165"></a><spanclass="lineno"> 165</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"CRITICAL ERROR: Product species '{}' in reaction '{}' not found in network species map during conservation validation."</span>,</div>
<divclass="line"><aid="l00173"name="l00173"></a><spanclass="lineno"> 173</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Mass number (A) not conserved for reaction '{}': Reactants A={} vs Products A={}."</span>,</div>
<divclass="line"><aid="l00178"name="l00178"></a><spanclass="lineno"> 178</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Atomic number (Z) not conserved for reaction '{}': Reactants Z={} vs Products Z={}."</span>,</div>
<divclass="line"><aid="l00184"name="l00184"></a><spanclass="lineno"> 184</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Mass (A) and charge (Z) conservation validated successfully for all reactions."</span>);</div>
<divclass="line"><aid="l00185"name="l00185"></a><spanclass="lineno"> 185</span><spanclass="keywordflow">return</span><spanclass="keyword">true</span>; <spanclass="comment">// All reactions passed the conservation check</span></div>
<divclass="line"><aid="l00189"name="l00189"></a><spanclass="lineno"> 189</span><spanclass="comment">// Check if the requested network has already been cached.</span></div>
<divclass="line"><aid="l00190"name="l00190"></a><spanclass="lineno"> 190</span><spanclass="comment">// PERF: Rebuilding this should be pretty fast but it may be a good point of optimization in the future.</span></div>
<divclass="line"><aid="l00192"name="l00192"></a><spanclass="lineno"> 192</span><spanclass="comment">// TODO: need some more robust method here to</span></div>
<divclass="line"><aid="l00193"name="l00193"></a><spanclass="lineno"> 193</span><spanclass="comment">// A. Build the basic network from the composition's species with non zero mass fractions.</span></div>
<divclass="line"><aid="l00194"name="l00194"></a><spanclass="lineno"> 194</span><spanclass="comment">// B. rebuild a new composition from the reaction set's reactants + products (with the mass fractions from the things that are only products set to 0)</span></div>
<divclass="line"><aid="l00195"name="l00195"></a><spanclass="lineno"> 195</span><spanclass="comment">// C. Rebuild the reaction set from the new composition</span></div>
<divclass="line"><aid="l00196"name="l00196"></a><spanclass="lineno"> 196</span><spanclass="comment">// D. Cull reactions where all reactants have mass fractions below the culling threshold.</span></div>
<divclass="line"><aid="l00197"name="l00197"></a><spanclass="lineno"> 197</span><spanclass="comment">// E. Be careful about maintaining caching through all of this</span></div>
<divclass="line"><aid="l00200"name="l00200"></a><spanclass="lineno"> 200</span><spanclass="comment">// This allows for dynamic network modification while retaining caching for networks which are very similar.</span></div>
<divclass="line"><aid="l00202"name="l00202"></a><spanclass="lineno"> 202</span> LOG_DEBUG(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Reaction set not cached. Rebuilding the reaction set for T9={} and culling={}."</span>, T9, culling);</div>
<divclass="line"><aid="l00204"name="l00204"></a><spanclass="lineno"> 204</span><aclass="code hl_function"href="classgridfire_1_1_graph_engine.html#acdce8d87e23a2cd1504bc9472e538c0f">syncInternalMaps</a>(); <spanclass="comment">// Re-sync internal maps after updating reactions. Note this will also retrace the AD tape.</span></div>
<divclass="line"><aid="l00212"name="l00212"></a><spanclass="lineno"> 212</span><spanclass="comment">// Task 1: Set dimensions and initialize the matrix</span></div>
<divclass="line"><aid="l00220"name="l00220"></a><spanclass="lineno"> 220</span><spanclass="comment">// Task 2: Populate the stoichiometry matrix</span></div>
<divclass="line"><aid="l00221"name="l00221"></a><spanclass="lineno"> 221</span><spanclass="comment">// Iterate through all reactions, assign them a column index, and fill in their stoichiometric coefficients.</span></div>
<divclass="line"><aid="l00224"name="l00224"></a><spanclass="lineno"> 224</span><spanclass="comment">// Get the net stoichiometry for the current reaction</span></div>
<divclass="line"><aid="l00227"name="l00227"></a><spanclass="lineno"> 227</span><spanclass="comment">// Iterate through the species and their coefficients in the stoichiometry map</span></div>
<divclass="line"><aid="l00229"name="l00229"></a><spanclass="lineno"> 229</span><spanclass="comment">// Find the row index for this species</span></div>
<divclass="line"><aid="l00230"name="l00230"></a><spanclass="lineno"> 230</span><spanclass="keyword">auto</span> it = <aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#ad8237c252145a75092202d00f5e1ddf7">m_speciesToIndexMap</a>.find(species);</div>
<divclass="line"><aid="l00233"name="l00233"></a><spanclass="lineno"> 233</span><spanclass="comment">// Set the matrix element. Boost.uBLAS handles sparse insertion.</span></div>
<divclass="line"><aid="l00236"name="l00236"></a><spanclass="lineno"> 236</span><spanclass="comment">// This scenario should ideally not happen if m_networkSpeciesMap and m_speciesToIndexMap are correctly synced</span></div>
<divclass="line"><aid="l00237"name="l00237"></a><spanclass="lineno"> 237</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"CRITICAL ERROR: Species '{}' from reaction '{}' stoichiometry not found in species to index map."</span>,</div>
<divclass="line"><aid="l00240"name="l00240"></a><spanclass="lineno"> 240</span><spanclass="keywordflow">throw</span> std::runtime_error(<spanclass="stringliteral">"Species not found in species to index map: "</span> + std::string(species.name()));</div>
<divclass="line"><aid="l00243"name="l00243"></a><spanclass="lineno"> 243</span> reactionColumnIndex++; <spanclass="comment">// Move to the next column for the next reaction</span></div>
<divclass="line"><aid="l00246"name="l00246"></a><spanclass="lineno"> 246</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Stoichiometry matrix population complete. Number of non-zero elements: {}."</span>,</div>
<divclass="line"><aid="l00247"name="l00247"></a><spanclass="lineno"> 247</span><aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#ad1cb5fd32efc37668e2d9ecf0c72ad24">m_stoichiometryMatrix</a>.nnz()); <spanclass="comment">// Assuming nnz() exists for compressed_matrix</span></div>
<divclass="line"><aid="l00293"name="l00293"></a><spanclass="lineno"> 293</span><spanclass="comment">// 1. Pack the input variables into a vector for CppAD</span></div>
<divclass="line"><aid="l00294"name="l00294"></a><spanclass="lineno"> 294</span> std::vector<double> adInput(numSpecies + 2, 0.0); <spanclass="comment">// +2 for T9 and rho</span></div>
<divclass="line"><aid="l00295"name="l00295"></a><spanclass="lineno"> 295</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">size_t</span> i = 0; i < numSpecies; ++i) {</div>
<divclass="line"><aid="l00339"name="l00339"></a><spanclass="lineno"> 339</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Failed to open file for writing: {}"</span>, filename);</div>
<divclass="line"><aid="l00341"name="l00341"></a><spanclass="lineno"> 341</span><spanclass="keywordflow">throw</span> std::runtime_error(<spanclass="stringliteral">"Failed to open file for writing: "</span> + filename);</div>
<divclass="line"><aid="l00356"name="l00356"></a><spanclass="lineno"> 356</span><spanclass="comment">// 2. Define all reactions as intermediate nodes and connect them</span></div>
<divclass="line"><aid="l00359"name="l00359"></a><spanclass="lineno"> 359</span><spanclass="comment">// Create a unique ID for the reaction node</span></div>
<divclass="line"><aid="l00362"name="l00362"></a><spanclass="lineno"> 362</span><spanclass="comment">// Define the reaction node (small, black dot)</span></div>
<divclass="line"><aid="l00365"name="l00365"></a><spanclass="lineno"> 365</span><spanclass="comment">// Draw edges from reactants to the reaction node</span></div>
<divclass="line"><aid="l00370"name="l00370"></a><spanclass="lineno"> 370</span><spanclass="comment">// Draw edges from the reaction node to products</span></div>
<divclass="line"><aid="l00387"name="l00387"></a><spanclass="lineno"> 387</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Failed to open file for writing: {}"</span>, filename);</div>
<divclass="line"><aid="l00389"name="l00389"></a><spanclass="lineno"> 389</span><spanclass="keywordflow">throw</span> std::runtime_error(<spanclass="stringliteral">"Failed to open file for writing: "</span> + filename);</div>
<divclass="line"><aid="l00393"name="l00393"></a><spanclass="lineno"> 393</span><spanclass="comment">// Dynamic cast to REACLIBReaction to access specific properties</span></div>
<divclass="line"><aid="l00453"name="l00453"></a><spanclass="lineno"> 453</span><spanclass="keywordflow">return</span>; <spanclass="comment">// No-op for GraphEngine, as it does not support manually triggering updates.</span></div>
<divclass="line"><aid="l00457"name="l00457"></a><spanclass="lineno"> 457</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Recording AD tape for the RHS calculation..."</span>);</div>
<divclass="line"><aid="l00459"name="l00459"></a><spanclass="lineno"> 459</span><spanclass="comment">// Task 1: Set dimensions and initialize the matrix</span></div>
<divclass="line"><aid="l00462"name="l00462"></a><spanclass="lineno"> 462</span> LOG_ERROR(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"Cannot record AD tape: No species in the network."</span>);</div>
<divclass="line"><aid="l00464"name="l00464"></a><spanclass="lineno"> 464</span><spanclass="keywordflow">throw</span> std::runtime_error(<spanclass="stringliteral">"Cannot record AD tape: No species in the network."</span>);</div>
<divclass="line"><aid="l00466"name="l00466"></a><spanclass="lineno"> 466</span><spanclass="keyword">const</span><spanclass="keywordtype">size_t</span> numADInputs = numSpecies + 2; <spanclass="comment">// Note here that by not letting T9 and rho be independent variables, we are constraining the network to a constant temperature and density during each evaluation.</span></div>
<divclass="line"><aid="l00470"name="l00470"></a><spanclass="lineno"> 470</span><spanclass="comment">// We also initialize the dummy variable for tape recording (these tell CppAD what the derivative chain looks like).</span></div>
<divclass="line"><aid="l00471"name="l00471"></a><spanclass="lineno"> 471</span><spanclass="comment">// Their numeric values are irrelevant except for in so far as they avoid numerical instabilities.</span></div>
<divclass="line"><aid="l00473"name="l00473"></a><spanclass="lineno"> 473</span><spanclass="comment">// Distribute total mass fraction uniformly between species in the dummy variable space</span></div>
<divclass="line"><aid="l00480"name="l00480"></a><spanclass="lineno"> 480</span><spanclass="comment">// This also beings the tape recording process.</span></div>
<divclass="line"><aid="l00484"name="l00484"></a><spanclass="lineno"> 484</span><spanclass="keywordflow">for</span>(<spanclass="keywordtype">size_t</span> i = 0; i < numSpecies; ++i) {</div>
<divclass="line"><aid="l00491"name="l00491"></a><spanclass="lineno"> 491</span><spanclass="comment">// 5. Call the actual templated function</span></div>
<divclass="line"><aid="l00492"name="l00492"></a><spanclass="lineno"> 492</span><spanclass="comment">// We let T9 and rho be constant, so we pass them as fixed values.</span></div>
<divclass="line"><aid="l00497"name="l00497"></a><spanclass="lineno"> 497</span> LOG_TRACE_L1(<aclass="code hl_variable"href="classgridfire_1_1_graph_engine.html#a483979fc154adc88d029b3b672066d53">m_logger</a>, <spanclass="stringliteral">"AD tape recorded successfully for the RHS calculation. Number of independent variables: {}."</span>,</div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a0ed390f3e598ebba4e245ac90bb78767"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a0ed390f3e598ebba4e245ac90bb78767">gridfire::GraphEngine::getNetworkSpecies</a></div><divclass="ttdeci">const std::vector< fourdst::atomic::Species >& getNetworkSpecies() const override</div><divclass="ttdoc">Gets the list of species in the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00113">engine_graph.cpp:113</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a26215593544c3a52597194602e4e25dd"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a26215593544c3a52597194602e4e25dd">gridfire::GraphEngine::getSpeciesTimescales</a></div><divclass="ttdeci">std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double >&Y, double T9, double rho) const override</div><divclass="ttdoc">Computes timescales for all species in the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00436">engine_graph.cpp:436</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a26602e1b3c610780a47b5a6511d6d567"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a26602e1b3c610780a47b5a6511d6d567">gridfire::GraphEngine::populateReactionIDMap</a></div><divclass="ttdeci">void populateReactionIDMap()</div><divclass="ttdoc">Populates the reaction ID map.</div><divclass="ttdef"><b>Definition</b><ahref="#l00086">engine_graph.cpp:86</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a2e22b111f6d00ecc9e3804a71f1ce876"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a2e22b111f6d00ecc9e3804a71f1ce876">gridfire::GraphEngine::m_rhsADFun</a></div><divclass="ttdeci">CppAD::ADFun< double > m_rhsADFun</div><divclass="ttdoc">CppAD function for the right-hand side of the ODE.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00317">engine_graph.h:317</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a2f1718c89d4aaad028102724d18fa910"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a2f1718c89d4aaad028102724d18fa910">gridfire::GraphEngine::m_jacobianMatrix</a></div><divclass="ttdeci">boost::numeric::ublas::compressed_matrix< double > m_jacobianMatrix</div><divclass="ttdoc">Jacobian matrix (species x species).</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00315">engine_graph.h:315</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a303e6093591cde91430f866a04a8be7c"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a303e6093591cde91430f866a04a8be7c">gridfire::GraphEngine::getJacobianMatrixEntry</a></div><divclass="ttdeci">double getJacobianMatrixEntry(const int i, const int j) const override</div><divclass="ttdoc">Gets an entry from the previously generated Jacobian matrix.</div><divclass="ttdef"><b>Definition</b><ahref="#l00317">engine_graph.cpp:317</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a30e09ed0bce6aa5fc89beaa316a7b827"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a30e09ed0bce6aa5fc89beaa316a7b827">gridfire::GraphEngine::m_networkSpeciesMap</a></div><divclass="ttdeci">std::unordered_map< std::string_view, fourdst::atomic::Species > m_networkSpeciesMap</div><divclass="ttdoc">Map from species name to Species object.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00311">engine_graph.h:311</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a47202c43342b96480070874bffce1391"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a47202c43342b96480070874bffce1391">gridfire::GraphEngine::populateSpeciesToIndexMap</a></div><divclass="ttdeci">void populateSpeciesToIndexMap()</div><divclass="ttdoc">Populates the species-to-index map.</div><divclass="ttdef"><b>Definition</b><ahref="#l00095">engine_graph.cpp:95</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a52edc3e88f1e8fc497e1e63972d63c80"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a52edc3e88f1e8fc497e1e63972d63c80">gridfire::GraphEngine::m_screeningType</a></div><divclass="ttdeci">screening::ScreeningType m_screeningType</div><divclass="ttdoc">Screening type for the reaction network. Default to no screening.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00319">engine_graph.h:319</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a5a5458ed01923124f2d7e1f04f32f138"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a5a5458ed01923124f2d7e1f04f32f138">gridfire::GraphEngine::reserveJacobianMatrix</a></div><divclass="ttdeci">void reserveJacobianMatrix()</div><divclass="ttdoc">Reserves space for the Jacobian matrix.</div><divclass="ttdef"><b>Definition</b><ahref="#l00102">engine_graph.cpp:102</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a5d6cc63b99b467c2a976d1fbaaa1dfa3"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a5d6cc63b99b467c2a976d1fbaaa1dfa3">gridfire::GraphEngine::m_reactionIDMap</a></div><divclass="ttdeci">std::unordered_map< std::string_view, reaction::Reaction * > m_reactionIDMap</div><divclass="ttdoc">Map from reaction ID to REACLIBReaction. //PERF: This makes copies of REACLIBReaction and could be a ...</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00308">engine_graph.h:308</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a6b5feaf788bade212b7c8df7ac8c8152"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a6b5feaf788bade212b7c8df7ac8c8152">gridfire::GraphEngine::getStoichiometryMatrixEntry</a></div><divclass="ttdeci">int getStoichiometryMatrixEntry(const int speciesIndex, const int reactionIndex) const override</div><divclass="ttdoc">Gets an entry from the stoichiometry matrix.</div><divclass="ttdef"><b>Definition</b><ahref="#l00327">engine_graph.cpp:327</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a832e2fe066381811a3e0464806ff5e95"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a832e2fe066381811a3e0464806ff5e95">gridfire::GraphEngine::exportToCSV</a></div><divclass="ttdeci">void exportToCSV(const std::string &filename) const</div><divclass="ttdoc">Exports the network to a CSV file for analysis.</div><divclass="ttdef"><b>Definition</b><ahref="#l00382">engine_graph.cpp:382</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a8b3baf29829c7ae0a61430ea70632bbf"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a8b3baf29829c7ae0a61430ea70632bbf">gridfire::GraphEngine::calculateRHSAndEnergy</a></div><divclass="ttdeci">StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double >&Y, const double T9, const double rho) const override</div><divclass="ttdoc">Calculates the right-hand side (dY/dt) and energy generation rate.</div><divclass="ttdef"><b>Definition</b><ahref="#l00038">engine_graph.cpp:38</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a8c29d8bbde407e913be5eb77efb2c0c9"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a8c29d8bbde407e913be5eb77efb2c0c9">gridfire::GraphEngine::getNetReactionStoichiometry</a></div><divclass="ttdeci">static std::unordered_map< fourdst::atomic::Species, int > getNetReactionStoichiometry(const reaction::Reaction &reaction)</div><divclass="ttdoc">Gets the net stoichiometry for a given reaction.</div><divclass="ttdef"><b>Definition</b><ahref="#l00321">engine_graph.cpp:321</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a9245642b741f215e52861d00e756fb3f"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a9245642b741f215e52861d00e756fb3f">gridfire::GraphEngine::calculateMolarReactionFlow</a></div><divclass="ttdeci">double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double >&Y, const double T9, const double rho) const override</div><divclass="ttdoc">Calculates the molar reaction flow for a given reaction.</div><divclass="ttdef"><b>Definition</b><ahref="#l00275">engine_graph.cpp:275</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a92d26068ba139e47d335f5fe9e2814cc"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a92d26068ba139e47d335f5fe9e2814cc">gridfire::GraphEngine::m_networkSpecies</a></div><divclass="ttdeci">std::vector< fourdst::atomic::Species > m_networkSpecies</div><divclass="ttdoc">Vector of unique species in the network.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00310">engine_graph.h:310</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a95563f6bc86007d9ee053a0f1e15b889"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a95563f6bc86007d9ee053a0f1e15b889">gridfire::GraphEngine::recordADTape</a></div><divclass="ttdeci">void recordADTape()</div><divclass="ttdoc">Records the AD tape for the right-hand side of the ODE.</div><divclass="ttdef"><b>Definition</b><ahref="#l00456">engine_graph.cpp:456</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_a9f74786ff930ab72664b31f29d05a30c"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#a9f74786ff930ab72664b31f29d05a30c">gridfire::GraphEngine::GraphEngine</a></div><divclass="ttdeci">GraphEngine(const fourdst::composition::Composition &composition)</div><divclass="ttdoc">Constructs a GraphEngine from a composition.</div><divclass="ttdef"><b>Definition</b><ahref="#l00026">engine_graph.cpp:26</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_aa6202cee0c3c481eda77cc9a91bc126b"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#aa6202cee0c3c481eda77cc9a91bc126b">gridfire::GraphEngine::involvesSpecies</a></div><divclass="ttdeci">bool involvesSpecies(const fourdst::atomic::Species &species) const</div><divclass="ttdoc">Checks if a given species is involved in the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00125">engine_graph.cpp:125</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_acb7c4f5108b0efeae48ad15598e808c3"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#acb7c4f5108b0efeae48ad15598e808c3">gridfire::GraphEngine::m_reactions</a></div><divclass="ttdeci">reaction::LogicalReactionSet m_reactions</div><divclass="ttdoc">Set of REACLIB reactions in the network.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00307">engine_graph.h:307</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_acdce8d87e23a2cd1504bc9472e538c0f"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#acdce8d87e23a2cd1504bc9472e538c0f">gridfire::GraphEngine::syncInternalMaps</a></div><divclass="ttdeci">void syncInternalMaps()</div><divclass="ttdoc">Synchronizes the internal maps.</div><divclass="ttdef"><b>Definition</b><ahref="#l00047">engine_graph.cpp:47</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_acf4cfccea20f5cb31c9886bf233a28be"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#acf4cfccea20f5cb31c9886bf233a28be">gridfire::GraphEngine::validateConservation</a></div><divclass="ttdeci">bool validateConservation() const</div><divclass="ttdoc">Validates mass and charge conservation across all reactions.</div><divclass="ttdef"><b>Definition</b><ahref="#l00133">engine_graph.cpp:133</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_ad1cb5fd32efc37668e2d9ecf0c72ad24"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#ad1cb5fd32efc37668e2d9ecf0c72ad24">gridfire::GraphEngine::m_stoichiometryMatrix</a></div><divclass="ttdeci">boost::numeric::ublas::compressed_matrix< int > m_stoichiometryMatrix</div><divclass="ttdoc">Stoichiometry matrix (species x reactions).</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00314">engine_graph.h:314</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_ad45650d10fc5dff1673ae3f806d067da"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#ad45650d10fc5dff1673ae3f806d067da">gridfire::GraphEngine::getNetworkReactions</a></div><divclass="ttdeci">const reaction::LogicalReactionSet & getNetworkReactions() const override</div><divclass="ttdoc">Gets the set of logical reactions in the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00119">engine_graph.cpp:119</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_ad8237c252145a75092202d00f5e1ddf7"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#ad8237c252145a75092202d00f5e1ddf7">gridfire::GraphEngine::m_speciesToIndexMap</a></div><divclass="ttdeci">std::unordered_map< fourdst::atomic::Species, size_t > m_speciesToIndexMap</div><divclass="ttdoc">Map from species to their index in the stoichiometry matrix.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00312">engine_graph.h:312</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_adac8c7d62bae76e17fc060e86dadd929"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#adac8c7d62bae76e17fc060e86dadd929">gridfire::GraphEngine::exportToDot</a></div><divclass="ttdeci">void exportToDot(const std::string &filename) const</div><divclass="ttdoc">Exports the network to a DOT file for visualization.</div><divclass="ttdef"><b>Definition</b><ahref="#l00334">engine_graph.cpp:334</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_ae347ff0316e532e0298ec8c913908105"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#ae347ff0316e532e0298ec8c913908105">gridfire::GraphEngine::generateJacobianMatrix</a></div><divclass="ttdeci">void generateJacobianMatrix(const std::vector< double >&Y, const double T9, const double rho) override</div><divclass="ttdoc">Generates the Jacobian matrix for the current state.</div><divclass="ttdef"><b>Definition</b><ahref="#l00284">engine_graph.cpp:284</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_aed726d36ee2b3796beff6067a1e4db38"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#aed726d36ee2b3796beff6067a1e4db38">gridfire::GraphEngine::generateStoichiometryMatrix</a></div><divclass="ttdeci">void generateStoichiometryMatrix() override</div><divclass="ttdoc">Generates the stoichiometry matrix for the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00209">engine_graph.cpp:209</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_aedf42d83bfcc28313b6b6454034d2efa"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#aedf42d83bfcc28313b6b6454034d2efa">gridfire::GraphEngine::collectNetworkSpecies</a></div><divclass="ttdeci">void collectNetworkSpecies()</div><divclass="ttdoc">Collects the unique species in the network.</div><divclass="ttdef"><b>Definition</b><ahref="#l00057">engine_graph.cpp:57</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_aeeafeab40a5f4dbfae78bdc87e25e93f"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#aeeafeab40a5f4dbfae78bdc87e25e93f">gridfire::GraphEngine::validateComposition</a></div><divclass="ttdeci">void validateComposition(const fourdst::composition::Composition &composition, double culling, double T9)</div><divclass="ttdoc">Validates the composition against the current reaction set.</div><divclass="ttdef"><b>Definition</b><ahref="#l00188">engine_graph.cpp:188</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1_graph_engine_html_af41df9ce979b6410e12642cb093916c9"><divclass="ttname"><ahref="classgridfire_1_1_graph_engine.html#af41df9ce979b6410e12642cb093916c9">gridfire::GraphEngine::calculateAllDerivatives</a></div><divclass="ttdeci">StepDerivatives< T > calculateAllDerivatives(const std::vector< T >&Y_in, T T9, T rho) const</div><divclass="ttdoc">Calculates all derivatives (dY/dt) and the energy generation rate.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00487">engine_graph.h:487</a></div></div>
<divclass="ttc"id="aclassgridfire_1_1reaction_1_1_reaction_html"><divclass="ttname"><ahref="classgridfire_1_1reaction_1_1_reaction.html">gridfire::reaction::Reaction</a></div><divclass="ttdoc">Represents a single nuclear reaction from a specific data source.</div><divclass="ttdef"><b>Definition</b><ahref="reaction_8h_source.html#l00072">reaction.h:72</a></div></div>
<divclass="ttc"id="anamespacegridfire_1_1reaction_html_aa86f08712565f278adacc7cd2361eb31"><divclass="ttname"><ahref="namespacegridfire_1_1reaction.html#aa86f08712565f278adacc7cd2361eb31">gridfire::reaction::LogicalReactionSet</a></div><divclass="ttdeci">TemplatedReactionSet< LogicalReaction > LogicalReactionSet</div><divclass="ttdoc">A set of logical reactions.</div><divclass="ttdef"><b>Definition</b><ahref="reaction_8h_source.html#l00557">reaction.h:557</a></div></div>
<divclass="ttc"id="anamespacegridfire_html_a1121d0b2d005195333412559fa29d3cc"><divclass="ttname"><ahref="namespacegridfire.html#a1121d0b2d005195333412559fa29d3cc">gridfire::ADDouble</a></div><divclass="ttdeci">CppAD::AD< double > ADDouble</div><divclass="ttdoc">Alias for CppAD AD type for double precision.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00034">engine_graph.h:34</a></div></div>
<divclass="ttc"id="anamespacegridfire_html_ae01b1738df1921db565bcbd68dd6cf64"><divclass="ttname"><ahref="namespacegridfire.html#ae01b1738df1921db565bcbd68dd6cf64">gridfire::MIN_JACOBIAN_THRESHOLD</a></div><divclass="ttdeci">static constexpr double MIN_JACOBIAN_THRESHOLD</div><divclass="ttdoc">Minimum value for Jacobian matrix entries.</div><divclass="ttdef"><b>Definition</b><ahref="engine__graph_8h_source.html#l00064">engine_graph.h:64</a></div></div>
<divclass="ttc"id="areaction_8h_html"><divclass="ttname"><ahref="reaction_8h.html">reaction.h</a></div><divclass="ttdoc">Defines classes for representing and managing nuclear reactions.</div></div>
<divclass="ttc"id="astructgridfire_1_1_step_derivatives_html"><divclass="ttname"><ahref="structgridfire_1_1_step_derivatives.html">gridfire::StepDerivatives</a></div><divclass="ttdoc">Structure holding derivatives and energy generation for a network step.</div><divclass="ttdef"><b>Definition</b><ahref="engine__abstract_8h_source.html#l00053">engine_abstract.h:53</a></div></div>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.13.2 </li>