39 #include <boost/core/ignore_unused.hpp> 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.");
73 boost::ignore_unused(vm);
76 if (
m_f->m_exp[0]->GetNumElmts() == 0)
82 "ProcessHomogeneousStretch only works for Homogeneous1D.");
85 "Missing parameter factor for ProcessHomogeneousStretch");
87 int factor =
m_config[
"factor"].as<
int>();
88 int nfields =
m_f->m_variables.size();
89 int nplanes =
m_f->m_exp[0]->GetHomogeneousBasis()->GetZ().num_elements();
91 ASSERTL0(factor > 1,
"Parameter factor must be an int greater than 1.");
94 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
96 for (
int s = 0; s < nstrips; ++s)
98 for (
int i = 0; i < nfields; ++i)
100 int n = s * nfields + i;
101 int ncoeffs =
m_f->m_exp[n]->GetPlane(0)->GetNcoeffs();
103 for (
int p = nplanes - 1;
p > 1; --
p)
105 int newP = 2 * factor * (
p / 2) +
p % 2;
109 ncoeffs,
m_f->m_exp[n]->GetPlane(
p)->GetCoeffs(), 1,
110 m_f->m_exp[n]->GetPlane(newP)->UpdateCoeffs(), 1);
116 m_f->m_exp[n]->BwdTrans(
m_f->m_exp[n]->GetCoeffs(),
117 m_f->m_exp[n]->UpdatePhys());
118 m_f->m_exp[n]->SetHomoLen(factor*
m_f->m_exp[n]->GetHomoLen());
#define ASSERTL0(condition, msg)
std::map< std::string, ConfigOption > m_config
List of configuration values.
Represents a command-line configuration option.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
virtual void Process(po::variables_map &vm)
Write mesh to output file.
virtual ~ProcessHomogeneousStretch()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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.