NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
CPhyloTreePS Class Reference

Search Toolkit Book for CPhyloTreePS

class CPhyloTreePS More...

#include <gui/widgets/phylo_tree/phylo_tree_ps.hpp>

+ Collaboration diagram for CPhyloTreePS:

Classes

struct  Edge
 Data structure for an edge between two nodes. More...
 
struct  Node
 Data structure for a node in the particle system. More...
 
struct  PhysicsParms
 

Public Types

typedef CVect2< float > TVec
 

Public Member Functions

 CPhyloTreePS (CPhyloTreeDataSource &ds)
 
 ~CPhyloTreePS ()
 
void Clear ()
 
void Init (CPhyloTreeDataSource &ds)
 
void SetElectricalRepulsion (float r)
 Get/Set particle system parameters. More...
 
float GetElectricalRepulsion () const
 
void SetStep (float s)
 Get/Set timestep. More...
 
float GetStep () const
 
void SetDamping (float d)
 Get/Set damping parameter. More...
 
float GetDamping () const
 
void SetEdgeK (float k)
 Get/Set edge stiffness. More...
 
float GetEdgeK () const
 
void SetRepulsionDist (float d)
 Get/Set maximum effective repulsion distance. More...
 
float GetRepulsionDist () const
 
void SetVelocityThresholdK (float k)
 Get/Set scaling factor for velocity threshold below which system stops. More...
 
float GetVelocityThresholdK () const
 
void SetPhysicsParms (const PhysicsParms &p)
 Get/Set all the current physics parms. More...
 
PhysicsParms getPhysicParms ()
 
float GetMaxVelocity () const
 Get max velocity from last call to UpdateAndSynch. More...
 
