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