Beispiel #1
0
/**
 * A constructor.
 * Creates a new node.
 * @param place position inside the parent
 * @param parent pointer to the parent
 */
Node::Node(unsigned char place, Node *parent)
{
    m_place = place;
    m_parent = parent;

    if(m_parent != NULL)
    {
        //Update neighbor pointers in neighbors
        for(unsigned char neighbor = 0; neighbor < NEIGHBORS; neighbor++)
        {
            m_neighbors[neighbor] = computeNeighbor(neighbor);

            if(m_neighbors[neighbor] != NULL)
            {
                m_neighbors[neighbor]->m_neighbors[reverseNeighborId(neighbor)] = this;
            }
        }
    }
    else
    {
        //Root node hasn't got any neighbors
        for(unsigned char neighbor = 0; neighbor < NEIGHBORS; neighbor++)
        {
            m_neighbors[neighbor] = NULL;
        }
    }

    for(unsigned char i = 0; i < CHILDREN; i++)
    {
        m_children[i] = NULL;
    }
}
Beispiel #2
0
void SPHSystem::sphLoop()
{
	TIMER[NEIGHBOR].Start();
	computeNeighbor();
	TIMER[NEIGHBOR].Stop();

	TIMER[DENSITY].Start();
	computeDensityPressure();
	TIMER[DENSITY].Stop();
	
	TIMER[FORCE].Start();
	computeForce();
	TIMER[FORCE].Stop();

	TIMER[INTEGRATION].Start();
	integration();
	TIMER[INTEGRATION].Stop();

	numFrame++;
}