Commit 873073a4 authored by David Moxey's avatar David Moxey
Browse files

Working XXT for static cond single level

parent e85b5ebc
......@@ -69,23 +69,14 @@ namespace Nektar
const AssemblyMapSharedPtr &pLocToGloMap,
const int pNumDir)
{
Array<OneD, NekDouble> vLocalIn(pNumRows, 0.0);
Array<OneD, NekDouble> vLocalOut(pNumRows, 0.0);
int nLocal = m_map.num_elements();
Array<OneD, NekDouble> vLocalIn(nLocal, 0.0);
Array<OneD, NekDouble> vLocalOut(nLocal, 0.0);
GlobalToLocalNoSign(pInput, vLocalIn);
Xxt::Solve(vLocalOut, m_crsData, vLocalIn);
LocalToGlobalNoSign(vLocalOut, pOutput);
}
/// Solve the linear system for given input and output vectors
/// using a specified local to global map.
void GlobalLinSysXxt::v_Solve( const Array<OneD, const NekDouble> &in,
Array<OneD, NekDouble> &out,
const AssemblyMapSharedPtr &pLocToGloMap,
const Array<OneD, const NekDouble> &pDirForcing)
{
ASSERTL0(false, "Not implemented for this GlobalLinSys type.");
}
void GlobalLinSysXxt::GlobalToLocalNoSign(const Array<OneD, const NekDouble> &global,
Array<OneD, NekDouble> &local)
{
......
......@@ -26,7 +26,7 @@ namespace Nektar
//class AssemblyMapDG;
class ExpList;
class GlobalLinSysXxt : public GlobalLinSys
class GlobalLinSysXxt : virtual public GlobalLinSys
{
public:
/// Constructor for full direct matrix solve.
......@@ -48,14 +48,6 @@ namespace Nektar
Array<OneD, int> m_map;
/// Solve the linear system for given input and output vectors
/// using a specified local to global map.
virtual void v_Solve(
const Array<OneD, const NekDouble> &in,
Array<OneD, NekDouble> &out,
const AssemblyMapSharedPtr &locToGloMap,
const Array<OneD, const NekDouble> &dirForcing = NullNekDouble1DArray);
/// Solve the linear system for given input and output vectors.
virtual void v_SolveLinearSystem(
const int pNumRows,
......
......@@ -61,7 +61,8 @@ namespace Nektar
const boost::weak_ptr<ExpList> &pExp,
const boost::shared_ptr<AssemblyMap>
&pLocToGloMap)
: GlobalLinSysXxt(pLinSysKey, pExp, pLocToGloMap)
: GlobalLinSys (pLinSysKey, pExp, pLocToGloMap),
GlobalLinSysXxt(pLinSysKey, pExp, pLocToGloMap)
{
ASSERTL1(m_linSysKey.GetGlobalSysSolnType()==eXxtFullMatrix,
......
......@@ -38,6 +38,7 @@
#include <MultiRegions/GlobalMatrix.h>
#include <MultiRegions/GlobalLinSysKey.h>
#include <MultiRegions/GlobalLinSysXxt.h>
#include <MultiRegions/GlobalLinSysStaticCond.h>
#include <MultiRegions/AssemblyMap/AssemblyMapCG.h>
namespace Nektar
......@@ -53,7 +54,8 @@ namespace Nektar
GlobalLinSysXxtStaticCondSharedPtr;
/// A global linear system.
class GlobalLinSysXxtStaticCond : public GlobalLinSysXxt
class GlobalLinSysXxtStaticCond : virtual public GlobalLinSysXxt,
virtual public GlobalLinSysStaticCond
{
public:
/// Creates an instance of this class
......@@ -63,8 +65,11 @@ namespace Nektar
const boost::shared_ptr<AssemblyMap>
&pLocToGloMap)
{
return MemoryManager<GlobalLinSysXxtStaticCond>
::AllocateSharedPtr(pLinSysKey, pExpList, pLocToGloMap);
GlobalLinSysSharedPtr p = MemoryManager<
GlobalLinSysXxtStaticCond>::AllocateSharedPtr(
pLinSysKey, pExpList, pLocToGloMap);
p->InitObject();
return p;
}
/// Name of class
......@@ -91,67 +96,21 @@ namespace Nektar
virtual ~GlobalLinSysXxtStaticCond();
private:
/// Schur complement for Direct Static Condensation.
GlobalLinSysXxtStaticCondSharedPtr m_recursiveSchurCompl;
/// Block matrices at this level
DNekScalBlkMatSharedPtr m_schurCompl;
DNekScalBlkMatSharedPtr m_BinvD;
DNekScalBlkMatSharedPtr m_C;
DNekScalBlkMatSharedPtr m_invD;
/// Globally assembled Schur complement matrix at this level
GlobalMatrixSharedPtr m_globalSchurCompl;
// Local to global map.
boost::shared_ptr<AssemblyMap> m_locToGloMap;
// Workspace array for matrix multiplication
Array<OneD, NekDouble> m_wsp;
/// Solve the linear system for given input and output vectors
/// using a specified local to global map.
virtual void v_Solve(
const Array<OneD, const NekDouble> &in,
Array<OneD, NekDouble> &out,
const AssemblyMapSharedPtr &locToGloMap,
const Array<OneD, const NekDouble> &dirForcing
= NullNekDouble1DArray);
/// Initialise this object
void Initialise(
const boost::shared_ptr<AssemblyMap>& locToGloMap);
/// Set up the storage for the Schur complement or the top level
/// of the multi-level Schur complement.
void SetupTopLevel(
const boost::shared_ptr<AssemblyMap>& locToGloMap);
protected:
void CreateMap(const boost::shared_ptr<AssemblyMap> &pLocToGloMap);
/// Assemble the Schur complement matrix.
void AssembleSchurComplementMatrixArrays(
const boost::shared_ptr<AssemblyMap>& locToGloMap);
///
void ConstructNextLevelCondensedSystem(
const boost::shared_ptr<AssemblyMap>& locToGloMap);
/// Compute a diagonal preconditioner of the Shur-complement matrix.
void ComputeDiagonalPreconditioner(
const boost::shared_ptr<AssemblyMap> &pLocToGloMap);
/// Perform a Shur-complement matrix multiply operation.
virtual void v_DoMatrixMultiply(
const Array<OneD, NekDouble>& pInput,
Array<OneD, NekDouble>& pOutput);
/// Compute the preconditioner for the Shur-complement matrix.
virtual void v_ComputePreconditioner();
virtual void v_UniqueMap();
virtual void v_AssembleSchurComplement(
boost::shared_ptr<AssemblyMap> locToGloMap);
virtual GlobalLinSysStaticCondSharedPtr v_Recurse(
const GlobalLinSysKey &mkey,
const boost::weak_ptr<ExpList> &pExpList,
const DNekScalBlkMatSharedPtr pSchurCompl,
const DNekScalBlkMatSharedPtr pBinvD,
const DNekScalBlkMatSharedPtr pC,
const DNekScalBlkMatSharedPtr pInvD,
const boost::shared_ptr<AssemblyMap> &locToGloMap);
};
}
}
......
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