Commit 38c18f5b authored by Douglas Serson's avatar Douglas Serson

Move interpolator to FieldUtils

parent 9f589b22
SET(FieldUtilsHeaders
Module.h
Field.hpp
Interpolator.h
InputModules/InputDat.h
InputModules/InputFld.h
InputModules/InputXml.h
......@@ -46,6 +47,7 @@ SET(FieldUtilsHeaders
SET(FieldUtilsSources
Module.cpp
Interpolator.cpp
InputModules/InputDat.cpp
InputModules/InputFld.cpp
InputModules/InputXml.cpp
......
......@@ -34,13 +34,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
using namespace std;
namespace Nektar
{
namespace SolverUtils
namespace FieldUtils
{
/**
......
......@@ -34,8 +34,8 @@
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_INTERPOLATOR_H
#define NEKTAR_SOLVERUTILS_INTERPOLATOR_H
#ifndef FIELDUTILS_INTERPOLATOR_H
#define FIELDUTILS_INTERPOLATOR_H
#include <vector>
......@@ -54,12 +54,14 @@
#include <LibUtilities/BasicUtils/VmathArray.hpp>
#include <LibUtilities/BasicUtils/PtsField.h>
#include "FieldUtilsDeclspec.h"
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
namespace Nektar
{
namespace SolverUtils
namespace FieldUtils
{
enum InterpMethod
......@@ -102,52 +104,52 @@ public:
m_coordId(coordId){};
/// Compute interpolation weights without doing any interpolation
LIB_UTILITIES_EXPORT void CalcWeights(
FIELD_UTILS_EXPORT void CalcWeights(
const LibUtilities::PtsFieldSharedPtr ptsInField,
LibUtilities::PtsFieldSharedPtr &ptsOutField);
/// Interpolate from a pts field to a pts field
LIB_UTILITIES_EXPORT void Interpolate(
FIELD_UTILS_EXPORT void Interpolate(
const LibUtilities::PtsFieldSharedPtr ptsInField,
LibUtilities::PtsFieldSharedPtr &ptsOutField);
/// Interpolate from an expansion to an expansion
LIB_UTILITIES_EXPORT void Interpolate(
FIELD_UTILS_EXPORT void Interpolate(
const std::vector<MultiRegions::ExpListSharedPtr> expInField,
std::vector<MultiRegions::ExpListSharedPtr> &expOutField);
/// Interpolate from an expansion to a pts field
LIB_UTILITIES_EXPORT void Interpolate(
FIELD_UTILS_EXPORT void Interpolate(
const std::vector<MultiRegions::ExpListSharedPtr> expInField,
LibUtilities::PtsFieldSharedPtr &ptsOutField);
/// Interpolate from a pts field to an expansion
LIB_UTILITIES_EXPORT void Interpolate(
FIELD_UTILS_EXPORT void Interpolate(
const LibUtilities::PtsFieldSharedPtr ptsInField,
std::vector<MultiRegions::ExpListSharedPtr> &expOutField);
/// returns the dimension of the Interpolator.
/// Should be higher than the dimensions of the interpolated fields
LIB_UTILITIES_EXPORT int GetDim() const;
FIELD_UTILS_EXPORT int GetDim() const;
/// Returns the filter width
LIB_UTILITIES_EXPORT NekDouble GetFiltWidth() const;
FIELD_UTILS_EXPORT NekDouble GetFiltWidth() const;
/// Returns the coordinate id along which the interpolation should be
/// performed
LIB_UTILITIES_EXPORT int GetCoordId() const;
FIELD_UTILS_EXPORT int GetCoordId() const;
/// Returns the interpolation method used by this interpolator
LIB_UTILITIES_EXPORT InterpMethod GetInterpMethod() const;
FIELD_UTILS_EXPORT InterpMethod GetInterpMethod() const;
/// Returns the input field
LIB_UTILITIES_EXPORT LibUtilities::PtsFieldSharedPtr GetInField() const;
FIELD_UTILS_EXPORT LibUtilities::PtsFieldSharedPtr GetInField() const;
/// Returns the output field
LIB_UTILITIES_EXPORT LibUtilities::PtsFieldSharedPtr GetOutField() const;
FIELD_UTILS_EXPORT LibUtilities::PtsFieldSharedPtr GetOutField() const;
/// Print statics of the interpolation weights
LIB_UTILITIES_EXPORT void PrintStatistics();
FIELD_UTILS_EXPORT void PrintStatistics();
/// sets a callback funtion which gets called every time the interpolation
/// progresses
......@@ -213,29 +215,29 @@ private:
boost::function<void(const int position, const int goal)>
m_progressCallback;
LIB_UTILITIES_EXPORT void CalcW_Gauss(const PtsPoint &searchPt,
FIELD_UTILS_EXPORT void CalcW_Gauss(const PtsPoint &searchPt,
const NekDouble sigma,
const int maxPts = 250);
LIB_UTILITIES_EXPORT void CalcW_Linear(const PtsPoint &searchPt,
FIELD_UTILS_EXPORT void CalcW_Linear(const PtsPoint &searchPt,
int coordId);
LIB_UTILITIES_EXPORT void CalcW_NNeighbour(const PtsPoint &searchPt);
FIELD_UTILS_EXPORT void CalcW_NNeighbour(const PtsPoint &searchPt);
LIB_UTILITIES_EXPORT void CalcW_Shepard(const PtsPoint &searchPt);
FIELD_UTILS_EXPORT void CalcW_Shepard(const PtsPoint &searchPt);
LIB_UTILITIES_EXPORT void CalcW_Quadratic(const PtsPoint &searchPt,
FIELD_UTILS_EXPORT void CalcW_Quadratic(const PtsPoint &searchPt,
int coordId);
LIB_UTILITIES_EXPORT void SetupTree();
FIELD_UTILS_EXPORT void SetupTree();
LIB_UTILITIES_EXPORT void FindNeighbours(
FIELD_UTILS_EXPORT void FindNeighbours(
const PtsPoint &searchPt,
std::vector<PtsPoint> &neighbourPts,
const NekDouble dist,
const unsigned int maxPts = 1);
LIB_UTILITIES_EXPORT void FindNNeighbours(
FIELD_UTILS_EXPORT void FindNNeighbours(
const PtsPoint &searchPt,
std::vector<PtsPoint> &neighbourPts,
const unsigned int numPts = 1);
......
......@@ -41,7 +41,7 @@ using namespace std;
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
#include <boost/math/special_functions/fpclassify.hpp>
namespace Nektar
{
......@@ -231,7 +231,7 @@ void ProcessInterpField::Process(po::variables_map &vm)
}
}
SolverUtils::Interpolator interp;
Interpolator interp;
if (m_f->m_comm->GetRank() == 0)
{
interp.SetProgressCallback(&ProcessInterpField::PrintProgressbar,
......
......@@ -40,7 +40,7 @@ using namespace std;
#include "ProcessInterpPointDataToFld.h"
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
#include <LibUtilities/BasicUtils/PtsField.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
......@@ -114,7 +114,7 @@ void ProcessInterpPointDataToFld::Process(po::variables_map &vm)
ASSERTL0(coord_id <= m_f->m_fieldPts->GetDim() - 1,
"interpcoord is bigger than the Pts files dimension");
SolverUtils::Interpolator interp(SolverUtils::eNoMethod, coord_id);
Interpolator interp(eNoMethod, coord_id);
if (m_f->m_comm->GetRank() == 0)
{
......
......@@ -41,7 +41,7 @@ using namespace std;
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/lexical_cast.hpp>
namespace Nektar
......@@ -533,7 +533,7 @@ void ProcessInterpPoints::InterpolateFieldToPts(
int nfields = field0.size();
SolverUtils::Interpolator interp;
Interpolator interp;
if (m_f->m_comm->GetRank() == 0)
{
interp.SetProgressCallback(&ProcessInterpPoints::PrintProgressbar,
......
......@@ -31,7 +31,6 @@ SET(SOLVER_UTILS_SOURCES
Filters/FilterFieldConvert.cpp
Filters/FilterThresholdMax.cpp
Filters/FilterThresholdMin.cpp
Interpolator.cpp
RiemannSolvers/RiemannSolver.cpp
RiemannSolvers/UpwindSolver.cpp
RiemannSolvers/UpwindLDGSolver.cpp
......@@ -76,7 +75,6 @@ SET(SOLVER_UTILS_HEADERS
Filters/FilterFieldConvert.h
Filters/FilterThresholdMax.h
Filters/FilterThresholdMin.h
Interpolator.h
RiemannSolvers/RiemannSolver.h
RiemannSolvers/UpwindSolver.h
RiemannSolvers/UpwindLDGSolver.h
......
......@@ -914,12 +914,12 @@ namespace Nektar
// check if we already computed this funcKey combination
std::string interpKey = m_session->GetFunctionFilename(pFunctionName, pFieldName, domain);
map<std::string, Interpolator >::iterator it
map<std::string, FieldUtils::Interpolator >::iterator it
= m_interpolators.find(interpKey);
if (it == m_interpolators.end())
{
m_interpolators[interpKey] = SolverUtils::Interpolator(
Nektar::SolverUtils::eShepard);
m_interpolators[interpKey] = FieldUtils::Interpolator(
Nektar::FieldUtils::eShepard);
if (m_comm->GetRank() == 0)
{
m_interpolators[interpKey].SetProgressCallback(
......
......@@ -46,7 +46,7 @@
#include <LibUtilities/BasicUtils/PtsField.h>
#include <LibUtilities/BasicUtils/PtsIO.h>
#include <MultiRegions/ExpList.h>
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
#include <SolverUtils/SolverUtilsDeclspec.h>
#include <SolverUtils/Core/Misc.h>
......@@ -454,7 +454,7 @@ namespace Nektar
/// Field input/output
LibUtilities::FieldIOSharedPtr m_fld;
/// Map of interpolator objects
std::map<std::string, Interpolator > m_interpolators;
std::map<std::string, FieldUtils::Interpolator > m_interpolators;
/// Array holding all dependent variables.
Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
/// Base fields.
......
......@@ -41,7 +41,7 @@
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/PtsIO.h>
#include <SolverUtils/Interpolator.h>
#include <FieldUtils/Interpolator.h>
#include <NekMeshUtils/MeshElements/Element.h>
......@@ -218,7 +218,7 @@ NekDouble ProcessCurve::EvaluateCoordinate(NekDouble xCoord)
LibUtilities::PtsFieldSharedPtr toPts =
MemoryManager<LibUtilities::PtsField>::AllocateSharedPtr(1, tmp);
SolverUtils::Interpolator interp;
FieldUtils::Interpolator interp;
interp.Interpolate(m_fieldPts, toPts);
return tmp[1][0];
......
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