Commit d28ddff1 authored by Cristiano Malossi's avatar Cristiano Malossi
Browse files

BCInterface full splitting completed!

parent aff35547
......@@ -117,6 +117,7 @@ public:
typedef typename bcInterface_Type::vectorFunctionSolverDefined_Type vectorFunctionSolverDefined_Type;
typedef BCInterfaceData0D data_Type;
typedef boost::shared_ptr< data_Type > dataPtr_Type;
//@}
......@@ -125,7 +126,7 @@ public:
//@{
//! Constructor
explicit BCInterface0D() : bcInterface_Type(), M_data() {}
explicit BCInterface0D() : bcInterface_Type(), M_data( new data_Type() ) {}
//! Destructor
virtual ~BCInterface0D() {}
......@@ -144,7 +145,7 @@ public:
*/
void readBC ( const std::string& fileName, const std::string& dataSection, const std::string& name )
{
M_data.readBC ( fileName, dataSection, name );
M_data->readBC ( fileName, dataSection, name );
}
//! Insert the current boundary condition in the BChandler
......@@ -162,7 +163,7 @@ public:
*/
data_Type& dataContainer()
{
return M_data;
return *M_data;
}
//@}
......@@ -188,7 +189,7 @@ private:
//@}
// Data
data_Type M_data;
dataPtr_Type M_data;
};
// ===================================================
......@@ -205,7 +206,7 @@ BCInterface0D< BcHandler, PhysicalSolverType >::insertBC()
ZeroDimensionalFunction base;
switch ( M_data.base().second )
switch ( M_data->base().second )
{
case BCIFunctionParser:
case BCIFunctionParserFile:
......@@ -224,7 +225,7 @@ BCInterface0D< BcHandler, PhysicalSolverType >::insertBC()
default:
std::cout << " !!! Error: " << M_data.base().first << " is not valid in BCInterface0D !!!" << std::endl;
std::cout << " !!! Error: " << M_data->base().first << " is not valid in BCInterface0D !!!" << std::endl;
break;
}
}
......@@ -242,8 +243,8 @@ BCInterface0D< BcHandler, PhysicalSolverType >::addBcToHandler( BCBaseType& base
{
this->createHandler();
}
//boost::bind ( &BCInterfaceFunction<BcHandler, PhysicalSolverType>::functionTime, this->M_vectorFunction.back(), _1 )
this->M_handler->setBC ( M_data.flag(), M_data.type(), base );
this->M_handler->setBC ( M_data->flag(), M_data->type(), base );
}
} // Namespace LifeV
......
......@@ -44,7 +44,6 @@ namespace LifeV
// ===================================================
BCInterfaceData0D::BCInterfaceData0D() :
BCInterfaceData (),
M_flag (),
M_type (),
M_mapType ()
{
......@@ -55,7 +54,6 @@ BCInterfaceData0D::BCInterfaceData0D() :
BCInterfaceData0D::BCInterfaceData0D ( const BCInterfaceData0D& data ) :
BCInterfaceData ( data ),
M_flag ( data.M_flag ),
M_type ( data.M_type ),
M_mapType ( data.M_mapType )
{
......@@ -70,7 +68,6 @@ BCInterfaceData0D::operator= ( const BCInterfaceData0D& data )
if ( this != &data )
{
BCInterfaceData::operator= ( data );
M_flag = data.M_flag;
M_type = data.M_type;
M_mapType = data.M_mapType;
}
......@@ -101,7 +98,6 @@ BCInterfaceData0D::showMe ( std::ostream& output ) const
dataContainer_Type::showMe ( output );
// Show 0D data
output << "Flag = " << static_cast< Real > ( M_flag ) << std::endl;
output << "Type = " << M_type << std::endl;
}
......
......@@ -126,7 +126,7 @@ public:
*/
void setFlag ( const bcFlag_Type& flag )
{
M_flag = flag;
M_boundaryID = flag;
}
//! Set the type of the boundary condition
......@@ -150,7 +150,7 @@ public:
*/
const bcFlag_Type& flag() const
{
return M_flag;
return M_boundaryID;
}
//! Get the type of the boundary condition
......@@ -171,7 +171,7 @@ private:
void readFlag ( const GetPot& dataFile, const char* flag )
{
M_flag = dataFile ( flag, 0 );
M_boundaryID = dataFile ( flag, 0 );
}
void readType ( const GetPot& dataFile, const char* type )
......@@ -186,7 +186,6 @@ private:
//@{
bcFlag_Type M_flag;
bcType_Type M_type;
......
......@@ -50,4 +50,19 @@ BCInterfaceFunctionParser< ZeroDimensionalBCHandler, ZeroDimensionalData >::assi
base.setFunction ( functionSelectorTime() );
}
// ===================================================
// Set Methods
// ===================================================
template< >
void
BCInterfaceFunctionParser< ZeroDimensionalBCHandler, ZeroDimensionalData >::setData ( const boost::shared_ptr< BCInterfaceData >& data )
{
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5022 ) << "BCInterfaceFunction::setData" << "\n";
#endif
setupParser ( data );
}
} // Namespace LifeV
......@@ -41,6 +41,7 @@
#include <lifev/zero_dimensional/solver/ZeroDimensionalData.hpp>
// BCInterface includes
#include <lifev/bc_interface/0D/bc/BCInterfaceData0D.hpp>
#include <lifev/bc_interface/core/function/BCInterfaceFunctionParser.hpp>
namespace LifeV
......@@ -53,6 +54,13 @@ template< >
void
BCInterfaceFunctionParser< ZeroDimensionalBCHandler, ZeroDimensionalData >::assignFunction ( bcBase_Type& base );
// ===================================================
// Set Methods
// ===================================================
template< >
void
BCInterfaceFunctionParser< ZeroDimensionalBCHandler, ZeroDimensionalData >::setData ( const boost::shared_ptr< BCInterfaceData >& data );
} // Namespace LifeV
#endif /* BCInterfaceFunctionParser0D_H */
......@@ -90,7 +90,7 @@ BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >
// ===================================================
template< >
void
BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >::createAccessList ( const BCInterfaceData& data )
BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >::createAccessList ( const boost::shared_ptr< BCInterfaceData >& data )
{
#ifdef HAVE_LIFEV_DEBUG
......
......@@ -41,6 +41,7 @@
#include <lifev/zero_dimensional/solver/ZeroDimensionalData.hpp>
// BCInterface includes
#include <lifev/bc_interface/0D/function/BCInterfaceFunctionParser0D.hpp>
#include <lifev/bc_interface/core/function/BCInterfaceFunctionParserSolver.hpp>
namespace LifeV
......@@ -58,7 +59,7 @@ BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >
// ===================================================
template< >
void
BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >::createAccessList ( const BCInterfaceData& data );
BCInterfaceFunctionParserSolver< ZeroDimensionalBCHandler, ZeroDimensionalData >::createAccessList ( const boost::shared_ptr< BCInterfaceData >& data );
} // Namespace LifeV
......
......@@ -124,6 +124,7 @@ public:
typedef typename bcInterface_Type::vectorFunctionSolverDefined_Type vectorFunctionSolverDefined_Type;
typedef BCInterfaceData1D data_Type;
typedef boost::shared_ptr< data_Type > dataPtr_Type;
typedef typename bcHandler_Type::solutionPtr_Type solutionPtr_Type;
typedef typename bcHandler_Type::fluxPtr_Type fluxPtr_Type;
......@@ -137,7 +138,7 @@ public:
//@{
//! Constructor
explicit BCInterface1D() : bcInterface_Type(), M_data() {}
explicit BCInterface1D() : bcInterface_Type(), M_data( new data_Type() ) {}
//! Destructor
virtual ~BCInterface1D() {}
......@@ -156,7 +157,7 @@ public:
*/
void readBC ( const std::string& fileName, const std::string& dataSection, const std::string& name )
{
M_data.readBC ( fileName, dataSection, name );
M_data->readBC ( fileName, dataSection, name );
}
//! Insert the current boundary condition in the BChandler
......@@ -212,7 +213,7 @@ public:
*/
data_Type& dataContainer()
{
return M_data;
return *M_data;
}
//@}
......@@ -241,7 +242,7 @@ private:
//@}
// Data
data_Type M_data;
dataPtr_Type M_data;
};
// ===================================================
......@@ -261,7 +262,7 @@ BCInterface1D< BcHandler, PhysicalSolverType >::insertBC()
OneDFSIFunction base;
// Define correct BCI type
switch ( M_data.base().second )
switch ( M_data->base().second )
{
case BCIFunctionParser:
case BCIFunctionParserFile:
......@@ -283,7 +284,7 @@ BCInterface1D< BcHandler, PhysicalSolverType >::insertBC()
}
default:
std::cout << " !!! Error: " << M_data.base().first << " is not valid in BCInterface1D !!!" << std::endl;
std::cout << " !!! Error: " << M_data->base().first << " is not valid in BCInterface1D !!!" << std::endl;
return;
}
......@@ -354,7 +355,7 @@ BCInterface1D< BcHandler, PhysicalSolverType >::addBcToHandler ( BCBaseType& bas
debugStream ( 5020 ) << "BCInterface1D::addBCManager" << "\n\n";
#endif
this->M_handler->setBC ( M_data.side(), M_data.line(), M_data.quantity(), base );
this->M_handler->setBC ( M_data->side(), M_data->line(), M_data->quantity(), base );
}
} // Namespace LifeV
......
......@@ -44,7 +44,6 @@ namespace LifeV
// ===================================================
BCInterfaceData1D::BCInterfaceData1D() :
BCInterfaceData (),
M_side (),
M_line (),
M_quantity (),
M_resistance (),
......@@ -72,7 +71,6 @@ BCInterfaceData1D::BCInterfaceData1D() :
BCInterfaceData1D::BCInterfaceData1D ( const BCInterfaceData1D& data ) :
BCInterfaceData ( data ),
M_side ( data.M_side ),
M_line ( data.M_line ),
M_quantity ( data.M_quantity ),
M_resistance ( data.M_resistance ),
......@@ -92,7 +90,6 @@ BCInterfaceData1D::operator= ( const BCInterfaceData1D& data )
if ( this != &data )
{
BCInterfaceData::operator= ( data );
M_side = data.M_side;
M_line = data.M_line;
M_quantity = data.M_quantity;
M_resistance = data.M_resistance;
......@@ -131,7 +128,6 @@ BCInterfaceData1D::showMe ( std::ostream& output ) const
dataContainer_Type::showMe ( output );
// Show 1D data
output << "Side = " << M_side << std::endl;
output << "Line = " << M_line << std::endl;
output << "Quantity = " << M_quantity << std::endl;
output << "Resistance = ";
......
......@@ -122,11 +122,11 @@ public:
//! Set the side of the boundary condition
/*!
* @param flag Boundary condition side
* @param side Boundary condition side
*/
void setSide ( const OneDFSI::bcSide_Type& side )
{
M_side = side;
M_boundaryID = ( side == OneDFSI::left ) ? 0 : 1;
}
//! Set the line of the boundary condition
......@@ -157,9 +157,9 @@ public:
/*!
* @return Boundary condition side
*/
const OneDFSI::bcSide_Type& side() const
OneDFSI::bcSide_Type side() const
{
return M_side;
return ( M_boundaryID == 0 ) ? OneDFSI::left : OneDFSI::right;
}
//! Get the mode of the boundary condition
......@@ -207,7 +207,7 @@ private:
void readSide ( const GetPot& dataFile, const char* side )
{
M_side = M_mapSide[dataFile ( side, "left" )];
M_boundaryID = ( M_mapSide[dataFile ( side, "left" )] == OneDFSI::left ) ? 0 : 1;
}
void readLine ( const GetPot& dataFile, const char* line )
......@@ -233,7 +233,6 @@ private:
//! @name Private Members
//@{
OneDFSI::bcSide_Type M_side;
OneDFSI::bcLine_Type M_line;
OneDFSI::bcType_Type M_quantity;
......
......@@ -50,4 +50,19 @@ BCInterfaceFunctionParser< OneDFSIBCHandler, OneDFSISolver >::assignFunction ( b
base.setFunction ( functionSelectorTimeTimeStep() );
}
// ===================================================
// Set Methods
// ===================================================
template< >
void
BCInterfaceFunctionParser< OneDFSIBCHandler, OneDFSISolver >::setData ( const boost::shared_ptr< BCInterfaceData >& data )
{
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5022 ) << "BCInterfaceFunction::setData" << "\n";
#endif
setupParser ( data );
}
} // Namespace LifeV
......@@ -41,6 +41,7 @@
#include <lifev/one_d_fsi/solver/OneDFSISolver.hpp>
// BCInterface includes
#include <lifev/bc_interface/1D/bc/BCInterfaceData1D.hpp>
#include <lifev/bc_interface/core/function/BCInterfaceFunctionParser.hpp>
namespace LifeV
......@@ -53,6 +54,13 @@ template< >
void
BCInterfaceFunctionParser< OneDFSIBCHandler, OneDFSISolver >::assignFunction ( bcBase_Type& base );
// ===================================================
// Set Methods
// ===================================================
template< >
void
BCInterfaceFunctionParser< OneDFSIBCHandler, OneDFSISolver >::setData ( const boost::shared_ptr< BCInterfaceData >& data );
} // Namespace LifeV
#endif /* BCInterfaceFunctionParser1D_H */
......@@ -52,6 +52,7 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
debugStream ( 5023 ) << "BCInterfaceFunctionSolver<FSI>::updatePhysicalSolverVariables" << "\n";
#endif
OneDFSI::bcSide_Type side = ( M_boundaryID == 0 ) ? OneDFSI::left : OneDFSI::right;
// Create/Update variables
for ( std::set< physicalSolverList >::iterator j = M_list.begin(); j != M_list.end(); ++j )
switch ( *j )
......@@ -69,9 +70,9 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
case f_area:
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5023 ) << " f_area(" << static_cast<Real> (M_side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::A, M_side ) << "\n";
debugStream ( 5023 ) << " f_area(" << static_cast<Real> (side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::A, side ) << "\n";
#endif
setVariable ( "f_area", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::A, M_side ) );
setVariable ( "f_area", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::A, side ) );
break;
......@@ -87,20 +88,20 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
case f_flux:
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5023 ) << " f_flux(" << static_cast<Real> (M_side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::Q, M_side ) << "\n";
debugStream ( 5023 ) << " f_flux(" << static_cast<Real> (side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::Q, side ) << "\n";
#endif
setVariable ( "f_flux", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::Q, M_side ) );
setVariable ( "f_flux", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::Q, side ) );
break;
case f_pressure:
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5023 ) << " f_pressure(" << static_cast<Real> (M_side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::P, M_side ) << "\n";
debugStream ( 5023 ) << " f_pressure(" << static_cast<Real> (side) << "): " << M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::P, side ) << "\n";
#endif
setVariable ( "f_pressure", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::P, M_side ) );
setVariable ( "f_pressure", M_physicalSolver->boundaryValue ( *M_solution, OneDFSI::P, side ) );
break;
......@@ -146,10 +147,10 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
case s_thickness:
#ifdef HAVE_LIFEV_DEBUG
debugStream ( 5023 ) << " s_thickness: " << M_physicalSolver->physics()->data()->thickness ( M_physicalSolver->boundaryDOF ( M_side ) ) << "\n";
debugStream ( 5023 ) << " s_thickness: " << M_physicalSolver->physics()->data()->thickness ( M_physicalSolver->boundaryDOF ( side ) ) << "\n";
#endif
setVariable ( "s_thickness", M_physicalSolver->physics()->data()->thickness ( M_physicalSolver->boundaryDOF ( M_side ) ) );
setVariable ( "s_thickness", M_physicalSolver->physics()->data()->thickness ( M_physicalSolver->boundaryDOF ( side ) ) );
break;
......@@ -187,7 +188,7 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
// ===================================================
template< >
void
BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::createAccessList ( const BCInterfaceData& data )
BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::createAccessList ( const boost::shared_ptr< BCInterfaceData >& data )
{
#ifdef HAVE_LIFEV_DEBUG
......
......@@ -41,6 +41,7 @@
#include <lifev/one_d_fsi/solver/OneDFSISolver.hpp>
// BCInterface includes
#include <lifev/bc_interface/1D/function/BCInterfaceFunctionParser1D.hpp>
#include <lifev/bc_interface/core/function/BCInterfaceFunctionParserSolver.hpp>
namespace LifeV
......@@ -58,7 +59,7 @@ BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::updatePhysic
// ===================================================
template< >
void
BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::createAccessList ( const BCInterfaceData& data );
BCInterfaceFunctionParserSolver< OneDFSIBCHandler, OneDFSISolver >::createAccessList ( const boost::shared_ptr< BCInterfaceData >& data );
} // Namespace LifeV
......
......@@ -95,7 +95,7 @@ BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::assignFunct
// Set Methods
// ===================================================
void
BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::setData ( const BCInterfaceData1D& data )
BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::setData ( const dataPtr_Type& data )
{
#ifdef HAVE_LIFEV_DEBUG
......@@ -109,31 +109,31 @@ BCInterfaceFunctionSolverDefined< OneDFSIBCHandler, OneDFSISolver >::setData ( c
mapFunction["Absorbing"] = Absorbing;
mapFunction["Resistance"] = Resistance;
M_defaultFunction = mapFunction[data.baseString()];
M_defaultFunction = mapFunction[data->baseString()];
switch ( M_defaultFunction )
{
case Riemann:
M_function.reset ( new OneDFSIFunctionSolverDefinedRiemann ( data.side(), data.quantity() ) );
M_function.reset ( new OneDFSIFunctionSolverDefinedRiemann ( data->side(), data->quantity() ) );
break;
case Compatibility:
M_function.reset ( new OneDFSIFunctionSolverDefinedCompatibility ( data.side(), data.quantity() ) );
M_function.reset ( new OneDFSIFunctionSolverDefinedCompatibility ( data->side(), data->quantity() ) );
break;
case Absorbing:
M_function.reset ( new OneDFSIFunctionSolverDefinedAbsorbing ( data.side(), data.quantity() ) );
M_function.reset ( new OneDFSIFunctionSolverDefinedAbsorbing ( data->side(), data->quantity() ) );
break;
case Resistance:
M_function.reset ( new OneDFSIFunctionSolverDefinedResistance ( data.side(), data.quantity(), data.resistance() [0] ) );
M_function.reset ( new OneDFSIFunctionSolverDefinedResistance ( data->side(), data->quantity(), data->resistance() [0] ) );
break;
}
......
......@@ -41,6 +41,7 @@
#include <lifev/one_d_fsi/solver/OneDFSISolver.hpp>
// BCInterface includes
#include <lifev/bc_interface/1D/bc/BCInterfaceData1D.hpp>
#include <lifev/bc_interface/core/function/BCInterfaceFunctionSolverDefined.hpp>
namespace LifeV
......@@ -72,18 +73,21 @@ public:
//! @name Type definitions
//@{
typedef OneDFSIBCHandler bcHandler_Type;
typedef OneDFSISolver physicalSolver_Type;
typedef boost::shared_ptr< physicalSolver_Type > physicalSolverPtr_Type;
typedef OneDFSIBCHandler bcHandler_Type;
typedef OneDFSISolver physicalSolver_Type;
typedef boost::shared_ptr< physicalSolver_Type > physicalSolverPtr_Type;
typedef bcHandler_Type::bc_Type bc_Type;
typedef bc_Type::bcFunctionSolverDefinedPtr_Type bcFunctionSolverDefinedPtr_Type;
typedef bcHandler_Type::bc_Type bc_Type;
typedef bc_Type::bcFunctionSolverDefinedPtr_Type bcFunctionSolverDefinedPtr_Type;
typedef bc_Type::vectorPtrContainer_Type vectorPtrContainer_Type;
typedef bc_Type::vectorPtrContainer_Type vectorPtrContainer_Type;
typedef bc_Type::fluxPtr_Type fluxPtr_Type;
typedef bc_Type::sourcePtr_Type sourcePtr_Type;
typedef bc_Type::solutionPtr_Type solutionPtr_Type;
typedef BCInterfaceData1D data_Type;
typedef boost::shared_ptr< data_Type > dataPtr_Type;
typedef bc_Type::fluxPtr_Type fluxPtr_Type;
typedef bc_Type::sourcePtr_Type sourcePtr_Type;
typedef bc_Type::solutionPtr_Type solutionPtr_Type;
//@}
......@@ -122,7 +126,7 @@ public:
/*!
* @param data BC data loaded from GetPot file
*/
void setData ( const BCInterfaceData1D& data );
void setData ( const dataPtr_Type& data );
//! Set flux and source
/*!
......
......@@ -128,6 +128,7 @@ public:
typedef typename bcInterface_Type::vectorFunctionSolverDefined_Type vectorFunctionSolverDefined_Type;
typedef BCInterfaceData3D data_Type;
typedef boost::shared_ptr< data_Type > dataPtr_Type;
typedef BCFunctionRobin bcFunctionRobin_Type;
typedef boost::shared_ptr< bcFunctionRobin_Type > bcFunctionRobinPtr_Type;
......@@ -167,7 +168,7 @@ public:
*/
void readBC ( const std::string& fileName, const std::string& dataSection, const std::string& name )
{
M_data.readBC ( fileName, dataSection, name );
M_data->readBC ( fileName, dataSection, name );
}
//! Insert the current boundary condition in the BChandler
......@@ -218,7 +219,7 @@ public:
/*!
* @param physicalSolver physical solver
*/
void setPhysicalSolver ( const boost::shared_ptr< physicalSolver_Type >& physicalSolver );
void setPhysicalSolver ( const physicalSolverPtr_Type& physicalSolver );
//@}
......@@ -232,7 +233,7 @@ public:
*/