GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
CodeGenerator::GroupMerged< G > Class Template Reference

#include <groupMerged.h>

Inheritance diagram for CodeGenerator::GroupMerged< G >:
CodeGenerator::CustomUpdateHostReductionGroupMergedBase< G > CodeGenerator::CustomUpdateInitGroupMergedBase< G >

Public Types

enum  FieldType { FieldType::Standard, FieldType::Host, FieldType::ScalarEGP, FieldType::PointerEGP }
 
typedef G GroupInternal
 
typedef std::function< std::string(const G &, size_t)> GetFieldValueFunc
 
typedef std::tuple< std::string, std::string, GetFieldValueFunc, FieldTypeField
 

Public Member Functions

 GroupMerged (size_t index, const std::string &precision, const std::vector< std::reference_wrapper< const GroupInternal >> groups)
 
size_t getIndex () const
 
const GroupInternalgetArchetype () const
 Get 'archetype' neuron group - it's properties represent those of all other merged neuron groups. More...
 
const std::string & getMemorySpace () const
 Get name of memory space assigned to group. More...
 
const std::vector< std::reference_wrapper< const GroupInternal > > & getGroups () const
 Gets access to underlying vector of neuron groups which have been merged. More...
 
const std::vector< Field > & getFields () const
 Get group fields. More...
 
std::vector< FieldgetSortedFields (const BackendBase &backend) const
 Get group fields, sorted into order they will appear in struct. More...
 
void generateStruct (CodeStream &os, const BackendBase &backend, const std::string &name, bool host=false) const
 Generate declaration of struct to hold this merged group. More...
 
void generateStructFieldArgumentDefinitions (CodeStream &os, const BackendBase &backend) const
 
size_t getStructArraySize (const BackendBase &backend) const
 
void assignMemorySpaces (const BackendBase &backend, BackendBase::MemorySpaces &memorySpaces)
 Assign memory spaces to group. More...
 

Protected Member Functions

bool isParamReferenced (const std::vector< std::string > &codeStrings, const std::string &paramName) const
 Helper to test whether parameter is referenced in vector of codestrings. More...
 
template<typename P >
bool isParamValueHeterogeneous (size_t index, P getParamValuesFn) const
 Helper to test whether parameter values are heterogeneous within merged group. More...
 
void addField (const std::string &type, const std::string &name, GetFieldValueFunc getFieldValue, FieldType fieldType=FieldType::Standard)
 
void addScalarField (const std::string &name, GetFieldValueFunc getFieldValue, FieldType fieldType=FieldType::Standard)
 
void addPointerField (const std::string &type, const std::string &name, const std::string &prefix)
 
void addVars (const Models::Base::VarVec &vars, const std::string &arrayPrefix)
 
template<typename V >
void addVarReferences (const Models::Base::VarRefVec &varReferences, const std::string &arrayPrefix, V getVarRefFn)
 
void addEGPs (const Snippet::Base::EGPVec &egps, const std::string &arrayPrefix, const std::string &varName="")
 
template<typename E >
void addEGPReferences (const Models::Base::EGPRefVec &egpRefs, const std::string &arrayPrefix, E getEGPRefFn)
 
template<typename T , typename P , typename H >
void addHeterogeneousParams (const Snippet::Base::StringVec &paramNames, const std::string &suffix, P getParamValues, H isHeterogeneous)
 
template<typename T , typename D , typename H >
void addHeterogeneousDerivedParams (const Snippet::Base::DerivedParamVec &derivedParams, const std::string &suffix, D getDerivedParamValues, H isHeterogeneous)
 
template<typename T , typename V , typename H >
void addHeterogeneousVarInitParams (const Models::Base::VarVec &vars, V getVarInitialisers, H isHeterogeneous)
 
template<typename T , typename V , typename H >
void addHeterogeneousVarInitDerivedParams (const Models::Base::VarVec &vars, V getVarInitialisers, H isHeterogeneous)
 
template<typename H >
void updateHash (H getHashableFn, boost::uuids::detail::sha1 &hash) const
 Helper to update hash with the hash of calling getHashableFn on each group. More...
 
template<typename T , typename V , typename R >
void updateParamHash (R isParamReferencedFn, V getValueFn, boost::uuids::detail::sha1 &hash) const
 
template<typename T , typename V , typename R >
void updateVarInitParamHash (V getVarInitialisers, R isParamReferencedFn, boost::uuids::detail::sha1 &hash) const
 
template<typename T , typename V , typename R >
void updateVarInitDerivedParamHash (V getVarInitialisers, R isDerivedParamReferencedFn, boost::uuids::detail::sha1 &hash) const
 
void generateRunnerBase (const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc, const std::string &name, bool host=false) const
 

Member Typedef Documentation

◆ Field

template<typename G>
typedef std::tuple<std::string, std::string, GetFieldValueFunc, FieldType> CodeGenerator::GroupMerged< G >::Field

◆ GetFieldValueFunc

template<typename G>
typedef std::function<std::string(const G &, size_t)> CodeGenerator::GroupMerged< G >::GetFieldValueFunc

◆ GroupInternal

template<typename G>
typedef G CodeGenerator::GroupMerged< G >::GroupInternal

Member Enumeration Documentation

◆ FieldType

template<typename G>
enum CodeGenerator::GroupMerged::FieldType
strong
Enumerator
Standard 
Host 
ScalarEGP 
PointerEGP 

Constructor & Destructor Documentation

◆ GroupMerged()

template<typename G>
CodeGenerator::GroupMerged< G >::GroupMerged ( size_t  index,
const std::string &  precision,
const std::vector< std::reference_wrapper< const GroupInternal >>  groups 
)
inline

Member Function Documentation

◆ addEGPReferences()

template<typename G>
template<typename E >
void CodeGenerator::GroupMerged< G >::addEGPReferences ( const Models::Base::EGPRefVec egpRefs,
const std::string &  arrayPrefix,
getEGPRefFn 
)
inlineprotected

◆ addEGPs()

template<typename G>
void CodeGenerator::GroupMerged< G >::addEGPs ( const Snippet::Base::EGPVec egps,
const std::string &  arrayPrefix,
const std::string &  varName = "" 
)
inlineprotected

◆ addField()

template<typename G>
void CodeGenerator::GroupMerged< G >::addField ( const std::string &  type,
const std::string &  name,
GetFieldValueFunc  getFieldValue,
FieldType  fieldType = FieldType::Standard 
)
inlineprotected

◆ addHeterogeneousDerivedParams()

template<typename G>
template<typename T , typename D , typename H >
void CodeGenerator::GroupMerged< G >::addHeterogeneousDerivedParams ( const Snippet::Base::DerivedParamVec derivedParams,
const std::string &  suffix,
getDerivedParamValues,
isHeterogeneous 
)
inlineprotected

◆ addHeterogeneousParams()

template<typename G>
template<typename T , typename P , typename H >
void CodeGenerator::GroupMerged< G >::addHeterogeneousParams ( const Snippet::Base::StringVec paramNames,
const std::string &  suffix,
getParamValues,
isHeterogeneous 
)
inlineprotected

◆ addHeterogeneousVarInitDerivedParams()

template<typename G>
template<typename T , typename V , typename H >
void CodeGenerator::GroupMerged< G >::addHeterogeneousVarInitDerivedParams ( const Models::Base::VarVec vars,
getVarInitialisers,
isHeterogeneous 
)
inlineprotected

◆ addHeterogeneousVarInitParams()

template<typename G>
template<typename T , typename V , typename H >
void CodeGenerator::GroupMerged< G >::addHeterogeneousVarInitParams ( const Models::Base::VarVec vars,
getVarInitialisers,
isHeterogeneous 
)
inlineprotected

◆ addPointerField()

template<typename G>
void CodeGenerator::GroupMerged< G >::addPointerField ( const std::string &  type,
const std::string &  name,
const std::string &  prefix 
)
inlineprotected

◆ addScalarField()

template<typename G>
void CodeGenerator::GroupMerged< G >::addScalarField ( const std::string &  name,
GetFieldValueFunc  getFieldValue,
FieldType  fieldType = FieldType::Standard 
)
inlineprotected

◆ addVarReferences()

template<typename G>
template<typename V >
void CodeGenerator::GroupMerged< G >::addVarReferences ( const Models::Base::VarRefVec varReferences,
const std::string &  arrayPrefix,
getVarRefFn 
)
inlineprotected

◆ addVars()

template<typename G>
void CodeGenerator::GroupMerged< G >::addVars ( const Models::Base::VarVec vars,
const std::string &  arrayPrefix 
)
inlineprotected

◆ assignMemorySpaces()

template<typename G>
void CodeGenerator::GroupMerged< G >::assignMemorySpaces ( const BackendBase backend,
BackendBase::MemorySpaces memorySpaces 
)
inline

Assign memory spaces to group.

Memory spaces are given out on a first-come, first-serve basis so this should be called on groups in preferential order

◆ generateRunnerBase()

template<typename G>
void CodeGenerator::GroupMerged< G >::generateRunnerBase ( const BackendBase backend,
CodeStream definitionsInternal,
CodeStream definitionsInternalFunc,
CodeStream definitionsInternalVar,
CodeStream runnerVarDecl,
CodeStream runnerMergedStructAlloc,
const std::string &  name,
bool  host = false 
) const
inlineprotected

◆ generateStruct()

template<typename G>
void CodeGenerator::GroupMerged< G >::generateStruct ( CodeStream os,
const BackendBase backend,
const std::string &  name,
bool  host = false 
) const
inline

Generate declaration of struct to hold this merged group.

◆ generateStructFieldArgumentDefinitions()

template<typename G>
void CodeGenerator::GroupMerged< G >::generateStructFieldArgumentDefinitions ( CodeStream os,
const BackendBase backend 
) const
inline

◆ getArchetype()

template<typename G>
const GroupInternal& CodeGenerator::GroupMerged< G >::getArchetype ( ) const
inline

Get 'archetype' neuron group - it's properties represent those of all other merged neuron groups.

◆ getFields()

template<typename G>
const std::vector<Field>& CodeGenerator::GroupMerged< G >::getFields ( ) const
inline

Get group fields.

◆ getGroups()

template<typename G>
const std::vector<std::reference_wrapper<const GroupInternal> >& CodeGenerator::GroupMerged< G >::getGroups ( ) const
inline

Gets access to underlying vector of neuron groups which have been merged.

◆ getIndex()

template<typename G>
size_t CodeGenerator::GroupMerged< G >::getIndex ( ) const
inline

◆ getMemorySpace()

template<typename G>
const std::string& CodeGenerator::GroupMerged< G >::getMemorySpace ( ) const
inline

Get name of memory space assigned to group.

◆ getSortedFields()

template<typename G>
std::vector<Field> CodeGenerator::GroupMerged< G >::getSortedFields ( const BackendBase backend) const
inline

Get group fields, sorted into order they will appear in struct.

◆ getStructArraySize()

template<typename G>
size_t CodeGenerator::GroupMerged< G >::getStructArraySize ( const BackendBase backend) const
inline

◆ isParamReferenced()

template<typename G>
bool CodeGenerator::GroupMerged< G >::isParamReferenced ( const std::vector< std::string > &  codeStrings,
const std::string &  paramName 
) const
inlineprotected

Helper to test whether parameter is referenced in vector of codestrings.

◆ isParamValueHeterogeneous()

template<typename G>
template<typename P >
bool CodeGenerator::GroupMerged< G >::isParamValueHeterogeneous ( size_t  index,
getParamValuesFn 
) const
inlineprotected

Helper to test whether parameter values are heterogeneous within merged group.

◆ updateHash()

template<typename G>
template<typename H >
void CodeGenerator::GroupMerged< G >::updateHash ( getHashableFn,
boost::uuids::detail::sha1 &  hash 
) const
inlineprotected

Helper to update hash with the hash of calling getHashableFn on each group.

◆ updateParamHash()

template<typename G>
template<typename T , typename V , typename R >
void CodeGenerator::GroupMerged< G >::updateParamHash ( isParamReferencedFn,
getValueFn,
boost::uuids::detail::sha1 &  hash 
) const
inlineprotected

◆ updateVarInitDerivedParamHash()

template<typename G>
template<typename T , typename V , typename R >
void CodeGenerator::GroupMerged< G >::updateVarInitDerivedParamHash ( getVarInitialisers,
isDerivedParamReferencedFn,
boost::uuids::detail::sha1 &  hash 
) const
inlineprotected

◆ updateVarInitParamHash()

template<typename G>
template<typename T , typename V , typename R >
void CodeGenerator::GroupMerged< G >::updateVarInitParamHash ( getVarInitialisers,
isParamReferencedFn,
boost::uuids::detail::sha1 &  hash 
) const
inlineprotected

The documentation for this class was generated from the following file: