Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Collection.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Collection.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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Collection top class definition
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBRARY_COLLECTIONS_COLLECTION_H
37 #define NEKTAR_LIBRARY_COLLECTIONS_COLLECTION_H
38 
39 #include <vector>
40 
44 #include <Collections/Operator.h>
46 
47 #include <boost/unordered_map.hpp>
48 
49 namespace Nektar {
50 namespace Collections {
51 
52 
53 /**
54  * @brief Collection
55  */
57 {
58  public:
59 
61  std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,
62  OperatorImpMap &impTypes);
63 
64  inline void ApplyOperator(
65  const OperatorType &op,
66  const Array<OneD, const NekDouble> &inarray,
67  Array<OneD, NekDouble> &output);
68 
69  inline void ApplyOperator(
70  const OperatorType &op,
71  const Array<OneD, const NekDouble> &inarray,
72  Array<OneD, NekDouble> &output0,
73  Array<OneD, NekDouble> &output1);
74 
75  inline void ApplyOperator(
76  const OperatorType &op,
77  const Array<OneD, const NekDouble> &inarray,
78  Array<OneD, NekDouble> &output0,
79  Array<OneD, NekDouble> &output1,
80  Array<OneD, NekDouble> &output2);
81 
82  inline void ApplyOperator(
83  const OperatorType &op,
84  int dir,
85  const Array<OneD, const NekDouble> &inarray,
86  Array<OneD, NekDouble> &output);
87 
88  inline bool HasOperator(const OperatorType &op);
89 
90  protected:
92  std::vector<SpatialDomains::GeometrySharedPtr> m_geom;
93  boost::unordered_map<OperatorType, OperatorSharedPtr> m_ops;
95 
96 };
97 
98 typedef std::vector<Collection> CollectionVector;
99 typedef boost::shared_ptr<CollectionVector> CollectionVectorSharedPtr;
100 
101 
102 /**
103  *
104  */
106  const OperatorType &op,
107  const Array<OneD, const NekDouble> &inarray,
108  Array<OneD, NekDouble> &output)
109 {
110  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
111  (*m_ops[op])(inarray, output, NullNekDouble1DArray,
112  NullNekDouble1DArray, wsp);
113 }
114 
115 
116 /**
117  *
118  */
120  const OperatorType &op,
121  const Array<OneD, const NekDouble> &inarray,
122  Array<OneD, NekDouble> &output0,
123  Array<OneD, NekDouble> &output1)
124 {
125  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
126  (*m_ops[op])(inarray, output0, output1, NullNekDouble1DArray, wsp);
127 }
128 
129 
130 /**
131  *
132  */
134  const OperatorType &op,
135  const Array<OneD, const NekDouble> &inarray,
136  Array<OneD, NekDouble> &output0,
137  Array<OneD, NekDouble> &output1,
138  Array<OneD, NekDouble> &output2)
139 {
140  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
141  (*m_ops[op])(inarray, output0, output1, output2, wsp);
142 }
143 
144 /**
145  *
146  */
148  const OperatorType &op,
149  int dir,
150  const Array<OneD, const NekDouble> &inarray,
151  Array<OneD, NekDouble> &output)
152 {
153  Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
154  (*m_ops[op])(dir, inarray, output, wsp);
155 }
156 
157 inline bool Collection::HasOperator(const OperatorType &op)
158 {
159  return (m_ops.find(op) != m_ops.end());
160 }
161 
162 }
163 }
164 
165 #endif
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:94
static Array< OneD, NekDouble > NullNekDouble1DArray
bool HasOperator(const OperatorType &op)
Definition: Collection.h:157
std::vector< SpatialDomains::GeometrySharedPtr > m_geom
Definition: Collection.h:92
std::vector< Collection > CollectionVector
Definition: Collection.h:98
void ApplyOperator(const OperatorType &op, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output)
Definition: Collection.h:105
boost::shared_ptr< CollectionVector > CollectionVectorSharedPtr
Definition: Collection.h:99
boost::unordered_map< OperatorType, OperatorSharedPtr > m_ops
Definition: Collection.h:93
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:102
COLLECTIONS_EXPORT Collection(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, OperatorImpMap &impTypes)
Definition: Collection.cpp:47
#define COLLECTIONS_EXPORT
boost::shared_ptr< CoalescedGeomData > CoalescedGeomDataSharedPtr
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Collection.h:91
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr