Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels Namespace Reference

namespace for models More...

Namespaces

namespace  basegodunov
 namespace for the basegodunov model
namespace  sph
 namespace for the sph model
namespace  zeus
 namespace for the zeus model

Classes

struct  EOSConfig
 Configuration struct for the equation of state used in the hydrodynamic models. More...
struct  ExtForceVariant
struct  ExtForceConfig
struct  SolverLog
 Class holding the logs of the solver /todo add a variable to keep only a definite number of steps in the step_logs. More...

Enumerations

enum  NeighCacheStrategy { SingleStage = 0 , TwoStage = 1 }
 Strategy used to build the neighbour cache out of the tree traversal. More...

Functions

template<typename BasicJsonType>
void to_json (BasicJsonType &j, const NeighCacheStrategy &e)
template<typename BasicJsonType>
void from_json (const BasicJsonType &j, NeighCacheStrategy &e)
NeighCacheStrategy neigh_cache_strategy_from_two_stage_search (bool use_two_stage_search)
 Map the legacy use_two_stage_search boolean onto the strategy enum.
void get_to_neigh_cache_strategy (const nlohmann::json &j, NeighCacheStrategy &value, const std::string &log_ctx, bool &has_used_defaults, bool &has_updated_config)
 Deserialize the neighbour cache strategy, falling back on the legacy boolean key.
template<class Tvec>
void to_json (nlohmann::json &j, const EOSConfig< Tvec > &p)
 Serialize EOSConfig to json.
template<class Tvec>
void from_json (const nlohmann::json &j, EOSConfig< Tvec > &p)
 Deserializes an EOSConfig<Tvec> from a JSON object.
template<class Tvec>
void to_json (nlohmann::json &j, const ExtForceVariant< Tvec > &p)
template<class Tvec>
void from_json (const nlohmann::json &j, ExtForceVariant< Tvec > &p)
template<class Tvec>
void to_json (nlohmann::json &j, const ExtForceConfig< Tvec > &p)
template<class Tvec>
void from_json (const nlohmann::json &j, ExtForceConfig< Tvec > &p)
std::string report_perf_timestep (f64 rate, u64 nobj, u64 npatch, f64 tcompute, f64 mpi_timer, f64 alloc_time_device, f64 alloc_time_host, size_t max_mem_device, size_t max_mem_host, shamsys::SystemMetrics system_metrics={}, bool report_power_usage=false)
template void to_json< f64_3 > (nlohmann::json &j, const EOSConfig< f64_3 > &p)
template void from_json< f64_3 > (const nlohmann::json &j, EOSConfig< f64_3 > &p)

Variables

constexpr const char * neigh_cache_strategy_json_key = "neigh_cache_strategy"
 Json key holding the neighbour cache strategy.
constexpr const char * neigh_cache_strategy_legacy_json_key = "use_two_stage_search"
 Legacy json key, which used to hold the strategy as a boolean.

Detailed Description

namespace for models

Enumeration Type Documentation

◆ NeighCacheStrategy

Strategy used to build the neighbour cache out of the tree traversal.

Note
This used to be a use_two_stage_search boolean, it is an enum so that more strategies can be added without breaking the config API again.
Enumerator
SingleStage 

Single tree traversal per particle.

TwoStage 

Two stage neighbours search (see shamrock paper).

Definition at line 31 of file enum_NeighCacheStrategy.hpp.

Function Documentation

◆ from_json() [1/4]

template<typename BasicJsonType>
void shammodels::from_json ( const BasicJsonType & j,
NeighCacheStrategy & e )
inline

Definition at line 39 of file enum_NeighCacheStrategy.hpp.

◆ from_json() [2/4]

template<class Tvec>
void shammodels::from_json ( const nlohmann::json & j,
EOSConfig< Tvec > & p )

Deserializes an EOSConfig<Tvec> from a JSON object.

Template Parameters
TvecThe vector type of the EOSConfig<Tvec>
Parameters
jThe JSON object to deserialize
pThe EOSConfig<Tvec> to deserialize to
See also
shammodels::to_json(nlohmann::json &j, const EOSConfig<Tvec> &p) for details of the format

