コード例 #1
0
//! allcates the global context and for all threads a local context
FMEGlobalContext* FMEMultipoleKernel::allocateContext(ArrayGraph* pGraph, FMEGlobalOptions* pOptions, __uint32 numThreads)
{
	FMEGlobalContext* globalContext = new FMEGlobalContext();

	globalContext->numThreads = numThreads;
	globalContext->pOptions = pOptions;
	globalContext->pGraph = pGraph;
	globalContext->pQuadtree = new LinearQuadtree(pGraph->numNodes(), pGraph->nodeXPos(), pGraph->nodeYPos(), pGraph->nodeSize());
	globalContext->pWSPD = globalContext->pQuadtree->wspd();
	globalContext->pExpansion = new LinearQuadtreeExpansion(globalContext->pOptions->multipolePrecision, (*globalContext->pQuadtree));
	__uint32 numPoints = globalContext->pQuadtree->numberOfPoints();
	typedef FMELocalContext* FMELocalContextPtr;
		
	globalContext->pLocalContext = new FMELocalContextPtr[numThreads];
	globalContext->globalForceX = (float*)MALLOC_16(sizeof(float)*numPoints); 
	globalContext->globalForceY = (float*)MALLOC_16(sizeof(float)*numPoints); 
	for (__uint32 i=0; i < numThreads; i++)
	{
		globalContext->pLocalContext[i] = new FMELocalContext;
		globalContext->pLocalContext[i]->forceX = (float*)MALLOC_16(sizeof(float)*numPoints);
		globalContext->pLocalContext[i]->forceY = (float*)MALLOC_16(sizeof(float)*numPoints);
		globalContext->pLocalContext[i]->pGlobalContext = globalContext;
	};
	return globalContext;
};
コード例 #2
0
void LinearQuadtree::allocate(__uint32 n)
{
	m_numPoints = n;
	m_maxNumNodes = 2*n;
	m_tree = (LQNode*)MALLOC_16(m_maxNumNodes*sizeof(LQNode));
	m_nodeXPos = (float*)MALLOC_16(m_maxNumNodes*sizeof(float));
	m_nodeYPos = (float*)MALLOC_16(m_maxNumNodes*sizeof(float));
	m_nodeSize = (float*)MALLOC_16(m_maxNumNodes*sizeof(float));
	m_points = (LQPoint*)MALLOC_16(m_numPoints*sizeof(LQPoint));
	for (__uint32 i = 0; i < m_numPoints; i++)
		m_points[i].ref = i;
	m_pointXPos = (float*)MALLOC_16(m_numPoints*sizeof(float));
	m_pointYPos = (float*)MALLOC_16(m_numPoints*sizeof(float));
	m_pointSize = (float*)MALLOC_16(m_numPoints*sizeof(float));
	m_notWspd = (LQWSPair*)MALLOC_16(m_maxNumNodes*sizeof(LQWSPair)*27);
	m_directNodes = (NodeID*)MALLOC_16(m_maxNumNodes*sizeof(NodeID));
	m_WSPD = new WSPD(m_maxNumNodes);
};
コード例 #3
0
ファイル: LinearQuadtree.cpp プロジェクト: marvin2k/ogdf
void LinearQuadtree::allocate(uint32_t n)
{
	// prevent call to malloc(0)
	OGDF_ASSERT( n >= 1 );

	m_numPoints = n;
	m_maxNumNodes = 2 * n;
	m_tree = static_cast<LQNode*>(MALLOC_16(m_maxNumNodes*sizeof(LQNode)));
	m_nodeXPos = static_cast<float*>(MALLOC_16(m_maxNumNodes*sizeof(float)));
	m_nodeYPos = static_cast<float*>(MALLOC_16(m_maxNumNodes*sizeof(float)));
	m_nodeSize = static_cast<float*>(MALLOC_16(m_maxNumNodes*sizeof(float)));
	m_points = static_cast<LQPoint*>(MALLOC_16(m_numPoints*sizeof(LQPoint)));
	for (uint32_t i = 0; i < m_numPoints; i++)
		m_points[i].ref = i;
	m_pointXPos = static_cast<float*>(MALLOC_16(m_numPoints*sizeof(float)));
	m_pointYPos = static_cast<float*>(MALLOC_16(m_numPoints*sizeof(float)));
	m_pointSize = static_cast<float*>(MALLOC_16(m_numPoints*sizeof(float)));
	m_notWspd = static_cast<LQWSPair*>(MALLOC_16(m_maxNumNodes*sizeof(LQWSPair) * 27));
	m_directNodes = static_cast<NodeID*>(MALLOC_16(m_maxNumNodes*sizeof(NodeID)));
	m_WSPD = new WSPD(m_maxNumNodes);
}
コード例 #4
0
ファイル: ArrayGraph.cpp プロジェクト: skieffer/sminthopsys
void ArrayGraph::allocate(__uint32 numNodes, __uint32 numEdges)
{
    m_nodeXPos = (float*)MALLOC_16(numNodes*sizeof(float));
    m_nodeYPos = (float*)MALLOC_16(numNodes*sizeof(float));
    m_nodeSize = (float*)MALLOC_16(numNodes*sizeof(float));
    m_nodeMoveRadius = (float*)MALLOC_16(numNodes*sizeof(float));
    m_nodeAdj = (NodeAdjInfo*)MALLOC_16(numNodes*sizeof(NodeAdjInfo));
    m_desiredEdgeLength = (float*)MALLOC_16(numEdges*sizeof(float));
    m_edgeAdj = (EdgeAdjInfo*)MALLOC_16(numEdges*sizeof(EdgeAdjInfo));

    for (__uint32 i=0; i < numNodes; i++)
        nodeInfo(i).degree = 0;
};
コード例 #5
0
void LinearQuadtreeExpansion::allocate()
{
	m_multiExp = (double*)MALLOC_16(m_numCoeff*sizeof(double)*2*m_numExp);
	m_localExp = (double*)MALLOC_16(m_numCoeff*sizeof(double)*2*m_numExp);
};