Nektar++
Loading...
Searching...
No Matches
PhysGalerkinProject1DScaledOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PhysGalerkinProject1DScaledOp.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: Physical space (1D tensor based) Galerkin projection from a
32// scaled (finer) quadrature grid back down to the native quadrature grid.
33// This is the reverse operator to PhysInterp1DScaled and is used to
34// complete the anti-aliasing filter of 3/2-rule spectral/hp dealiasing.
35//
36///////////////////////////////////////////////////////////////////////////////
37
38#pragma once
39
41
43
45{
46
47// PhysGalerkinProject1DScaled base class
48// Defines the apply operator to enforce apply parameter types
49template <typename TData>
51 : public ElmtOp<FieldState::Phys, FieldState::Phys, TData>
52{
53 friend class ElmtOp<FieldState::Phys, FieldState::Phys, TData>;
54
55public:
56 static std::shared_ptr<PhysGalerkinProject1DScaledOp<TData>> Create(
57 const MultiRegions::ExpListSharedPtr &expansionList,
58 const std::vector<std::string> &components,
59 const std::string &execStr = "", const std::string &implStr = "")
60 {
64 expansionList, components, execStr, implStr);
65 }
66
67 static inline const std::string name = "PhysGalerkinProject1DScaled";
68
69 // scale is the same over-integration factor used to build the source
70 // (finer) grid via PhysInterp1DScaled, e.g. 1.5 for the 3/2 rule.
71 void SetScaleFactor(TData scale)
72 {
73 // Loop over the blocks.
74 for (unsigned int blk = 0; blk < this->m_blockOp.size(); ++blk)
75 {
76 this->m_blockOp[blk]->SetScaleFactor(scale);
77 }
78 }
79
80 void SetAppend(const bool &append)
81 {
82 // Loop over the blocks.
83 for (unsigned int blk = 0; blk < this->m_blockOp.size(); ++blk)
84 {
85 this->m_blockOp[blk]->SetAppend(append);
86 }
87 }
88
89protected:
90 std::vector<std::shared_ptr<PhysGalerkinProject1DScaledBlockOp<TData>>>
92
94 const MultiRegions::ExpListSharedPtr &expansionList,
95 const std::vector<std::string> &components)
96 : ElmtOp<FieldState::Phys, FieldState::Phys, TData>(expansionList,
97 components)
98 {
99 }
100
101 ~PhysGalerkinProject1DScaledOp() override = default;
102
105 {
106 ASSERTL1(in.GetNumComponents() == out.GetNumComponents(),
107 "Number of input and output components differ");
108
109 ASSERTL1(in.GetNumHomoModes() == out.GetNumHomoModes(),
110 "Number of input and output homogeneous modes differ");
111
112 // Loop over the blocks.
113 for (unsigned int blk = 0; blk < this->m_blockOp.size(); ++blk)
114 {
115 // Block dependent.
116 auto &inblock = in.GetBlocks()[blk];
117 auto &outblock = out.GetBlocks()[blk];
118
119 this->m_blockOp[blk]->Apply(inblock, outblock);
120 }
121 }
122};
123
124} // namespace Nektar::MultiRegions
Whole-field base class and factory machinery shared by every element-operator family in the MultiRegi...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
A Field represents expansion data to be operated on.
Common base class of the element-operator interfaces: an operator applied independently to every elem...
Definition ElmtOp.hpp:111
static std::shared_ptr< TOperator< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="", const std::string &implStr="")
Build a complete element operator: the whole-field interface object plus one block operator per eleme...
Definition ElmtOp.hpp:166
static std::shared_ptr< PhysGalerkinProject1DScaledOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="", const std::string &implStr="")
void v_Apply(LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &out) override
PhysGalerkinProject1DScaledOp(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
std::vector< std::shared_ptr< PhysGalerkinProject1DScaledBlockOp< TData > > > m_blockOp
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
FieldState
Possible states for Field data.