GridFire v0.7.6rc4.0
General Purpose Nuclear Network
Loading...
Searching...
No Matches
engine_defined_scratchpad.h File Reference

Scratchpad implementation for the DefinedEngineView. More...

#include "gridfire/engine/scratchpads/types.h"
#include "gridfire/engine/scratchpads/scratchpad_abstract.h"
#include "gridfire/reaction/reaction.h"
#include "fourdst/atomic/atomicSpecies.h"
#include <vector>
#include <memory>
#include <set>
Include dependency graph for engine_defined_scratchpad.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  gridfire::engine::scratch::DefinedEngineViewScratchPad
 Scratchpad for storing working memory used by defined reaction network engines. More...
 

Namespaces

namespace  gridfire
 
namespace  gridfire::engine
 
namespace  gridfire::engine::scratch
 Scratchpad memory management for computational engines.
 

Detailed Description

Scratchpad implementation for the DefinedEngineView.

This header defines the DefinedEngineViewScratchPad, a concrete implementation of AbstractScratchPad designed for use with engines that have a statically defined reaction network. It provides storage for the active species, reactions, and index mappings that enable efficient lookups during computations.

Purpose
The DefinedEngineViewScratchPad stores:
  • The set of active species in the defined network
  • The set of active reactions in the defined network
  • Index mappings for efficient species and reaction lookups
  • A cached vector representation of active species for performance
Examples
// Create a scratchpad for a defined engine
// Populate active species
scratch.active_species.insert(species1);
scratch.active_species.insert(species2);
// Set up index mappings for efficient lookups
scratch.species_index_map = {0, 1, 2, 3};
scratch.reaction_index_map = {0, 1};
if (scratch.is_initialized()) {
// Use the scratchpad for computations
for (size_t idx : scratch.species_index_map) {
// Process species by index
}
}
// Clone for parallel execution
auto worker_scratch = scratch.clone();
Scratchpad implementation for the DefinedEngineView.
Scratchpad for storing working memory used by defined reaction network engines.
Definition engine_defined_scratchpad.h:80
std::vector< size_t > species_index_map
Mapping from local indices to global species indices.
Definition engine_defined_scratchpad.h:94
std::set< fourdst::atomic::Species > active_species
Set of species active in the defined network.
Definition engine_defined_scratchpad.h:88
bool is_initialized() const override
Check whether the scratchpad has been initialized.
Definition engine_defined_scratchpad.h:107
std::vector< size_t > reaction_index_map
Mapping from local indices to global reaction indices.
Definition engine_defined_scratchpad.h:97
std::unique_ptr< AbstractScratchPad > clone() const override
Create a deep copy of this scratchpad.
Definition engine_defined_scratchpad.h:128
Thread Safety
This class is not thread-safe. Each thread should have its own instance of DefinedEngineViewScratchPad. Use clone() to create independent copies for parallel workers.
See also
AbstractScratchPad
DefinedEngineView