Nektar++
Operator.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Operator.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: Operator top class definition
32//
33///////////////////////////////////////////////////////////////////////////////
34
37
38namespace Nektar::Collections
39{
40
41/**
42 *
43 */
45{
46 static OperatorFactory instance;
47 return instance;
48}
49
50// simple operator Map evaluation
52{
53 OperatorImpMap opMap;
54
55 for (int i = 0; i < SIZE_OperatorType; ++i)
56 {
57 opMap[(OperatorType)i] = defaultType;
58 }
59
60 return opMap;
61}
62
63/**
64 *
65 */
66Operator::Operator(std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,
67 std::shared_ptr<CoalescedGeomData> GeomData,
68 [[maybe_unused]] StdRegions::FactorMap factors)
69 : m_isDeformed(GeomData->IsDeformed(pCollExp)),
70 m_stdExp(pCollExp[0]->GetStdExp()), m_numElmt(pCollExp.size()),
71 m_nqe(pCollExp[0]->GetTotPoints()), m_wspSize(0)
72{
73}
74
75/**
76 *
77 */
78bool operator<(OperatorKey const &p1, OperatorKey const &p2)
79{
80 if (std::get<0>(p1) < std::get<0>(p2))
81 {
82 return true;
83 }
84 if (std::get<0>(p1) > std::get<0>(p2))
85 {
86 return false;
87 }
88 if (std::get<1>(p1) < std::get<1>(p2))
89 {
90 return true;
91 }
92 if (std::get<1>(p1) > std::get<1>(p2))
93 {
94 return false;
95 }
96 if (std::get<2>(p1) < std::get<2>(p2))
97 {
98 return true;
99 }
100 if (std::get<2>(p1) > std::get<2>(p2))
101 {
102 return false;
103 }
104
105 if (std::get<3>(p1) < std::get<3>(p2))
106 {
107 return true;
108 }
109 if (std::get<3>(p1) > std::get<3>(p2))
110 {
111 return false;
112 }
113
114 return false;
115}
116
117/**
118 *
119 */
120std::ostream &operator<<(std::ostream &os, OperatorKey const &p)
121{
122 os << LibUtilities::ShapeTypeMap[std::get<0>(p)] << ", "
123 << OperatorTypeMap[std::get<1>(p)] << ", "
124 << ImplementationTypeMap[std::get<2>(p)] << ", "
125 << (std::get<3>(p) ? "Nodal" : "Modal");
126 return os;
127}
128
129} // namespace Nektar::Collections
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:66
Provides a generic Factory class.
bool operator<(OperatorKey const &p1, OperatorKey const &p2)
Less-than comparison operator for OperatorKey objects.
Definition: Operator.cpp:78
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:131
const char *const ImplementationTypeMap[]
Definition: Operator.h:97
std::ostream & operator<<(std::ostream &os, OperatorKey const &p)
Stream output operator for OperatorKey objects.
Definition: Operator.cpp:120
const char *const OperatorTypeMap[]
Definition: Operator.h:74
std::tuple< LibUtilities::ShapeType, OperatorType, ImplementationType, ExpansionIsNodal > OperatorKey
Key for describing an Operator.
Definition: Operator.h:120
OperatorFactory & GetOperatorFactory()
Returns the singleton Operator factory object.
Definition: Operator.cpp:44
OperatorImpMap SetFixedImpType(ImplementationType defaultType)
simple Operator Implementation Map generator
Definition: Operator.cpp:51
ConstFactorMap FactorMap
Definition: StdRegions.hpp:434
StdRegions::ConstFactorMap factors