bool IsDone () const
 Return true if velocity has dropped below a threshold that indicates the system is stable (and doesn't need to keep running) More...
 
void CalcForces ()
 Calculate forces for all nodes. More...
 
void Update ()
 Calculate force then update positions. More...
 
void UpdateAndSynch ()
 Calculate forces, update positions, and update underlying tree. More...
 
void Draw ()
 Visualize graph - debug rendering. More...
 
float & GetDefaultEdgeLen ()
 Default length for all edges in system. More...
 
TVecGetMinPos ()
 Tracks bounding rectangle for all nodes. More...
 
TVecGetMaxPos ()
 
std::vector< Node > & GetNodes ()
 Set of all nodes. More...
 
std::vector< Edge > & GetEdges ()
 Set of all edges. More...
 

Protected Member Functions

void x_Init (CPhyloTree *tree)
 Create particle system from tree - ignore collapsed. More...
 
void x_UpdateVoxels ()
 Update spatial subdivision of nodes. More...
 
void x_ApplyRepulsiveForcesHashed ()
 Apply forces between nodes based on defined neighborhood size. More...
 
void x_ApplyRepulsiveForces ()
 Apply repulsive forces between all nodes. More...
 
void x_ApplyNeighborCellForces (std::vector< int > &cell_nodes, const CVect2< int > &adjacent_idx)
 Called compute forces between nodes in 2 cells. More...
 

Protected Attributes

std::vector< Nodem_Nodes
 Set of all nodes. More...
 
std::vector< Edgem_Edges
 Set of all edges. More...
 
CSpatialHash2D< std::vector< int > > m_NodeGrid
 Grid that keeps track of adjacent nodes. More...
 
PhysicsParms m_PhysicsParmsVolatile
 (potentially) updated from other thread(s) More...
 
PhysicsParms m_PhysicsParmsSafe
 Updated from m_PhysicsPamsVolatile when safe to do so. More...
 
float m_AdaptiveStep
 Multiplier for m_PhysicsParmsSafe.m_Step to allow step size to be adaptively lowered if system appears unstable. More...
 
float m_RepulsionDist2
 Square of current effective repulsion distance. More...
 
float m_RepulsionInv_x_ElectricalRepulsion
 Inverse of repulsion dist * electrical repulsion factor. More...
 
float m_edge_forces_t
 For timer values. More...
 
float m_node_forces_t
 
float m_integrate_t
 
float m_bound_update_t
 
int m_node_node_interactions_t
 
float m_edge_forces_safe_t
 
float m_node_forces_safe_t
 
float m_integrate_safe_t
 
float m_bound_update_safe_t
 
int m_node_node_interactions_safe_t
 
float m_MaxVelocity
 The maximum velocity is the maximum node velocity during the last call to UpdateAndSynch() More...
 
float m_PrevMaxVelocity
 Maximum velocity in previous update. More...
 
bool m_IsDone
 If true, system has slowed down to the point where continuing to update it is not necessary. More...
 
float m_DefaultEdgeLen
 Default length for all edges in system. More...
 
CPhyloTreem_Tree
 Root node of tree. More...
 
TVec m_MinPos
 Tracks bounding rectangle for all nodes. More...
 
TVec m_MaxPos
 
std::vector< CVect2< int > > m_ValidateGrid
 Only used for debugging. More...
 
std::vector< CVect2< int > > m_ValidateNsq
 
float m_LogDistMax
 For debug-drawing. More...
 
float m_LogDistMin
 

Private Member Functions

 CPhyloTreePS ()
 

Detailed Description

class CPhyloTreePS

Definition at line 52 of file phylo_tree_ps.hpp.

Member Typedef Documentation

◆ TVec

typedef CVect2<float> CPhyloTreePS::TVec

Definition at line 55 of file phylo_tree_ps.hpp.

Constructor & Destructor Documentation

◆ CPhyloTreePS() [1/2]

CPhyloTreePS::CPhyloTreePS ( CPhyloTreeDataSource ds)

◆ ~CPhyloTreePS()

CPhyloTreePS::~CPhyloTreePS ( )

◆ CPhyloTreePS() [2/2]

CPhyloTreePS::CPhyloTreePS ( )
private

Member Function Documentation

◆ CalcForces()

void CPhyloTreePS::CalcForces ( )

◆ Clear()

void CPhyloTreePS::Clear ( void  )

◆ Draw()

void CPhyloTreePS::Draw ( void  )

Visualize graph - debug rendering.

Definition at line 591 of file phylo_tree_ps.cpp.

References abs, CVect2< T >::GetData(), m_Edges, m_LogDistMax, m_LogDistMin, m_Nodes, max(), offset, and CPhyloTreePS::Node::pos.

◆ GetDamping()

float CPhyloTreePS::GetDamping ( ) const
inline

◆ GetDefaultEdgeLen()

float& CPhyloTreePS::GetDefaultEdgeLen ( )
inline

Default length for all edges in system.

Definition at line 169 of file phylo_tree_ps.hpp.

References m_DefaultEdgeLen.

Referenced by CInitPSNodes::operator()().

◆ GetEdgeK()

float CPhyloTreePS::GetEdgeK ( ) const
inline

◆ GetEdges()

std::vector<Edge>& CPhyloTreePS::GetEdges ( )
inline

Set of all edges.

Definition at line 177 of file phylo_tree_ps.hpp.

References m_Edges.

Referenced by CInitPSNodes::operator()().

◆ GetElectricalRepulsion()

float CPhyloTreePS::GetElectricalRepulsion ( ) const
inline

◆ GetMaxPos()

TVec& CPhyloTreePS::GetMaxPos ( )
inline

Definition at line 173 of file phylo_tree_ps.hpp.

References m_MaxPos.

Referenced by CInitPSNodes::operator()().

◆ GetMaxVelocity()

float CPhyloTreePS::GetMaxVelocity ( ) const
inline

Get max velocity from last call to UpdateAndSynch.

Definition at line 121 of file phylo_tree_ps.hpp.

References m_MaxVelocity.

◆ GetMinPos()

TVec& CPhyloTreePS::GetMinPos ( )
inline

Tracks bounding rectangle for all nodes.

Definition at line 172 of file phylo_tree_ps.hpp.

References m_MinPos.

Referenced by CInitPSNodes::operator()().

◆ GetNodes()

std::vector<Node>& CPhyloTreePS::GetNodes ( )
inline

Set of all nodes.

Definition at line 175 of file phylo_tree_ps.hpp.

References m_Nodes.

Referenced by CInitPSNodes::operator()().

◆ getPhysicParms()

PhysicsParms CPhyloTreePS::getPhysicParms ( )
inline

Definition at line 118 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile.

Referenced by CPhyloForce::x_Layout().

◆ GetRepulsionDist()

float CPhyloTreePS::GetRepulsionDist ( ) const
inline

◆ GetStep()

float CPhyloTreePS::GetStep ( void  ) const
inline

Definition at line 94 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile, and CPhyloTreePS::PhysicsParms::m_Step.

◆ GetVelocityThresholdK()

float CPhyloTreePS::GetVelocityThresholdK ( ) const
inline

◆ Init()

void CPhyloTreePS::Init ( CPhyloTreeDataSource ds)

◆ IsDone()

bool CPhyloTreePS::IsDone ( ) const
inline

Return true if velocity has dropped below a threshold that indicates the system is stable (and doesn't need to keep running)

Definition at line 125 of file phylo_tree_ps.hpp.

References m_IsDone.

Referenced by CForceJob::x_Calculate(), CPhyloForce::x_Layout(), and CPhyloForce::x_SingleThreadPhysics().

◆ SetDamping()

void CPhyloTreePS::SetDamping ( float  d)
inline

Get/Set damping parameter.

Definition at line 97 of file phylo_tree_ps.hpp.

References CPhyloTreePS::PhysicsParms::m_Damping, and m_PhysicsParmsVolatile.

◆ SetEdgeK()

void CPhyloTreePS::SetEdgeK ( float  k)
inline

Get/Set edge stiffness.

Definition at line 101 of file phylo_tree_ps.hpp.

References CPhyloTreePS::PhysicsParms::m_EdgeK, and m_PhysicsParmsVolatile.

◆ SetElectricalRepulsion()

void CPhyloTreePS::SetElectricalRepulsion ( float  r)
inline

Get/Set particle system parameters.

Two sets of parms are specified (volatile and safe) so that other threads can access parms while particle system is running. Get/Set node-node repulsion force (between all nodes)

Definition at line 87 of file phylo_tree_ps.hpp.

References CPhyloTreePS::PhysicsParms::m_ElectricalRepulsion, m_PhysicsParmsVolatile, and r().

◆ SetPhysicsParms()

void CPhyloTreePS::SetPhysicsParms ( const PhysicsParms p)
inline

Get/Set all the current physics parms.

Definition at line 117 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile.

Referenced by CPhyloForce::x_Layout().

◆ SetRepulsionDist()

void CPhyloTreePS::SetRepulsionDist ( float  d)
inline

Get/Set maximum effective repulsion distance.

Definition at line 105 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile, and CPhyloTreePS::PhysicsParms::m_RepulsionDist.

◆ SetStep()

void CPhyloTreePS::SetStep ( float  s)
inline

Get/Set timestep.

Definition at line 93 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile, and CPhyloTreePS::PhysicsParms::m_Step.

◆ SetVelocityThresholdK()

void CPhyloTreePS::SetVelocityThresholdK ( float  k)
inline

Get/Set scaling factor for velocity threshold below which system stops.

Definition at line 111 of file phylo_tree_ps.hpp.

References m_PhysicsParmsVolatile, and CPhyloTreePS::PhysicsParms::m_VelocityThresholdK.

Referenced by CPhyloForce::x_Layout().

◆ Update()

void CPhyloTreePS::Update ( void  )

◆ UpdateAndSynch()

void CPhyloTreePS::UpdateAndSynch ( )

◆ x_ApplyNeighborCellForces()

void CPhyloTreePS::x_ApplyNeighborCellForces ( std::vector< int > &  cell_nodes,
const CVect2< int > &  adjacent_idx 
)
protected

◆ x_ApplyRepulsiveForces()

void CPhyloTreePS::x_ApplyRepulsiveForces ( )
protected

◆ x_ApplyRepulsiveForcesHashed()

void CPhyloTreePS::x_ApplyRepulsiveForcesHashed ( )
protected

◆ x_Init()

void CPhyloTreePS::x_Init ( CPhyloTree tree)
protected

Create particle system from tree - ignore collapsed.

Definition at line 740 of file phylo_tree_ps.cpp.

References TreeDepthFirstEx().

Referenced by Init().

◆ x_UpdateVoxels()

void CPhyloTreePS::x_UpdateVoxels ( )
protected

Member Data Documentation

◆ m_AdaptiveStep

float CPhyloTreePS::m_AdaptiveStep
protected

Multiplier for m_PhysicsParmsSafe.m_Step to allow step size to be adaptively lowered if system appears unstable.

Definition at line 208 of file phylo_tree_ps.hpp.

Referenced by Clear(), CPhyloTreePS(), Update(), and UpdateAndSynch().

◆ m_bound_update_safe_t

float CPhyloTreePS::m_bound_update_safe_t
protected

Definition at line 228 of file phylo_tree_ps.hpp.

Referenced by CPhyloTreePS(), and UpdateAndSynch().

◆ m_bound_update_t

float CPhyloTreePS::m_bound_update_t
protected

Definition at line 222 of file phylo_tree_ps.hpp.

Referenced by Update(), and UpdateAndSynch().

◆ m_DefaultEdgeLen

float CPhyloTreePS::m_DefaultEdgeLen
protected

Default length for all edges in system.

Definition at line 242 of file phylo_tree_ps.hpp.

Referenced by GetDefaultEdgeLen(), and Init().

◆ m_edge_forces_safe_t

float CPhyloTreePS::m_edge_forces_safe_t
protected

Definition at line 225 of file phylo_tree_ps.hpp.

Referenced by CPhyloTreePS(), and UpdateAndSynch().

◆ m_edge_forces_t

float CPhyloTreePS::m_edge_forces_t
protected

For timer values.

Definition at line 219 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), and UpdateAndSynch().

◆ m_Edges

std::vector<Edge> CPhyloTreePS::m_Edges
protected

Set of all edges.

Definition at line 196 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), Clear(), Draw(), GetEdges(), and Init().

