47 #include <boost/math/special_functions/fpclassify.hpp>
53 ModuleKey ProcessInterpPointDataToFld::className =
56 ProcessInterpPointDataToFld::create,
57 "Interpolates given discrete data using a finite difference "
58 "approximation to a fld file given a xml file");
65 ConfigOption(
false,
"-1",
"coordinate id to use for interpolation");
76 if (
m_f->m_comm->TreatAsRankZero())
79 <<
"ProcessInterpPointDataToFld: interpolating data to field..."
88 "No input points found");
90 int nFields =
m_f->m_fieldPts->GetNFields();
91 ASSERTL0(nFields > 0,
"No field values provided in input");
94 m_f->m_exp.resize(nFields + 1);
95 for (i = 1; i < nFields; ++i)
97 m_f->m_exp[i] =
m_f->AppendExpList(0);
100 int totpoints =
m_f->m_exp[0]->GetTotPoints();
102 for (
int i = 0; i < 3 + nFields; ++i)
106 m_f->m_exp[0]->GetCoords(intFields[0], intFields[1], intFields[2]);
110 int coord_id =
m_config[
"interpcoord"].as<
int>();
111 ASSERTL0(coord_id <= m_f->m_fieldPts->GetDim() - 1,
112 "interpcoord is bigger than the Pts files dimension");
116 if (
m_f->m_comm->GetRank() == 0)
118 interp.SetProgressCallback(
121 interp.Interpolate(
m_f->m_fieldPts, outPts);
122 if (
m_f->m_comm->GetRank() == 0)
127 for (i = 0; i < totpoints; ++i)
129 for (j = 0; j < nFields; ++j)
131 m_f->m_exp[j]->SetPhys(i, outPts->GetPointVal(j, i));
136 for (i = 0; i < nFields; ++i)
138 m_f->m_exp[i]->FwdTrans_IterPerExp(
m_f->m_exp[i]->GetPhys(),
139 m_f->m_exp[i]->UpdateCoeffs());
143 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
144 m_f->m_exp[0]->GetFieldDefinitions();
145 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
147 for (j = 0; j < nFields; ++j)
149 for (i = 0; i < FieldDef.size(); ++i)
151 FieldDef[i]->m_fields.push_back(
m_f->m_fieldPts->GetFieldName(j));
153 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
157 m_f->m_fielddef = FieldDef;
158 m_f->m_data = FieldData;
map< string, ConfigOption > m_config
List of configuration values.
#define ASSERTL0(condition, msg)
A class that contains algorithms for interpolation between pts fields, expansions and different meshe...
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Represents a command-line configuration option.
virtual ~ProcessInterpPointDataToFld()
pair< ModuleType, string > ModuleKey
boost::shared_ptr< PtsField > PtsFieldSharedPtr
boost::shared_ptr< Field > FieldSharedPtr
static PtsFieldSharedPtr NullPtsField
void PrintProgressbar(const int position, const int goal) const
virtual void Process(po::variables_map &vm)
Write mesh to output file.
Abstract base class for processing modules.
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.