Nektar++
Loading...
Searching...
No Matches
ExpressionOpImpl.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: ExpressionOpImpl.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 ExpressionOpImpl.hpp
37 * @brief Factory-registration shim for the whole-field Expression
38 * operator.
39 *
40 * The CMake-generated factory declarations instantiate
41 * detail::ExpressionOpImpl per execution space and data type and
42 * register it under the key "Expression" + execution space; see
43 * ExpressionOp.hpp for the family overview.
44 *
45 * @note CMake includes this header into the registration translation
46 * units it generates for this operator, one per execution space and
47 * data type; it should not normally be included by any other
48 * translation unit. Other code goes through ExpressionOp.hpp and the
49 * operator factory.
50 */
51
52#pragma once
53
55
57{
58
59/**
60 * @brief Concrete whole-field Expression operator for one execution
61 * space.
62 *
63 * As for every element-operator family, the execution-space class adds
64 * no behaviour of its own: all evaluation state and logic lives in the
65 * per-block operators (detail::ExpressionBlockOpImpl of
66 * ExpressionBlockOpSerialAVXGeneric.hpp / ExpressionBlockOpDeviceGeneric.hpp),
67 * which the inherited ExpressionOp machinery creates and drives. This
68 * class exists so the operator factory has a distinct concrete type to
69 * register for each execution space.
70 *
71 * @tparam ExecSpace Execution back-end (NektarSpaces::Serial, AVX or
72 * Device); only forms the factory key here, since
73 * the numerical work happens in the block operators.
74 * @tparam TData Floating-point type of the field data.
75 */
76template <typename ExecSpace, typename TData>
77class ExpressionOpImpl : public ExpressionOp<TData>
78{
79public:
80 /// @brief Construct the operator for @p expansionList and
81 /// @p components; forwards to ExpressionOp.
83 const std::vector<std::string> &components)
84 : ExpressionOp<TData>(expansionList, components)
85 {
86 }
87
88 /// Operator class name; defined by the generated factory code.
89 static std::string className;
90
91 /// Creator function registered with OperatorFactory.
92 static std::unique_ptr<Operator<TData>> Instantiate(
93 const MultiRegions::ExpListSharedPtr &expansionList,
94 const std::vector<std::string> &components)
95 {
96 return std::make_unique<ExpressionOpImpl<ExecSpace, TData>>(
97 expansionList, components);
98 }
99};
100
101} // namespace Nektar::MultiRegions::detail
Public interface of the Expression operator, which evaluates analytical expressions at the quadrature...
Whole-field interface of the Expression operator: evaluates one analytical expression per field compo...
Concrete whole-field Expression operator for one execution space.
static std::string className
Operator class name; defined by the generated factory code.
ExpressionOpImpl(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
Construct the operator for expansionList and components; forwards to ExpressionOp.
static std::unique_ptr< Operator< TData > > Instantiate(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
Creator function registered with OperatorFactory.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.