39 #include <boost/core/ignore_unused.hpp> 40 #include <boost/geometry.hpp> 41 #include <boost/math/special_functions/fpclassify.hpp> 51 namespace bg = boost::geometry;
52 namespace bgi = boost::geometry::index;
59 ModuleKey ProcessInterpPointDataToFld::className =
62 ProcessInterpPointDataToFld::create,
63 "Interpolates given discrete data using a finite difference " 64 "approximation to a fld file given a xml file");
70 false,
"NotSet",
"Pts file from which to interpolate field");
73 ConfigOption(
false,
"-1",
"coordinate id to use for interpolation");
82 boost::ignore_unused(vm);
88 "ProcessInterpPointDataToFld requires frompts parameter");
89 string inFile =
m_config[
"frompts"].as<
string>().c_str();
91 if (boost::filesystem::path(inFile).extension() ==
".pts")
96 ptsIO->Import(inFile, fieldPts);
98 else if (boost::filesystem::path(inFile).extension() ==
".csv")
103 csvIO->Import(inFile, fieldPts);
107 ASSERTL0(
false,
"unknown frompts file type");
110 int nFields = fieldPts->GetNFields();
111 ASSERTL0(nFields > 0,
"No field values provided in input");
115 "ProcessInterpPointDataToFld does not support homogeneous expansion");
117 m_f->m_exp.resize(nFields);
118 for (i = 1; i < nFields; ++i)
120 m_f->m_exp[i] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
123 int totpoints =
m_f->m_exp[0]->GetTotPoints();
125 for (
int i = 0; i < 3 + nFields; ++i)
129 m_f->m_exp[0]->GetCoords(intFields[0], intFields[1], intFields[2]);
133 int coord_id =
m_config[
"interpcoord"].as<
int>();
134 cout << coord_id << endl;
135 cout << outPts->GetDim() << endl;
136 ASSERTL0(coord_id <= static_cast<int>(outPts->GetDim()) - 1,
137 "interpcoord is bigger than the Pts files dimension");
141 if (
m_f->m_verbose &&
m_f->m_comm->TreatAsRankZero())
147 if (
m_f->m_verbose &&
m_f->m_comm->TreatAsRankZero())
152 for (i = 0; i < totpoints; ++i)
154 for (j = 0; j < nFields; ++j)
156 m_f->m_exp[j]->SetPhys(i, outPts->GetPointVal(3 + j, i));
161 for (i = 0; i < nFields; ++i)
163 m_f->m_exp[i]->FwdTrans_IterPerExp(
m_f->m_exp[i]->GetPhys(),
164 m_f->m_exp[i]->UpdateCoeffs());
168 for (
int j = 0; j < fieldPts->GetNFields(); ++j)
170 m_f->m_variables.push_back(fieldPts->GetFieldName(j));
#define ASSERTL0(condition, msg)
A class that contains algorithms for interpolation between pts fields, expansions and different meshe...
std::map< std::string, ConfigOption > m_config
List of configuration values.
void SetProgressCallback(FuncPointerT func, ObjectPointerT obj)
sets a callback funtion which gets called every time the interpolation progresses ...
Represents a command-line configuration option.
virtual ~ProcessInterpPointDataToFld()
std::shared_ptr< Field > FieldSharedPtr
std::shared_ptr< PtsIO > PtsIOSharedPtr
std::shared_ptr< PtsField > PtsFieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
FIELD_UTILS_EXPORT void Interpolate(const std::vector< MultiRegions::ExpListSharedPtr > expInField, std::vector< MultiRegions::ExpListSharedPtr > &expOutField, NekDouble def_value=0.0)
Interpolate from an expansion to an expansion.
void PrintProgressbar(const int position, const int goal) const
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
virtual void Process(po::variables_map &vm)
Write mesh to output file.
Abstract base class for processing modules.
std::shared_ptr< CsvIO > CsvIOSharedPtr
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.