Nektar++
Coupling.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Coupling.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2017 Kilian Lackhove
10//
11// Permission is hereby granted, free of charge, to any person obtaining a
12// copy of this software and associated documentation files (the "Software"),
13// to deal in the Software without restriction, including without limitation
14// the rights to use, copy, modify, merge, publish, distribute, sublicense,
15// and/or sell copies of the Software, and to permit persons to whom the
16// Software is furnished to do so, subject to the following conditions:
17//
18// The above copyright notice and this permission notice shall be included
19// in all copies or substantial portions of the Software.
20//
21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27// DEALINGS IN THE SOFTWARE.
28//
29// Description: Coupling class
30//
31///////////////////////////////////////////////////////////////////////////////
32
33#ifndef NEKTAR_COUPLING
34#define NEKTAR_COUPLING
35
39
40namespace Nektar
41{
42namespace SolverUtils
43{
44
45class Coupling;
46
47SOLVER_UTILS_EXPORT typedef std::shared_ptr<Coupling> CouplingSharedPtr;
48
49/// Declaration of the Coupling factory
53
54/// Declaration of the Coupling factory singleton
56
58{
59
60public:
61 typedef std::map<std::string, std::string> CouplingConfigMap;
62
64 {
65 }
66
68 {
69 v_Init();
70 }
71
72 SOLVER_UTILS_EXPORT inline const std::map<std::string, std::string> GetConfig()
73 {
74 return m_config;
75 }
76
77 SOLVER_UTILS_EXPORT inline std::vector<std::string> GetSendFieldNames()
78 {
79 return m_sendFieldNames;
80 }
81
82 SOLVER_UTILS_EXPORT inline std::vector<std::string> GetRecvFieldNames()
83 {
84 return m_recvFieldNames;
85 }
86
88 {
89 v_Finalize();
90 }
91
93 const int step, const NekDouble time,
94 const Array<OneD, const Array<OneD, NekDouble>> &field,
95 std::vector<std::string> &varNames)
96 {
97 v_Send(step, time, field, varNames);
98 }
99
101 const int step, const NekDouble time,
103 std::vector<std::string> &varNames)
104 {
105 v_Receive(step, time, field, varNames);
106 }
107
108protected:
109 std::string m_couplingName;
110
112
114
116 std::vector<std::string> m_sendFieldNames;
118
120 std::vector<std::string> m_recvFieldNames;
122
124
125 SOLVER_UTILS_EXPORT virtual void v_Init();
126
128 const int step, const NekDouble time,
129 const Array<OneD, const Array<OneD, NekDouble>> &field,
130 std::vector<std::string> &varNames) = 0;
131
133 const int step, const NekDouble time,
135 std::vector<std::string> &varNames) = 0;
136
138 {
139 }
140
142 std::vector<std::string> &vars, std::vector<std::string> &transVars);
143};
144} // namespace SolverUtils
145} // namespace Nektar
146
147#endif
#define SOLVER_UTILS_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:105
virtual SOLVER_UTILS_EXPORT void v_Init()
Definition: Coupling.cpp:61
SOLVER_UTILS_EXPORT void Finalize()
Definition: Coupling.h:87
SOLVER_UTILS_EXPORT void Receive(const int step, const NekDouble time, Array< OneD, Array< OneD, NekDouble > > &field, std::vector< std::string > &varNames)
Definition: Coupling.h:100
MultiRegions::ExpListSharedPtr m_evalField
Definition: Coupling.h:113
SOLVER_UTILS_EXPORT const std::map< std::string, std::string > GetConfig()
Definition: Coupling.h:72
SOLVER_UTILS_EXPORT void Init()
Definition: Coupling.h:67
std::vector< std::string > m_sendFieldNames
Definition: Coupling.h:116
std::map< std::string, std::string > CouplingConfigMap
Definition: Coupling.h:61
virtual SOLVER_UTILS_EXPORT void v_Finalize()
Definition: Coupling.h:137
SOLVER_UTILS_EXPORT std::vector< std::string > GetRecvFieldNames()
Definition: Coupling.h:82
virtual SOLVER_UTILS_EXPORT void v_Send(const int step, const NekDouble time, const Array< OneD, const Array< OneD, NekDouble > > &field, std::vector< std::string > &varNames)=0
CouplingConfigMap m_config
Definition: Coupling.h:111
virtual SOLVER_UTILS_EXPORT ~Coupling()
Definition: Coupling.h:63
std::vector< std::string > m_recvFieldNames
Definition: Coupling.h:120
SOLVER_UTILS_EXPORT Coupling(MultiRegions::ExpListSharedPtr field)
Definition: Coupling.cpp:50
SOLVER_UTILS_EXPORT std::vector< std::string > GetSendFieldNames()
Definition: Coupling.h:77
SOLVER_UTILS_EXPORT void Send(const int step, const NekDouble time, const Array< OneD, const Array< OneD, NekDouble > > &field, std::vector< std::string > &varNames)
Definition: Coupling.h:92
virtual SOLVER_UTILS_EXPORT void v_Receive(const int step, const NekDouble time, Array< OneD, Array< OneD, NekDouble > > &field, std::vector< std::string > &varNames)=0
SOLVER_UTILS_EXPORT std::vector< int > GenerateVariableMapping(std::vector< std::string > &vars, std::vector< std::string > &transVars)
Definition: Coupling.cpp:134
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
SOLVER_UTILS_EXPORT typedef LibUtilities::NekFactory< std::string, Coupling, MultiRegions::ExpListSharedPtr > CouplingFactory
Declaration of the Coupling factory.
Definition: Coupling.h:52
SOLVER_UTILS_EXPORT typedef std::shared_ptr< Coupling > CouplingSharedPtr
Definition: Coupling.h:47
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
Definition: Coupling.cpp:44
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble