Commit 64fee55e authored by Douglas Serson's avatar Douglas Serson
Browse files

Remove usage of fielddef and fielddat in modules working on m_exp

parent b65bdb9c
......@@ -92,6 +92,8 @@ struct Field
vector<MultiRegions::ExpListSharedPtr> m_exp;
vector<string> m_variables;
int m_numHomogeneousDir;
bool m_declareExpansionAsContField;
bool m_declareExpansionAsDisContField;
......
......@@ -84,6 +84,13 @@ InputXml::~InputXml()
void InputXml::Process(po::variables_map &vm)
{
Timer timerpart;
if (m_f->m_verbose)
{
if (m_f->m_comm->TreatAsRankZero())
{
timerpart.Start();
}
}
// check for multiple calls to inputXml due to split xml
// files. If so just return
......
......@@ -158,17 +158,7 @@ void OutputFld::OutputFromExp(po::variables_map &vm)
{
BndExp[j][Border]->AppendFieldData(FieldDef[k],
FieldData[k]);
if (m_f->m_fielddef.size() > 0)
{
FieldDef[k]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
}
else
{
FieldDef[k]->m_fields.push_back(
m_f->m_session->GetVariable(j));
}
FieldDef[k]->m_fields.push_back(m_f->m_variables[j]);
}
}
......@@ -279,11 +269,11 @@ void OutputFld::OutputFromExp(po::variables_map &vm)
if (rank == 0)
{
cout << "L 2 error (variable "
<< m_f->m_fielddef[0]->m_fields[j] << ") : " << l2err
<< m_f->m_variables[j] << ") : " << l2err
<< endl;
cout << "L inf error (variable "
<< m_f->m_fielddef[0]->m_fields[j] << ") : " << linferr
<< m_f->m_variables[j] << ") : " << linferr
<< endl;
}
}
......
......@@ -66,15 +66,12 @@ ProcessAddCompositeID::~ProcessAddCompositeID()
void ProcessAddCompositeID::Process(po::variables_map &vm)
{
int nfields = 0;
int NumHomogeneousDir = 0;
int nfields = m_f->m_variables.size();
int NumHomogeneousDir = m_f->m_numHomogeneousDir;
MultiRegions::ExpListSharedPtr exp;
if (m_f->m_fielddef.size())
if (nfields)
{
nfields = m_f->m_fielddef[0]->m_fields.size();
NumHomogeneousDir = m_f->m_fielddef[0]->m_numHomogeneousDir;
m_f->m_exp.resize(nfields + 1);
exp = m_f->AppendExpList(NumHomogeneousDir, "Composite ID");
......@@ -122,30 +119,8 @@ void ProcessAddCompositeID::Process(po::variables_map &vm)
// forward transform
exp->FwdTrans_IterPerExp(exp->GetPhys(), exp->UpdateCoeffs());
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
// copy in previous fields if they exist.
for (int i = 0; i < nfields; ++i)
{
for (int j = 0; j < FieldDef.size(); ++j)
{
FieldDef[j]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[i]);
m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
}
}
// append composite id field
for (int j = 0; j < FieldDef.size(); ++j)
{
FieldDef[j]->m_fields.push_back("compositeID");
m_f->m_variables.push_back("compositeID");
m_f->m_exp[nfields]->AppendFieldData(FieldDef[j], FieldData[j]);
}
m_f->m_variables.push_back("compositeID");
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
}
......@@ -127,7 +127,7 @@ void ProcessC0Projection::Process(po::variables_map &vm)
m_f->m_declareExpansionAsContField = true;
m_f->m_requireBoundaryExpansion = false;
C0ProjectExp[0] = m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, "DefaultVar", true);
m_f->m_numHomogeneousDir, "DefaultVar", true);
m_f->m_declareExpansionAsContField = savedef;
m_f->m_requireBoundaryExpansion = savedef2;
for (int i = 1; i < nfields; ++i)
......@@ -234,23 +234,6 @@ void ProcessC0Projection::Process(po::variables_map &vm)
}
}
// reset FieldDef in case of serial input and parallel output
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
// reset up FieldData with new values before projecting
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (int i = 0; i < nfields; ++i)
{
for (int j = 0; j < FieldDef.size(); ++j)
{
FieldDef[j]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[i]);
m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
}
......@@ -71,14 +71,13 @@ void ProcessCombineAvg::Process(po::variables_map &vm)
{
ASSERTL0(m_f->m_exp.size() != 0, "No input expansion defined");
int nfields = m_f->m_fielddef[0]->m_fields.size();
int nfields = m_f->m_variables.size();
int nq = m_f->m_exp[0]->GetTotPoints();
int expdim = m_f->m_graph->GetMeshDimension();
int spacedim = expdim;
if ((m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
(m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
if ((m_f->m_numHomogeneousDir) == 1 || (m_f->m_numHomogeneousDir) == 2)
{
spacedim += m_f->m_fielddef[0]->m_numHomogeneousDir;
spacedim += m_f->m_numHomogeneousDir;
}
// Allocate storage for new field and correction (for Reynolds stress)
......@@ -110,7 +109,7 @@ void ProcessCombineAvg::Process(po::variables_map &vm)
for (int j = 0; j < nfields; ++j)
{
ASSERTL0(fromField->m_fielddef[0]->m_fields[j] ==
m_f->m_fielddef[0]->m_fields[j],
m_f->m_variables[j],
"Field names do not match.");
// load new field (overwrite m_f->m_exp coeffs for now)
......@@ -139,7 +138,7 @@ void ProcessCombineAvg::Process(po::variables_map &vm)
int stress = -1;
for (int j = 0; j < nfields; ++j)
{
if (m_f->m_fielddef[0]->m_fields[j] == "uu")
if (m_f->m_variables[j] == "uu")
{
stress = j;
break;
......@@ -237,21 +236,6 @@ void ProcessCombineAvg::Process(po::variables_map &vm)
boost::lexical_cast<std::string>(finTime);
}
// Update field def and data
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (int i = 0; i < nfields; ++i)
{
for (int j = 0; j < FieldDef.size(); ++j)
{
FieldDef[j]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[i]);
m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
}
......@@ -85,22 +85,12 @@ void ProcessCreateExp::Process(po::variables_map &vm)
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())
{
return;
}
m_f->m_exp.resize(1);
// load fielddef header if fld file is defined. This gives
// precedence to Homogeneous definition in fld file
int NumHomogeneousDir = 0;
m_f->m_numHomogeneousDir = 0;
if (fldfilegiven)
{
NumHomogeneousDir = m_f->m_fielddef[0]->m_numHomogeneousDir;
m_f->m_numHomogeneousDir = m_f->m_fielddef[0]->m_numHomogeneousDir;
// Set up Expansion information to use mode order from field
m_f->m_graph->SetExpansions(m_f->m_fielddef);
......@@ -116,17 +106,33 @@ void ProcessCreateExp::Process(po::variables_map &vm)
(HomoStr == "Homogeneous1D") ||
(HomoStr == "1D") || (HomoStr == "Homo1D"))
{
NumHomogeneousDir = 1;
m_f->m_numHomogeneousDir = 1;
}
if ((HomoStr == "HOMOGENEOUS2D") ||
(HomoStr == "Homogeneous2D") ||
(HomoStr == "2D") || (HomoStr == "Homo2D"))
{
NumHomogeneousDir = 2;
m_f->m_numHomogeneousDir = 2;
}
}
}
// 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())
{
return;
}
m_f->m_exp.resize(1);
if (fldfilegiven)
{
// Set up Expansion information to use mode order from field
m_f->m_graph->SetExpansions(m_f->m_fielddef);
}
// reset expansion defintion to use equispaced points if required.
if (m_requireEquiSpaced || vm.count("output-points"))
{
......@@ -165,14 +171,15 @@ void ProcessCreateExp::Process(po::variables_map &vm)
}
// Override number of planes with value from cmd line
if (NumHomogeneousDir == 1 && vm.count("output-points-hom-z"))
if (m_f->m_numHomogeneousDir == 1 && vm.count("output-points-hom-z"))
{
int expdim = m_f->m_graph->GetMeshDimension();
m_f->m_fielddef[0]->m_numModes[expdim] =
vm["output-points-hom-z"].as<int>();
}
m_f->m_exp[0] = m_f->SetUpFirstExpList(NumHomogeneousDir, fldfilegiven);
m_f->m_exp[0] = m_f->SetUpFirstExpList(m_f->m_numHomogeneousDir,
fldfilegiven);
if (m_f->m_verbose)
{
......@@ -196,19 +203,20 @@ void ProcessCreateExp::Process(po::variables_map &vm)
m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
vector<string> vars;
if (vm.count("useSessionVariables"))
{
nfields = m_f->m_session->GetVariables().size();
vars = m_f->m_session->GetVariables();
}
else
{
nfields = m_f->m_fielddef[0]->m_fields.size();
nfields = m_f->m_variables.size();
vars = m_f->m_variables;
}
m_f->m_exp.resize(nfields * nstrips);
vector<string> vars = m_f->m_session->GetVariables();
// declare other fields;
for (int s = 0; s < nstrips; ++s) // homogeneous strip varient
{
......@@ -220,7 +228,7 @@ void ProcessCreateExp::Process(po::variables_map &vm)
if (!m_f->m_exp[s * nfields + i])
{
m_f->m_exp[s * nfields + i] = m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, vars[i]);
m_f->m_numHomogeneousDir, vars[i]);
}
}
else
......@@ -228,12 +236,12 @@ void ProcessCreateExp::Process(po::variables_map &vm)
if (vars.size())
{
m_f->m_exp[s * nfields + i] = m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, vars[0]);
m_f->m_numHomogeneousDir, vars[0]);
}
else
{
m_f->m_exp[s * nfields + i] = m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
m_f->m_numHomogeneousDir);
}
}
}
......@@ -257,24 +265,6 @@ void ProcessCreateExp::Process(po::variables_map &vm)
m_f->m_exp[s * nfields + j]->UpdatePhys());
}
}
// reset output field in case Import loaded elements that are not
// in the expansion (because of range option of partitioning)
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (j = 0; j < nfields; ++j)
{
for (i = 0; i < FieldDef.size(); ++i)
{
FieldDef[i]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
......
......@@ -94,38 +94,15 @@ void ProcessEquiSpacedOutput::SetupEquiSpacedField(void)
// Check if we have a homogeneous expansion
bool homogeneous1D = false;
if (m_f->m_fielddef.size())
if (m_f->m_numHomogeneousDir == 1)
{
if (m_f->m_fielddef[0]->m_numHomogeneousDir == 1)
{
coordim++;
shapedim++;
homogeneous1D = true;
}
else if (m_f->m_fielddef[0]->m_numHomogeneousDir == 2)
{
ASSERTL0(false, "Homegeneous2D case not supported");
}
coordim++;
shapedim++;
homogeneous1D = true;
}
else
else if (m_f->m_numHomogeneousDir == 2)
{
if (m_f->m_session->DefinesSolverInfo("HOMOGENEOUS"))
{
std::string HomoStr = m_f->m_session->GetSolverInfo("HOMOGENEOUS");
if ((HomoStr == "HOMOGENEOUS1D") || (HomoStr == "Homogeneous1D") ||
(HomoStr == "1D") || (HomoStr == "Homo1D"))
{
coordim++;
shapedim++;
homogeneous1D = true;
}
if ((HomoStr == "HOMOGENEOUS2D") || (HomoStr == "Homogeneous2D") ||
(HomoStr == "2D") || (HomoStr == "Homo2D"))
{
ASSERTL0(false, "Homegeneous2D case not supported");
}
}
ASSERTL0(false, "Homegeneous2D case not supported");
}
// set up the number of points in each element
......@@ -340,14 +317,7 @@ void ProcessEquiSpacedOutput::SetupEquiSpacedField(void)
cnt += newpoints;
}
if (m_f->m_fielddef.size())
{
nfields = m_f->m_exp.size();
}
else // just the mesh points
{
nfields = 0;
}
nfields = m_f->m_variables.size();
Array<OneD, Array<OneD, NekDouble> > pts(nfields + coordim);
......@@ -392,45 +362,36 @@ void ProcessEquiSpacedOutput::SetupEquiSpacedField(void)
}
}
if (m_f->m_fielddef.size())
for (int n = 0; n < m_f->m_variables.size(); ++n)
{
ASSERTL0(m_f->m_fielddef[0]->m_fields.size() == m_f->m_exp.size(),
"More expansion defined than fields");
cnt = 0;
int cnt1 = 0;
for (int n = 0; n < m_f->m_exp.size(); ++n)
if (m_config["modalenergy"].m_beenSet)
{
cnt = 0;
int cnt1 = 0;
if (m_config["modalenergy"].m_beenSet)
Array<OneD, const NekDouble> phys = m_f->m_exp[n]->GetPhys();
for (int i = 0; i < nel; ++i)
{
Array<OneD, const NekDouble> phys = m_f->m_exp[n]->GetPhys();
for (int i = 0; i < nel; ++i)
{
GenOrthoModes(i, phys + cnt, tmp = pts[coordim + n] + cnt1);
cnt1 += ppe[i];
cnt += m_f->m_exp[0]->GetExp(i)->GetTotPoints();
}
GenOrthoModes(i, phys + cnt, tmp = pts[coordim + n] + cnt1);
cnt1 += ppe[i];
cnt += m_f->m_exp[0]->GetExp(i)->GetTotPoints();
}
else
}
else
{
Array<OneD, const NekDouble> phys = m_f->m_exp[n]->GetPhys();
for (int i = 0; i < nel; ++i)
{
Array<OneD, const NekDouble> phys = m_f->m_exp[n]->GetPhys();
for (int i = 0; i < nel; ++i)
{
m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
phys + cnt, tmp = pts[coordim + n] + cnt1);
cnt1 += ppe[i];
cnt += m_f->m_exp[0]->GetExp(i)->GetTotPoints();
}
m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
phys + cnt, tmp = pts[coordim + n] + cnt1);
cnt1 += ppe[i];
cnt += m_f->m_exp[0]->GetExp(i)->GetTotPoints();
}
// Set up Variable string.
fieldNames.push_back(m_f->m_fielddef[0]->m_fields[n]);
}
}
m_f->m_fieldPts = MemoryManager<LibUtilities::PtsField>::AllocateSharedPtr(
coordim, fieldNames, pts);
coordim, m_f->m_variables, pts);
if (shapedim == 1)
{
m_f->m_fieldPts->SetPtsType(LibUtilities::ePtsSegBlock);
......
......@@ -66,8 +66,8 @@ void ProcessGrad::Process(po::variables_map &vm)
{
int i, j;
int expdim = m_f->m_graph->GetMeshDimension();
int spacedim = m_f->m_fielddef[0]->m_numHomogeneousDir + expdim;
int nfields = m_f->m_fielddef[0]->m_fields.size();
int spacedim = m_f->m_numHomogeneousDir + expdim;
int nfields = m_f->m_variables.size();
int addfields = nfields * spacedim;
int npoints = m_f->m_exp[0]->GetNpoints();
......@@ -165,7 +165,7 @@ void ProcessGrad::Process(po::variables_map &vm)
for (i = 0; i < addfields; ++i)
{
m_f->m_exp[nfields + i] =
m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
m_f->AppendExpList(m_f->m_numHomogeneousDir);
Vmath::Vcopy(npoints, grad[i], 1, m_f->m_exp[nfields + i]->UpdatePhys(),
1);
m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(
......@@ -176,36 +176,20 @@ void ProcessGrad::Process(po::variables_map &vm)
{
if (spacedim == 1)
{
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_x");
m_f->m_variables.push_back(m_f->m_variables[i] + "_x");
}
else if (spacedim == 2)
{
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_x");
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_y");
m_f->m_variables.push_back(m_f->m_variables[i] + "_x");
m_f->m_variables.push_back(m_f->m_variables[i] + "_y");
}
else if (spacedim == 3)
{
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_x");
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_y");
m_f->m_variables.push_back(m_f->m_fielddef[0]->m_fields[i] + "_z");
m_f->m_variables.push_back(m_f->m_variables[i] + "_x");
m_f->m_variables.push_back(m_f->m_variables[i] + "_y");
m_f->m_variables.push_back(m_f->m_variables[i] + "_z");
}
}
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (j = 0; j < nfields + addfields; ++j)
{
for (i = 0; i < FieldDef.size(); ++i)
{
FieldDef[i]->m_fields.push_back(m_f->m_variables[j]);
m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
}
......@@ -68,7 +68,7 @@ ProcessHomogeneousPlane::~ProcessHomogeneousPlane()
void ProcessHomogeneousPlane::Process(po::variables_map &vm)
{
if ((m_f->m_fielddef[0]->m_numHomogeneousDir) != 1)
if ((m_f->m_numHomogeneousDir) != 1)
{
ASSERTL0(false,
"ProcessHomogeneousPlane only works for Homogeneous1D.");
......@@ -78,16 +78,16 @@ void ProcessHomogeneousPlane::Process(po::variables_map &vm)
"Missing parameter planeid for ProcessHomogeneousPlane");
int planeid = m_config["planeid"].as<int>();
int nfields = m_f->m_fielddef[0]->m_fields.size();
int nfields = m_f->m_variables.size();
int nstrips;
m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
// Look for correct plane (because of parallel case)
int plane = -1;
for (int i = 0; i < m_f->m_fielddef[0]->m_homogeneousZIDs.size(); ++i)
for (int i = 0; i < m_f->m_exp[0]->GetZIDs().num_elements(); ++i)
{
if (m_f->m_fielddef[0]->m_homogeneousZIDs[i] == planeid)
if (m_f->m_exp[0]->GetZIDs()[i] == planeid)
{
plane = i;
}
......@@ -114,28 +114,6 @@ void ProcessHomogeneousPlane::Process(po::variables_map &vm)
}
}
}
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());