Nektar++
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// 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: Collection top class definition
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_LIBRARY_COLLECTIONS_COLLECTION_H
36#define NEKTAR_LIBRARY_COLLECTIONS_COLLECTION_H
37
38#include <vector>
39
46
47namespace Nektar
48{
49namespace Collections
50{
51
52/**
53 * @brief Collection
54 */
56{
57public:
59 std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,
60 OperatorImpMap &impTypes);
61
64 int coll_phys_offset = 0);
65
67 const OperatorType opType,
69
70 inline void ApplyOperator(const OperatorType &op,
71 const Array<OneD, const NekDouble> &inarray,
73
74 inline void ApplyOperator(const OperatorType &op,
75 const Array<OneD, const NekDouble> &inarray,
77 Array<OneD, NekDouble> &output1);
78
79 inline void ApplyOperator(const OperatorType &op,
80 const Array<OneD, const NekDouble> &inarray,
83 Array<OneD, NekDouble> &output2);
84
85 inline void ApplyOperator(const OperatorType &op, int dir,
86 const Array<OneD, const NekDouble> &inarray,
88
89 inline bool HasOperator(const OperatorType &op);
90
92 {
93 return m_ops[op];
94 }
95
97 {
98 return m_geomData;
99 }
100
101protected:
102 std::unordered_map<OperatorType, OperatorSharedPtr, EnumHash> m_ops;
104 // store details for initialisation on call rather than default
105 // initialisation
106 std::vector<StdRegions::StdExpansionSharedPtr> m_collExp;
108};
109
110typedef std::vector<Collection> CollectionVector;
111typedef std::shared_ptr<CollectionVector> CollectionVectorSharedPtr;
112
113/**
114 *
115 */
117 const OperatorType &op, const Array<OneD, const NekDouble> &inarray,
119{
120 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
121 (*m_ops[op])(inarray, output, NullNekDouble1DArray, NullNekDouble1DArray,
122 wsp);
123}
124
125/**
126 *
127 */
129 const OperatorType &op, const Array<OneD, const NekDouble> &inarray,
131{
132 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
133 (*m_ops[op])(inarray, output0, output1, NullNekDouble1DArray, wsp);
134}
135
136/**
137 *
138 */
140 const OperatorType &op, const Array<OneD, const NekDouble> &inarray,
142 Array<OneD, NekDouble> &output2)
143{
144 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
145 (*m_ops[op])(inarray, output0, output1, output2, wsp);
146}
147
148/**
149 *
150 */
152 const OperatorType &op, int dir,
154{
155 Array<OneD, NekDouble> wsp(m_ops[op]->GetWspSize());
156 (*m_ops[op])(dir, inarray, output, wsp);
157}
158
160{
161 return (m_ops.find(op) != m_ops.end());
162}
163
164} // namespace Collections
165} // namespace Nektar
166
167#endif
#define COLLECTIONS_EXPORT
COLLECTIONS_EXPORT Collection(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, OperatorImpMap &impTypes)
Definition: Collection.cpp:48
bool HasOperator(const OperatorType &op)
Definition: Collection.h:159
std::vector< StdRegions::StdExpansionSharedPtr > m_collExp
Definition: Collection.h:106
COLLECTIONS_EXPORT void CheckFactors(const OperatorType opType, StdRegions::FactorMap factors, int coll_phys_offset=0)
Definition: Collection.cpp:56
std::unordered_map< OperatorType, OperatorSharedPtr, EnumHash > m_ops
Definition: Collection.h:102
COLLECTIONS_EXPORT void Initialise(const OperatorType opType, StdRegions::FactorMap factors=StdRegions::NullFactorMap)
Definition: Collection.cpp:63
CoalescedGeomDataSharedPtr GetGeomSharedPtr()
Definition: Collection.h:96
OperatorSharedPtr GetOpSharedPtr(const OperatorType &op)
Definition: Collection.h:91
CoalescedGeomDataSharedPtr m_geomData
Definition: Collection.h:103
void ApplyOperator(const OperatorType &op, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &output)
Definition: Collection.h:116
std::map< OperatorType, ImplementationType > OperatorImpMap
Definition: Operator.h:112
std::shared_ptr< CollectionVector > CollectionVectorSharedPtr
Definition: Collection.h:111
std::shared_ptr< Operator > OperatorSharedPtr
Shared pointer to an Operator object.
Definition: Operator.h:172
std::shared_ptr< CoalescedGeomData > CoalescedGeomDataSharedPtr
std::vector< Collection > CollectionVector
Definition: Collection.h:110
static FactorMap NullFactorMap
Definition: StdRegions.hpp:413
ConstFactorMap FactorMap
Definition: StdRegions.hpp:412
StdRegions::ConstFactorMap factors
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
static Array< OneD, NekDouble > NullNekDouble1DArray