50 ModuleKey ProcessHomogeneousStretch::className =
53 ProcessHomogeneousStretch::create,
54 "Stretches homogeneous direction of a 3DH1D expansion, requires factor "
56 "defined. The number of modes in the final expansion can be defined "
58 " --output-points-hom-z.");
74 if (
m_f->m_comm->GetRank() == 0)
76 cout <<
"ProcessHomogeneousStretch: Stretching expansion..."
81 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) != 1)
84 "ProcessHomogeneousStretch only works for Homogeneous1D.");
88 "Missing parameter factor for ProcessHomogeneousStretch");
90 int factor =
m_config[
"factor"].as<
int>();
91 int nfields =
m_f->m_fielddef[0]->m_fields.size();
92 int nplanes =
m_f->m_exp[0]->GetHomogeneousBasis()->GetZ().num_elements();
94 ASSERTL0(factor > 1,
"Parameter factor must be greater than 1.");
97 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
99 for (
int s = 0; s < nstrips; ++s)
101 for (
int i = 0; i < nfields; ++i)
103 int n = s * nfields + i;
104 int ncoeffs =
m_f->m_exp[n]->GetPlane(0)->GetNcoeffs();
106 for (
int p = nplanes - 1;
p > 1; --
p)
108 int newP = 2 * factor * (
p / 2) +
p % 2;
112 ncoeffs,
m_f->m_exp[n]->GetPlane(
p)->GetCoeffs(), 1,
113 m_f->m_exp[n]->GetPlane(newP)->UpdateCoeffs(), 1);
119 m_f->m_exp[n]->BwdTrans(
m_f->m_exp[n]->GetCoeffs(),
120 m_f->m_exp[n]->UpdatePhys());
123 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
124 m_f->m_exp[0]->GetFieldDefinitions();
125 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
127 for (
int s = 0; s < nstrips; ++s)
129 for (
int j = 0; j < nfields; ++j)
131 for (
int i = 0; i < FieldDef.size() / nstrips; ++i)
133 int n = s * FieldDef.size() / nstrips + i;
135 FieldDef[n]->m_fields.push_back(
136 m_f->m_fielddef[0]->m_fields[j]);
137 m_f->m_exp[s * nfields + j]->AppendFieldData(FieldDef[n],
142 for (
int i = 0; i < FieldDef.size(); ++i)
144 FieldDef[i]->m_homogeneousLengths[0] =
145 factor *
m_f->m_fielddef[i]->m_homogeneousLengths[0];
147 m_f->m_fielddef = FieldDef;
148 m_f->m_data = FieldData;
map< string, ConfigOption > m_config
List of configuration values.
#define ASSERTL0(condition, msg)
Represents a command-line configuration option.
pair< ModuleType, string > ModuleKey
boost::shared_ptr< Field > FieldSharedPtr
virtual void Process(po::variables_map &vm)
Write mesh to output file.
virtual ~ProcessHomogeneousStretch()
void Zero(int n, T *x, const int incx)
Zero vector.
Abstract base class for processing modules.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.