Commit 3b733086 authored by Douglas Serson's avatar Douglas Serson

Allow using xml file without expansion tag in FieldConvert

parent 56f554e3
......@@ -93,29 +93,28 @@ void InputFld::Process(po::variables_map &vm)
int oldSize = m_f->m_fielddef.size();
if(m_f->m_graph)
{
// 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();
// if Range has been specified it is possible to have a
// partition which is empty so check this and return if
// no elements present.
if (!expansions.size())
// Determine IDs of elements in the domain
vector<int> IDs;
auto domain = m_f->m_graph->GetDomain();
for(int d = 0; d < domain.size(); ++d)
{
return;
for (auto &compIter : domain[d])
{
for (auto &x : *compIter.second)
{
IDs.push_back(x->GetGlobalID());
}
}
}
Array<OneD, int> ElementGIDs(expansions.size());
i = 0;
for (auto &expIt : expansions)
if (!IDs.size())
{
ElementGIDs[i++] = expIt.second->m_geomShPtr->GetGlobalID();
return;
}
// Move to an array to match FieldIO interface
Array<OneD, int> ElementGIDs(IDs.size(), IDs.data());
fld->Import(
fileName, m_f->m_fielddef, m_f->m_data,
m_f->m_fieldMetaDataMap, ElementGIDs);
......
......@@ -79,11 +79,6 @@ void ProcessCreateExp::Process(po::variables_map &vm)
// expansion defintion if required
bool fldfilegiven = (m_f->m_fielddef.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();
// load fielddef header if fld file is defined. This gives
// precedence to Homogeneous definition in fld file
m_f->m_numHomogeneousDir = 0;
......@@ -118,22 +113,30 @@ void ProcessCreateExp::Process(po::variables_map &vm)
m_f->m_exp.resize(1);
// Check if there are any elements to process
vector<int> IDs;
auto domain = m_f->m_graph->GetDomain();
for(int d = 0; d < domain.size(); ++d)
{
for (auto &compIter : domain[d])
{
for (auto &x : *compIter.second)
{
IDs.push_back(x->GetGlobalID());
}
}
}
// if Range has been specified it is possible to have a
// partition which is empty so check this and return with empty
// expansion if no elements present.
if (!expansions.size())
if (!IDs.size())
{
m_f->m_exp[0] = MemoryManager<MultiRegions::ExpList>::
AllocateSharedPtr();
return;
}
if (fldfilegiven)
{
// Set up Expansion information to use mode order from field
m_f->m_graph->SetExpansions(m_f->m_fielddef);
}
// Adjust number of quadrature points
if (vm.count("output-points"))
{
......
......@@ -187,7 +187,14 @@ namespace Nektar
void MeshPartition::ReadExpansions(const LibUtilities::SessionReaderSharedPtr& pSession)
{
// Find the Expansions tag
TiXmlElement *expansionTypes = pSession->GetElement("Nektar/Expansions");
TiXmlElement *master = pSession->GetElement("Nektar");
TiXmlElement *expansionTypes =
master->FirstChildElement("EXPANSIONS");
if(!expansionTypes)
{
return;
}
// Find the Expansion type
TiXmlElement *expansion = expansionTypes->FirstChildElement();
......
......@@ -606,7 +606,6 @@ namespace Nektar
// Find the Expansions tag
TiXmlElement *expansionTypes = master->FirstChildElement("EXPANSIONS");
ASSERTL0(expansionTypes, "Unable to find EXPANSIONS tag in file.");
if(expansionTypes)
{
......
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