Commit 57743e87 authored by Dave Moxey's avatar Dave Moxey

Merge branch 'fix/FCduplicateImport' into 'master'

Avoid reading fld twice in FieldConvert

This MR introduces a small change to avoid loading the fld file twice in FieldConvert. Currently, InputXml imports just the FieldDef to set the expansion, and later InputFld reads the data. However, this is very inefficient, since the whole fld file has to be loaded even if we just want the FieldDef. This MR basically makes InputXml load both the fielddef and the data, and later InputFld just extracts the data.

See merge request !649
parent 68f4e8d4
......@@ -6,6 +6,9 @@ v4.3.3
**Library**:
- Minor fix to suppress Xxt output unless `--verbose` is specified (!642)
**FieldConvert**:
- Fix to avoid repeated import of field file (!649)
**Packaging**:
- Fix NekMesh dependencies for DEB package (!650)
......
......@@ -139,41 +139,45 @@ void InputFld::Process(po::variables_map &vm)
}
if(m_f->m_graph) // all for restricted expansion defintion when loading field
if(m_f->m_graph)
{
// currently load all field (possibly could read data from expansion list
// but it is re-arranged in expansion)
if (m_f->m_data.size() == 0)
{
// currently load all field (possibly could read data from
// expansion list but it is re-arranged in expansion)
const SpatialDomains::ExpansionMap &expansions = m_f->m_graph->GetExpansions();
const SpatialDomains::ExpansionMap &expansions =
m_f->m_graph->GetExpansions();
// if Range has been speficied it is possible to have a
// partition which is empty so check this and return if
// no elements present.
// if Range has been speficied it is possible to have a
// partition which is empty so check this and return if
// no elements present.
if(!expansions.size())
{
return;
}
if(!expansions.size())
{
return;
}
m_f->m_exp.resize(1);
m_f->m_exp.resize(1);
Array<OneD,int> ElementGIDs(expansions.size());
SpatialDomains::ExpansionMap::const_iterator expIt;
Array<OneD,int> ElementGIDs(expansions.size());
SpatialDomains::ExpansionMap::const_iterator expIt;
i = 0;
for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
{
ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
}
i = 0;
for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
{
ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
}
m_f->m_fielddef.clear();
m_f->m_data.clear();
m_f->m_fielddef.clear();
m_f->m_data.clear();
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap,
ElementGIDs);
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap,
ElementGIDs);
}
}
else // load all data.
{
......
......@@ -337,10 +337,14 @@ void InputXml::Process(po::variables_map &vm)
{
ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
}
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],m_f->m_fielddef,
LibUtilities::NullVectorNekDoubleVector,
LibUtilities::NullFieldMetaDataMap,
m_f->m_fielddef.clear();
m_f->m_data.clear();
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap,
ElementGIDs);
NumHomogeneousDir = m_f->m_fielddef[0]->m_numHomogeneousDir;
......
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