Commit bc866953 authored by Kilian Lackhove's avatar Kilian Lackhove
Browse files

FieldConvert: show progressbars ehrn using interpolator

parent 0db55741
......@@ -40,6 +40,7 @@ using namespace std;
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <SolverUtils/Interpolator.h>
#include <boost/math/special_functions/fpclassify.hpp>
namespace Nektar
......@@ -229,7 +230,16 @@ void ProcessInterpField::Process(po::variables_map &vm)
}
SolverUtils::Interpolator interp;
if (m_f->m_comm->GetRank() == 0)
{
interp.SetProgressCallback(&ProcessInterpField::PrintProgressbar,
this);
}
interp.Interpolate(m_fromField->m_exp, m_f->m_exp);
if (m_f->m_comm->GetRank() == 0)
{
cout << endl;
}
for (int i = 0; i < nfields; ++i)
{
......@@ -266,6 +276,12 @@ void ProcessInterpField::Process(po::variables_map &vm)
m_f->m_data = FieldData;
}
void ProcessInterpField::PrintProgressbar(const int position,
const int goal) const
{
LibUtilities::PrintProgressbar(position, goal, "Interpolating");
}
}
}
......
......@@ -61,6 +61,8 @@ class ProcessInterpField : public ProcessModule
/// Write mesh to output file.
virtual void Process(po::variables_map &vm);
void PrintProgressbar(const int position, const int goal) const;
private:
FieldSharedPtr m_fromField;
......
......@@ -105,18 +105,19 @@ void ProcessInterpPointDataToFld::Process(po::variables_map &vm)
ASSERTL0(coord_id <= m_f->m_fieldPts->GetDim() - 1,
"interpcoord is bigger than the Pts files dimension");
// interpolate points and transform
if (m_f->m_session->GetComm()->GetRank() == 0)
SolverUtils::Interpolator interp(SolverUtils::eNoMethod, coord_id);
if (m_f->m_comm->GetRank() == 0)
{
m_f->m_fieldPts->setProgressCallback(
interp.SetProgressCallback(
&ProcessInterpPointDataToFld::PrintProgressbar, this);
cout << "Interpolating: ";
}
interp.Interpolate(m_f->m_fieldPts, outPts);
if (m_f->m_comm->GetRank() == 0)
{
cout << endl;
}
SolverUtils::Interpolator Interp(SolverUtils::eNoMethod, coord_id);
Interp.Interpolate(m_f->m_fieldPts, outPts);
cout << " done" << endl;
for(i = 0; i < totpoints; ++i)
{
......@@ -126,11 +127,6 @@ void ProcessInterpPointDataToFld::Process(po::variables_map &vm)
}
}
if(m_f->m_session->GetComm()->GetRank() == 0)
{
cout << endl;
}
// forward transform fields
for(i = 0; i < nFields; ++i)
{
......
......@@ -40,6 +40,7 @@ using namespace std;
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <SolverUtils/Interpolator.h>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/lexical_cast.hpp>
......@@ -505,11 +506,6 @@ void ProcessInterpPoints::Process(po::variables_map &vm)
m_f->m_fieldPts->AddField(newPts, fromField->m_fielddef[0]->m_fields[j]);
}
if(rank == 0)
{
cout << "Interpolating on proc 0 [" << flush;
}
NekDouble clamp_low = m_config["clamptolowervalue"].as<NekDouble>();
NekDouble clamp_up = m_config["clamptouppervalue"].as<NekDouble>();
NekDouble def_value = m_config["defaultvalue"].as<NekDouble>();
......@@ -517,11 +513,6 @@ void ProcessInterpPoints::Process(po::variables_map &vm)
InterpolateFieldToPts(fromField->m_exp, m_f->m_fieldPts,
clamp_low, clamp_up, def_value);
if(rank == 0)
{
cout << "]" << endl;
}
if(!boost::iequals(m_config["cp"].as<string>(),"NotSet"))
{
calcCp0();
......@@ -547,7 +538,16 @@ void ProcessInterpPoints::InterpolateFieldToPts(
}
SolverUtils::Interpolator interp;
if (m_f->m_comm->GetRank() == 0)
{
interp.SetProgressCallback(&ProcessInterpPoints::PrintProgressbar,
this);
}
interp.Interpolate(field0, pts);
if (m_f->m_comm->GetRank() == 0)
{
cout << endl;
}
for (int f = 0; f < nfields; ++f)
{
......@@ -665,5 +665,11 @@ void ProcessInterpPoints::calcCp0()
}
}
void ProcessInterpPoints::PrintProgressbar(const int position,
const int goal) const
{
LibUtilities::PrintProgressbar(position, goal, "Interpolating");
}
}
}
......@@ -63,6 +63,8 @@ class ProcessInterpPoints : public ProcessModule
/// Write mesh to output file.
virtual void Process(po::variables_map &vm);
void PrintProgressbar(const int position, const int goal) const;
private:
void InterpolateFieldToPts(vector<MultiRegions::ExpListSharedPtr> &field0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment