Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | List of all members
Nektar::MultiRegions::PreconditionerLinearWithLowEnergy Class Reference

#include <PreconditionerLinearWithLowEnergy.h>

Inheritance diagram for Nektar::MultiRegions::PreconditionerLinearWithLowEnergy:
Inheritance graph
[legend]
Collaboration diagram for Nektar::MultiRegions::PreconditionerLinearWithLowEnergy:
Collaboration graph
[legend]

Public Member Functions

 PreconditionerLinearWithLowEnergy (const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
 
virtual ~PreconditionerLinearWithLowEnergy ()
 
- Public Member Functions inherited from Nektar::MultiRegions::Preconditioner
 Preconditioner (const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
 
virtual ~Preconditioner ()
 
void DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void DoPreconditionerWithNonVertOutput (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const Array< OneD, NekDouble > &pNonVertOutput, Array< OneD, NekDouble > &pVertForce=NullNekDouble1DArray)
 
void DoTransformToLowEnergy (Array< OneD, NekDouble > &pInOut, int offset)
 
void DoTransformToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void DoTransformFromLowEnergy (Array< OneD, NekDouble > &pInOut)
 
void DoMultiplybyInverseTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void DoMultiplybyInverseTransposedTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void BuildPreconditioner ()
 
void InitObject ()
 
Array< OneD, NekDoubleAssembleStaticCondGlobalDiagonals ()
 Performs global assembly of diagonal entries to global Schur complement matrix. More...
 
const DNekScalBlkMatSharedPtrGetBlockTransformedSchurCompl () const
 
const DNekScalBlkMatSharedPtrGetBlockCMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockInvDMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockSchurCompl () const
 
const DNekScalBlkMatSharedPtrGetBlockTransformationMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockTransposedTransformationMatrix () const
 
DNekScalMatSharedPtr TransformedSchurCompl (int offset, const boost::shared_ptr< DNekScalMat > &loc_mat)
 

Static Public Member Functions

static PreconditionerSharedPtr create (const boost::shared_ptr< GlobalLinSys > &plinsys, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 

Protected Attributes

PreconditionerSharedPtr m_linSpacePrecon
 
PreconditionerSharedPtr m_lowEnergyPrecon
 
- Protected Attributes inherited from Nektar::MultiRegions::Preconditioner
const boost::weak_ptr
< GlobalLinSys
m_linsys
 
PreconditionerType m_preconType
 
DNekMatSharedPtr m_preconditioner
 
boost::shared_ptr< AssemblyMapm_locToGloMap
 
LibUtilities::CommSharedPtr m_comm
 

Private Member Functions

virtual void v_InitObject ()
 
virtual void v_DoTransformToLowEnergy (Array< OneD, NekDouble > &pInOut, int offset)
 Transform from original basis to low energy basis. More...
 
virtual void v_DoTransformFromLowEnergy (Array< OneD, NekDouble > &pInput)
 Transform from low energy basis to orignal basis. More...
 
virtual DNekScalMatSharedPtr v_TransformedSchurCompl (int offset, const boost::shared_ptr< DNekScalMat > &loc_mat)
 Get block elemental transposed transformation matrix $\mathbf{R}^{T}$. More...
 
virtual void v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 Apply a preconditioner to the conjugate gradient method. More...
 
virtual void v_BuildPreconditioner ()
 

Additional Inherited Members

Detailed Description

This class implements preconditioning for the conjugate gradient matrix solver.

Definition at line 49 of file PreconditionerLinearWithLowEnergy.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::PreconditionerLinearWithLowEnergy ( const boost::shared_ptr< GlobalLinSys > &  plinsys,
const AssemblyMapSharedPtr pLocToGloMap 
)

Definition at line 63 of file PreconditionerLinearWithLowEnergy.cpp.

66  : Preconditioner(plinsys, pLocToGloMap)
67  {
68  }
Preconditioner(const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
virtual Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::~PreconditionerLinearWithLowEnergy ( )
inlinevirtual

Definition at line 71 of file PreconditionerLinearWithLowEnergy.h.

71 {}

Member Function Documentation

static PreconditionerSharedPtr Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::create ( const boost::shared_ptr< GlobalLinSys > &  plinsys,
const boost::shared_ptr< AssemblyMap > &  pLocToGloMap 
)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file PreconditionerLinearWithLowEnergy.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

57  {
59  p->InitObject();
60  return p;
61  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< Preconditioner > PreconditionerSharedPtr
Definition: GlobalLinSys.h:62
void Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_BuildPreconditioner ( )
privatevirtual

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 110 of file PreconditionerLinearWithLowEnergy.cpp.

References m_linSpacePrecon, and m_lowEnergyPrecon.

111  {
112  m_linSpacePrecon->BuildPreconditioner();
113  m_lowEnergyPrecon->BuildPreconditioner();
114  }
void Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_DoPreconditioner ( const Array< OneD, NekDouble > &  pInput,
Array< OneD, NekDouble > &  pOutput 
)
privatevirtual

Apply a preconditioner to the conjugate gradient method.

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 120 of file PreconditionerLinearWithLowEnergy.cpp.

References m_linSpacePrecon, m_lowEnergyPrecon, and Vmath::Vadd().

123  {
124  int nGlobal = pInput.num_elements();
125 
126  Array<OneD, NekDouble> OutputLowEnergy(nGlobal, 0.0);
127  Array<OneD, NekDouble> tmp(nGlobal, 0.0);
128  Array<OneD, NekDouble> OutputLinear(nGlobal, 0.0);
129  Array<OneD, NekDouble> InputLinear(nGlobal, 0.0);
130 
131  //Apply Low Energy preconditioner
132  m_lowEnergyPrecon->DoPreconditioner(pInput, OutputLowEnergy);
133 
134  //Transform input from low energy to original basis
135  m_lowEnergyPrecon->DoMultiplybyInverseTransformationMatrix(pInput, InputLinear);
136 
137  //Apply linear space preconditioner
138  m_linSpacePrecon->DoPreconditionerWithNonVertOutput(InputLinear, OutputLinear, tmp);
139 
140  m_lowEnergyPrecon->DoMultiplybyInverseTransposedTransformationMatrix(OutputLinear,pOutput);
141 
142  Vmath::Vadd(nGlobal,pOutput,1,OutputLowEnergy,1,pOutput,1);
143  }
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_DoTransformFromLowEnergy ( Array< OneD, NekDouble > &  pInput)
privatevirtual

Transform from low energy basis to orignal basis.

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 92 of file PreconditionerLinearWithLowEnergy.cpp.

References m_lowEnergyPrecon.

94  {
95  m_lowEnergyPrecon->DoTransformFromLowEnergy(pInput);
96  }
void Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_DoTransformToLowEnergy ( Array< OneD, NekDouble > &  pInOut,
int  offset 
)
privatevirtual

Transform from original basis to low energy basis.

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 82 of file PreconditionerLinearWithLowEnergy.cpp.

References m_lowEnergyPrecon.

85  {
86  m_lowEnergyPrecon->DoTransformToLowEnergy(pInOut,offset);
87  }
void Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_InitObject ( )
privatevirtual

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 73 of file PreconditionerLinearWithLowEnergy.cpp.

References Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::MultiRegions::GetPreconFactory(), m_linSpacePrecon, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and m_lowEnergyPrecon.

74  {
77  }
boost::shared_ptr< AssemblyMap > m_locToGloMap
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
PreconFactory & GetPreconFactory()
const boost::weak_ptr< GlobalLinSys > m_linsys
DNekScalMatSharedPtr Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::v_TransformedSchurCompl ( int  offset,
const boost::shared_ptr< DNekScalMat > &  loc_mat 
)
privatevirtual

Get block elemental transposed transformation matrix $\mathbf{R}^{T}$.

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 100 of file PreconditionerLinearWithLowEnergy.cpp.

References m_lowEnergyPrecon.

101  {
102  DNekScalMatSharedPtr returnval;
103  returnval=m_lowEnergyPrecon->TransformedSchurCompl(offset,loc_mat);
104  return returnval;
105  }
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr

Member Data Documentation

string Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::className
static
Initial value:
"FullLinearSpaceWithLowEnergyBlock",
"Full Linear space and low energy block preconditioning")

Name of class.

Registers the class with the Factory.

Definition at line 64 of file PreconditionerLinearWithLowEnergy.h.

PreconditionerSharedPtr Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::m_linSpacePrecon
protected
PreconditionerSharedPtr Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::m_lowEnergyPrecon
protected