Nektar++
IProductWRTBase.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: IProductWRTBase.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: IProductWRTBase operator implementations
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <boost/core/ignore_unused.hpp>
36 
37 #include <Collections/Operator.h>
38 #include <Collections/Collection.h>
39 #include <Collections/IProduct.h>
40 
41 using namespace std;
42 
43 namespace Nektar {
44 namespace Collections {
45 
53 
54 /**
55  * @brief Inner product operator using standard matrix approach
56  */
58 {
59  public:
61 
63  {
64  }
65 
66  virtual void operator()(
67  const Array<OneD, const NekDouble> &input,
68  Array<OneD, NekDouble> &output,
69  Array<OneD, NekDouble> &output1,
70  Array<OneD, NekDouble> &output2,
72  {
73  boost::ignore_unused(output1, output2);
74 
75  ASSERTL1(wsp.num_elements() == m_wspSize,
76  "Incorrect workspace size");
77 
78  Vmath::Vmul(m_jac.num_elements(),m_jac,1,input,1,wsp,1);
79 
80  Blas::Dgemm('N', 'N', m_mat->GetRows(), m_numElmt,
81  m_mat->GetColumns(), 1.0, m_mat->GetRawPtr(),
82  m_mat->GetRows(), wsp.get(), m_stdExp->GetTotPoints(),
83  0.0, output.get(), m_stdExp->GetNcoeffs());
84  }
85 
86  virtual void operator()(
87  int dir,
88  const Array<OneD, const NekDouble> &input,
89  Array<OneD, NekDouble> &output,
91  {
92  boost::ignore_unused(dir, input, output, wsp);
93  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
94  }
95 
96  protected:
99 
100  private:
102  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
103  CoalescedGeomDataSharedPtr pGeomData)
104  : Operator(pCollExp, pGeomData)
105  {
106  m_jac = pGeomData->GetJac(pCollExp);
108  m_stdExp->DetShapeType(), *m_stdExp);
109  m_mat = m_stdExp->GetStdMatrix(key);
110  m_wspSize = m_stdExp->GetTotPoints()*m_numElmt;
111  }
112 };
113 
114 /// Factory initialisation for the IProductWRTBase_StdMat operators
115 OperatorKey IProductWRTBase_StdMat::m_typeArr[] = {
118  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Seg"),
121  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Tri"),
124  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_NodalTri"),
127  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Quad"),
130  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Tet"),
133  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_NodalTet"),
136  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Pyr"),
139  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Prism"),
142  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_NodalPrism"),
145  IProductWRTBase_StdMat::create, "IProductWRTBase_StdMat_Hex"),
148  IProductWRTBase_StdMat::create, "IProductWRTBase_SumFac_Pyr")
149 };
150 
151 
152 /**
153  * @brief Inner product operator using element-wise operation
154  */
156 {
157  public:
159 
161  {
162  }
163 
164  virtual void operator()(
165  const Array<OneD, const NekDouble> &input,
166  Array<OneD, NekDouble> &output,
167  Array<OneD, NekDouble> &output1,
168  Array<OneD, NekDouble> &output2,
170  {
171  boost::ignore_unused(output1, output2);
172 
173  ASSERTL1(wsp.num_elements() == m_wspSize,
174  "Incorrect workspace size");
175 
176  const int nCoeffs = m_stdExp->GetNcoeffs();
177  const int nPhys = m_stdExp->GetTotPoints();
179 
180  Vmath::Vmul(m_jac.num_elements(),m_jac,1,input,1,wsp,1);
181 
182  for (int i = 0; i < m_numElmt; ++i)
183  {
184  m_stdExp->IProductWRTBase_SumFac(wsp + i*nPhys,
185  tmp = output + i*nCoeffs,
186  false);
187  }
188  }
189 
190  virtual void operator()(
191  int dir,
192  const Array<OneD, const NekDouble> &input,
193  Array<OneD, NekDouble> &output,
195  {
196  boost::ignore_unused(dir, input, output, wsp);
197  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
198  }
199 
200  protected:
202 
203  private:
205  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
206  CoalescedGeomDataSharedPtr pGeomData)
207  : Operator(pCollExp, pGeomData)
208  {
209  int nqtot = 1;
210  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
211  for(int i = 0; i < PtsKey.size(); ++i)
212  {
213  nqtot *= PtsKey[i].GetNumPoints();
214  }
215 
216  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
217 
218  m_wspSize = nqtot*m_numElmt;
219  }
220 
221 };
222 
223 /// Factory initialisation for the IProductWRTBase_IterPerExp operators
224 OperatorKey IProductWRTBase_IterPerExp::m_typeArr[] = {
227  IProductWRTBase_IterPerExp::create,
228  "IProductWRTBase_IterPerExp_Seg"),
231  IProductWRTBase_IterPerExp::create,
232  "IProductWRTBase_IterPerExp_Tri"),
235  IProductWRTBase_IterPerExp::create,
236  "IProductWRTBase_IterPerExp_NodalTri"),
239  IProductWRTBase_IterPerExp::create,
240  "IProductWRTBase_IterPerExp_Quad"),
243  IProductWRTBase_IterPerExp::create,
244  "IProductWRTBase_IterPerExp_Tet"),
247  IProductWRTBase_IterPerExp::create,
248  "IProductWRTBase_IterPerExp_NodalTet"),
251  IProductWRTBase_IterPerExp::create,
252  "IProductWRTBase_IterPerExp_Pyr"),
255  IProductWRTBase_IterPerExp::create,
256  "IProductWRTBase_IterPerExp_Prism"),
259  IProductWRTBase_IterPerExp::create,
260  "IProductWRTBase_IterPerExp_NodalPrism"),
263  IProductWRTBase_IterPerExp::create,
264  "IProductWRTBase_IterPerExp_Hex"),
265 };
266 
267 
268 /**
269  * @brief Inner product operator using original MultiRegions implementation.
270  */
272 {
273  public:
275 
277  {
278  }
279 
280  virtual void operator()(
281  const Array<OneD, const NekDouble> &input,
282  Array<OneD, NekDouble> &output,
283  Array<OneD, NekDouble> &output1,
284  Array<OneD, NekDouble> &output2,
286  {
287  boost::ignore_unused(output1, output2, wsp);
288 
289  const int nCoeffs = m_expList[0]->GetNcoeffs();
290  const int nPhys = m_expList[0]->GetTotPoints();
292 
293  for (int i = 0; i < m_numElmt; ++i)
294  {
295  m_expList[i]->IProductWRTBase(input + i*nPhys,
296  tmp = output + i*nCoeffs);
297  }
298 
299  }
300 
301  virtual void operator()(
302  int dir,
303  const Array<OneD, const NekDouble> &input,
304  Array<OneD, NekDouble> &output,
306  {
307  boost::ignore_unused(dir, input, output, wsp);
308  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
309  }
310 
311  protected:
312  vector<StdRegions::StdExpansionSharedPtr> m_expList;
313 
314  private:
316  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
317  CoalescedGeomDataSharedPtr pGeomData)
318  : Operator(pCollExp, pGeomData)
319  {
320  m_expList = pCollExp;
321  }
322 };
323 
324 /// Factory initialisation for the IProductWRTBase_NoCollection operators
325 OperatorKey IProductWRTBase_NoCollection::m_typeArr[] = {
328  IProductWRTBase_NoCollection::create,
329  "IProductWRTBase_NoCollection_Seg"),
332  IProductWRTBase_NoCollection::create,
333  "IProductWRTBase_NoCollection_Tri"),
336  IProductWRTBase_NoCollection::create,
337  "IProductWRTBase_NoCollection_NodalTri"),
340  IProductWRTBase_NoCollection::create,
341  "IProductWRTBase_NoCollection_Quad"),
344  IProductWRTBase_NoCollection::create,
345  "IProductWRTBase_NoCollection_Tet"),
348  IProductWRTBase_NoCollection::create,
349  "IProductWRTBase_NoCollection_NodalTet"),
352  IProductWRTBase_NoCollection::create,
353  "IProductWRTBase_NoCollection_Pyr"),
356  IProductWRTBase_NoCollection::create,
357  "IProductWRTBase_NoCollection_Prism"),
360  IProductWRTBase_NoCollection::create,
361  "IProductWRTBase_NoCollection_NodalPrism"),
364  IProductWRTBase_NoCollection::create,
365  "IProductWRTBase_NoCollection_Hex"),
366 };
367 
368 
369 /**
370  * @brief Inner product operator using sum-factorisation (Segment)
371  */
373 {
374  public:
376 
378  {
379  }
380 
381  virtual void operator()(
382  const Array<OneD, const NekDouble> &input,
383  Array<OneD, NekDouble> &output,
384  Array<OneD, NekDouble> &output1,
385  Array<OneD, NekDouble> &output2,
387  {
388  boost::ignore_unused(output1, output2);
389 
390  if(m_colldir0)
391  {
392  Vmath::Vmul(m_numElmt*m_nquad0,m_jac,1,input,1,output,1);
393  }
394  else
395  {
396  Vmath::Vmul(m_numElmt*m_nquad0,m_jac,1,input,1,wsp,1);
397 
398  // out = B0*in;
399  Blas::Dgemm('T','N', m_nmodes0, m_numElmt, m_nquad0,
400  1.0, m_base0.get(), m_nquad0,
401  &wsp[0], m_nquad0, 0.0,
402  &output[0], m_nmodes0);
403  }
404  }
405 
406  virtual void operator()(
407  int dir,
408  const Array<OneD, const NekDouble> &input,
409  Array<OneD, NekDouble> &output,
411  {
412  boost::ignore_unused(dir, input, output, wsp);
413  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
414  }
415 
416  protected:
417  const int m_nquad0;
418  const int m_nmodes0;
419  const bool m_colldir0;
422 
423  private:
425  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
426  CoalescedGeomDataSharedPtr pGeomData)
427  : Operator (pCollExp, pGeomData),
428  m_nquad0 (m_stdExp->GetNumPoints(0)),
429  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
430  m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
431  m_base0 (m_stdExp->GetBasis(0)->GetBdata())
432  {
433  m_wspSize = m_numElmt*m_nquad0;
434  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
435  }
436 };
437 
438 /// Factory initialisation for the IProductWRTBase_SumFac_Seg operator
439 OperatorKey IProductWRTBase_SumFac_Seg::m_type = GetOperatorFactory().
440  RegisterCreatorFunction(
442  IProductWRTBase_SumFac_Seg::create, "IProductWRTBase_SumFac_Seg");
443 
444 
445 
446 /**
447  * @brief Inner product operator using sum-factorisation (Quad)
448  */
450 {
451  public:
453 
455  {
456  }
457 
458  virtual void operator()(const Array<OneD, const NekDouble> &input,
459  Array<OneD, NekDouble> &output,
460  Array<OneD, NekDouble> &output1,
461  Array<OneD, NekDouble> &output2,
463  {
464  boost::ignore_unused(output1, output2);
465 
466  ASSERTL1(wsp.num_elements() == m_wspSize,
467  "Incorrect workspace size");
468 
469  QuadIProduct(m_colldir0,m_colldir1,m_numElmt,
470  m_nquad0, m_nquad1,
471  m_nmodes0, m_nmodes1,
472  m_base0, m_base1,
473  m_jac, input, output, wsp);
474  }
475 
476  virtual void operator()(
477  int dir,
478  const Array<OneD, const NekDouble> &input,
479  Array<OneD, NekDouble> &output,
481  {
482  boost::ignore_unused(dir, input, output, wsp);
483  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
484  }
485 
486  protected:
487  const int m_nquad0;
488  const int m_nquad1;
489  const int m_nmodes0;
490  const int m_nmodes1;
491  const bool m_colldir0;
492  const bool m_colldir1;
496 
497  private:
499  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
500  CoalescedGeomDataSharedPtr pGeomData)
501  : Operator (pCollExp, pGeomData),
502  m_nquad0 (m_stdExp->GetNumPoints(0)),
503  m_nquad1 (m_stdExp->GetNumPoints(1)),
504  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
505  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
506  m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
507  m_colldir1(m_stdExp->GetBasis(1)->Collocation()),
508  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
509  m_base1 (m_stdExp->GetBasis(1)->GetBdata())
510  {
511  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
512  m_wspSize = 2 * m_numElmt
513  * (max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1));
514  }
515 };
516 
517 /// Factory initialisation for the IProductWRTBase_SumFac_Quad operator
518 OperatorKey IProductWRTBase_SumFac_Quad::m_type = GetOperatorFactory().
519  RegisterCreatorFunction(
521  IProductWRTBase_SumFac_Quad::create, "IProductWRTBase_SumFac_Quad");
522 
523 
524 /**
525  * @brief Inner product operator using sum-factorisation (Tri)
526  */
528 {
529  public:
531 
533  {
534  }
535 
536  virtual void operator()(
537  const Array<OneD, const NekDouble> &input,
538  Array<OneD, NekDouble> &output,
539  Array<OneD, NekDouble> &output1,
540  Array<OneD, NekDouble> &output2,
542  {
543  boost::ignore_unused(output1, output2);
544 
545  ASSERTL1(wsp.num_elements() == m_wspSize,
546  "Incorrect workspace size");
547 
548  TriIProduct(m_sortTopVertex, m_numElmt, m_nquad0, m_nquad1,
549  m_nmodes0, m_nmodes1,m_base0,m_base1,m_jac, input,
550  output,wsp);
551  }
552 
553  virtual void operator()(
554  int dir,
555  const Array<OneD, const NekDouble> &input,
556  Array<OneD, NekDouble> &output,
558  {
559  boost::ignore_unused(dir, input, output, wsp);
560  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
561  }
562 
563  protected:
564  const int m_nquad0;
565  const int m_nquad1;
566  const int m_nmodes0;
567  const int m_nmodes1;
572 
573  private:
575  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
576  CoalescedGeomDataSharedPtr pGeomData)
577  : Operator (pCollExp, pGeomData),
578  m_nquad0 (m_stdExp->GetNumPoints(0)),
579  m_nquad1 (m_stdExp->GetNumPoints(1)),
580  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
581  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
582  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
583  m_base1 (m_stdExp->GetBasis(1)->GetBdata())
584  {
585  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
586  m_wspSize = 2 * m_numElmt
587  * (max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1));
588  if(m_stdExp->GetBasis(0)->GetBasisType()
590  {
591  m_sortTopVertex = true;
592  }
593  else
594  {
595  m_sortTopVertex = false;
596  }
597  }
598 };
599 
600 /// Factory initialisation for the IProductWRTBase_SumFac_Tri operator
601 OperatorKey IProductWRTBase_SumFac_Tri::m_type = GetOperatorFactory().
602  RegisterCreatorFunction(
604  IProductWRTBase_SumFac_Tri::create, "IProductWRTBase_SumFac_Tri");
605 
606 
607 /**
608  * @brief Inner Product operator using sum-factorisation (Hex)
609  */
611 {
612  public:
614 
616  {
617  }
618 
619  virtual void operator()(
620  const Array<OneD, const NekDouble> &input,
621  Array<OneD, NekDouble> &output,
622  Array<OneD, NekDouble> &output1,
623  Array<OneD, NekDouble> &output2,
625  {
626  boost::ignore_unused(output1, output2);
627 
628  ASSERTL1(wsp.num_elements() == m_wspSize,
629  "Incorrect workspace size");
630 
631  HexIProduct(m_colldir0,m_colldir1,m_colldir2, m_numElmt,
632  m_nquad0, m_nquad1, m_nquad2,
633  m_nmodes0, m_nmodes1, m_nmodes2,
634  m_base0, m_base1, m_base2,
635  m_jac,input,output,wsp);
636  }
637 
638  virtual void operator()(
639  int dir,
640  const Array<OneD, const NekDouble> &input,
641  Array<OneD, NekDouble> &output,
643  {
644  boost::ignore_unused(dir, input, output, wsp);
645  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
646  }
647 
648  protected:
649  const int m_nquad0;
650  const int m_nquad1;
651  const int m_nquad2;
652  const int m_nmodes0;
653  const int m_nmodes1;
654  const int m_nmodes2;
655  const bool m_colldir0;
656  const bool m_colldir1;
657  const bool m_colldir2;
662 
663  private:
665  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
666  CoalescedGeomDataSharedPtr pGeomData)
667  : Operator (pCollExp, pGeomData),
668  m_nquad0 (m_stdExp->GetNumPoints(0)),
669  m_nquad1 (m_stdExp->GetNumPoints(1)),
670  m_nquad2 (m_stdExp->GetNumPoints(2)),
671  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
672  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
673  m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
674  m_colldir0(m_stdExp->GetBasis(0)->Collocation()),
675  m_colldir1(m_stdExp->GetBasis(1)->Collocation()),
676  m_colldir2(m_stdExp->GetBasis(2)->Collocation()),
677  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
678  m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
679  m_base2 (m_stdExp->GetBasis(2)->GetBdata())
680 
681  {
682  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
683  m_wspSize = 3 * m_numElmt * (max(m_nquad0*m_nquad1*m_nquad2,
684  m_nmodes0*m_nmodes1*m_nmodes2));
685  }
686 };
687 
688 /// Factory initialisation for the IProductWRTBase_SumFac_Hex operator
689 OperatorKey IProductWRTBase_SumFac_Hex::m_type = GetOperatorFactory().
690  RegisterCreatorFunction(
692  IProductWRTBase_SumFac_Hex::create, "IProductWRTBase_SumFac_Hex");
693 
694 
695 
696 /**
697  * @brief Inner product operator using sum-factorisation (Tet)
698  */
700 {
701  public:
703 
705  {
706  }
707 
708  virtual void operator()(
709  const Array<OneD, const NekDouble> &input,
710  Array<OneD, NekDouble> &output,
711  Array<OneD, NekDouble> &output1,
712  Array<OneD, NekDouble> &output2,
714  {
715  boost::ignore_unused(output1, output2);
716 
717  ASSERTL1(wsp.num_elements() == m_wspSize,
718  "Incorrect workspace size");
719 
720  TetIProduct(m_sortTopEdge, m_numElmt,
721  m_nquad0, m_nquad1, m_nquad2,
722  m_nmodes0, m_nmodes1, m_nmodes2,
723  m_base0, m_base1, m_base2,
724  m_jac,input,output,wsp);
725 
726  }
727 
728  virtual void operator()(
729  int dir,
730  const Array<OneD, const NekDouble> &input,
731  Array<OneD, NekDouble> &output,
733  {
734  boost::ignore_unused(dir, input, output, wsp);
735  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
736  }
737 
738  protected:
739  const int m_nquad0;
740  const int m_nquad1;
741  const int m_nquad2;
742  const int m_nmodes0;
743  const int m_nmodes1;
744  const int m_nmodes2;
750 
751  private:
753  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
754  CoalescedGeomDataSharedPtr pGeomData)
755  : Operator (pCollExp, pGeomData),
756  m_nquad0 (m_stdExp->GetNumPoints(0)),
757  m_nquad1 (m_stdExp->GetNumPoints(1)),
758  m_nquad2 (m_stdExp->GetNumPoints(2)),
759  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
760  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
761  m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
762  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
763  m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
764  m_base2 (m_stdExp->GetBasis(2)->GetBdata())
765  {
766  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
767  m_wspSize = m_numElmt*(max(m_nquad0*m_nquad1*m_nquad2,
768  m_nquad2*m_nmodes0*(2*m_nmodes1-m_nmodes0+1)/2)+
769  m_nquad2*m_nquad1*m_nmodes0);
770 
771  if(m_stdExp->GetBasis(0)->GetBasisType()
773  {
774  m_sortTopEdge = true;
775  }
776  else
777  {
778  m_sortTopEdge = false;
779  }
780  }
781 };
782 
783 /// Factory initialisation for the IProductWRTBase_SumFac_Tet operator
784 OperatorKey IProductWRTBase_SumFac_Tet::m_type = GetOperatorFactory().
785  RegisterCreatorFunction(
787  IProductWRTBase_SumFac_Tet::create, "IProductWRTBase_SumFac_Tet");
788 
789 
790 
791 /**
792  * @brief Inner Product operator using sum-factorisation (Prism)
793  */
795 {
796  public:
798 
800  {
801  }
802 
803  virtual void operator()(
804  const Array<OneD, const NekDouble> &input,
805  Array<OneD, NekDouble> &output,
806  Array<OneD, NekDouble> &output1,
807  Array<OneD, NekDouble> &output2,
809  {
810  boost::ignore_unused(output1, output2);
811 
812  ASSERTL1(wsp.num_elements() == m_wspSize,
813  "Incorrect workspace size");
814 
815  PrismIProduct(m_sortTopVertex, m_numElmt,
816  m_nquad0, m_nquad1, m_nquad2,
817  m_nmodes0, m_nmodes1, m_nmodes2,
818  m_base0, m_base1, m_base2,
819  m_jac,input,output,wsp);
820  }
821 
822  virtual void operator()(
823  int dir,
824  const Array<OneD, const NekDouble> &input,
825  Array<OneD, NekDouble> &output,
827  {
828  boost::ignore_unused(dir, input, output, wsp);
829  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
830  }
831 
832  protected:
833  const int m_nquad0;
834  const int m_nquad1;
835  const int m_nquad2;
836  const int m_nmodes0;
837  const int m_nmodes1;
838  const int m_nmodes2;
844 
845  private:
847  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
848  CoalescedGeomDataSharedPtr pGeomData)
849  : Operator (pCollExp, pGeomData),
850  m_nquad0 (m_stdExp->GetNumPoints(0)),
851  m_nquad1 (m_stdExp->GetNumPoints(1)),
852  m_nquad2 (m_stdExp->GetNumPoints(2)),
853  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
854  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
855  m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
856  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
857  m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
858  m_base2 (m_stdExp->GetBasis(2)->GetBdata())
859 
860  {
861  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
862 
863  m_wspSize = m_numElmt * m_nquad2
864  *(max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1))
865  + m_nquad1*m_nquad2*m_numElmt*m_nmodes0;
866 
867  if(m_stdExp->GetBasis(0)->GetBasisType()
869  {
870  m_sortTopVertex = true;
871  }
872  else
873  {
874  m_sortTopVertex = false;
875  }
876  }
877 };
878 
879 /// Factory initialisation for the IProductWRTBase_SumFac_Prism operator
880 OperatorKey IProductWRTBase_SumFac_Prism::m_type = GetOperatorFactory().
881  RegisterCreatorFunction(
883  IProductWRTBase_SumFac_Prism::create, "IProductWRTBase_SumFac_Prism");
884 
885 
886 /**
887  * @brief Inner Product operator using sum-factorisation (Pyr)
888  */
890 {
891  public:
893 
895  {
896  }
897 
898  virtual void operator()(
899  const Array<OneD, const NekDouble> &input,
900  Array<OneD, NekDouble> &output,
901  Array<OneD, NekDouble> &output1,
902  Array<OneD, NekDouble> &output2,
904  {
905  boost::ignore_unused(output1, output2);
906 
907  ASSERTL1(wsp.num_elements() == m_wspSize,
908  "Incorrect workspace size");
909 
910  PyrIProduct(m_sortTopVertex, m_numElmt,
911  m_nquad0, m_nquad1, m_nquad2,
912  m_nmodes0, m_nmodes1, m_nmodes2,
913  m_base0, m_base1, m_base2,
914  m_jac,input,output,wsp);
915  }
916 
917  virtual void operator()(
918  int dir,
919  const Array<OneD, const NekDouble> &input,
920  Array<OneD, NekDouble> &output,
922  {
923  boost::ignore_unused(dir, input, output, wsp);
924  NEKERROR(ErrorUtil::efatal, "Not valid for this operator.");
925  }
926 
927  protected:
928  const int m_nquad0;
929  const int m_nquad1;
930  const int m_nquad2;
931  const int m_nmodes0;
932  const int m_nmodes1;
933  const int m_nmodes2;
939 
940  private:
942  vector<StdRegions::StdExpansionSharedPtr> pCollExp,
943  CoalescedGeomDataSharedPtr pGeomData)
944  : Operator (pCollExp, pGeomData),
945  m_nquad0 (m_stdExp->GetNumPoints(0)),
946  m_nquad1 (m_stdExp->GetNumPoints(1)),
947  m_nquad2 (m_stdExp->GetNumPoints(2)),
948  m_nmodes0 (m_stdExp->GetBasisNumModes(0)),
949  m_nmodes1 (m_stdExp->GetBasisNumModes(1)),
950  m_nmodes2 (m_stdExp->GetBasisNumModes(2)),
951  m_base0 (m_stdExp->GetBasis(0)->GetBdata()),
952  m_base1 (m_stdExp->GetBasis(1)->GetBdata()),
953  m_base2 (m_stdExp->GetBasis(2)->GetBdata())
954 
955  {
956  m_jac = pGeomData->GetJacWithStdWeights(pCollExp);
957 
958  m_wspSize = m_numElmt * m_nquad2
959  *(max(m_nquad0*m_nquad1,m_nmodes0*m_nmodes1))
960  + m_nquad1*m_nquad2*m_numElmt*m_nmodes0;
961 
962  if(m_stdExp->GetBasis(0)->GetBasisType()
964  {
965  m_sortTopVertex = true;
966  }
967  else
968  {
969  m_sortTopVertex = false;
970  }
971  }
972 };
973 
974 /// Factory initialisation for the IProductWRTBase_SumFac_Pyr operator
975 OperatorKey IProductWRTBase_SumFac_Pyr::m_type = GetOperatorFactory().
976  RegisterCreatorFunction(
978  IProductWRTBase_SumFac_Pyr::create, "IProductWRTBase_SumFac_Pyr");
979 
980 
981 }
982 }
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
std::shared_ptr< CoalescedGeomData > CoalescedGeomDataSharedPtr
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)
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)
Definition: IProduct.cpp:178
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
Inner Product operator using sum-factorisation (Prism)
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
Inner Product operator using sum-factorisation (Pyr)
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.
void PyrIProduct(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)
Definition: IProduct.cpp:427
Inner product operator using sum-factorisation (Tet)
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.
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:161
Principle Modified Functions .
Definition: BasisType.h:48
STL namespace.
Inner product operator using sum-factorisation (Quad)
IProductWRTBase_SumFac_Pyr(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
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)
Definition: IProduct.cpp:48
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
vector< StdRegions::StdExpansionSharedPtr > m_expList
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where A[m x n], B[n x k], C[m x k].
Definition: Blas.hpp:213
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.
Definition: Operator.h:109
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)
Definition: IProduct.cpp:522
IProductWRTBase_SumFac_Tri(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
IProductWRTBase_NoCollection(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
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)
Definition: IProduct.cpp:134
Inner product operator using sum-factorisation (Tri)
Inner product operator using standard matrix approach.
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()(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.
Definition: Operator.cpp:108
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.
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.
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)
Definition: IProduct.cpp:355
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)
Definition: Operator.h:45
virtual void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:199
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 (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...
Definition: ErrorUtil.hpp:250
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.
Definition: Vmath.cpp:186