39#include <MatrixFreeOps/Operator.hpp>
93 unsigned int nmodes =
m_expList[0]->GetNcoeffs();
94 unsigned int nphys =
m_expList[0]->GetTotPoints();
110 m_expList[n]->GeneralMatrixOp(entry0 + n * nmodes,
111 tmp = entry1 + n * nmodes, mkey);
147 m_dim = pCollExp[0]->GetNumBases();
159 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Seg"),
162 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Tri"),
165 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_NodalTri"),
168 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Quad"),
171 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Tet"),
174 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_NodalTet"),
177 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Pyr"),
180 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Prism"),
183 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_NodalPrism"),
186 Helmholtz_NoCollection::create,
"Helmholtz_NoCollection_Hex")};
204 const int nCoeffs =
m_stdExp->GetNcoeffs();
205 const int nPhys =
m_stdExp->GetTotPoints();
208 "input array size is insufficient");
210 "output array size is insufficient");
219 dtmp[i - 1] = wsp + i * nPhys;
220 tmp[i - 1] = wsp + (i +
m_coordim) * nPhys;
225 m_stdExp->BwdTrans(input + i * nCoeffs, tmpphys);
228 m_stdExp->PhysDeriv(tmpphys, dtmp[0], dtmp[1], dtmp[2]);
241 m_stdExp->IProductWRTBase(tmpphys, t1 = output + i * nCoeffs);
243 t1 = output + i * nCoeffs, 1);
252 &dtmp[0][0], 1, &tmp[j][0], 1);
254 for (
int k = 1; k <
m_dim; ++k)
259 &dtmp[k][0], 1, &tmp[j][0], 1, &tmp[j][0], 1);
275 &tmpphys[0], 1, &tmpphys[0], 1);
278 for (
int j = 0; j <
m_dim; ++j)
281 1, &tmpphys[0], 1, &dtmp[j][0], 1);
292 &tmpphys[0], 1, &tmpphys[0], 1);
295 for (
int j = 0; j <
m_dim; ++j)
300 1, &tmpphys[0], 1, &dtmp[j][0], 1,
309 for (
int j = 0; j <
m_dim; ++j)
312 1, &tmp[0][0], 1, &dtmp[j][0], 1);
319 1, &tmp[k][0], 1, &dtmp[j][0], 1,
326 for (
int j = 0; j <
m_dim; ++j)
332 m_stdExp->IProductWRTDerivBase(j, dtmp[j], tmp[0]);
333 Vmath::Vadd(nCoeffs, tmp[0], 1, output + i * nCoeffs, 1,
334 t1 = output + i * nCoeffs, 1);
345 for (
int k = 1; k <
m_dim; ++k)
348 &dtmp[k][0], 1, &tmp[j][0], 1, &tmp[j][0],
365 &tmpphys[0], 1, &tmpphys[0], 1);
368 for (
int j = 0; j <
m_dim; ++j)
382 &tmpphys[0], 1, &tmpphys[0], 1);
385 for (
int j = 0; j <
m_dim; ++j)
388 &tmpphys[0], 1, &dtmp[j][0], 1,
397 for (
int j = 0; j <
m_dim; ++j)
405 &tmp[k][0], 1, &dtmp[j][0], 1,
412 for (
int j = 0; j <
m_dim; ++j)
417 m_stdExp->IProductWRTDerivBase(j, dtmp[j], tmp[0]);
418 Vmath::Vadd(nCoeffs, tmp[0], 1, output + i * nCoeffs, 1,
419 t1 = output + i * nCoeffs, 1);
452 "Constant factor not defined: " +
533 m_dim = pCollExp[0]->GetShapeDimension();
535 int nqtot =
m_stdExp->GetTotPoints();
537 m_derivFac = pGeomData->GetDerivFactors(pCollExp);
538 m_jac = pGeomData->GetJac(pCollExp);
553 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Seg"),
556 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Tri"),
559 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_NodalTri"),
562 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Quad"),
565 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Tet"),
568 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_NodalTet"),
571 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Pyr"),
574 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Prism"),
577 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_NodalPrism"),
580 Helmholtz_IterPerExp::create,
"Helmholtz_IterPerExp_Hex")};
600 (*m_oper)(input, output0);
627 "Constant factor not defined: " +
630 m_oper->SetLambda(x->second);
633 bool isConstVarDiff =
false;
635 diff[0] = diff[2] = diff[5] = 1.0;
638 if (xd00 !=
factors.end() && xd00->second != 1.0)
640 isConstVarDiff =
true;
641 diff[0] = xd00->second;
645 if (xd01 !=
factors.end() && xd01->second != 0.0)
647 isConstVarDiff =
true;
648 diff[1] = xd01->second;
652 if (xd11 !=
factors.end() && xd11->second != 1.0)
654 isConstVarDiff =
true;
655 diff[2] = xd11->second;
659 if (xd02 !=
factors.end() && xd02->second != 0.0)
661 isConstVarDiff =
true;
662 diff[3] = xd02->second;
666 if (xd12 !=
factors.end() && xd12->second != 0.0)
668 isConstVarDiff =
true;
669 diff[4] = xd12->second;
673 if (xd22 !=
factors.end() && xd22->second != 1.0)
675 isConstVarDiff =
true;
676 diff[5] = xd22->second;
681 m_oper->SetConstVarDiffusion(diff);
686 if (k !=
factors.end() && k->second != 0.0)
688 m_oper->SetVarDiffusion(diff);
707 std::shared_ptr<MatrixFree::Helmholtz>
m_oper;
717 pCollExp[0]->GetStdExp()->GetNcoeffs(),
724 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
727 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
728 for (
auto i = 0; i < dim; ++i)
730 basis[i] = pCollExp[0]->GetBasis(i);
734 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
737 std::string op_string =
"Helmholtz";
738 op_string += MatrixFree::GetOpstring(shapeType,
m_isDeformed);
740 op_string, basis, pCollExp.size());
743 oper->SetJac(pGeomData->GetJacInterLeave(pCollExp,
m_nElmtPad));
746 oper->SetDF(pGeomData->GetDerivFactorsInterLeave(pCollExp,
m_nElmtPad));
748 oper->SetUpBdata(basis);
749 oper->SetUpDBdata(basis);
750 oper->SetUpZW(basis);
753 m_oper = std::dynamic_pointer_cast<MatrixFree::Helmholtz>(oper);
767 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Quad"),
770 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Tri"),
773 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Hex"),
776 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Prism"),
779 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Pyr"),
782 Helmholtz_MatrixFree::create,
"Helmholtz_MatrixFree_Tet"),
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define OPERATOR_CREATE(cname)
Helmholtz help class to calculate the size of the collection that is given as an input and as an outp...
Helmholtz operator using LocalRegions implementation.
StdRegions::VarCoeffMap m_varcoeffs
void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
~Helmholtz_IterPerExp() final=default
StdRegions::FactorMap m_factors
void UpdateFactors(StdRegions::FactorMap factors) override
Check the validity of supplied constant factors.
Array< TwoD, const NekDouble > m_derivFac
void UpdateVarcoeffs(StdRegions::VarCoeffMap &varcoeffs) override
Check the validity of supplied variable coefficients. Note that the m_varcoeffs are not implemented f...
const StdRegions::ConstFactorType m_factorCoeffDef[3][3]
Helmholtz_IterPerExp(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
Array< OneD, Array< OneD, NekDouble > > m_diff
Array< OneD, const NekDouble > m_jac
Helmholtz operator using matrix free operators.
StdRegions::VarCoeffMap m_varcoeffs
void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
void UpdateVarcoeffs(StdRegions::VarCoeffMap &varcoeffs) override
Check the validity of supplied variable coefficients. Note that the m_varcoeffs are not implemented f...
~Helmholtz_MatrixFree() final=default
std::shared_ptr< MatrixFree::Helmholtz > m_oper
StdRegions::FactorMap m_factors
void UpdateFactors(StdRegions::FactorMap factors) override
Update the supplied factor map.
Helmholtz_MatrixFree(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
Helmholtz operator using LocalRegions implementation.
void UpdateVarcoeffs(StdRegions::VarCoeffMap &varcoeffs) override
Update the supplied variable coefficients.
Helmholtz_NoCollection(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
void UpdateFactors(StdRegions::FactorMap factors) override
Update the supplied factor map.
StdRegions::FactorMap m_factors
~Helmholtz_NoCollection() final=default
vector< StdRegions::StdExpansionSharedPtr > m_expList
StdRegions::VarCoeffMap m_varcoeffs
unsigned int m_nElmtPad
size after padding
Base class for operators on a collection of elements.
StdRegions::StdExpansionSharedPtr m_stdExp
unsigned int m_outputSizeOther
Number of modes or quadrature points, opposite to m_outputSize.
unsigned int m_numElmt
number of elements that the operator is applied on
unsigned int m_inputSizeOther
Number of modes or quadrature points, opposite to m_inputSize.
unsigned int m_outputSize
number of modes or quadrature points that are taken as output from an operator
unsigned int m_inputSize
number of modes or quadrature points that are passed as input to an operator
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
std::shared_ptr< CoalescedGeomData > CoalescedGeomDataSharedPtr
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
const NekPoint< NekDouble > origin
static FactorMap NullFactorMap
const char *const ConstFactorTypeMap[]
VarCoeffMap RestrictCoeffMap(const VarCoeffMap &m, size_t offset, size_t cnt)
static VarCoeffMap NullVarCoeffMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
std::vector< double > d(NPUPPER *NPUPPER)
StdRegions::ConstFactorMap factors
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
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.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.