Nektar++
Loading...
Searching...
No Matches
PhysTraceExtractOpImpl.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PhysTraceExtractOpImpl.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 PhysTraceExtractOpImpl.hpp
37 * @brief Factory-registered whole-field implementation of the
38 * PhysTraceExtract operator: one registrable type per execution space.
39 *
40 * @details
41 * The whole-field level of this operator carries no execution-space
42 * specific behaviour. PhysTraceExtractOp already implements the loop over
43 * the element blocks, and every arithmetic decision belongs to the block
44 * operators, which are selected independently through the block-operator
45 * factory key. This header therefore only supplies the distinct type per
46 * execution space that the operator factory needs in order to have
47 * something to register.
48 *
49 * CMake generates one translation unit per execution space and data type
50 * from Common/OpFactoryDec.cpp.in. That unit includes this header and
51 * defines PhysTraceExtractOpImpl::className, whose initialiser registers
52 * Instantiate() with the operator factory under the key
53 * `PhysTraceExtractOp::name + <ExecSpace>`, which is exactly the key
54 * PhysTraceExtractOp::Create() asks for.
55 *
56 * @see PhysTraceExtractOp.hpp for what the operator computes and for the
57 * layout of the family.
58 *
59 * @note CMake includes this header into the registration translation
60 * units it generates for this operator, one per execution space and
61 * data type; it should not normally be included by any other
62 * translation unit. Other code goes through PhysTraceExtractOp.hpp and the
63 * operator factory.
64 */
65
66#pragma once
67
69
71{
72
73/**
74 * @brief Execution-space instantiation of the whole-field trace
75 * extraction; adds no behaviour of its own to PhysTraceExtractOp.
76 *
77 * @tparam ExecSpace NektarSpaces::Serial, NektarSpaces::AVX or
78 * NektarSpaces::Device. It selects the type the
79 * factory registers and the key it is registered
80 * under, and is otherwise unused in this class: the
81 * execution space reaches the numerical work through
82 * the block-operator factory key instead.
83 * @tparam TData Floating-point type of the field data.
84 *
85 * @see PhysTraceExtractOp for the interface this class inherits whole.
86 */
87template <typename ExecSpace, typename TData>
89{
90public:
91 /**
92 * @brief Forward the expansion list and component names to the
93 * interface base; there is nothing else to set up.
94 *
95 * @param expansionList Expansion list the operator acts on.
96 * @param components Component names the operator is set up
97 * for.
98 */
100 const std::vector<std::string> &components)
101 : PhysTraceExtractOp<TData>(expansionList, components)
102 {
103 }
104
105 /// Factory registration token. Only declared here: the generated
106 /// per-execution-space translation unit defines it, and the
107 /// definition's initialiser is what performs the registration.
108 // className - for OperatorFactory
109 static std::string className;
110
111 /**
112 * @brief Creator function handed to the operator factory.
113 *
114 * @param expansionList Expansion list the operator acts on.
115 * @param components Component names the operator is set up
116 * for.
117 *
118 * @return The new operator, owned by the caller.
119 */
120 // instantiation function for CreatorFunction in OperatorFactory
121 static std::unique_ptr<Operator<TData>> Instantiate(
122 const MultiRegions::ExpListSharedPtr &expansionList,
123 const std::vector<std::string> &components)
124 {
125 return std::make_unique<PhysTraceExtractOpImpl<ExecSpace, TData>>(
126 expansionList, components);
127 }
128};
129
130} // namespace Nektar::MultiRegions::detail
Public interface of the PhysTraceExtract element operator, which interpolates a volume physical-space...
Whole-field interface of the trace extraction: interpolates the volume field of every element onto th...
Execution-space instantiation of the whole-field trace extraction; adds no behaviour of its own to Ph...
static std::unique_ptr< Operator< TData > > Instantiate(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
Creator function handed to the operator factory.
PhysTraceExtractOpImpl(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
Forward the expansion list and component names to the interface base; there is nothing else to set up...
static std::string className
Factory registration token. Only declared here: the generated per-execution-space translation unit de...
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.