10 #include <Atoms/Globals.h>
11 #include <AtomsCore/Metadata/MapMetadata.h>
12 #include <AtomsCore/Metadata/MetadataImpl.h>
13 #include <Atoms/BehaviourModuleAttributeCache.h>
130 virtual const std::string&
typeName()
const {
return m_typeName; }
133 virtual void setTypeName(
const std::string& typeName) { m_typeName = typeName; }
136 virtual void addAttribute(
const std::string& attributeName, AtomsPtr<AtomsCore::Metadata>& metadata,
bool perAgent =
false);
137 virtual void addAttribute(
const std::string& attributeName,
AtomsCore::Metadata* metadata,
bool perAgent =
false);
140 virtual void addAttributeProperty(
const std::string& attributeName,
const std::string& propertyName, AtomsPtr<AtomsCore::Metadata>& metadata);
141 virtual void addAttributeProperty(
const std::string& attributeName,
const std::string& propertyName,
AtomsCore::Metadata* metadata);
159 virtual const std::string&
name()
const {
return m_name; }
162 virtual void setName(
const std::string& name) { m_name = name; }
175 T getAttributePerAgent(
const T& defaultValue,
AtomsCore::MapMetadata* overrideMap,
const std::string&
id);
184 void setProfileTime(
unsigned short index,
size_t us);
186 static bool ignoreCurrentModule(
Atoms::Agent* agent,
const std::string& currentModuleName,
const std::vector<std::string>& moduleNames,
const std::string& metadataName);
187 static void enableCurrentActiveModuleMetadata(
Atoms::Agent* agent,
const std::string& currentModuleName,
const std::string& metadataName,
const bool enable);
189 static void initializeAngularVelocity(
Atoms::Agent* agent);
191 static void setAngularVelocities(
Atoms::Agent* agent,
const double angularVelocity,
const double frameAngularVelocity);
195 void addAttributeRandomization(
const std::string& attributeName,
AtomsCore::Metadata* metadata);
197 void addAttributeExpression(
const std::string& attributeName,
AtomsCore::Metadata* metadata);
203 std::string m_typeName;
207 size_t m_profileTime[10];
220 if (dataPtr)
return dataPtr->
value();
231 return agentDataPtr->
value();
237 if (dataPtr)
return dataPtr->
value();
Agent group.
Definition: AgentGroup.h:36
Agent.
Definition: Agent.h:44
Behaviour module.
Definition: BehaviourModule.h:32
virtual void setTypeName(const std::string &typeName)
Sets the module type name.
Definition: BehaviourModule.h:133
size_t profileTime(unsigned short index) const
Get profile time.
virtual void setEnabled(bool value)
Set the enabled state for this module.
Definition: BehaviourModule.h:147
bool singleThread() const
Return true if this module use a single thread.
Definition: BehaviourModule.h:156
virtual void initSimulation(AgentGroup *agentGroup=nullptr)
Init simulation.
virtual void refreshAttributes()
Refresh the attribute map metadata.
virtual void addAttributeProperty(const std::string &attributeName, const std::string &propertyName, AtomsPtr< AtomsCore::Metadata > &metadata)
Add an attribute property to the module.
virtual AtomsCore::MapMetadata & attributes()
Returns the module attributes map.
Definition: BehaviourModule.h:124
virtual void initFrame(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Init frame.
virtual void preFrame(AgentGroup *agentGroup=nullptr)
Pre frame.
virtual void prePhysics(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Pre Physics.
virtual void resetSimulation(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Reset simulation.
virtual void endSimulation(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
End simulation.
virtual void preDraw(DrawContext *context, const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Pre draw.
virtual void setName(const std::string &name)
Sets the module name.
Definition: BehaviourModule.h:162
virtual bool isEnabled() const
Gets the enabled state for this module.
Definition: BehaviourModule.h:150
virtual void draw(DrawContext *context, const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Draw.
virtual ~BehaviourModule()
Destructor.
virtual AtomsCore::MapMetadata & attributeProperties()
Returns the module attribute properties map.
Definition: BehaviourModule.h:127
virtual void endFrame(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
End frame.
virtual void agentsKilled(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Post frame.
virtual bool removeAttribute(const std::string &attributeName)
Removes an attribute from the module, this also removes the _override entry if present.
BehaviourModule()
Constructor.
void setSingleThread(bool value)
Use single thread.
Definition: BehaviourModule.h:153
virtual const std::string & typeName() const
Gets the module type name.
Definition: BehaviourModule.h:130
T getAttributePerAgent(const T &defaultValue, AtomsCore::MapMetadata *overrideMap, const std::string &id)
Utils to get per agent attributes.
Definition: BehaviourModule.h:215
virtual void postPhysics(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Post Physics.
virtual void agentsCreated(const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
Agents Created.
virtual const std::string & name() const
Gets the module name.
Definition: BehaviourModule.h:159
virtual bool hasDynamicAttributes() const
Check if this module can generate attribute dynamically.
virtual void addAttribute(const std::string &attributeName, AtomsPtr< AtomsCore::Metadata > &metadata, bool perAgent=false)
Add an attribute to the module, if the perAgent flag is set to true an extra attribute is added with ...
Definition: DrawContext.h:17
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Atoms namespace.
Definition: Agent.h:29