Commit 0d7bfd44 authored by Dave Moxey's avatar Dave Moxey
Browse files

Switch map from linear search to lookup

parent b36d04da
...@@ -2325,19 +2325,14 @@ namespace Nektar ...@@ -2325,19 +2325,14 @@ namespace Nektar
ExpansionShPtr MeshGraph::GetExpansion(GeometrySharedPtr geom, const std::string variable) ExpansionShPtr MeshGraph::GetExpansion(GeometrySharedPtr geom, const std::string variable)
{ {
ExpansionMapIter iter; ExpansionMapIter iter;
ExpansionShPtr returnval;
ExpansionMapShPtr expansionMap = m_expansionMapShPtrMap.find(variable)->second; ExpansionMapShPtr expansionMap = m_expansionMapShPtrMap.find(variable)->second;
for (iter = expansionMap->begin(); iter!=expansionMap->end(); ++iter) iter = expansionMap->find(geom->GetGlobalID());
{ ASSERTL1(iter != expansionMap.end(),
if ((iter->second)->m_geomShPtr == geom) "Could not find expansion " +
{ boost::lexical_cast<string>(geom->GetGlobalID()) +
returnval = iter->second; " in expansion for variable " + variable);
break; return iter->second;
}
}
return returnval;
} }
......
Markdown is supported
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