36 #include <loki/Singleton.h>
44 namespace Collections {
73 ASSERTL1(wsp.num_elements() == m_wspSize,
74 "Incorrect workspace size");
76 Vmath::Vmul(m_jac.num_elements(),m_jac,1,input,1,wsp,1);
78 Blas::Dgemm(
'N',
'N', m_mat->GetRows(), m_numElmt,
79 m_mat->GetColumns(), 1.0, m_mat->GetRawPtr(),
80 m_mat->GetRows(), wsp.get(), m_stdExp->GetTotPoints(),
81 0.0, output.get(), m_stdExp->GetNcoeffs());
90 ASSERTL0(
false,
"Not valid for this operator.");
99 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
103 m_jac = pGeomData->GetJac(pCollExp);
105 m_stdExp->DetShapeType(), *m_stdExp);
106 m_mat = m_stdExp->GetStdMatrix(key);
107 m_wspSize = m_stdExp->GetTotPoints()*m_numElmt;
112 OperatorKey IProductWRTBase_StdMat::m_typeArr[] = {
115 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Seg"),
118 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Tri"),
121 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_NodalTri"),
124 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Quad"),
127 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Tet"),
130 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_NodalTet"),
133 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Pyr"),
136 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Prism"),
139 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_NodalPrism"),
142 IProductWRTBase_StdMat::create,
"IProductWRTBase_StdMat_Hex"),
165 ASSERTL1(wsp.num_elements() == m_wspSize,
166 "Incorrect workspace size");
168 const int nCoeffs = m_stdExp->GetNcoeffs();
169 const int nPhys = m_stdExp->GetTotPoints();
172 Vmath::Vmul(m_jac.num_elements(),m_jac,1,input,1,wsp,1);
174 for (
int i = 0; i < m_numElmt; ++i)
176 m_stdExp->IProductWRTBase_SumFac(wsp + i*nPhys,
177 tmp = output + i*nCoeffs,
188 ASSERTL0(
false,
"Not valid for this operator.");
196 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
202 for(
int i = 0; i < PtsKey.size(); ++i)
204 nqtot *= PtsKey[i].GetNumPoints();
207 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
209 m_wspSize = nqtot*m_numElmt;
215 OperatorKey IProductWRTBase_IterPerExp::m_typeArr[] = {
218 IProductWRTBase_IterPerExp::create,
219 "IProductWRTBase_IterPerExp_Seg"),
222 IProductWRTBase_IterPerExp::create,
223 "IProductWRTBase_IterPerExp_Tri"),
226 IProductWRTBase_IterPerExp::create,
227 "IProductWRTBase_IterPerExp_NodalTri"),
230 IProductWRTBase_IterPerExp::create,
231 "IProductWRTBase_IterPerExp_Quad"),
234 IProductWRTBase_IterPerExp::create,
235 "IProductWRTBase_IterPerExp_Tet"),
238 IProductWRTBase_IterPerExp::create,
239 "IProductWRTBase_IterPerExp_NodalTet"),
242 IProductWRTBase_IterPerExp::create,
243 "IProductWRTBase_IterPerExp_Pyr"),
246 IProductWRTBase_IterPerExp::create,
247 "IProductWRTBase_IterPerExp_Prism"),
250 IProductWRTBase_IterPerExp::create,
251 "IProductWRTBase_IterPerExp_NodalPrism"),
254 IProductWRTBase_IterPerExp::create,
255 "IProductWRTBase_IterPerExp_Hex"),
279 const int nCoeffs = m_expList[0]->GetNcoeffs();
280 const int nPhys = m_expList[0]->GetTotPoints();
283 for (
int i = 0; i < m_numElmt; ++i)
285 m_expList[i]->IProductWRTBase(input + i*nPhys,
286 tmp = output + i*nCoeffs);
297 ASSERTL0(
false,
"Not valid for this operator.");
305 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
309 m_expList = pCollExp;
314 OperatorKey IProductWRTBase_NoCollection::m_typeArr[] = {
317 IProductWRTBase_NoCollection::create,
318 "IProductWRTBase_NoCollection_Seg"),
321 IProductWRTBase_NoCollection::create,
322 "IProductWRTBase_NoCollection_Tri"),
325 IProductWRTBase_NoCollection::create,
326 "IProductWRTBase_NoCollection_NodalTri"),
329 IProductWRTBase_NoCollection::create,
330 "IProductWRTBase_NoCollection_Quad"),
333 IProductWRTBase_NoCollection::create,
334 "IProductWRTBase_NoCollection_Tet"),
337 IProductWRTBase_NoCollection::create,
338 "IProductWRTBase_NoCollection_NodalTet"),
341 IProductWRTBase_NoCollection::create,
342 "IProductWRTBase_NoCollection_Pyr"),
345 IProductWRTBase_NoCollection::create,
346 "IProductWRTBase_NoCollection_Prism"),
349 IProductWRTBase_NoCollection::create,
350 "IProductWRTBase_NoCollection_NodalPrism"),
353 IProductWRTBase_NoCollection::create,
354 "IProductWRTBase_NoCollection_Hex"),
380 Vmath::Vmul(m_numElmt*m_nquad0,m_jac,1,input,1,output,1);
384 Vmath::Vmul(m_numElmt*m_nquad0,m_jac,1,input,1,wsp,1);
387 Blas::Dgemm(
'T',
'N', m_nmodes0, m_numElmt, m_nquad0,
388 1.0, m_base0.get(), m_nquad0,
389 &wsp[0], m_nquad0, 0.0,
390 &output[0], m_nmodes0);
400 ASSERTL0(
false,
"Not valid for this operator.");
412 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
415 m_nquad0 (m_stdExp->GetNumPoints(0)),
416 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
417 m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
418 m_base0 (m_stdExp->GetBasis(0)->GetBdata())
420 m_wspSize = m_numElmt*m_nquad0;
421 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
427 RegisterCreatorFunction(
429 IProductWRTBase_SumFac_Seg::create,
"IProductWRTBase_SumFac_Seg");
451 ASSERTL1(wsp.num_elements() == m_wspSize,
452 "Incorrect workspace size");
456 m_nmodes0, m_nmodes1,
458 m_jac, input, output, wsp);
467 ASSERTL0(
false,
"Not valid for this operator.");
483 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
486 m_nquad0 (m_stdExp->GetNumPoints(0)),
487 m_nquad1 (m_stdExp->GetNumPoints(1)),
488 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
489 m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
490 m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
491 m_colldir1(m_stdExp->GetBasis(1)->Collocation()),
492 m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
493 m_base1 (m_stdExp->GetBasis(1)->GetBdata())
495 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
496 m_wspSize = 2 * m_numElmt
497 * (max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1));
503 RegisterCreatorFunction(
505 IProductWRTBase_SumFac_Quad::create,
"IProductWRTBase_SumFac_Quad");
527 ASSERTL1(wsp.num_elements() == m_wspSize,
528 "Incorrect workspace size");
530 TriIProduct(m_sortTopVertex, m_numElmt, m_nquad0, m_nquad1,
531 m_nmodes0, m_nmodes1,m_base0,m_base1,m_jac, input,
541 ASSERTL0(
false,
"Not valid for this operator.");
556 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
559 m_nquad0 (m_stdExp->GetNumPoints(0)),
560 m_nquad1 (m_stdExp->GetNumPoints(1)),
561 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
562 m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
563 m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
564 m_base1 (m_stdExp->GetBasis(1)->GetBdata())
566 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
567 m_wspSize = 2 * m_numElmt
568 * (max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1));
569 if(m_stdExp->GetBasis(0)->GetBasisType()
572 m_sortTopVertex =
true;
576 m_sortTopVertex =
false;
583 RegisterCreatorFunction(
585 IProductWRTBase_SumFac_Tri::create,
"IProductWRTBase_SumFac_Tri");
608 ASSERTL1(wsp.num_elements() == m_wspSize,
609 "Incorrect workspace size");
611 HexIProduct(m_colldir0,m_colldir1,m_colldir2, m_numElmt,
612 m_nquad0, m_nquad1, m_nquad2,
613 m_nmodes0, m_nmodes1, m_nmodes2,
614 m_base0, m_base1, m_base2,
615 m_jac,input,output,wsp);
624 ASSERTL0(
false,
"Not valid for this operator.");
644 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
647 m_nquad0 (m_stdExp->GetNumPoints(0)),
648 m_nquad1 (m_stdExp->GetNumPoints(1)),
649 m_nquad2 (m_stdExp->GetNumPoints(2)),
650 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
651 m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
652 m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
653 m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
654 m_colldir1(m_stdExp->GetBasis(1)->Collocation()),
655 m_colldir2(m_stdExp->GetBasis(2)->Collocation()),
656 m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
657 m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
658 m_base2 (m_stdExp->GetBasis(2)->GetBdata())
661 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
662 m_wspSize = 3 * m_numElmt * (max(m_nquad0*m_nquad1*m_nquad2,
663 m_nmodes0*m_nmodes1*m_nmodes2));
669 RegisterCreatorFunction(
671 IProductWRTBase_SumFac_Hex::create,
"IProductWRTBase_SumFac_Hex");
694 ASSERTL1(wsp.num_elements() == m_wspSize,
695 "Incorrect workspace size");
698 m_nquad0, m_nquad1, m_nquad2,
699 m_nmodes0, m_nmodes1, m_nmodes2,
700 m_base0, m_base1, m_base2,
701 m_jac,input,output,wsp);
711 ASSERTL0(
false,
"Not valid for this operator.");
729 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
732 m_nquad0 (m_stdExp->GetNumPoints(0)),
733 m_nquad1 (m_stdExp->GetNumPoints(1)),
734 m_nquad2 (m_stdExp->GetNumPoints(2)),
735 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
736 m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
737 m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
738 m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
739 m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
740 m_base2 (m_stdExp->GetBasis(2)->GetBdata())
742 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
743 m_wspSize = m_numElmt*(max(m_nquad0*m_nquad1*m_nquad2,
744 m_nquad2*m_nmodes0*(2*m_nmodes1-m_nmodes0+1)/2)+
745 m_nquad2*m_nquad1*m_nmodes0);
747 if(m_stdExp->GetBasis(0)->GetBasisType()
750 m_sortTopEdge =
true;
754 m_sortTopEdge =
false;
761 RegisterCreatorFunction(
763 IProductWRTBase_SumFac_Tet::create,
"IProductWRTBase_SumFac_Tet");
787 ASSERTL1(wsp.num_elements() == m_wspSize,
788 "Incorrect workspace size");
791 m_nquad0, m_nquad1, m_nquad2,
792 m_nmodes0, m_nmodes1, m_nmodes2,
793 m_base0, m_base1, m_base2,
794 m_jac,input,output,wsp);
803 ASSERTL0(
false,
"Not valid for this operator.");
821 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
824 m_nquad0 (m_stdExp->GetNumPoints(0)),
825 m_nquad1 (m_stdExp->GetNumPoints(1)),
826 m_nquad2 (m_stdExp->GetNumPoints(2)),
827 m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
828 m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
829 m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
830 m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
831 m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
832 m_base2 (m_stdExp->GetBasis(2)->GetBdata())
835 m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
837 m_wspSize = m_numElmt * m_nquad2
838 *(max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1))
839 + m_nquad1*m_nquad2*m_numElmt*m_nmodes0;
841 if(m_stdExp->GetBasis(0)->GetBasisType()
844 m_sortTopVertex =
true;
848 m_sortTopVertex =
false;
855 RegisterCreatorFunction(
857 IProductWRTBase_SumFac_Prism::create,
"IProductWRTBase_SumFac_Prism");
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
IProductWRTBase_StdMat(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
#define ASSERTL0(condition, msg)
void HexIProduct(bool colldir0, bool colldir1, bool colldir2, int numElmt, int nquad0, int nquad1, int nquad2, int nmodes0, int nmodes1, int nmodes2, const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &jac, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
Array< OneD, const NekDouble > m_jac
Array< OneD, const NekDouble > m_jac
Backward transform operator using sum-factorisation (Prism)
std::vector< PointsKey > PointsKeyVector
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Inner product operator using sum-factorisation (Tet)
boost::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Principle Modified Functions .
Array< OneD, const NekDouble > m_base1
Inner product operator using sum-factorisation (Quad)
void QuadIProduct(bool colldir0, bool colldir1, int numElmt, int nquad0, int nquad1, int nmodes0, int nmodes1, const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &jac, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
vector< StdRegions::StdExpansionSharedPtr > m_expList
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Base class for operators on a collection of elements.
boost::shared_ptr< DNekMat > DNekMatSharedPtr
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Array< OneD, const NekDouble > m_jac
void TetIProduct(bool sortTopEdge, int numElmt, int nquad0, int nquad1, int nquad2, int nmodes0, int nmodes1, int nmodes2, const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &jac, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
IProductWRTBase_SumFac_Tri(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
Array< OneD, const NekDouble > m_base2
IProductWRTBase_NoCollection(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
Array< OneD, const NekDouble > m_base1
Inner product operator using element-wise operation.
void TriIProduct(bool sortTopVertex, int numElmt, int nquad0, int nquad1, int nmodes0, int nmodes1, const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &jac, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
Inner product operator using sum-factorisation (Tri)
Inner product operator using standard matrix approach.
Array< OneD, const NekDouble > m_jac
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
IProductWRTBase_IterPerExp(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Array< OneD, const NekDouble > m_jac
IProductWRTBase_SumFac_Hex(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
Inner product operator using sum-factorisation (Segment)
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Array< OneD, const NekDouble > m_base0
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
IProductWRTBase_SumFac_Prism(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
void PrismIProduct(bool sortTopVertex, int numElmt, int nquad0, int nquad1, int nquad2, int nmodes0, int nmodes1, int nmodes2, const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &jac, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
Array< OneD, const NekDouble > m_base1
Array< OneD, const NekDouble > m_base0
Array< OneD, const NekDouble > m_base0
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
#define OPERATOR_CREATE(cname)
Array< OneD, const NekDouble > m_jac
Array< OneD, const NekDouble > m_base2
Array< OneD, const NekDouble > m_base1
Array< OneD, const NekDouble > m_base0
Array< OneD, const NekDouble > m_base0
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
boost::shared_ptr< CoalescedGeomData > CoalescedGeomDataSharedPtr
Array< OneD, NekDouble > m_jac
Array< OneD, const NekDouble > m_base0
Array< OneD, const NekDouble > m_jac
Array< OneD, const NekDouble > m_base2
virtual void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
Perform operation.
Backward transform operator using sum-factorisation (Hex)
IProductWRTBase_SumFac_Quad(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
IProductWRTBase_SumFac_Seg(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Inner product operator using original MultiRegions implementation.
IProductWRTBase_SumFac_Tet(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
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.
Array< OneD, const NekDouble > m_base1
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.