Nektar++
Loading...
Searching...
No Matches
PhysGalerkinProject1DScaledBlockOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PhysGalerkinProject1DScaledBlockOp.hpp
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:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
37#include <vector>
38
40
42{
43
44template <typename TData>
46 : public ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>
47{
48public:
49 static std::shared_ptr<PhysGalerkinProject1DScaledBlockOp<TData>> Create(
50 const unsigned int block_idx,
53 const std::string &execStr, const std::string &implStr)
54 {
56 template Create<PhysGalerkinProject1DScaledBlockOp>(
57 block_idx, exp, dataWarehouse, execStr, implStr);
58 }
59
60 static inline const std::string name = "BlockPhysGalerkinProject1DScaled";
61
62 void SetScaleFactor(const TData &scale)
63 {
64 v_SetScaleFactor(scale);
65 }
66
67 void SetAppend(const bool &append)
68 {
69 m_append = append;
70 }
71
72protected:
73 TData m_scale = -1.0; // scaling factor
74 bool m_append = false;
75
77 const unsigned int block_idx,
80 : ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>(block_idx, exp,
81 dataWarehouse)
82 {
83 }
84
86
87 /// \brief The per-direction point counts of the @p scale over-integrated
88 /// grid this operator's interpolation and projection matrices are built
89 /// for.
90 ///
91 /// Direction 0 scales outright, and a direction carrying one point fewer
92 /// than direction 0 keeps that offset, which is what lets the switch
93 /// templating see the same relationship on the over-integrated grid as on
94 /// the native one.
95 static std::vector<unsigned int> GetScaledNumPoints(
96 const std::vector<unsigned int> &nq, const NekDouble scale)
97 {
98 std::vector<unsigned int> nqScaled;
99 nqScaled.reserve(nq.size());
100
101 for (size_t d = 0; d < nq.size(); ++d)
102 {
103 nqScaled.push_back((d != 0 && nq[0] - nq[d] == 1)
104 ? static_cast<unsigned int>(scale * nq[0]) -
105 1
106 : static_cast<unsigned int>(scale * nq[d]));
107 }
108
109 return nqScaled;
110 }
111
112 virtual void v_SetScaleFactor(const TData &scale) = 0;
113};
114
115} // namespace Nektar::MultiRegions
Block-level base class, implementation-strategy tags and device launch helpers shared by every elemen...
Base class of the per-family block operators: applies one element operation to every element of one b...
virtual void v_SetScaleFactor(const TData &scale)=0
static std::vector< unsigned int > GetScaledNumPoints(const std::vector< unsigned int > &nq, const NekDouble scale)
The per-direction point counts of the scale over-integrated grid this operator's interpolation and pr...
static std::shared_ptr< PhysGalerkinProject1DScaledBlockOp< TData > > Create(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse, const std::string &execStr, const std::string &implStr)
PhysGalerkinProject1DScaledBlockOp(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse)
std::shared_ptr< NekDataWarehouse > NekDataWarehouseSharedPtr
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition Expansion.h:66
FieldState
Possible states for Field data.