Throws an std::runtime_error if the JSON object is not in the expected format

Definition at line 121 of file EOSConfig.cpp.

Here is the call graph for this function:

◆ from_json() [3/4]

template<class Tvec>
void shammodels::from_json ( const nlohmann::json & j,
ExtForceConfig< Tvec > & p )
inline

Definition at line 285 of file ExtForceConfig.hpp.

◆ from_json() [4/4]

template<class Tvec>
void shammodels::from_json ( const nlohmann::json & j,
ExtForceVariant< Tvec > & p )
inline

Definition at line 218 of file ExtForceConfig.hpp.

◆ get_to_neigh_cache_strategy()

void shammodels::get_to_neigh_cache_strategy ( const nlohmann::json & j,
NeighCacheStrategy & value,
const std::string & log_ctx,
bool & has_used_defaults,
bool & has_updated_config )
inline

Deserialize the neighbour cache strategy, falling back on the legacy boolean key.

Reads neigh_cache_strategy if the json object has it. Otherwise the legacy use_two_stage_search boolean is mapped onto the enum, so that configs dumped before the strategy became an enum can still be loaded. If neither key is there the value is left as is.

Parameters
jThe json object to deserialize from
valueThe strategy to populate
log_ctxLogger context used for the key update message
has_used_defaultsSet to true if no key was found
has_updated_configSet to true if the legacy key was used

Definition at line 68 of file enum_NeighCacheStrategy.hpp.

Here is the call graph for this function:

◆ neigh_cache_strategy_from_two_stage_search()

NeighCacheStrategy shammodels::neigh_cache_strategy_from_two_stage_search ( bool use_two_stage_search)
inline

Map the legacy use_two_stage_search boolean onto the strategy enum.

Definition at line 48 of file enum_NeighCacheStrategy.hpp.

◆ report_perf_timestep()

std::string shammodels::report_perf_timestep ( f64 rate,
u64 nobj,
u64 npatch,
f64 tcompute,
f64 mpi_timer,
f64 alloc_time_device,
f64 alloc_time_host,
size_t max_mem_device,
size_t max_mem_host,
shamsys::SystemMetrics system_metrics = {},
bool report_power_usage = false )

Definition at line 34 of file timestep_report.cpp.

◆ to_json() [1/4]

template<typename BasicJsonType>
void shammodels::to_json ( BasicJsonType & j,
const NeighCacheStrategy & e )
inline

Definition at line 39 of file enum_NeighCacheStrategy.hpp.

◆ to_json() [2/4]

template<class Tvec>
void shammodels::to_json ( nlohmann::json & j,
const EOSConfig< Tvec > & p )

Serialize EOSConfig to json.

This function serializes an EOSConfig to a json object with the following format:

{
"Tvec": "f32_3"|"f64_3",
"eos_type": "adiabatic"|"locally_isothermal"|"locally_isothermal_lp07",
"gamma"?: number,
"cs0"?: number,
"q"?: number,
"r0"?: number
}
Parameters
jjson object
pEOSConfig to serialize

Definition at line 43 of file EOSConfig.cpp.

Here is the call graph for this function:

◆ to_json() [3/4]

template<class Tvec>
void shammodels::to_json ( nlohmann::json & j,
const ExtForceConfig< Tvec > & p )
inline

Definition at line 278 of file ExtForceConfig.hpp.

◆ to_json() [4/4]

template<class Tvec>
void shammodels::to_json ( nlohmann::json & j,
const ExtForceVariant< Tvec > & p )
inline

Definition at line 163 of file ExtForceConfig.hpp.

Variable Documentation

◆ neigh_cache_strategy_json_key

const char* shammodels::neigh_cache_strategy_json_key = "neigh_cache_strategy"
inlineconstexpr

Json key holding the neighbour cache strategy.

Definition at line 42 of file enum_NeighCacheStrategy.hpp.

◆ neigh_cache_strategy_legacy_json_key

const char* shammodels::neigh_cache_strategy_legacy_json_key = "use_two_stage_search"
inlineconstexpr

Legacy json key, which used to hold the strategy as a boolean.

Definition at line 45 of file enum_NeighCacheStrategy.hpp.