LifeV
BCInterfaceFactory.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  * @file
29  * @brief File containing the BCInterfaceFactory class
30  *
31  * @date 18-03-2011
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #ifndef BCInterfaceFactory_H
38 #define BCInterfaceFactory_H 1
39 
40 #include <lifev/bc_interface/core/bc/BCInterfaceData.hpp>
41 
42 #include <lifev/bc_interface/core/function/BCInterfaceFunctionParser.hpp>
43 #include <lifev/bc_interface/core/function/BCInterfaceFunctionParserFile.hpp>
44 #include <lifev/bc_interface/core/function/BCInterfaceFunctionParserSolver.hpp>
45 #include <lifev/bc_interface/core/function/BCInterfaceFunctionParserFileSolver.hpp>
46 #include <lifev/bc_interface/core/function/BCInterfaceFunctionUserDefined.hpp>
47 #include <lifev/bc_interface/core/function/BCInterfaceFunctionSolverDefined.hpp>
48 
49 namespace LifeV
50 {
51 
52 // Forward class declarations
53 template< typename BcHandlerType, typename PhysicalSolverType >
54 class BCInterfaceFunctionSolverDefined;
55 
56 template< typename BcHandlerType, typename PhysicalSolverType >
57 inline BCInterfaceFunctionSolverDefined< BcHandlerType, PhysicalSolverType >* createBCInterfaceFunctionSolverDefined();
58 
59 
60 
61 //! BCInterfaceFactory - Factory to create \c BCInterface functions
62 /*!
63  * @author Cristiano Malossi
64  *
65  * This class allows to create boundary functions which can be used by any BCInterface implementation.
66  * The following functions are available (see the related classes for more information):
67  *
68  * <ol>
69  * <li> \c function, which is implemented in \c BCInterfaceFunctionParser;
70  * <li> \c functionFile, which is implemented in \c BCInterfaceFunctionParserFile;
71  * <li> \c functionSolver, which is implemented in \c BCInterfaceFunctionParserSolver;
72  * <li> \c functionFileSolver, which is implemented in \c BCInterfaceFunctionParserFileSolver;
73  * <li> \c functionUD, which is implemented in \c BCInterfaceFunctionUserDefined;
74  * <li> \c functionSD, which is implemented in \c BCInterfaceFunctionSolverDefined;
75  * </ol>
76  */
77 
78 template< typename BcHandlerType, typename PhysicalSolverType >
79 class BCInterfaceFactory
80 {
81 public:
82 
83  //! @name Type definitions
84  //@{
85 
86  typedef BcHandlerType bcHandler_Type;
87  typedef PhysicalSolverType physicalSolver_Type;
88 
92 
95 
96  typedef BCInterfaceFunctionSolverDefined< bcHandler_Type, physicalSolver_Type > bcFunctionSolverDefined_Type;
99 
100  //@}
101 
102 
103  //! @name Constructors & Destructor
104  //@{
105 
106  //! Constructor
107  explicit BCInterfaceFactory();
108 
109  //! Destructor
110  virtual ~BCInterfaceFactory() {}
111 
112  //@}
113 
114 
115  //! @name Methods
116  //@{
117 
118  //! Create a parser function
119  /*!
120  * @param data data container
121  */
122  template< typename DataPtrType >
123  bcFunctionPtr_Type createFunctionParser ( const DataPtrType& data );
124 
125  //! Create a user defined function
126  /*!
127  * @param data data container
128  */
129  template< typename DataPtrType >
131 
132  //@}
133 
134 private:
135 
136  //! @name Unimplemented Methods
137  //@{
138 
139  BCInterfaceFactory ( const BCInterfaceFactory& bcInterfaceFactory );
140 
141  BCInterfaceFactory& operator= ( const BCInterfaceFactory& bcInterfaceFactory );
142 
143  //@}
144 };
145 
146 // ===================================================
147 // Constructors & Destructor
148 // ===================================================
149 template< typename BcHandlerType, typename PhysicalSolverType >
150 BCInterfaceFactory< BcHandlerType, PhysicalSolverType >::BCInterfaceFactory()
151 {
152 
153 #ifdef HAVE_LIFEV_DEBUG
154  debugStream ( 5020 ) << "BCInterfaceFactory::BCInterfaceFactory" << "\n";
155 #endif
156 
157  //Factory registration
158  factoryFunction_Type::instance().registerProduct ( BCIFunctionParser, &createBCInterfaceFunctionParser< bcHandler_Type, physicalSolver_Type > );
159  factoryFunction_Type::instance().registerProduct ( BCIFunctionParserFile, &createBCInterfaceFunctionParserFile< bcHandler_Type, physicalSolver_Type > );
160  factoryFunction_Type::instance().registerProduct ( BCIFunctionParserSolver, &createBCInterfaceFunctionParserSolver< bcHandler_Type, physicalSolver_Type > );
161  factoryFunction_Type::instance().registerProduct ( BCIFunctionParserFileSolver, &createBCInterfaceFunctionParserFileSolver< bcHandler_Type, physicalSolver_Type > );
162  factoryFunction_Type::instance().registerProduct ( BCIFunctionUserDefined, &createBCInterfaceFunctionUserDefined< bcHandler_Type, physicalSolver_Type > );
163  factoryFunctionSolverDefined_Type::instance().registerProduct ( BCIFunctionSolverDefined, &createBCInterfaceFunctionSolverDefined< bcHandler_Type, physicalSolver_Type > );
164 }
165 
166 // ===================================================
167 // Methods
168 // ===================================================
169 template< typename BcHandlerType, typename PhysicalSolverType > template< typename DataPtrType >
170 inline typename BCInterfaceFactory< BcHandlerType, PhysicalSolverType >::bcFunctionPtr_Type
171 BCInterfaceFactory< BcHandlerType, PhysicalSolverType >::createFunctionParser ( const DataPtrType& data )
172 {
173  bcFunctionPtr_Type function ( factoryFunction_Type::instance().createObject ( data->base().second, data->mapBase() ) );
174 
175  function->setData ( data );
176 
177  return function;
178 }
179 
180 template< typename BcHandlerType, typename PhysicalSolverType > template< typename DataPtrType >
181 inline typename BCInterfaceFactory< BcHandlerType, PhysicalSolverType >::bcFunctionSolverDefinedPtr_Type
182 BCInterfaceFactory< BcHandlerType, PhysicalSolverType >::createFunctionSolverDefined ( const DataPtrType& data )
183 {
184  bcFunctionSolverDefinedPtr_Type function ( factoryFunctionSolverDefined_Type::instance().createObject ( data->base().second, data->mapBase() ) );
185 
186  function->setData ( data );
187 
188  return function;
189 }
190 
191 } // Namespace LifeV
192 
193 #endif /* BCInterfaceFactory_H */
PhysicalSolverType physicalSolver_Type
BCInterfaceFunctionParserSolver - LifeV boundary condition function file wrapper for BCInterface...
std::shared_ptr< bcFunctionParserSolver_Type > bcFunctionParserSolverPtr_Type
BCInterfaceFunctionParserSolver< bcHandler_Type, physicalSolver_Type > bcFunctionParserSolver_Type
BCInterfaceFunctionSolverDefined< bcHandler_Type, physicalSolver_Type > bcFunctionSolverDefined_Type
void updateInverseJacobian(const UInt &iQuadPt)
FactorySingleton< Factory< bcFunctionSolverDefined_Type, baseList_Type > > factoryFunctionSolverDefined_Type
bcFunctionPtr_Type createFunctionParser(const DataPtrType &data)
Create a parser function.
BCInterfaceFactory(const BCInterfaceFactory &bcInterfaceFactory)
BCInterfaceFunction< bcHandler_Type, physicalSolver_Type > bcFunction_Type
bcFunctionSolverDefinedPtr_Type createFunctionSolverDefined(const DataPtrType &data)
Create a user defined function.
BCInterfaceFactory & operator=(const BCInterfaceFactory &bcInterfaceFactory)
virtual ~BCInterfaceFactory()
Destructor.
std::shared_ptr< bcFunctionSolverDefined_Type > bcFunctionSolverDefinedPtr_Type
BCInterfaceFunctionSolverDefined< BcHandlerType, PhysicalSolverType > * createBCInterfaceFunctionSolverDefined()
Factory create function.
FactorySingleton< Factory< bcFunction_Type, baseList_Type > > factoryFunction_Type
BCInterfaceFunction - Base class for BCInterface boundary functions.
std::shared_ptr< bcFunction_Type > bcFunctionPtr_Type