Commit 2046281d authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Performance enhancements to MeshGraph construction.


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@3469 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 8e3b3b58
......@@ -1534,43 +1534,32 @@ namespace Nektar
return returnval;
}
/**
* Generate a single vector of Expansion structs mapping global element
* ID to a corresponding Geometry shared pointer and basis key.
*
* Expansion map ensures elements which appear in multiple composites
* within the domain are only listed once.
*/
ExpansionMapShPtr MeshGraph::SetUpExpansionMap(void)
{
ExpansionMapShPtr returnval;
returnval = MemoryManager<ExpansionMap>::AllocateSharedPtr();
// Need a vector of all elements and their associated
// expansion information.
const CompositeMap &domain = this->GetDomain();
CompositeMap::const_iterator compIter;
for (compIter = domain.begin(); compIter != domain.end(); ++compIter)
{
boost::shared_ptr<GeometryVector> geomVectorShPtr = compIter->second;
GeometryVectorIter geomIter;
for (geomIter = geomVectorShPtr->begin(); geomIter != geomVectorShPtr->end(); ++geomIter)
GeometryVector::const_iterator x;
for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
{
// Make sure we only have one instance of the
// GeometrySharedPtr stored in the list.
ExpansionMap::iterator elemIter;
for (elemIter = returnval->begin(); elemIter != returnval->end(); ++elemIter)
{
if (elemIter->second->m_geomShPtr == *geomIter)
{
break;
}
}
// Not found in list.
if (elemIter == returnval->end())
{
LibUtilities::BasisKeyVector def;
ExpansionShPtr expansionElementShPtr =
MemoryManager<Expansion>::AllocateSharedPtr(*geomIter, def);
int id = (*geomIter)->GetGlobalID();
(*returnval)[id] = expansionElementShPtr;
}
LibUtilities::BasisKeyVector def;
ExpansionShPtr expansionElementShPtr =
MemoryManager<Expansion>::AllocateSharedPtr(*x, def);
int id = (*x)->GetGlobalID();
(*returnval)[id] = expansionElementShPtr;
}
}
......@@ -1793,23 +1782,35 @@ namespace Nektar
GeometryVectorIter geomVecIter;
for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
{
ExpansionMapIter expVecIter;
for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
ExpansionMapIter x = expansionMap->find((*geomVecIter)->GetGlobalID());
ASSERTL0(x != expansionMap->end(), "Expansion not found!!");
if(useExpansionType)
{
if (*geomVecIter == (expVecIter->second)->m_geomShPtr)
{
if(useExpansionType)
{
(expVecIter->second)->m_basisKeyVector = DefineBasisKeyFromExpansionType(*geomVecIter,expansion_type,expansion_order);
}
else
{
ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size()," There is an incompatible expansion dimension with geometry dimension");
(expVecIter->second)->m_basisKeyVector = basiskeyvec;
}
break;
}
(x->second)->m_basisKeyVector = DefineBasisKeyFromExpansionType(*geomVecIter,expansion_type,expansion_order);
}
else
{
ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size()," There is an incompatible expansion dimension with geometry dimension");
(x->second)->m_basisKeyVector = basiskeyvec;
}
// ExpansionMapIter expVecIter;
// for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
// {
// if (*geomVecIter == (expVecIter->second)->m_geomShPtr)
// {
// if(useExpansionType)
// {
// (expVecIter->second)->m_basisKeyVector = DefineBasisKeyFromExpansionType(*geomVecIter,expansion_type,expansion_order);
// }
// else
// {
// ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size()," There is an incompatible expansion dimension with geometry dimension");
// (expVecIter->second)->m_basisKeyVector = basiskeyvec;
// }
// break;
// }
// }
}
}
......
......@@ -39,6 +39,8 @@
#include <cstdlib>
#include <fstream>
#include <boost/unordered_map.hpp>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/BasicUtils/Equation.h>
#include <SpatialDomains/InterfaceComponent.h>
......@@ -96,8 +98,6 @@ namespace Nektar
typedef std::list< SharedInterfaceCompPtr > InterfaceCompList;
typedef boost::shared_ptr< GeometryVector > Composite;
//typedef std::vector< Composite > CompositeVector;
//typedef std::vector< Composite >::iterator CompositeVectorIter;
typedef std::map<int, Composite> CompositeMap;
typedef std::map<int, Composite>::iterator CompositeMapIter;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment