Commit 4c597146 authored by Dave Moxey's avatar Dave Moxey

Fix post-merge issues, refactor code to make more operators generic

parent 588821ff
......@@ -33,7 +33,7 @@ SET(NEKTAR++_ROOT_DIR "@CMAKE_INSTALL_PREFIX@")
SET(NEKTAR++_INCLUDE_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_INCLUDE_DIR@")
SET(NEKTAR++_LIBRARY_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_LIB_DIR@")
SET(NEKTAR++_DEFINITIONS "")
SET(NEKTAR++_LIBRARIES SolverUtils MultiRegions LocalRegions SpatialDomains StdRegions LibUtilities)
SET(NEKTAR++_LIBRARIES SolverUtils MultiRegions Collections LocalRegions SpatialDomains StdRegions LibUtilities)
SET(NEKTAR++_TP_INCLUDE_DIRS "")
SET(NEKTAR++_TP_LIBRARIES "")
......
......@@ -11,18 +11,6 @@ SET(SOLVER_UTILS_HEADERS
#ADD_DEFINITIONS(-DSOLVER_UTILS_EXPORTS)
ADD_NEKTAR_LIBRARY(Collections lib ${NEKTAR_LIBRARY_TYPE} ${COLLECTIONS_SOURCES} ${COLLECTIONS_HEADERS})
TARGET_LINK_LIBRARIES(Collections
optimized LibUtilities debug LibUtilities-g
optimized SpatialDomains debug SpatialDomains-g
optimized StdRegions debug StdRegions-g
optimized ${TINYXML_LIB} debug ${TINYXML_LIB}
${Boost_THREAD_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
${Boost_DATE_TIME_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${ZLIB_LIBRARY}
)
SET_LAPACK_LINK_LIBRARIES(Collections)
TARGET_LINK_LIBRARIES(Collections LINK_PUBLIC LocalRegions)
INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/Collections COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
......@@ -57,15 +57,17 @@ namespace Collections {
: m_stdExp(pExp), m_geom(pGeom)
{
OperatorKey bwdLocMat(
pExp->GetShapeType(), eBwdTrans, eLocMat);
pExp->DetShapeType(), eBwdTrans, eLocMat);
OperatorKey bwdIterPerExp(
pExp->GetShapeType(), eBwdTrans, eIterPerExp);
pExp->DetShapeType(), eBwdTrans, eIterPerExp);
OperatorKey derivSumFac(
pExp->GetShapeType(), ePhysDeriv, eSumFac);
pExp->DetShapeType(), ePhysDeriv, eSumFac);
OperatorKey derivIterPerExp(
pExp->DetShapeType(), ePhysDeriv, eIterPerExp);
m_ops[eBwdTrans] = GetOperatorFactory().CreateInstance(
bwdIterPerExp, pExp, pGeom);
m_ops[ePhysDeriv] = GetOperatorFactory().CreateInstance(
derivSumFac, pExp, pGeom);
derivIterPerExp, pExp, pGeom);
}
void ApplyOperator(
......
......@@ -96,7 +96,7 @@ namespace Collections {
BwdTrans_LocMat(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom),
m_key(StdRegions::eBwdTrans, pExp->GetShapeType(), *pExp)
m_key(StdRegions::eBwdTrans, pExp->DetShapeType(), *pExp)
{
}
......@@ -165,5 +165,135 @@ namespace Collections {
OperatorKey(LibUtilities::eTriangle, eBwdTrans, eIterPerExp),
BwdTrans_IterPerExp::create, "BwdTrans_IterPerExp_Tri")
};
/*
* ----------------------------------------------------------
* PhysDeriv operators
* ----------------------------------------------------------
*/
class PhysDeriv_IterPerExp : public Operator
{
public:
PhysDeriv_IterPerExp(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->PhysDeriv(input + i*nPhys, tmp = output + i*nPhys);
}
}
OPERATOR_CREATE(PhysDeriv_IterPerExp)
};
OperatorKey PhysDeriv_IterPerExp::m_typeArr[] =
{
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, ePhysDeriv, eIterPerExp),
PhysDeriv_IterPerExp::create, "PhysDeriv_IterPerExp_Quad"),
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eTriangle, ePhysDeriv, eIterPerExp),
PhysDeriv_IterPerExp::create, "PhysDeriv_IterPerExp_Tri")
};
/*
* ----------------------------------------------------------
* IProductWRTBase operators
* ----------------------------------------------------------
*/
class IProductWRTBase_IterPerExp : public Operator
{
public:
IProductWRTBase_IterPerExp(
StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nCoeffs = m_stdExp->GetNcoeffs();
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->IProductWRTBase(
input + i*nPhys, tmp = output + i*nCoeffs);
}
}
OPERATOR_CREATE(IProductWRTBase_IterPerExp)
};
OperatorKey IProductWRTBase_IterPerExp::m_typeArr[] =
{
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, eIProductWRTBase, eIterPerExp),
IProductWRTBase_IterPerExp::create, "IProductWRTBase_IterPerExp_Quad"),
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eTriangle, eIProductWRTBase, eIterPerExp),
IProductWRTBase_IterPerExp::create, "IProductWRTBase_IterPerExp_Tri")
};
/*
* ----------------------------------------------------------
* FwdTrans operators
* ----------------------------------------------------------
*/
class FwdTrans_IterPerExp : public Operator
{
public:
FwdTrans_IterPerExp(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nCoeffs = m_stdExp->GetNcoeffs();
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->FwdTrans(input + i*nCoeffs, tmp = output + i*nPhys);
}
}
OPERATOR_CREATE(FwdTrans_IterPerExp)
};
OperatorKey FwdTrans_IterPerExp::m_typeArr[] =
{
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, eFwdTrans, eIterPerExp),
FwdTrans_IterPerExp::create, "FwdTrans_IterPerExp_Quad"),
GetOperatorFactory().RegisterCreatorFunction(
OperatorKey(LibUtilities::eTriangle, eFwdTrans, eIterPerExp),
FwdTrans_IterPerExp::create, "FwdTrans_IterPerExp_Tri")
};
}
}
......@@ -44,42 +44,11 @@ namespace Collections {
* ----------------------------------------------------------
*/
class QuadPhysDerivIterPerExp : public Operator
class PhysDeriv_SumFac_Quad : public Operator
{
public:
QuadPhysDerivIterPerExp(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->PhysDeriv(input + i*nPhys, tmp = output + i*nPhys);
}
}
OPERATOR_CREATE(QuadPhysDerivIterPerExp)
};
OperatorKey QuadPhysDerivIterPerExp::m_type = GetOperatorFactory().
RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, ePhysDeriv, eLocMat),
QuadPhysDerivIterPerExp::create, "QuadPhysDerivIterPerExp");
class QuadPhysDerivSumFac : public Operator
{
public:
QuadPhysDerivSumFac(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
PhysDeriv_SumFac_Quad(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator (pExp, pGeom),
m_nquad0 (pExp->GetNumPoints(0)),
m_nquad1 (pExp->GetNumPoints(1)),
......@@ -165,7 +134,7 @@ namespace Collections {
}
}
OPERATOR_CREATE(QuadPhysDerivSumFac)
OPERATOR_CREATE(PhysDeriv_SumFac_Quad)
protected:
const int m_nquad0;
......@@ -173,87 +142,9 @@ namespace Collections {
Array<TwoD, NekDouble> m_df;
};
OperatorKey QuadPhysDerivSumFac::m_type = GetOperatorFactory().
OperatorKey PhysDeriv_SumFac_Quad::m_type = GetOperatorFactory().
RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, ePhysDeriv, eSumFac),
QuadPhysDerivSumFac::create, "QuadPhysDerivSumFac");
/*
* ----------------------------------------------------------
* IProductWRTBase operators
* ----------------------------------------------------------
*/
class QuadIProductIterPerExp : public Operator
{
public:
QuadIProductIterPerExp(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nCoeffs = m_stdExp->GetNcoeffs();
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->IProductWRTBase(
input + i*nPhys, tmp = output + i*nCoeffs);
}
}
OPERATOR_CREATE(QuadIProductIterPerExp)
};
OperatorKey QuadIProductIterPerExp::m_type = GetOperatorFactory().
RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, eIProductWRTBase, eLocMat),
QuadIProductIterPerExp::create, "QuadIProductIterPerExp");
/*
* ----------------------------------------------------------
* FwdTrans operators
* ----------------------------------------------------------
*/
class QuadFwdTransIterPerExp : public Operator
{
public:
QuadFwdTransIterPerExp(StdRegions::StdExpansionSharedPtr pExp,
vector<SpatialDomains::GeometrySharedPtr> pGeom)
: Operator(pExp, pGeom)
{
}
virtual void operator()(
const Array<OneD, const NekDouble> &input,
Array<OneD, NekDouble> &output,
Array<OneD, NekDouble> &wsp)
{
const int nCoeffs = m_stdExp->GetNcoeffs();
const int nPhys = m_stdExp->GetTotPoints();
Array<OneD, NekDouble> tmp;
for (int i = 0; i < m_numElmt; ++i)
{
m_stdExp->FwdTrans(input + i*nCoeffs, tmp = output + i*nPhys);
}
}
OPERATOR_CREATE(QuadFwdTransIterPerExp)
};
OperatorKey QuadFwdTransIterPerExp::m_type = GetOperatorFactory().
RegisterCreatorFunction(
OperatorKey(LibUtilities::eQuadrilateral, eFwdTrans, eLocMat),
QuadFwdTransIterPerExp::create, "QuadFwdTransIterPerExp");
PhysDeriv_SumFac_Quad::create, "PhysDeriv_SumFac_Quad");
}
}
......@@ -120,7 +120,7 @@ ADD_DEFINITIONS(-DMULTI_REGIONS_EXPORTS)
ADD_NEKTAR_LIBRARY(MultiRegions lib ${NEKTAR_LIBRARY_TYPE} ${MULTI_REGIONS_SOURCES} ${MULTI_REGIONS_HEADERS} ${ASSEMBLY_MAP_HEADERS})
TARGET_LINK_LIBRARIES(MultiRegions LINK_PUBLIC LocalRegions)
TARGET_LINK_LIBRARIES(MultiRegions LINK_PUBLIC Collections)
# MultiRegions uses additional routines from Metis
TARGET_LINK_LIBRARIES(MultiRegions LINK_PRIVATE ${METIS_LIB})
......
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