Nektar++
Loading...
Searching...
No Matches
DivergenceBlockOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: DivergenceBlockOp.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/**
36 * @file DivergenceBlockOp.hpp
37 * @brief Per-block interface of the Divergence element operator.
38 *
39 * @details
40 * See DivergenceOp.hpp for the mathematical action and the layout of
41 * the family. The concrete per-block implementations
42 * (detail::DivergenceBlockOpImpl) live in the per-execution-space
43 * headers DivergenceBlockOpSerialAVXStdMat.hpp,
44 * DivergenceBlockOpSerialAVXSumFac.hpp, DivergenceBlockOpDeviceStdMat.hpp and
45 * DivergenceBlockOpDeviceSumFac.hpp.
46 */
47
48#pragma once
49
51
53{
54
55/**
56 * @brief Per-block interface of the divergence operator: applies the
57 * divergence to every element of one block.
58 *
59 * Sets the BlockAccessor states accepted by Apply() -- physical space
60 * in, physical space out -- and provides the factory hook through
61 * which ElmtOp::Create builds one implementation per block. The
62 * numerical work happens in the detail::DivergenceBlockOpImpl
63 * definitions, which override v_Apply(): the sum-factorised ones with
64 * a shape-type switch into the generated ShapeBlock() specialisations,
65 * the standard-matrix ones with dense matrix products. CMake includes
66 * exactly one of those headers per generated translation unit,
67 * matching the execution-space/implementation pair that unit
68 * registers with the block-operator factory.
69 *
70 * @tparam TData Floating-point type of the field data.
71 *
72 * @see ElmtBlockOp for the block concept and the per-block base-class
73 * contract; DivergenceOp for the whole-field loop driving this class.
74 */
75template <typename TData>
77 : public ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>
78{
79public:
80 /**
81 * @brief Create one divergence block operator through the
82 * block-operator factory under the key
83 * `"BlockDivergence" + execStr + implStr` (see
84 * ElmtBlockOp::Create for the Generic fall-back rules).
85 *
86 * @param block_idx Index of the block within the
87 * expansion list's Collections.
88 * @param exp Representative expansion of the block
89 * (its first element).
90 * @param dataWarehouse Data warehouse shared with the other
91 * operators on the expansion list.
92 * @param execStr Execution-space part of the factory
93 * key.
94 * @param implStr Implementation part of the factory
95 * key.
96 *
97 * @return The newly created block operator.
98 */
99 static std::shared_ptr<DivergenceBlockOp<TData>> Create(
100 const unsigned int block_idx,
103 const std::string &execStr, const std::string &implStr)
104 {
106 template Create<DivergenceBlockOp>(block_idx, exp, dataWarehouse,
107 execStr, implStr);
108 }
109
110 /// Block-operator base name; Create() appends the execution space
111 /// and implementation to it to form the factory key.
112 static inline const std::string name = "BlockDivergence";
113
114protected:
115 /**
116 * @brief Construct the interface part of a concrete block
117 * operator; called by the factory-registered creator functions.
118 *
119 * @param block_idx Index of the block within the
120 * expansion list's Collections.
121 * @param exp Representative expansion of the block.
122 * @param dataWarehouse Data warehouse shared with the other
123 * operators on the expansion list.
124 */
125 DivergenceBlockOp(const unsigned int block_idx,
128 : ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>(block_idx, exp,
129 dataWarehouse)
130 {
131 }
132
133 ~DivergenceBlockOp() override = default;
134};
135
136} // namespace Nektar::MultiRegions
Block-level base class, implementation-strategy tags and device launch helpers shared by every elemen...
Per-block interface of the divergence operator: applies the divergence to every element of one block.
DivergenceBlockOp(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse)
Construct the interface part of a concrete block operator; called by the factory-registered creator f...
static const std::string name
Block-operator base name; Create() appends the execution space and implementation to it to form the f...
static std::shared_ptr< DivergenceBlockOp< TData > > Create(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse, const std::string &execStr, const std::string &implStr)
Create one divergence block operator through the block-operator factory under the key "BlockDivergenc...
Base class of the per-family block operators: applies one element operation to every element of one b...
std::shared_ptr< NekDataWarehouse > NekDataWarehouseSharedPtr
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition Expansion.h:66
FieldState
Possible states for Field data.