LifeV
BCInterfaceFunctionSolverDefined1D.cpp
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 BCInterfaceFunctionSolverDefined class and specializations
30  *
31  * @date 23-04-2009
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #include <lifev/bc_interface/1D/function/BCInterfaceFunctionSolverDefined1D.hpp>
38 
39 namespace LifeV
40 {
41 
42 // ===================================================
43 // Constructors
44 // ===================================================
45 BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::BCInterfaceFunctionSolverDefined() :
47  M_function ()
48 {
49 
50 #ifdef HAVE_LIFEV_DEBUG
51  debugStream ( 5025 ) << "BCInterfaceFunctionSolverDefined::BCInterfaceFunctionSolverDefined()" << "\n";
52 #endif
53 
54 }
55 
56 // ===================================================
57 // Methods
58 // ===================================================
59 void
60 BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::assignFunction ( OneDFSIFunction& base )
61 {
62  switch ( M_defaultFunction )
63  {
64  case Riemann:
65 
66  base.setFunction ( std::bind ( &OneDFSIFunctionSolverDefinedRiemann::operator(),
67  dynamic_cast<OneDFSIFunctionSolverDefinedRiemann*> ( & ( *M_function ) ), std::placeholders::_1, std::placeholders::_2 ) );
68 
69  break;
70 
71  case Compatibility:
72 
73  base.setFunction ( std::bind ( &OneDFSIFunctionSolverDefinedCompatibility::operator(),
74  dynamic_cast<OneDFSIFunctionSolverDefinedCompatibility*> ( & ( *M_function ) ), std::placeholders::_1, std::placeholders::_2 ) );
75 
76  break;
77 
78  case Absorbing:
79 
80  base.setFunction ( std::bind ( &OneDFSIFunctionSolverDefinedAbsorbing::operator(),
81  dynamic_cast<OneDFSIFunctionSolverDefinedAbsorbing*> ( & ( *M_function ) ), std::placeholders::_1, std::placeholders::_2 ) );
82 
83  break;
84 
85  case Resistance:
86 
87  base.setFunction ( std::bind ( &OneDFSIFunctionSolverDefinedResistance::operator(),
88  dynamic_cast<OneDFSIFunctionSolverDefinedResistance*> ( & ( *M_function ) ), std::placeholders::_1, std::placeholders::_2 ) );
89 
90  break;
91  }
92 }
93 
94 // ===================================================
95 // Set Methods
96 // ===================================================
97 void
98 BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::setData ( const dataPtr_Type& data )
99 {
100 
101 #ifdef HAVE_LIFEV_DEBUG
102  debugStream ( 5025 ) << "BCInterfaceFunctionSolverDefined::setData( data )" << "\n";
103 #endif
104 
105  //Set mapFunction
106  std::map< std::string, solverDefinedFunctions > mapFunction;
107  mapFunction["Riemann"] = Riemann;
108  mapFunction["Compatibility"] = Compatibility;
109  mapFunction["Absorbing"] = Absorbing;
110  mapFunction["Resistance"] = Resistance;
111 
112  M_defaultFunction = mapFunction[data->baseString()];
113 
114  switch ( M_defaultFunction )
115  {
116  case Riemann:
117 
118  M_function.reset ( new OneDFSIFunctionSolverDefinedRiemann ( data->side(), data->quantity() ) );
119 
120  break;
121 
122  case Compatibility:
123 
124  M_function.reset ( new OneDFSIFunctionSolverDefinedCompatibility ( data->side(), data->quantity() ) );
125 
126  break;
127 
128  case Absorbing:
129 
130  M_function.reset ( new OneDFSIFunctionSolverDefinedAbsorbing ( data->side(), data->quantity() ) );
131 
132  break;
133 
134  case Resistance:
135 
136  M_function.reset ( new OneDFSIFunctionSolverDefinedResistance ( data->side(), data->quantity(), data->resistance() [0] ) );
137 
138  break;
139  }
140 }
141 
142 } // Namespace LifeV
void updateInverseJacobian(const UInt &iQuadPt)
OneDFSIFunction - Base class for 1D BC Functions.
OneDFSIBCHandler - Class featuring methods to handle boundary conditions.
OneDFSISolver - Solver class for the 1D model.