40#include <MatrixFreeOps/Operator.hpp>
76 "Constant factor not defined: " +
82 int shape_dimension =
m_stdExp->GetShapeDimension();
84 int npt0 =
m_stdExp->GetNumPoints(0);
86 for (
int i = 0; i < shape_dimension; ++i)
89 m_outputSize *= (npt0 - npt == 1) ? (
int)(npt0 * scale - 1)
110 int shape_dimension =
m_stdExp->GetShapeDimension();
112 int npt0 =
m_stdExp->GetNumPoints(0);
113 for (
int i = 0; i < shape_dimension; ++i)
115 int npt =
m_stdExp->GetNumPoints(i);
116 m_outputSize *= (npt0 - npt == 1) ? (
int)(npt0 * scale - 1)
117 : (int)(npt * scale);
143 (*m_oper)(input, output0);
152 "PhysInterp1DScaled_MatrixFree: Not valid for this operator.");
162 "Constant factor not defined: " +
169 const auto dim =
m_stdExp->GetShapeDimension();
172 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
173 for (
unsigned int i = 0; i < dim; ++i)
180 m_oper->SetScalingFactor(x->second);
186 std::shared_ptr<MatrixFree::PhysInterp1DScaled>
m_oper;
189 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
191 :
Operator(pCollExp, pGeomData, factors),
193 pCollExp[0]->GetStdExp()->GetTotPoints(),
197 const auto dim = pCollExp[0]->GetStdExp()->GetShapeDimension();
200 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
201 for (
unsigned int i = 0; i < dim; ++i)
203 basis[i] = pCollExp[0]->GetBasis(i);
207 auto shapeType = pCollExp[0]->GetStdExp()->DetShapeType();
210 std::string op_string =
"PhysInterp1DScaled";
211 op_string += MatrixFree::GetOpstring(shapeType,
false);
212 auto oper = MatrixFree::GetOperatorFactory().CreateInstance(
213 op_string, basis, pCollExp.size());
216 std::dynamic_pointer_cast<MatrixFree::PhysInterp1DScaled>(oper);
233 m_oper->SetScalingFactor(scale);
234 m_oper->SetUpInterp1D(basis, scale);
240OperatorKey PhysInterp1DScaled_MatrixFree::m_typeArr[] = {
243 PhysInterp1DScaled_MatrixFree::create,
244 "PhysInterp1DScaled_MatrixFree_Seg"),
247 PhysInterp1DScaled_MatrixFree::create,
248 "PhysInterp1DScaled_MatrixFree_Tri"),
251 PhysInterp1DScaled_MatrixFree::create,
252 "PhysInterp1DScaled_MatrixFree_NodalTri"),
255 PhysInterp1DScaled_MatrixFree::create,
256 "PhysInterp1DScaled_MatrixFree_Quad"),
259 PhysInterp1DScaled_MatrixFree::create,
260 "PhysInterp1DScaled_MatrixFree_Tet"),
263 PhysInterp1DScaled_MatrixFree::create,
264 "PhysInterp1DScaled_MatrixFree_NodalTet"),
267 PhysInterp1DScaled_MatrixFree::create,
268 "PhysInterp1DScaled_MatrixFree_Pyr"),
271 PhysInterp1DScaled_MatrixFree::create,
272 "PhysInterp1DScaled_MatrixFree_Prism"),
275 PhysInterp1DScaled_MatrixFree::create,
276 "PhysInterp1DScaled_MatrixFree_NodalPrism"),
279 PhysInterp1DScaled_MatrixFree::create,
280 "PhysInterp1DScaled_NoCollection_Hex"),
305 int dim{
m_expList[0]->GetShapeDimension()};
314 int npt0 = (int)(pt0 * scale);
328 Blas::Dgemv(
'N', npt0, pt0, 1.0, I0->GetPtr().data(), npt0,
329 &input[cnt], 1, 0.0, &output[cnt1], 1);
342 int npt0 = (int)(pt0 * scale);
343 int npt1 = (pt0 - pt1 == 1) ? (
int)(pt0 * scale - 1)
344 : (int)(pt1 * scale);
367 Blas::Dgemm(
'N',
'T', pt0, npt1, pt1, 1.0, &input[cnt], pt0,
368 I1->GetPtr().data(), npt1, 0.0, wsp.data(),
372 I0->GetPtr().data(), npt0, wsp.data(), pt0, 0.0,
373 &output[cnt1], npt0);
387 int npt0 = (int)(pt0 * scale);
388 int npt1 = (pt0 - pt1 == 1) ? (
int)(pt0 * scale - 1)
389 : (int)(pt1 * scale);
390 int npt2 = (pt0 - pt2 == 1) ? (
int)(pt0 * scale - 1)
391 : (int)(pt2 * scale);
421 I0->GetPtr().data(), npt0, &input[cnt], pt0,
422 0.0, wsp2.data(), npt0);
424 for (
int j = 0; j < pt2; j++)
427 wsp2.data() + j * npt0 * pt1, npt0,
428 I1->GetPtr().data(), npt1, 0.0,
429 wsp1.data() + j * npt0 * npt1, npt0);
433 wsp1.data(), npt0 * npt1, I2->GetPtr().data(),
434 npt2, 0.0, &output[cnt1], npt0 * npt1);
436 cnt += pt0 * pt1 * pt2;
437 cnt1 += npt0 * npt1 * npt2;
444 "PhysInterp1DScaled operator.");
454 ASSERTL0(
false,
"Not valid for this operator.");
465 vector<StdRegions::StdExpansionSharedPtr> pCollExp,
478OperatorKey PhysInterp1DScaled_NoCollection::m_typeArr[] = {
481 PhysInterp1DScaled_NoCollection::create,
482 "PhysInterp1DScaled_NoCollection_Seg"),
485 PhysInterp1DScaled_NoCollection::create,
486 "PhysInterp1DScaled_NoCollection_Tri"),
489 PhysInterp1DScaled_NoCollection::create,
490 "PhysInterp1DScaled_NoCollection_NodalTri"),
493 PhysInterp1DScaled_NoCollection::create,
494 "PhysInterp1DScaled_NoCollection_Quad"),
497 PhysInterp1DScaled_NoCollection::create,
498 "PhysInterp1DScaled_NoCollection_Tet"),
501 PhysInterp1DScaled_NoCollection::create,
502 "PhysInterp1DScaled_NoCollection_NodalTet"),
505 PhysInterp1DScaled_NoCollection::create,
506 "PhysInterp1DScaled_NoCollection_Pyr"),
509 PhysInterp1DScaled_NoCollection::create,
510 "PhysInterp1DScaled_NoCollection_Prism"),
513 PhysInterp1DScaled_NoCollection::create,
514 "PhysInterp1DScaled_NoCollection_NodalPrism"),
517 PhysInterp1DScaled_NoCollection::create,
518 "PhysInterp1DScaled_NoCollection_Hex"),
#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)
unsigned int m_nElmtPad
size after padding
unsigned int m_nOut
actural size of output array
Base class for operators on a collection of elements.
StdRegions::StdExpansionSharedPtr m_stdExp
unsigned int m_numElmt
number of elements that the operator is applied on
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
PhysInterp1DScaled help class to calculate the size of the collection that is given as an input and a...
StdRegions::FactorMap m_factors
PhysInterp1DScaled_Helper()
void UpdateFactors(StdRegions::FactorMap factors) override
Update the supplied factor map.
PhysInterp1DScaled operator using matrix free implementation.
PhysInterp1DScaled_MatrixFree(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
std::shared_ptr< MatrixFree::PhysInterp1DScaled > m_oper
~PhysInterp1DScaled_MatrixFree() final=default
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.
PhysInterp1DScaled operator using LocalRegions implementation.
PhysInterp1DScaled_NoCollection(vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
void operator()(const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp) override
Perform operation.
void UpdateFactors(StdRegions::FactorMap factors) override
Update the supplied factor map.
StdRegions::FactorMap m_factors
~PhysInterp1DScaled_NoCollection() final
vector< StdRegions::StdExpansionSharedPtr > m_expList
void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Defines a specification for a set of points.
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n].
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 op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
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.
PointsManagerT & PointsManager(void)
const char *const ConstFactorTypeMap[]
std::shared_ptr< DNekMat > DNekMatSharedPtr