40#include <MatrixFreeOps/Operator.hpp>
79 "Constant factor not defined: " +
85 int shape_dimension =
m_stdExp->GetShapeDimension();
87 int npt0 =
m_stdExp->GetNumPoints(0);
89 for (
int i = 0; i < shape_dimension; ++i)
92 m_outputSize *= (npt0 - npt == 1) ? (
int)(npt0 * scale - 1)
113 int shape_dimension =
m_stdExp->GetShapeDimension();
115 int npt0 =
m_stdExp->GetNumPoints(0);
116 for (
int i = 0; i < shape_dimension; ++i)
118 int npt =
m_stdExp->GetNumPoints(i);
119 m_outputSize *= (npt0 - npt == 1) ? (
int)(npt0 * scale - 1)
120 : (int)(npt * scale);
146 (*m_oper)(input, output0);
155 "PhysInterp1DScaled_MatrixFree: Not valid for this operator.");
165 "Constant factor not defined: " +
172 const auto dim =
m_stdExp->GetShapeDimension();
175 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
176 for (
unsigned int i = 0; i < dim; ++i)
183 m_oper->SetScalingFactor(x->second);
189 std::shared_ptr<MatrixFree::PhysInterp1DScaled>
m_oper;
192 vector<LocalRegions::ExpansionSharedPtr> pCollExp,
194 :
Operator(pCollExp, pGeomData, factors),
196 pCollExp[0]->GetTotPoints(), pCollExp.size()),
199 const auto dim = pCollExp[0]->GetShapeDimension();
202 std::vector<LibUtilities::BasisSharedPtr> basis(dim);
203 for (
unsigned int i = 0; i < dim; ++i)
205 basis[i] = pCollExp[0]->GetBasis(i);
209 auto shapeType = pCollExp[0]->DetShapeType();
212 std::string op_string =
"PhysInterp1DScaled";
213 op_string += MatrixFree::GetOpstring(shapeType,
false);
214 auto oper = MatrixFree::GetOperatorFactory().CreateInstance(
215 op_string, basis, pCollExp.size());
218 std::dynamic_pointer_cast<MatrixFree::PhysInterp1DScaled>(oper);
235 m_oper->SetScalingFactor(scale);
236 m_oper->SetUpInterp1D(basis, scale);
242OperatorKey PhysInterp1DScaled_MatrixFree::m_typeArr[] = {
245 PhysInterp1DScaled_MatrixFree::create,
246 "PhysInterp1DScaled_MatrixFree_Seg"),
249 PhysInterp1DScaled_MatrixFree::create,
250 "PhysInterp1DScaled_MatrixFree_Tri"),
253 PhysInterp1DScaled_MatrixFree::create,
254 "PhysInterp1DScaled_MatrixFree_NodalTri"),
257 PhysInterp1DScaled_MatrixFree::create,
258 "PhysInterp1DScaled_MatrixFree_Quad"),
261 PhysInterp1DScaled_MatrixFree::create,
262 "PhysInterp1DScaled_MatrixFree_Tet"),
265 PhysInterp1DScaled_MatrixFree::create,
266 "PhysInterp1DScaled_MatrixFree_NodalTet"),
269 PhysInterp1DScaled_MatrixFree::create,
270 "PhysInterp1DScaled_MatrixFree_Pyr"),
273 PhysInterp1DScaled_MatrixFree::create,
274 "PhysInterp1DScaled_MatrixFree_Prism"),
277 PhysInterp1DScaled_MatrixFree::create,
278 "PhysInterp1DScaled_MatrixFree_NodalPrism"),
281 PhysInterp1DScaled_MatrixFree::create,
282 "PhysInterp1DScaled_NoCollection_Hex"),
307 int dim{
m_expList[0]->GetShapeDimension()};
316 int npt0 = (int)(pt0 * scale);
330 Blas::Dgemv(
'N', npt0, pt0, 1.0, I0->GetPtr().data(), npt0,
331 &input[cnt], 1, 0.0, &output[cnt1], 1);
344 int npt0 = (int)(pt0 * scale);
345 int npt1 = (pt0 - pt1 == 1) ? (
int)(pt0 * scale - 1)
346 : (int)(pt1 * scale);
369 Blas::Dgemm(
'N',
'T', pt0, npt1, pt1, 1.0, &input[cnt], pt0,
370 I1->GetPtr().data(), npt1, 0.0, wsp.data(),
374 I0->GetPtr().data(), npt0, wsp.data(), pt0, 0.0,
375 &output[cnt1], npt0);
389 int npt0 = (int)(pt0 * scale);
390 int npt1 = (pt0 - pt1 == 1) ? (
int)(pt0 * scale - 1)
391 : (int)(pt1 * scale);
392 int npt2 = (pt0 - pt2 == 1) ? (
int)(pt0 * scale - 1)
393 : (int)(pt2 * scale);
423 I0->GetPtr().data(), npt0, &input[cnt], pt0,
424 0.0, wsp2.data(), npt0);
426 for (
int j = 0; j < pt2; j++)
429 wsp2.data() + j * npt0 * pt1, npt0,
430 I1->GetPtr().data(), npt1, 0.0,
431 wsp1.data() + j * npt0 * npt1, npt0);
435 wsp1.data(), npt0 * npt1, I2->GetPtr().data(),
436 npt2, 0.0, &output[cnt1], npt0 * npt1);
438 cnt += pt0 * pt1 * pt2;
439 cnt1 += npt0 * npt1 * npt2;
446 "PhysInterp1DScaled operator.");
456 ASSERTL0(
false,
"Not valid for this operator.");
467 vector<LocalRegions::ExpansionSharedPtr> pCollExp,
480OperatorKey PhysInterp1DScaled_NoCollection::m_typeArr[] = {
483 PhysInterp1DScaled_NoCollection::create,
484 "PhysInterp1DScaled_NoCollection_Seg"),
487 PhysInterp1DScaled_NoCollection::create,
488 "PhysInterp1DScaled_NoCollection_Tri"),
491 PhysInterp1DScaled_NoCollection::create,
492 "PhysInterp1DScaled_NoCollection_NodalTri"),
495 PhysInterp1DScaled_NoCollection::create,
496 "PhysInterp1DScaled_NoCollection_Quad"),
499 PhysInterp1DScaled_NoCollection::create,
500 "PhysInterp1DScaled_NoCollection_Tet"),
503 PhysInterp1DScaled_NoCollection::create,
504 "PhysInterp1DScaled_NoCollection_NodalTet"),
507 PhysInterp1DScaled_NoCollection::create,
508 "PhysInterp1DScaled_NoCollection_Pyr"),
511 PhysInterp1DScaled_NoCollection::create,
512 "PhysInterp1DScaled_NoCollection_Prism"),
515 PhysInterp1DScaled_NoCollection::create,
516 "PhysInterp1DScaled_NoCollection_NodalPrism"),
519 PhysInterp1DScaled_NoCollection::create,
520 "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.
std::shared_ptr< MatrixFree::PhysInterp1DScaled > m_oper
~PhysInterp1DScaled_MatrixFree() final=default
PhysInterp1DScaled_MatrixFree(vector< LocalRegions::ExpansionSharedPtr > 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.
PhysInterp1DScaled operator using LocalRegions implementation.
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.
PhysInterp1DScaled_NoCollection(vector< LocalRegions::ExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
StdRegions::FactorMap m_factors
~PhysInterp1DScaled_NoCollection() final
void operator()(int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
vector< LocalRegions::ExpansionSharedPtr > m_expList
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