Commit 2110e20f authored by Douglas Serson's avatar Douglas Serson Committed by Spencer Sherwin
Browse files

Rewrite meanmode module using homogeneous plane

parent daa56c79
......@@ -52,7 +52,7 @@ ModuleKey ProcessMeanMode::className =
ModuleKey(eProcessModule, "meanmode"),
ProcessMeanMode::create, "Extract mean mode from 3DH1D.");
ProcessMeanMode::ProcessMeanMode(FieldSharedPtr f) : ProcessModule(f)
ProcessMeanMode::ProcessMeanMode(FieldSharedPtr f) : ProcessHomogeneousPlane(f)
{
}
......@@ -66,52 +66,17 @@ void ProcessMeanMode::Process(po::variables_map &vm)
{
cout << "ProcessMeanMode: Extracting mean mode..." << endl;
}
if ((m_f->m_fielddef[0]->m_numHomogeneousDir) != 1)
{
ASSERTL0(false, "ProcessMeanMode only works for Homogeneous1D.");
}
if (m_f->m_fielddef[0]->m_homogeneousZIDs[0] != 0)
{
ASSERTL0(false, "ProcessMeanMode: mean mode not found.");
}
int nfields = m_f->m_fielddef[0]->m_fields.size();
int nstrips;
m_f->m_session->LoadParameter("Strip_Z",nstrips,1);
for(int s = 0; s < nstrips; ++s)
{
for (int i = 0; i < nfields; ++i)
{
int n = s*nfields + i;
m_f->m_exp[n] = m_f->m_exp[n]->GetPlane(0);
m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
m_f->m_exp[n]->UpdatePhys());
}
}
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for(int s = 0; s < nstrips; ++s)
{
for (int j = 0; j < nfields; ++j)
{
for (int i = 0; i < FieldDef.size()/nstrips; ++i)
{
int n = s * FieldDef.size()/nstrips + i;
FieldDef[n]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[j]);
m_f->m_exp[s*nfields+j]->AppendFieldData(FieldDef[n], FieldData[n]);
}
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
// Set parameters for mean mode
RegisterConfig("planeid" , "0");
RegisterConfig("wavespace", "1");
ProcessHomogeneousPlane::Process(vm);
}
}
......
......@@ -37,6 +37,7 @@
#define UTILITIES_PREPROCESSING_FIELDCONVERT_PROCESSMEANMODE
#include "../Module.h"
#include "ProcessHomogeneousPlane.h"
namespace Nektar
{
......@@ -46,7 +47,7 @@ namespace Utilities
* @brief This processing module replaces all expansions by the mean mode
* from 3DH1D fields
*/
class ProcessMeanMode : public ProcessModule
class ProcessMeanMode : public ProcessHomogeneousPlane
{
public:
/// Creates an instance of this class
......
Supports Markdown
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