Commit 8954dc7b authored by Douglas Serson's avatar Douglas Serson
Browse files

Move conversion to equispaced points to output modules

parent 64fee55e
......@@ -137,7 +137,7 @@ class Module
{
public:
FIELD_UTILS_EXPORT Module(FieldSharedPtr p_f)
: m_f(p_f), m_requireEquiSpaced(false)
: m_f(p_f)
{
}
virtual void Process(po::variables_map &vm) = 0;
......@@ -153,16 +153,6 @@ public:
FIELD_UTILS_EXPORT void PrintConfig();
FIELD_UTILS_EXPORT void SetDefaults();
FIELD_UTILS_EXPORT bool GetRequireEquiSpaced(void)
{
return m_requireEquiSpaced;
}
FIELD_UTILS_EXPORT void SetRequireEquiSpaced(bool pVal)
{
m_requireEquiSpaced = pVal;
}
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts(
LocalRegions::ExpansionSharedPtr &exp,
const Array<OneD, const NekDouble> &infield,
......@@ -175,7 +165,6 @@ protected:
FieldSharedPtr m_f;
/// List of configuration values.
map<string, ConfigOption> m_config;
bool m_requireEquiSpaced;
};
/**
......
......@@ -49,6 +49,7 @@ namespace FieldUtils
OutputFileBase::OutputFileBase(FieldSharedPtr f) : OutputModule(f)
{
m_requireEquiSpaced = false;
}
OutputFileBase::~OutputFileBase()
......@@ -103,6 +104,44 @@ void OutputFileBase::Process(po::variables_map &vm)
}
else if(m_f->m_exp.size())
{
// reset expansion definition to use equispaced points if required.
if (m_requireEquiSpaced && (vm.count("noequispaced") == 0 ) )
{
// Information to create new expansion
int numFields = m_f->m_exp.size();
m_f->m_fielddef = m_f->m_exp[0]->GetFieldDefinitions();
// Set points to equispaced
int nPointsNew = 0;
if (vm.count("output-points"))
{
nPointsNew = vm["output-points"].as<int>();
}
m_f->m_graph->SetExpansionsToEvenlySpacedPoints(nPointsNew);
// Save original expansion
vector<MultiRegions::ExpListSharedPtr> expOld = m_f->m_exp;
// Create new expansion
m_f->m_exp[0] = m_f->SetUpFirstExpList(m_f->m_numHomogeneousDir,
true);
for(int i = 1; i < numFields; ++i)
{
m_f->m_exp[i] =
m_f->AppendExpList(m_f->m_numHomogeneousDir);
}
// Extract result to new expansion
for(int i = 0; i < numFields; ++i)
{
m_f->m_exp[i]->ExtractCoeffsToCoeffs(
expOld[i],
expOld[i]->GetCoeffs(),
m_f->m_exp[i]->UpdateCoeffs());
m_f->m_exp[i]->BwdTrans(
m_f->m_exp[i]->GetCoeffs(),
m_f->m_exp[i]->UpdatePhys());
}
}
OutputFromExp(vm);
}
else if(m_f->m_data.size())
......
......@@ -73,6 +73,9 @@ public:
return "Writing file";
}
protected:
bool m_requireEquiSpaced;
};
}
}
......
......@@ -74,10 +74,7 @@ OutputTecplot::OutputTecplot(FieldSharedPtr f) : OutputFileBase(f),
m_binary(false),
m_oneOutputFile(false)
{
if (!f->m_setUpEquiSpacedFields)
{
m_requireEquiSpaced = true;
}
m_requireEquiSpaced = true;
m_config["writemultiplefiles"] =
ConfigOption(true,"0","Write multiple files in parallel");
}
......
......@@ -133,25 +133,11 @@ void ProcessCreateExp::Process(po::variables_map &vm)
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"))
// Adjust number of quadrature points
if (vm.count("output-points"))
{
int nPointsNew = 0;
if (vm.count("output-points"))
{
nPointsNew = vm["output-points"].as<int>();
}
m_f->m_graph->SetExpansionsToEvenlySpacedPoints(nPointsNew);
}
else
{
if (vm.count("output-points"))
{
int nPointsNew = vm["output-points"].as<int>();
m_f->m_graph->SetExpansionsToPointOrder(nPointsNew);
}
int nPointsNew = vm["output-points"].as<int>();
m_f->m_graph->SetExpansionsToPointOrder(nPointsNew);
}
if (m_f->m_verbose)
......
......@@ -120,7 +120,6 @@ void ProcessEquiSpacedOutput::SetupEquiSpacedField(void)
LocalRegions::ExpansionSharedPtr e;
// prepare PtsField
vector<std::string> fieldNames;
vector<int> ppe;
vector<Array<OneD, int> > ptsConn;
int nfields;
......
......@@ -59,8 +59,6 @@ ModuleKey ProcessPointDataToFld::className =
ProcessPointDataToFld::ProcessPointDataToFld(FieldSharedPtr f)
: ProcessModule(f)
{
m_requireEquiSpaced = true;
m_config["setnantovalue"] = ConfigOption(
false, "NotSet", "reset any nan value to prescribed value");
......
......@@ -65,7 +65,7 @@ ProcessVorticity::~ProcessVorticity()
void ProcessVorticity::Process(po::variables_map &vm)
{
int i, j, s;
int i, s;
int expdim = m_f->m_graph->GetMeshDimension();
int spacedim = expdim;
if ((m_f->m_numHomogeneousDir) == 1 || (m_f->m_numHomogeneousDir) == 2)
......
......@@ -446,22 +446,6 @@ void FilterFieldConvert::CreateModules( vector<string> &modcmds)
// Ensure configuration options have been set.
mod->SetDefaults();
}
bool RequiresEquiSpaced = false;
for (int i = 0; i < m_modules.size(); ++i)
{
if(m_modules[i]->GetRequireEquiSpaced())
{
RequiresEquiSpaced = true;
}
}
if (RequiresEquiSpaced)
{
for (int i = 0; i < m_modules.size(); ++i)
{
m_modules[i]->SetRequireEquiSpaced(true);
}
}
}
void FilterFieldConvert::CreateFields(
......
......@@ -360,33 +360,6 @@ int main(int argc, char* argv[])
mod->SetDefaults();
}
// If any output module has to reset points then set intput modules to match
if(vm.count("noequispaced"))
{
for (int i = 0; i < modules.size(); ++i)
{
modules[i]->SetRequireEquiSpaced(false);
}
}
else
{
bool RequiresEquiSpaced = false;
for (int i = 0; i < modules.size(); ++i)
{
if(modules[i]->GetRequireEquiSpaced())
{
RequiresEquiSpaced = true;
}
}
if (RequiresEquiSpaced)
{
for (int i = 0; i < modules.size(); ++i)
{
modules[i]->SetRequireEquiSpaced(true);
}
}
}
// Run field process.
for (int i = 0; i < modules.size(); ++i)
{
......
......@@ -3100,7 +3100,10 @@
<DOMAIN> C[17] </DOMAIN>
</GEOMETRY>
<EXPANSIONS>
<E COMPOSITE="C[17]" NUMMODES="4" TYPE="MODIFIED" FIELDS="u" />
<E COMPOSITE="C[17]"
NUMMODES="4,4" BASISTYPE="Modified_A,Modified_B"
NUMPOINTS="4,4" POINTSTYPE="PolyEvenlySpaced,PolyEvenlySpaced"
FIELDS="u" />
</EXPANSIONS>
<CONDITIONS />
</NEKTAR>
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