Beispiel #1
0
void GenericMap::compactIfNeeded(float frag, bool topoOnly)
{
	if (fragmentation(DART)< frag)
		compactTopo();

	if (topoOnly)
		return;

	std::vector<unsigned int> oldnew;

	for (unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
	{
		if ((orbit != DART) && (isOrbitEmbedded(orbit)) && (fragmentation(orbit)< frag))
		{
			m_attribs[orbit].compact(oldnew);
			for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i))
			{
				unsigned int& idx = m_embeddings[orbit]->operator[](i);
				unsigned int jdx = oldnew[idx];
				if (jdx != 0xffffffff)
					idx = jdx;
			}
		}
	}
}
Beispiel #2
0
void GenericMap::compactOrbitContainer(unsigned int orbit, float frag)
{
	std::vector<unsigned int> oldnew;

	if (isOrbitEmbedded(orbit) && (fragmentation(orbit)< frag))
	{
		m_attribs[orbit].compact(oldnew);
		for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i))
		{
			unsigned int& idx = m_embeddings[orbit]->operator[](i);
			unsigned int jdx = oldnew[idx];
			if (jdx != 0xffffffff)
				idx = jdx;
		}
	}
}
Beispiel #3
0
GenericMap::~GenericMap()
{

	for(unsigned int i = 0; i < NB_ORBITS; ++i)
	{
		if(isOrbitEmbedded(i))
			m_attribs[i].clear(true) ;
	}

	for(std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*>::iterator it = attributeHandlers.begin(); it != attributeHandlers.end(); ++it)
		(*it).second->setInvalid() ;
	attributeHandlers.clear() ;

	// remove instance of table
	auto it = std::find(s_instances->begin(), s_instances->end(), this);
	*it = s_instances->back();
	s_instances->pop_back();

	// clean type registry if necessary

	if (s_instances->size() == 0)
	{
		for (std::map<std::string, RegisteredBaseAttribute*>::iterator it =  m_attributes_registry_map->begin(); it != m_attributes_registry_map->end(); ++it)
			delete it->second;

		delete m_attributes_registry_map;
		m_attributes_registry_map = NULL;

		for(unsigned int i = 0; i < NB_THREAD; ++i)
		{
			for (auto it =s_vdartsBuffers[i].begin(); it != s_vdartsBuffers[i].end(); ++it)
				delete *it;
			for (auto it =s_vintsBuffers[i].begin(); it != s_vintsBuffers[i].end(); ++it)
				delete *it;
		}


	}
}
Beispiel #4
0
inline float GenericMap::fragmentation(unsigned int orbit)
{
	if (isOrbitEmbedded(orbit))
		return m_attribs[orbit].fragmentation();
	return 1.0f;
}