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

Type definitions and utilities for the scratchpad system. More...

#include <cstdint>
#include <string_view>
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Namespaces

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

Enumerations

enum class  gridfire::engine::scratch::ScratchPadType : uint8_t {
  gridfire::engine::scratch::GRAPH_ENGINE_SCRATCHPAD , gridfire::engine::scratch::MULTISCALE_PARTITIONING_ENGINE_VIEW_SCRATCHPAD , gridfire::engine::scratch::ADAPTIVE_ENGINE_VIEW_SCRATCHPAD , gridfire::engine::scratch::DEFINED_ENGINE_VIEW_SCRATCHPAD ,
  gridfire::engine::scratch::PRIMING_ENGINE_VIEW_SCRATCHPAD , gridfire::engine::scratch::_COUNT
}
 Enumeration of all registered scratchpad types. More...
 

Functions

consteval size_t gridfire::engine::scratch::get_max_scratchpad_types ()
 Get the maximum number of scratchpad types at compile time.
 
constexpr std::string_view gridfire::engine::scratch::get_scratchpad_type_name (const ScratchPadType scratchpad_type)
 Convert a ScratchPadType to a human-readable name.
 

Detailed Description

Type definitions and utilities for the scratchpad system.

This header defines the ScratchPadType enumeration which identifies all registered scratchpad types in the system, along with utility functions for querying scratchpad type information at compile-time and runtime.

Purpose
The types header provides:
  • A centralized enumeration of all scratchpad types
  • Compile-time constant for the maximum number of scratchpad types
  • Runtime conversion of scratchpad types to human-readable names
Adding New Scratchpad Types
To add a new scratchpad type:
  1. Add a new enumerator before _COUNT in ScratchPadType
  2. Add a corresponding case in get_scratchpad_type_name()
  3. Create the concrete scratchpad class with a static ID member set to the new type
Examples
using namespace gridfire::engine::scratch;
// Get the maximum number of scratchpad types at compile time
constexpr size_t max_types = get_max_scratchpad_types();
std::array<bool, max_types> enrolled_flags{};
// Get a human-readable name for a scratchpad type
std::string_view name = get_scratchpad_type_name(type);
// name == "GraphEngineScratchPad"
// Iterate over all scratchpad types
for (size_t i = 0; i < get_max_scratchpad_types(); ++i) {
auto type = static_cast<ScratchPadType>(i);
std::cout << get_scratchpad_type_name(type) << "\n";
}
Type definitions and utilities for the scratchpad system.
Scratchpad memory management for computational engines.
Definition blob.h:69
ScratchPadType
Enumeration of all registered scratchpad types.
Definition types.h:64
@ GRAPH_ENGINE_SCRATCHPAD
GraphEngineScratchPad for CppAD-based engines.
Definition types.h:65
consteval size_t get_max_scratchpad_types()
Get the maximum number of scratchpad types at compile time.
Definition types.h:93
constexpr std::string_view get_scratchpad_type_name(const ScratchPadType scratchpad_type)
Convert a ScratchPadType to a human-readable name.
Definition types.h:121
See also
AbstractScratchPad
StateBlob