Commit 8febd4b5 authored by Chris Cantwell's avatar Chris Cantwell

Separate TimeIntegrationSchemeOperators into separate file.

parent 97553ea0
......@@ -84,6 +84,7 @@
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/TimeIntegration/TimeIntegrationScheme.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeOperators.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSolution.h>
///////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -38,6 +38,7 @@
using namespace std;
#include <LibUtilities/TimeIntegration/TimeIntegrationSolution.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeOperators.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationScheme.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeData.h>
#include <LibUtilities/BasicConst/NektarUnivConsts.hpp>
......
......@@ -61,6 +61,7 @@ namespace LibUtilities
class TimeIntegrationScheme;
class TimeIntegrationSchemeData;
class TimeIntegrationSolution;
class TimeIntegrationSchemeOperators;
typedef std::shared_ptr<TimeIntegrationScheme> TimeIntegrationSchemeSharedPtr;
......@@ -143,121 +144,6 @@ const char *const TimeIntegrationSchemeTypeMap[] = {
"Implicit"};
/**
* @brief Binds a set of functions for use by time integration schemes.
*/
class TimeIntegrationSchemeOperators
{
public:
typedef const Array<OneD, const Array<OneD, NekDouble>> InArrayType;
typedef Array<OneD, Array<OneD, NekDouble>> OutArrayType;
typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble)>
FunctorType1;
typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble,
const NekDouble)>
FunctorType2;
typedef const FunctorType1 &ConstFunctorType1Ref;
typedef const FunctorType2 &ConstFunctorType2Ref;
typedef Array<OneD, FunctorType1> FunctorType1Array;
typedef Array<OneD, FunctorType2> FunctorType2Array;
TimeIntegrationSchemeOperators(void) : m_functors1(4), m_functors2(1)
{
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[0] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeExplicitRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[1] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeImplicitRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[2] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[3] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
{
m_functors2[0] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, std::placeholders::_4);
}
inline void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[0], "OdeRhs should be defined for this time "
"integration scheme");
m_functors1[0](inarray, outarray, time);
}
inline void DoOdeExplicitRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[1], "OdeExplicitRhs should be defined for this "
"time integration scheme");
m_functors1[1](inarray, outarray, time);
}
inline void DoOdeImplicitRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[2], "OdeImplictRhs should be defined for this "
"time integration scheme");
m_functors1[2](inarray, outarray, time);
}
inline void DoProjection(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[3], "Projection operation should be defined for "
"this time integration scheme");
m_functors1[3](inarray, outarray, time);
}
inline void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time,
const NekDouble lambda) const
{
ASSERTL1(m_functors2[0], "ImplicitSolve should be defined for this "
"time integration scheme");
m_functors2[0](inarray, outarray, time, lambda);
}
protected:
FunctorType1Array m_functors1;
FunctorType2Array m_functors2;
private:
}; // end class TimeIntegrationSchemeOperators()
/**
* @brief Base class for time integration schemes.
*/
......
......@@ -38,6 +38,7 @@
#include <LibUtilities/BasicUtils/VmathArray.hpp>
#include <LibUtilities/LinearAlgebra/Blas.hpp>
#include <LibUtilities/TimeIntegration/TimeIntegrationSolution.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeOperators.h>
#include <iostream>
......
///////////////////////////////////////////////////////////////////////////////
//
// File: TimeIntegrationOperators.h
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// 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).
//
// 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: Header file of time integration operators class
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_FOUNDATIONS_TIMEINTEGRATIONSCHEMEOPERATORS_H
#define NEKTAR_LIB_UTILITIES_FOUNDATIONS_TIMEINTEGRATIONSCHEMEOPERATORS_H
#include <string>
#include <boost/core/ignore_unused.hpp>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
///////////////////////////////////////////////////////////////////////////////
#define LUE LIB_UTILITIES_EXPORT
namespace Nektar
{
namespace LibUtilities
{
/**
* @brief Binds a set of functions for use by time integration schemes.
*/
class TimeIntegrationSchemeOperators
{
public:
typedef const Array<OneD, const Array<OneD, NekDouble>> InArrayType;
typedef Array<OneD, Array<OneD, NekDouble>> OutArrayType;
typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble)>
FunctorType1;
typedef std::function<void(InArrayType &, OutArrayType &, const NekDouble,
const NekDouble)>
FunctorType2;
typedef const FunctorType1 &ConstFunctorType1Ref;
typedef const FunctorType2 &ConstFunctorType2Ref;
typedef Array<OneD, FunctorType1> FunctorType1Array;
typedef Array<OneD, FunctorType2> FunctorType2Array;
TimeIntegrationSchemeOperators(void) : m_functors1(4), m_functors2(1)
{
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[0] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeExplicitRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[1] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineOdeImplicitRhs(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[2] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
{
m_functors1[3] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3);
}
template <typename FuncPointerT, typename ObjectPointerT>
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
{
m_functors2[0] =
std::bind(func, obj, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, std::placeholders::_4);
}
inline void DoOdeRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[0], "OdeRhs should be defined for this time "
"integration scheme");
m_functors1[0](inarray, outarray, time);
}
inline void DoOdeExplicitRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[1], "OdeExplicitRhs should be defined for this "
"time integration scheme");
m_functors1[1](inarray, outarray, time);
}
inline void DoOdeImplicitRhs(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[2], "OdeImplictRhs should be defined for this "
"time integration scheme");
m_functors1[2](inarray, outarray, time);
}
inline void DoProjection(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time) const
{
ASSERTL1(m_functors1[3], "Projection operation should be defined for "
"this time integration scheme");
m_functors1[3](inarray, outarray, time);
}
inline void DoImplicitSolve(InArrayType &inarray, OutArrayType &outarray,
const NekDouble time,
const NekDouble lambda) const
{
ASSERTL1(m_functors2[0], "ImplicitSolve should be defined for this "
"time integration scheme");
m_functors2[0](inarray, outarray, time, lambda);
}
protected:
FunctorType1Array m_functors1;
FunctorType2Array m_functors2;
private:
};
}
}
#endif
......@@ -36,6 +36,7 @@
#define NEKTAR_SOLVERUTILS_UNSTEADYSYSTEM_H
#include <LibUtilities/TimeIntegration/TimeIntegrationScheme.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeOperators.h>
#include <SolverUtils/EquationSystem.h>
#include <SolverUtils/Filters/Filter.h>
......
......@@ -39,6 +39,7 @@
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/BasicUtils/FieldIO.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationScheme.h>
#include <LibUtilities/TimeIntegration/TimeIntegrationSchemeOperators.h>
#include <SpatialDomains/MeshGraph.h>
#include <MultiRegions/ContField2D.h>
......
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