◆ m_integrate_safe_t

float CPhyloTreePS::m_integrate_safe_t
protected

Definition at line 227 of file phylo_tree_ps.hpp.

Referenced by CPhyloTreePS(), and UpdateAndSynch().

◆ m_integrate_t

float CPhyloTreePS::m_integrate_t
protected

Definition at line 221 of file phylo_tree_ps.hpp.

Referenced by Update(), and UpdateAndSynch().

◆ m_IsDone

bool CPhyloTreePS::m_IsDone
protected

If true, system has slowed down to the point where continuing to update it is not necessary.

Based on max velocity and tree size

Definition at line 238 of file phylo_tree_ps.hpp.

Referenced by Clear(), IsDone(), and UpdateAndSynch().

◆ m_LogDistMax

float CPhyloTreePS::m_LogDistMax
protected

For debug-drawing.

Definition at line 256 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), and Draw().

◆ m_LogDistMin

float CPhyloTreePS::m_LogDistMin
protected

Definition at line 257 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), and Draw().

◆ m_MaxPos

TVec CPhyloTreePS::m_MaxPos
protected

Definition at line 249 of file phylo_tree_ps.hpp.

Referenced by GetMaxPos(), Init(), Update(), UpdateAndSynch(), and x_UpdateVoxels().

◆ m_MaxVelocity

