Nektar++
Loading...
Searching...
No Matches
BlockOpShapeBlockTwoOutStates.cpp.in
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: @OPERATOR@@ExecSpace@@Impl@@TData@@Shape@.cpp
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: Cmake configuration for boilerplate code to generate the
32// shape specific ShapeBlock definitions of a block operator that is
33// templated on its output field state, each wrapped in the switch statement
34// the operator asks for.
35//
36// This file is the two output state counterpart of BlockOpShapeBlock.cpp.in
37// and is shared by every element operator whose @OPERATOR@BlockOp is
38// templated on FieldState TFieldOut: such an operator has one ShapeBlock per
39// output state, and both are compiled into this one translation unit. Its
40// only
41// inputs are the substitutions made by CMake (@OPERATOR@, @ExecSpace@,
42// @Impl@, @TData@ and @Shape@); nothing else here is operator specific,
43// because the input and output field states come from the operator's
44// ElmtBlockOp base via the InBlock and OutBlock aliases, and the switch
45// construction from the NEKTAR_BLOCKOP_SWITCH_*_CoeffOut
46// and NEKTAR_BLOCKOP_SWITCH_*_PhysOut macros that the operator's
47// implementation header defines -- one per output state,
48// since the two need not use the same switch. There is no default: an output
49// state reaching this file without naming a switch is a compile error, not a
50// silent fall back to the two level switch.
51//
52// The switch is a performance optimisation -- it dispatches to OperatorND
53// instantiations templated on the mode and quadrature counts, falling back
54// to a non-templated call. An implementation that does not use it declares
55// no ShapeBlock, so CMake generates no per-shape sources for it and it
56// never reaches this file.
57//
58///////////////////////////////////////////////////////////////////////////////
59
60// clang-format off
61@IMPL_HEADER@
62
64{
65// FieldState::Coeff output case. The switch level definitions are included
66// per output state because the two states may use different switches; the
67// defs headers are re-includable so that they may also use the same one.
68#if defined(NEKTAR_BLOCKOP_SWITCH_CODE_CoeffOut)
70#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS_CoeffOut)
72#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D_CoeffOut)
74#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE_CoeffOut)
76#else
77// The @OPERATOR@ @Impl@ implementation header defines no
78// NEKTAR_BLOCKOP_SWITCH_<kind>_CoeffOut macro. The kinds are
79// CODE, 1DCOORDS, PHYSINTERP1D and PHYSTRACE.
80#error "@OPERATOR@ @Impl@ names no switch for its FieldState::Coeff output"
81#endif
82
83template <>
84template <>
85void @OPERATOR@BlockOpImpl<NektarSpaces::@ExecSpace@, MultiRegions::@Impl@,
86 FieldState::Coeff, @TData@>::
87 ShapeBlock<LibUtilities::@Shape@>(InBlock &inblock, OutBlock &outblock)
88{
89 // The following will use predefined code generated from one of the
90 // switch templates in LibUtilities/BasicUtils/Switch, to import boost_pp
91 // code to make wrapper code to call the OperatorND method with the size
92 // parameter matching the shape: 1D for Segs, 2D for Tris and Quads and 3D
93 // otherwise
94 //
95 // To see the full code from this macros, Compile the .cpp file with make
96 // VERBOSE=1 copy the full compile command and add in --preprocess after the
97 // c++ command then you can view the file in the file output after the -o
98 // option in the compile line.
99
100#define SHAPE_TYPE_@Shape@
101#if defined(NEKTAR_BLOCKOP_SWITCH_CODE_CoeffOut)
102#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchCode@Shape@.h>
103#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS_CoeffOut)
104#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitch1DCoordsCode@Shape@.h>
105#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D_CoeffOut)
106#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysInterp1D@Shape@.h>
107#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE_CoeffOut)
108#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysTraceExtract@Shape@.h>
109#else
110#error "@OPERATOR@ @Impl@ names no switch for its FieldState::Coeff output"
111#endif
112}
113
114// FieldState::Phys output case. The switch level definitions are included
115// per output state because the two states may use different switches; the
116// defs headers are re-includable so that they may also use the same one.
117#if defined(NEKTAR_BLOCKOP_SWITCH_CODE_PhysOut)
119#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS_PhysOut)
121#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D_PhysOut)
123#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE_PhysOut)
125#else
126// The @OPERATOR@ @Impl@ implementation header defines no
127// NEKTAR_BLOCKOP_SWITCH_<kind>_PhysOut macro. The kinds are
128// CODE, 1DCOORDS, PHYSINTERP1D and PHYSTRACE.
129#error "@OPERATOR@ @Impl@ names no switch for its FieldState::Phys output"
130#endif
131
132template <>
133template <>
134void @OPERATOR@BlockOpImpl<NektarSpaces::@ExecSpace@, MultiRegions::@Impl@,
135 FieldState::Phys, @TData@>::
136 ShapeBlock<LibUtilities::@Shape@>(InBlock &inblock, OutBlock &outblock)
137{
138 // The following will use predefined code generated from one of the
139 // switch templates in LibUtilities/BasicUtils/Switch, to import boost_pp
140 // code to make wrapper code to call the OperatorND method with the size
141 // parameter matching the shape: 1D for Segs, 2D for Tris and Quads and 3D
142 // otherwise
143 //
144 // To see the full code from this macros, Compile the .cpp file with make
145 // VERBOSE=1 copy the full compile command and add in --preprocess after the
146 // c++ command then you can view the file in the file output after the -o
147 // option in the compile line.
148
149#define SHAPE_TYPE_@Shape@
150#if defined(NEKTAR_BLOCKOP_SWITCH_CODE_PhysOut)
151#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchCode@Shape@.h>
152#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS_PhysOut)
153#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitch1DCoordsCode@Shape@.h>
154#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D_PhysOut)
155#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysInterp1D@Shape@.h>
156#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE_PhysOut)
157#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysTraceExtract@Shape@.h>
158#else
159#error "@OPERATOR@ @Impl@ names no switch for its FieldState::Phys output"
160#endif
161}
162} // namespace Nektar::MultiRegions::detail
163// clang-format on