Nektar++
Loading...
Searching...
No Matches
BlockOpShapeBlock.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 definition of a block operator, wrapped in the
33// switch statement the operator asks for.
34//
35// This file is shared by every element operator that splits ShapeBlock out
36// of its implementation header, whatever that implementation is. Its only
37// inputs are the substitutions made by CMake (@OPERATOR@, @ExecSpace@,
38// @Impl@, @TData@ and @Shape@); nothing else here is operator specific,
39// because the input and output field states come from the operator's
40// ElmtBlockOp base via the InBlock and OutBlock aliases, and the switch
41// construction from the NEKTAR_BLOCKOP_SWITCH_* macro that the operator's
42// implementation header defines. There is no default: an implementation
43// reaching this file without naming a switch is a compile error, not a
44// silent fall back to the two level switch.
45//
46// The switch is a performance optimisation -- it dispatches to OperatorND
47// instantiations templated on the mode and quadrature counts, falling back
48// to a non-templated call. An implementation that does not use it declares
49// no ShapeBlock, so CMake generates no per-shape sources for it and it
50// never reaches this file.
51//
52///////////////////////////////////////////////////////////////////////////////
53
54// clang-format off
55@IMPL_HEADER@
56
57// The switch the @OPERATOR@ @Impl@ implementation asked for, and the macro
58// definitions it is built from. Keep the branches here in step with the
59// shape specific switch code selected in the function body below.
60#if defined(NEKTAR_BLOCKOP_SWITCH_CODE)
62#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS)
64#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D)
66#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE)
68#else
69// The @OPERATOR@ @Impl@ implementation header defines no
70// NEKTAR_BLOCKOP_SWITCH_<kind> macro. The kinds are CODE,
71// 1DCOORDS, PHYSINTERP1D and PHYSTRACE; an implementation that uses no
72// switch declares no ShapeBlock instead, and so generates no per-shape
73// sources at all.
74#error "@OPERATOR@ @Impl@ names no switch for its generated ShapeBlock"
75#endif
76
78{
79template <>
80template <>
81void @OPERATOR@BlockOpImpl<NektarSpaces::@ExecSpace@, MultiRegions::@Impl@,
82 @TData@>::
83 ShapeBlock<LibUtilities::@Shape@>(InBlock &inblock, OutBlock &outblock)
84{
85 // The following will use predefined code generated from one of the
86 // switch templates in LibUtilities/BasicUtils/Switch, to import boost_pp
87 // code to make wrapper code to call the OperatorND method with the size
88 // parameter matching the shape: 1D for Segs, 2D for Tris and Quads and 3D
89 // otherwise
90 //
91 // To see the full code from this macros, Compile the .cpp file with make
92 // VERBOSE=1 copy the full compile command and add in --preprocess after the
93 // c++ command then you can view the file in the file output after the -o
94 // option in the compile line.
95
96#define SHAPE_TYPE_@Shape@
97#if defined(NEKTAR_BLOCKOP_SWITCH_CODE)
98#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchCode@Shape@.h>
99#elif defined(NEKTAR_BLOCKOP_SWITCH_1DCOORDS)
100#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitch1DCoordsCode@Shape@.h>
101#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSINTERP1D)
102#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysInterp1D@Shape@.h>
103#elif defined(NEKTAR_BLOCKOP_SWITCH_PHYSTRACE)
104#include <@CMAKE_CURRENT_BINARY_DIR@/include/BlockOpSwitchPhysTraceExtract@Shape@.h>
105#else
106// The @OPERATOR@ @Impl@ implementation header defines no
107// NEKTAR_BLOCKOP_SWITCH_<kind> macro. The kinds are CODE,
108// 1DCOORDS, PHYSINTERP1D and PHYSTRACE; an implementation that uses no
109// switch declares no ShapeBlock instead, and so generates no per-shape
110// sources at all.
111#error "@OPERATOR@ @Impl@ names no switch for its generated ShapeBlock"
112#endif
113}
114} // namespace Nektar::MultiRegions::detail