Commit 25790739 authored by Dave Moxey's avatar Dave Moxey

Merge branch 'tidy/SessionFunction' into 'master'

Tidy: Move EquationSystem::EvaluateFunction and Forcing::EvaluateFunction into separate class

See merge request !759
parents ec641e68 fe571186
......@@ -10,6 +10,8 @@ v5.0.0
- Fix ThridpartyCCM options (!802)
- Fix Windows CRLF tokens in GEO reader and improve comment handling (!805)
- Use chrono in Timer (!807)
- Fix caching of FUNCTION tags that read from file and provide the same
functionality in FUNCTIONs defined for forcings (!759)
**NekMesh**:
- Add feature to read basic 2D geo files as CAD (!731)
......
......@@ -147,7 +147,7 @@ public:
/// Returns the output field
FIELD_UTILS_EXPORT LibUtilities::PtsFieldSharedPtr GetOutField() const;
/// Print statics of the interpolation weights
/// Returns if the weights have already been computed
FIELD_UTILS_EXPORT void PrintStatistics();
/// sets a callback funtion which gets called every time the interpolation
......
SET(SOLVER_UTILS_SOURCES
Core/Misc.cpp
Core/SessionFunction.cpp
AdvectionSystem.cpp
Advection/Advection.cpp
Advection/Advection3DHomogeneous1D.cpp
......@@ -44,6 +45,7 @@ SET(SOLVER_UTILS_SOURCES
SET(SOLVER_UTILS_HEADERS
Core/Misc.h
Core/SessionFunction.h
AdvectionSystem.h
Advection/Advection.h
Advection/AdvectionFR.h
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
//
// File SessionFunction.h
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2017 Kilian Lackhove
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Session Function
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_SESSIONFUNCTION_H
#define NEKTAR_SOLVERUTILS_SESSIONFUNCTION_H
#include <FieldUtils/Interpolator.h>
#include <LibUtilities/BasicUtils/FieldIO.h>
#include <LibUtilities/BasicUtils/FileSystem.h>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <LibUtilities/BasicUtils/PtsField.h>
#include <LibUtilities/BasicUtils/PtsIO.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <MultiRegions/ExpList.h>
#include <SolverUtils/SolverUtilsDeclspec.h>
namespace Nektar
{
namespace SolverUtils
{
class SessionFunction
{
public:
/// Representation of a FUNCTION defined in the session xml file.
SOLVER_UTILS_EXPORT SessionFunction(
const LibUtilities::SessionReaderSharedPtr &session,
const MultiRegions::ExpListSharedPtr &field,
std::string functionName,
bool toCache = false);
/// Evaluates a function defined in the xml session file at each quadrature point.
SOLVER_UTILS_EXPORT void Evaluate(
Array<OneD, Array<OneD, NekDouble> > &pArray,
const NekDouble pTime = 0.0,
const int domain = 0);
/// Evaluates a function defined in the xml session file at each quadrature point.
SOLVER_UTILS_EXPORT void Evaluate(
std::vector<std::string> pFieldNames,
Array<OneD, Array<OneD, NekDouble> > &pArray,
const NekDouble &pTime = 0.0,
const int domain = 0);
/// Evaluates a function defined in the xml session file at each quadrature point.
SOLVER_UTILS_EXPORT void Evaluate(
std::vector<std::string> pFieldNames,
Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
const NekDouble &pTime = 0.0,
const int domain = 0);
// Evaluates a function defined in the xml session file at each quadrature point.
SOLVER_UTILS_EXPORT void Evaluate(std::string pFieldName,
Array<OneD, NekDouble> &pArray,
const NekDouble &pTime = 0.0,
const int domain = 0);
/// Provide a description of a function for a given field name.
SOLVER_UTILS_EXPORT std::string Describe(std::string pFieldName,
const int domain = 0);
SOLVER_UTILS_EXPORT const LibUtilities::SessionReaderSharedPtr & GetSession()
{
return m_session;
}
SOLVER_UTILS_EXPORT const MultiRegions::ExpListSharedPtr & GetExpansion()
{
return m_field;
}
private:
/// The session reader
LibUtilities::SessionReaderSharedPtr m_session;
/// The expansion we want to evaluate this function for
MultiRegions::ExpListSharedPtr m_field;
// Name of this function
std::string m_name;
/// Store resulting arrays (and interpolators)
bool m_toCache;
/// Last time the cache for this variable & domain combo was updated
std::map<std::pair<std::string, int>, NekDouble> m_lastCached;
/// Interpolator for pts file input for a variable & domain combination
std::map<std::string, FieldUtils::Interpolator> m_interpolators;
/// Cached result arrays
std::map<std::pair<std::string, int>, Array<OneD, NekDouble> > m_arrays;
// Evaluates a function from expression
SOLVER_UTILS_EXPORT void EvaluateExp(std::string pFieldName,
Array<OneD, NekDouble> &pArray,
const NekDouble &pTime = 0.0,
const int domain = 0);
// Evaluates a function from fld file
SOLVER_UTILS_EXPORT void EvaluateFld(std::string pFieldName,
Array<OneD, NekDouble> &pArray,
const NekDouble &pTime = 0.0,
const int domain = 0);
/// Evaluates a function from pts file
SOLVER_UTILS_EXPORT void EvaluatePts(std::string pFieldName,
Array<OneD, NekDouble> &pArray,
const NekDouble &pTime = 0.0,
const int domain = 0);
SOLVER_UTILS_EXPORT void PrintProgressbar(const int position,
const int goal) const
{
LibUtilities::PrintProgressbar(position, goal, "Interpolating");
}
};
typedef boost::shared_ptr<SessionFunction> SessionFunctionSharedPtr;
static SessionFunctionSharedPtr NullSessionFunction;
}
}
#endif
This diff is collapsed.
......@@ -48,6 +48,7 @@
#include <MultiRegions/ExpList.h>
#include <SolverUtils/SolverUtilsDeclspec.h>
#include <SolverUtils/Core/Misc.h>
#include <SolverUtils/Core/SessionFunction.h>
namespace Nektar
{
......@@ -68,11 +69,6 @@ class Interpolator;
> EquationSystemFactory;
SOLVER_UTILS_EXPORT EquationSystemFactory& GetEquationSystemFactory();
struct loadedFldField {
std::vector<LibUtilities::FieldDefinitionsSharedPtr> fieldDef;
std::vector<std::vector<NekDouble> > fieldData;
} ;
/// A base class for describing how to solve specific equations.
class EquationSystem : public boost::enable_shared_from_this<EquationSystem>
{
......@@ -143,43 +139,12 @@ class Interpolator;
/// Set parameter m_lambda
SOLVER_UTILS_EXPORT inline void SetLambda(NekDouble lambda);
/// Evaluates a function as specified in the session file.
SOLVER_UTILS_EXPORT void EvaluateFunction(
Array<OneD, Array<OneD, NekDouble> >& pArray,
std::string pFunctionName,
const NekDouble pTime = 0.0,
const int domain = 0);
/// Populate given fields with the function from session.
SOLVER_UTILS_EXPORT void EvaluateFunction(
std::vector<std::string> pFieldNames,
Array<OneD, Array<OneD, NekDouble> > &pFields,
const std::string& pName,
const NekDouble& pTime = 0.0,
const int domain = 0);
/// Populate given fields with the function from session.
SOLVER_UTILS_EXPORT void EvaluateFunction(
std::vector<std::string> pFieldNames,
Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
const std::string& pName,
const NekDouble& pTime = 0.0,
const int domain = 0);
// Populate an array with a function variable from session.
SOLVER_UTILS_EXPORT void EvaluateFunction(
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
const NekDouble& pTime = 0.0,
const int domain = 0);
// Describe a function.
SOLVER_UTILS_EXPORT std::string DescribeFunction(
std::string pFieldName,
const std::string &pFunctionName,
const int domain);
/// Get a SessionFunction by name
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(
std::string name,
const MultiRegions::ExpListSharedPtr &field = MultiRegions::NullExpListSharedPtr,
bool cache = false);
/// Perform initialisation of the base flow.
SOLVER_UTILS_EXPORT void InitialiseBaseFlow(
......@@ -458,14 +423,10 @@ class Interpolator;
LibUtilities::CommSharedPtr m_comm;
/// The session reader
LibUtilities::SessionReaderSharedPtr m_session;
/// Map of known SessionFunctions
std::map<std::string, SolverUtils::SessionFunctionSharedPtr> m_sessionFunctions;
/// Field input/output
LibUtilities::FieldIOSharedPtr m_fld;
/// Map of interpolator objects
std::map<std::string, FieldUtils::Interpolator > m_interpolators;
/// pts fields we already read from disk: {funcFilename: (filename, ptsfield)}
std::map<std::string, std::pair<std::string, LibUtilities::PtsFieldSharedPtr> > m_loadedPtsFields;
// fld fiels already loaded from disk: {funcFilename: (filename, loadedFldField)}
std::map<std::string, std::pair<std::string, loadedFldField> > m_loadedFldFields;
/// Array holding all dependent variables.
Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
/// Base fields.
......@@ -605,34 +566,6 @@ class Interpolator;
unsigned int field,
Array<OneD, NekDouble> &outfield,
const NekDouble time);
// Populate an array with a function variable from session.
SOLVER_UTILS_EXPORT void EvaluateFunctionExp(
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
const NekDouble& pTime = 0.0,
const int domain = 0);
// Populate an array with a function variable from session.
SOLVER_UTILS_EXPORT void EvaluateFunctionFld(
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
const NekDouble& pTime = 0.0,
const int domain = 0);
SOLVER_UTILS_EXPORT void EvaluateFunctionPts(
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
const NekDouble& pTime = 0.0,
const int domain = 0);
SOLVER_UTILS_EXPORT void LoadPts(
std::string funcFilename,
std::string filename,
Nektar::LibUtilities::PtsFieldSharedPtr &outPts);
//Initialise m_base in order to store the base flow from a file
SOLVER_UTILS_EXPORT void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh);
......
......@@ -153,79 +153,29 @@ namespace Nektar
pEqn->Evaluate(x0, x0, x0, pTime, pArray);
}
void Forcing::EvaluateFunction(
Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
LibUtilities::SessionReaderSharedPtr pSession,
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
NekDouble pTime)
SessionFunctionSharedPtr Forcing::GetFunction(
const Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
const LibUtilities::SessionReaderSharedPtr &pSession,
std::string pName,
bool pCache)
{
ASSERTL0(pSession->DefinesFunction(pFunctionName),
"Function '" + pFunctionName + "' does not exist.");
unsigned int nq = pFields[0]->GetNpoints();
if (pArray.num_elements() != nq)
if (pCache)
{
pArray = Array<OneD, NekDouble> (nq);
}
if ((m_sessionFunctions.find(pName) == m_sessionFunctions.end())
|| (m_sessionFunctions[pName]->GetSession() != pSession)
|| (m_sessionFunctions[pName]->GetExpansion() != pFields[0])
)
{
m_sessionFunctions[pName] =
MemoryManager<SessionFunction>::AllocateSharedPtr(
pSession, pFields[0], pName, pCache);
}
LibUtilities::FunctionType vType;
vType = pSession->GetFunctionType(pFunctionName, pFieldName);
if (vType == LibUtilities::eFunctionTypeExpression)
{
Array<OneD, NekDouble> x0(nq);
Array<OneD, NekDouble> x1(nq);
Array<OneD, NekDouble> x2(nq);
pFields[0]->GetCoords(x0, x1, x2);
LibUtilities::EquationSharedPtr ffunc =
pSession->GetFunction(pFunctionName, pFieldName);
ffunc->Evaluate(x0, x1, x2, pTime, pArray);
return m_sessionFunctions[pName];
}
else if (vType == LibUtilities::eFunctionTypeFile)
else
{
std::string filename = pSession->GetFunctionFilename(
pFunctionName,
pFieldName);
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
std::vector<std::vector<NekDouble> > FieldData;
Array<OneD, NekDouble> vCoeffs(pFields[0]->GetNcoeffs());
Vmath::Zero(vCoeffs.num_elements(), vCoeffs, 1);
LibUtilities::FieldIOSharedPtr fld =
LibUtilities::FieldIO::CreateForFile(m_session, filename);
fld->Import(filename, FieldDef, FieldData);
int idx = -1;
for (int i = 0; i < FieldDef.size(); ++i)
{
for (int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
{
if (FieldDef[i]->m_fields[j] == pFieldName)
{
idx = j;
}
}
if (idx >= 0)
{
pFields[0]->ExtractDataToCoeffs(
FieldDef[i],
FieldData[i],
FieldDef[i]->m_fields[idx],
vCoeffs);
}
else
{
cout << "Field " + pFieldName + " not found." << endl;
}
}
pFields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
return SessionFunctionSharedPtr(new SessionFunction(pSession, pFields[0], pName, pCache));
}
}
......
......@@ -41,6 +41,7 @@
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <MultiRegions/ExpList.h>
#include <SolverUtils/Core/SessionFunction.h>
#include <SolverUtils/SolverUtilsDeclspec.h>
namespace Nektar
......@@ -102,6 +103,8 @@ namespace SolverUtils
Array<OneD, Array<OneD, NekDouble> > m_Forcing;
/// Number of variables
int m_NumVariable;
/// Map of known SessionFunctions
std::map<std::string, SolverUtils::SessionFunctionSharedPtr> m_sessionFunctions;
/// Constructor
SOLVER_UTILS_EXPORT Forcing(
......@@ -118,13 +121,12 @@ namespace SolverUtils
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)=0;
SOLVER_UTILS_EXPORT void EvaluateFunction(
Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
LibUtilities::SessionReaderSharedPtr pSession,
std::string pFieldName,
Array<OneD, NekDouble>& pArray,
const std::string& pFunctionName,
NekDouble pTime = NekDouble(0));
/// Get a SessionFunction by name
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(
const Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
const LibUtilities::SessionReaderSharedPtr &pSession,
std::string pName,
bool pCache = false);
SOLVER_UTILS_EXPORT void EvaluateTimeFunction(
LibUtilities::SessionReaderSharedPtr pSession,
......
......@@ -81,8 +81,7 @@ namespace SolverUtils
"Variable '" + s_FieldStr + "' not defined.");
m_Absorption[i] = Array<OneD, NekDouble> (npts, 0.0);
m_Forcing[i] = Array<OneD, NekDouble> (npts, 0.0);
EvaluateFunction(pFields, m_session, s_FieldStr,
m_Absorption[i], funcName);
GetFunction(pFields, m_session, funcName)->Evaluate(s_FieldStr, m_Absorption[i]);
}
funcNameElmt = pForce->FirstChildElement("REFFLOW");
......@@ -99,8 +98,7 @@ namespace SolverUtils
ASSERTL0(m_session->DefinesFunction(funcName, s_FieldStr),
"Variable '" + s_FieldStr + "' not defined.");
m_Refflow[i] = Array<OneD, NekDouble> (npts, 0.0);
EvaluateFunction(pFields, m_session, s_FieldStr,
m_Refflow[i], funcName);
GetFunction(pFields, m_session, funcName)->Evaluate(s_FieldStr, m_Refflow[i]);
}
m_hasRefFlow = true;
}
......
......@@ -129,8 +129,7 @@ namespace SolverUtils
std::string s_FieldStr = m_session->GetVariable(i);
ASSERTL0(m_session->DefinesFunction(m_funcName, s_FieldStr),
"Variable '" + s_FieldStr + "' not defined.");
EvaluateFunction(pFields, m_session, s_FieldStr,
m_Forcing[i], m_funcName, time);
GetFunction(pFields, m_session, m_funcName, true)->Evaluate(s_FieldStr, m_Forcing[i], time);
}
// If singleMode or halfMode, transform the forcing term to be in
......
......@@ -62,7 +62,7 @@ namespace Nektar
vel.push_back("Vz");
vel.resize(m_spacedim);
EvaluateFunction(vel, m_velocity, "AdvectionVelocity");
GetFunction( "AdvectionVelocity")->Evaluate(vel, m_velocity);
if (m_explicitAdvection)
{
......
......@@ -61,7 +61,7 @@ namespace Nektar
vel.push_back("Vz");
vel.resize(m_spacedim);
EvaluateFunction(vel, m_velocity, "AdvectionVelocity");
GetFunction( "AdvectionVelocity")->Evaluate(vel, m_velocity);
}
void EigenValuesAdvection::v_DoInitialise()
......
......@@ -52,7 +52,7 @@ namespace Nektar
{
Laplace::v_InitObject();
EvaluateFunction(m_session->GetVariables(), m_fields, "Forcing");
GetFunction("Forcing")->Evaluate(m_session->GetVariables(), m_fields);
}
Poisson::~Poisson()
......
......@@ -51,7 +51,7 @@ void Projection::v_InitObject()
{
EquationSystem::v_InitObject();
EvaluateFunction(m_session->GetVariables(), m_fields, "Forcing");
GetFunction("Forcing")->Evaluate(m_session->GetVariables(), m_fields);
}
Projection::~Projection()
......
......@@ -77,7 +77,7 @@ namespace Nektar
void SteadyAdvectionDiffusion::v_DoInitialise()
{
// set initial forcing from session file
EvaluateFunction(m_session->GetVariables(), m_fields, "Forcing");
GetFunction("Forcing")->Evaluate(m_session->GetVariables(), m_fields);
}
void SteadyAdvectionDiffusion::v_DoSolve()
......
......@@ -74,7 +74,7 @@ namespace Nektar
// Store in the global variable m_velocity the advection velocities
m_velocity = Array<OneD, Array<OneD, NekDouble> >(m_spacedim);
EvaluateFunction(vel, m_velocity, "AdvectionVelocity");
GetFunction( "AdvectionVelocity")->Evaluate(vel, m_velocity);
// Type of advection class to be used
switch(m_projectionType)
......
......@@ -77,7 +77,7 @@ namespace Nektar
vel.push_back("Vz");
vel.resize(m_spacedim);
EvaluateFunction(vel, m_velocity, "AdvectionVelocity");
GetFunction( "AdvectionVelocity")->Evaluate(vel, m_velocity);
m_session->MatchSolverInfo(
"SpectralVanishingViscosity", "True", m_useSpecVanVisc, false);
......
......@@ -137,7 +137,7 @@ void APE::v_InitObject()
{
m_bf[i] = Array<OneD, NekDouble>(GetTotPoints());
}
EvaluateFunction(m_bfNames, m_bf, "Baseflow", m_time);
GetFunction("Baseflow", m_bfField, true)->Evaluate(m_bfNames, m_bf, m_time);
m_forcing = SolverUtils::Forcing::Load(m_session, m_fields, m_spacedim + 1);
......@@ -301,7 +301,7 @@ void APE::GetFluxVector(
*/
bool APE::v_PreIntegrate(int step)
{
EvaluateFunction(m_bfNames, m_bf, "Baseflow", m_time);
GetFunction("Baseflow", m_bfField, true)->Evaluate(m_bfNames, m_bf, m_time);
Array<OneD, NekDouble> tmpC(GetNcoeffs());
std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
......
......@@ -158,8 +158,8 @@ void BidomainRoth::v_InitObject()
aniso_var[j]),
"Function 'AnisotropicConductivity' not correctly "
"defined.");
EvaluateFunction(aniso_var[j], vTemp_j,
"ExtracellularAnisotropicConductivity");
GetFunction("ExtracellularAnisotropicConductivity")->Evaluate(aniso_var[j], vTemp_j);
// Loop through rows of D
for (int i = 0; i < j + 1; ++i)
......@@ -170,8 +170,7 @@ void BidomainRoth::v_InitObject()
"Function 'ExtracellularAnisotropicConductivity' not "
"correctly defined.");
EvaluateFunction(aniso_var[i], vTemp_i,
"ExtracellularAnisotropicConductivity");
GetFunction("ExtracellularAnisotropicConductivity")->Evaluate(aniso_var[i], vTemp_i);
Vmath::Vmul(nq, vTemp_i, 1, vTemp_j, 1,
m_vardiffe[varCoeffEnum[k]], 1);
......@@ -232,8 +231,7 @@ void BidomainRoth::v_InitObject()
"Function 'IntracellularAnisotropicConductivity' not "
"correctly defined.");
EvaluateFunction(aniso_var[j], vTemp_j,
"IntracellularAnisotropicConductivity");
GetFunction("IntracellularAnisotropicConductivity")->Evaluate(aniso_var[j], vTemp_j);
// Loop through rows of D
for (int i = 0; i < j + 1; ++i)
......@@ -243,8 +241,7 @@ void BidomainRoth::v_InitObject()
aniso_var[i]),
"Function 'IntracellularAnisotropicConductivity' not "
"correctly defined.");
EvaluateFunction(aniso_var[i], vTemp_i,
"IntracellularAnisotropicConductivity");
GetFunction("IntracellularAnisotropicConductivity")->Evaluate(aniso_var[i], vTemp_i);
Vmath::Vmul(nq, vTemp_i, 1, vTemp_j, 1,
m_vardiffi[varCoeffEnum[k]], 1);
......
......@@ -168,8 +168,7 @@ namespace Nektar
aniso_var[j]),
"Function 'AnisotropicConductivity' not correctly "
"defined.");
EvaluateFunction(aniso_var[j], vTemp_j,
"AnisotropicConductivity");
GetFunction("AnisotropicConductivity")->Evaluate(aniso_var[j], vTemp_j);
// Loop through rows of D
for (int i = 0; i < j + 1; ++i)
......@@ -178,8 +177,7 @@ namespace Nektar
"AnisotropicConductivity",aniso_var[i]),
"Function 'AnisotropicConductivity' not correctly "
"defined.");
EvaluateFunction(aniso_var[i], vTemp_i,
"AnisotropicConductivity");
GetFunction("AnisotropicConductivity")->Evaluate(aniso_var[i], vTemp_i);
Vmath::Vmul(nq, vTemp_i, 1, vTemp_j, 1,
m_vardiff[varCoeffEnum[k]], 1);
......@@ -223,7 +221,7 @@ namespace Nektar
const std::string varName = "intensity";
Array<OneD, NekDouble> vTemp;
EvaluateFunction(varName, vTemp, "IsotropicConductivity");
GetFunction( "IsotropicConductivity")->Evaluate(varName, vTemp);
// If the d_min and d_max parameters are defined, then we need to
// rescale the isotropic conductivity to convert from the source
......
......@@ -80,8 +80,8 @@ void ForcingQuasi1D::v_InitObject(
std::string sFieldStr = m_session->GetVariable(0);
ASSERTL0(m_session->DefinesFunction(funcName, sFieldStr),
"Variable '" + sFieldStr + "' not defined.");
EvaluateFunction(pFields, m_session, sFieldStr,
m_geomFactor, funcName, 0.0);
GetFunction(pFields, m_session, funcName, true)
->Evaluate(sFieldStr, m_geomFactor, 0.0);
pFields[0]->PhysDeriv(MultiRegions::DirCartesianMap[0], m_geomFactor, tmp);
Vmath::Vdiv(pFields[0]->GetTotPoints(), tmp, 1,
m_geomFactor, 1,
......
......@@ -1258,7 +1258,7 @@ namespace Nektar
{
fieldStr.push_back(m_boundaryConditions->GetVariable(m_velocity[i]));
}
EvaluateFunction(fieldStr,AdvField,"AdvectionVelocity");
GetFunction("AdvectionVelocity")->Evaluate(fieldStr, AdvField);
SetUpCoupledMatrix(0.0,AdvField,false);
}
......@@ -1290,7 +1290,7 @@ namespace Nektar
{
fieldStr.push_back(m_boundaryConditions->GetVariable(m_velocity[i]));
}
EvaluateFunction(fieldStr, Restart, "Restart");
GetFunction( "Restart")->Evaluate(fieldStr, Restart);
for(int i = 0; i < m_velocity.num_elements(); ++i)
{
......@@ -1338,7 +1338,7 @@ namespace Nektar
{
fieldStr.push_back(m_boundaryConditions->GetVariable(m_velocity[i]));
}
EvaluateFunction(fieldStr,AdvField,"AdvectionVelocity");
GetFunction("AdvectionVelocity")->Evaluate(fieldStr, AdvField);
SetUpCoupledMatrix(m_lambda,AdvField,true);
}
......@@ -1548,7 +1548,7 @@ namespace Nektar
{
fieldStr.push_back(m_boundaryConditions->GetVariable(m_velocity[i]));
}
EvaluateFunction(fieldStr, m_ForcingTerm, "ForcingTerm");
GetFunction( "ForcingTerm")->Evaluate(fieldStr, m_ForcingTerm);
for(int i = 0; i < m_velocity.num_elements(); ++i)
{
m_fields[m_velocity[i]]->FwdTrans_IterPerExp(m_ForcingTerm[i], m_ForcingTerm_Coeffs[i]);
......
......@@ -155,10 +155,8 @@ void ForcingMovingBody::v_Apply(
}
else
{
EvaluateFunction(pFields, m_session, m_motion[0], m_zta[j],
m_funcName[j], time);
EvaluateFunction(pFields, m_session, m_motion[1], m_eta[j],
m_funcName[j], time);
GetFunction(pFields, m_session, m_funcName[j], true)->Evaluate(m_motion[0], m_zta[j], time);