float CPhyloTreePS::m_MaxVelocity
protected

The maximum velocity is the maximum node velocity during the last call to UpdateAndSynch()

Definition at line 233 of file phylo_tree_ps.hpp.

Referenced by Clear(), CPhyloTreePS(), GetMaxVelocity(), Update(), and UpdateAndSynch().

◆ m_MinPos

TVec CPhyloTreePS::m_MinPos
protected

Tracks bounding rectangle for all nodes.

Definition at line 248 of file phylo_tree_ps.hpp.

Referenced by GetMinPos(), Init(), Update(), UpdateAndSynch(), and x_UpdateVoxels().

◆ m_node_forces_safe_t

float CPhyloTreePS::m_node_forces_safe_t
protected

Definition at line 226 of file phylo_tree_ps.hpp.

Referenced by CPhyloTreePS(), and UpdateAndSynch().

◆ m_node_forces_t

float CPhyloTreePS::m_node_forces_t
protected

Definition at line 220 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), and UpdateAndSynch().

◆ m_node_node_interactions_safe_t

int CPhyloTreePS::m_node_node_interactions_safe_t
protected

Definition at line 229 of file phylo_tree_ps.hpp.

Referenced by CPhyloTreePS(), and UpdateAndSynch().

◆ m_node_node_interactions_t

int CPhyloTreePS::m_node_node_interactions_t
protected

◆ m_NodeGrid

CSpatialHash2D<std::vector<int> > CPhyloTreePS::m_NodeGrid
protected

Grid that keeps track of adjacent nodes.

Definition at line 199 of file phylo_tree_ps.hpp.

Referenced by x_ApplyNeighborCellForces(), x_ApplyRepulsiveForcesHashed(), and x_UpdateVoxels().

◆ m_Nodes

std::vector<Node> CPhyloTreePS::m_Nodes
protected

◆ m_PhysicsParmsSafe

PhysicsParms CPhyloTreePS::m_PhysicsParmsSafe
protected

Updated from m_PhysicsPamsVolatile when safe to do so.

Definition at line 204 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), Update(), UpdateAndSynch(), x_ApplyNeighborCellForces(), x_ApplyRepulsiveForces(), x_ApplyRepulsiveForcesHashed(), and x_UpdateVoxels().

◆ m_PhysicsParmsVolatile

PhysicsParms CPhyloTreePS::m_PhysicsParmsVolatile
protected

◆ m_PrevMaxVelocity

float CPhyloTreePS::m_PrevMaxVelocity
protected

Maximum velocity in previous update.

Definition at line 235 of file phylo_tree_ps.hpp.

Referenced by Clear(), Update(), and UpdateAndSynch().

◆ m_RepulsionDist2

float CPhyloTreePS::m_RepulsionDist2
protected

Square of current effective repulsion distance.

Definition at line 211 of file phylo_tree_ps.hpp.

Referenced by CalcForces().

◆ m_RepulsionInv_x_ElectricalRepulsion

float CPhyloTreePS::m_RepulsionInv_x_ElectricalRepulsion
protected

Inverse of repulsion dist * electrical repulsion factor.

Definition at line 213 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), x_ApplyNeighborCellForces(), and x_ApplyRepulsiveForcesHashed().

◆ m_Tree

CPhyloTree* CPhyloTreePS::m_Tree
protected

Root node of tree.

Definition at line 245 of file phylo_tree_ps.hpp.

Referenced by Init().

◆ m_ValidateGrid

std::vector<CVect2<int> > CPhyloTreePS::m_ValidateGrid
protected

Only used for debugging.

Definition at line 252 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), Clear(), x_ApplyNeighborCellForces(), x_ApplyRepulsiveForces(), and x_ApplyRepulsiveForcesHashed().

◆ m_ValidateNsq

std::vector<CVect2<int> > CPhyloTreePS::m_ValidateNsq
protected

Definition at line 253 of file phylo_tree_ps.hpp.

Referenced by CalcForces(), and Clear().


The documentation for this class was generated from the following files:
Modified on Mon Apr 22 04:03:30 2024 by modify_doxy.py rev. 669887