45 #include <boost/math/special_functions/fpclassify.hpp>
51 ModuleKey ProcessInterpPointDataToFld::className =
54 ProcessInterpPointDataToFld::create,
55 "Interpolates given discrete data using a finite difference "
56 "approximation to a fld file given a xml file");
64 "coordinate id to use for interpolation");
78 "No input points found");
80 int nFields =
m_f->m_fieldPts->GetNFields();
82 "No field values provided in input");
85 m_f->m_exp.resize(nFields+1);
86 for(i = 1; i < nFields; ++i)
88 m_f->m_exp[i] =
m_f->AppendExpList(0);
91 int totpoints =
m_f->m_exp[0]->GetTotPoints();
98 m_f->m_exp[0]->GetCoords(coords[0],coords[1],coords[2]);
100 int coord_id =
m_config[
"interpcoord"].as<
int>();
101 ASSERTL0(coord_id <= m_f->m_fieldPts->GetDim() - 1,
102 "interpcoord is bigger than the Pts files dimension");
106 if (
m_f->m_session->GetComm()->GetRank() == 0)
108 m_f->m_fieldPts->setProgressCallback(
110 cout <<
"Interpolating: ";
112 m_f->m_fieldPts->Interpolate(coords, intFields, coord_id);
114 for(i = 0; i < totpoints; ++i)
116 for(j = 0; j < nFields; ++j)
118 m_f->m_exp[j]->SetPhys(i, intFields[j][i]);
122 if(
m_f->m_session->GetComm()->GetRank() == 0)
128 for(i = 0; i < nFields; ++i)
130 m_f->m_exp[i]->FwdTrans_IterPerExp(
m_f->m_exp[i]->GetPhys(),
131 m_f->m_exp[i]->UpdateCoeffs());
136 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
137 =
m_f->m_exp[0]->GetFieldDefinitions();
138 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
140 for (j = 0; j < nFields; ++j)
142 for (i = 0; i < FieldDef.size(); ++i)
144 FieldDef[i]->m_fields.push_back(
m_f->m_fieldPts->GetFieldName(j));
146 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
150 m_f->m_fielddef = FieldDef;
151 m_f->m_data = FieldData;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
virtual ~ProcessInterpPointDataToFld()
boost::shared_ptr< Field > FieldSharedPtr
Represents a command-line configuration option.
static PtsFieldSharedPtr NullPtsField
void PrintProgressbar(const int position, const int goal) const
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.