44 #include <boost/math/special_functions/fpclassify.hpp>
50 ModuleKey ProcessInterpPointDataToFld::className =
53 ProcessInterpPointDataToFld::create,
54 "Interpolates given discrete data using a finite differece "
55 "approximation to a fld file given a xml file");
63 "coordinate id ot use for interpolation");
76 cout <<
"Processing point data interpolation (linear)" << endl;
81 "No input points found");
84 "No field values provided in input");
87 m_f->m_exp.resize(
m_f->m_fieldPts->m_nFields+1);
88 for(i = 1; i <
m_f->m_fieldPts->m_nFields; ++i)
90 m_f->m_exp[i] =
m_f->AppendExpList(0);
93 if(
m_f->m_session->GetComm()->GetRank() == 0)
95 cout <<
"Interpolating [" << flush;
98 int totpoints =
m_f->m_exp[0]->GetTotPoints();
99 Array<OneD,NekDouble> coords[3];
101 coords[0] = Array<OneD,NekDouble>(totpoints);
102 coords[1] = Array<OneD,NekDouble>(totpoints);
103 coords[2] = Array<OneD,NekDouble>(totpoints);
105 m_f->m_exp[0]->GetCoords(coords[0],coords[1],coords[2]);
107 int coord_id =
m_config[
"interpcoord"].as<
int>();
110 Array<OneD, NekDouble> intfields(
m_f->m_fieldPts->m_nFields);
111 for(i = 0; i < totpoints; ++i)
113 m_f->m_fieldPts->Interp1DPts(coords[coord_id][i],intfields);
114 for(j = 0; j <
m_f->m_fieldPts->m_nFields; ++j)
116 m_f->m_exp[j]->SetPhys(i,intfields[j]);
120 if(
m_f->m_session->GetComm()->GetRank() == 0)
126 for(i = 0; i <
m_f->m_fieldPts->m_nFields; ++i)
128 m_f->m_exp[i]->FwdTrans_IterPerExp(
m_f->m_exp[i]->GetPhys(),
129 m_f->m_exp[i]->UpdateCoeffs());
134 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
135 =
m_f->m_exp[0]->GetFieldDefinitions();
136 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
138 for (j = 0; j <
m_f->m_fieldPts->m_nFields; ++j)
140 for (i = 0; i < FieldDef.size(); ++i)
142 FieldDef[i]->m_fields.push_back(
m_f->m_fieldPts->m_fields[j]);
144 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
148 m_f->m_fielddef = FieldDef;
149 m_f->m_data = FieldData;