36 #ifndef BCInterfaceFunctionParserFile_H    37 #define BCInterfaceFunctionParserFile_H 1
    39 #include <lifev/bc_interface/core/function/BCInterfaceFunctionParser.hpp>    86 template< 
typename BcHandlerType, 
typename PhysicalSolverType >
   159 template< 
typename BcHandlerType, 
typename PhysicalSolverType >
   168 template< 
typename BcHandlerType, 
typename PhysicalSolverType >
   178 #ifdef HAVE_LIFEV_DEBUG   179     debugStream ( 5022 ) << 
"BCInterfaceFunctionFile::BCInterfaceFunctionFile()" << 
"\n";
   189 template< 
typename BcHandlerType, 
typename PhysicalSolverType >
   194 #ifdef HAVE_LIFEV_DEBUG   195     debugStream ( 5022 ) << 
"BCInterfaceFunctionFile::loadData            fileName: " << data->baseString() << 
"\n";
   198     std::vector< std::string > stringsVector;
   199     boost::split ( stringsVector, data->baseString(), boost::is_any_of ( 
"[" ) );
   202     GetPot dataFile ( stringsVector[0] );
   208     M_variables.reserve ( variablesNumber );
   210     std::vector< Real > scale;
   211     scale.reserve ( variablesNumber );
   213     for ( 
UInt j ( 0 ); j < variablesNumber; ++j )
   215         M_variables.push_back ( dataFile ( 
"variables", 
"unknown", j ) );
   216         scale.push_back ( dataFile ( 
"scale", 1.0, j ) );
   219 #ifdef HAVE_LIFEV_DEBUG   220     std::stringstream output;
   221     output << 
"BCInterfaceFunctionFile::loadData           variables: ";
   222     for ( UInt j (0); j < variablesNumber; ++j )
   224         output << M_variables[j] << 
"  ";
   227     output << 
"\n                                                           scale: ";
   228     for ( UInt j (0); j < variablesNumber; ++j )
   230         output << scale[j] << 
"  ";
   233     debugStream ( 5022 ) << output.str() << 
"\n";
   243     for ( 
UInt j ( 0 ); j < variablesNumber; ++j )
   245         M_data[M_variables[j]].reserve ( dataLines );
   248     for ( 
UInt i ( 0 ); i < dataLines; ++i )
   249         for ( 
UInt j ( 0 ); j < variablesNumber; ++j )
   251             M_data[M_variables[j]].push_back ( scale[j] * dataFile ( 
"data", 0.0, i * variablesNumber + j ) );
   254 #ifdef HAVE_LIFEV_DEBUG   256     output << 
"                                                 loop: " << M_loop << 
"\n";
   258     for ( UInt i (0); i < dataLines; ++i )
   265         for ( UInt j (0); j < variablesNumber; ++j )
   267             output << 
" " << M_data[ M_variables[j] ][i];
   271     debugStream ( 5022 ) << output.str();
   275     M_dataIterator = M_data[M_variables[0]].begin();
   278     if ( stringsVector.size() < 2 )
   280         data->setBaseString ( dataFile 
( "function", "Undefined" ) );
   284         std::string search = 
"]";
   285         std::string replace = 
"";
   287         for( size_t pos = 0; ; pos += replace.length() ) {
   288             pos = stringsVector[1].find( search, pos );
   289             if( pos == std::string::npos ) 
break;
   290             stringsVector[1].erase( pos, search.length() );
   291             stringsVector[1].insert( pos, replace );
   294         data->setBaseString ( dataFile ( ( 
"function" + stringsVector[1] ).c_str(), 
"Undefined" ) );
   300 #ifdef HAVE_LIFEV_DEBUG   301     debugStream ( 5022 ) << 
"                                             function: " << data->baseString() << 
"\n";
   309 template< 
typename BcHandlerType, 
typename PhysicalSolverType >
   314     Real X = functionParser_Type::M_parser->variable ( M_variables[0] );
   319         X -= ( std::ceil ( X / M_data[M_variables[0]].back() ) - 1 ) * M_data[M_variables[0]].back();
   322 #ifdef HAVE_LIFEV_DEBUG   323     debugStream ( 5022 ) << 
"                                                    variable: " << X << 
"\n";
   330 #ifdef HAVE_LIFEV_DEBUG   331         debugStream ( 5022 ) << 
"                                       iterator  position   : " << 
static_cast<Real> ( M_dataIterator - M_data[ M_variables[0] ].begin() ) << 
"\n";
   332         debugStream ( 5022 ) << 
"                                       variable (position)  : " << *M_dataIterator << 
"\n";
   333         debugStream ( 5022 ) << 
"                                       variable (position+1): " << * (M_dataIterator + 1) << 
"\n";
   336         if ( X >= *M_dataIterator && X <= * ( M_dataIterator + 1 ) )
   341         if ( X > *M_dataIterator )
   343             if ( M_dataIterator + 1 == M_data[M_variables[0]].end() )
   354             if ( M_dataIterator == M_data[M_variables[0]].begin() )
   367     for ( UInt j ( 1 ), position = 
static_cast< UInt > ( M_dataIterator - M_data[M_variables[0]].begin() ) ;
   368             j < 
static_cast< UInt > ( M_variables.size() ); ++j )
   370         xA = M_data[M_variables[0]][position];
   371         xB = M_data[M_variables[0]][position + 1];
   372         A  = M_data[M_variables[j]][position];
   373         B  = M_data[M_variables[j]][position + 1];
   375         functionParser_Type::M_parser->setVariable ( M_variables[j], A + ( B - A ) / ( xB - xA ) * ( X - xA ) );
   377 #ifdef HAVE_LIFEV_DEBUG   378         debugStream ( 5022 ) << 
"                                                          " << M_variables[j] << 
" = " << A + (B - A) / (xB - xA) * (X - xA) << 
"\n";
 void dataInterpolation()
Linear interpolation (extrapolation) between two values of the data. 
 
BCInterfaceFunctionParser< bcHandler_Type, physicalSolver_Type > functionParser_Type
 
function_Type::data_Type data_Type
 
std::vector< Real >::iterator M_dataIterator
 
void updateInverseJacobian(const UInt &iQuadPt)
 
std::vector< std::string > M_variables
 
PhysicalSolverType physicalSolver_Type
 
BCInterfaceFunctionParserFile & operator=(const BCInterfaceFunctionParserFile &function)
 
virtual ~BCInterfaceFunctionParserFile()
Destructor. 
 
virtual void setData(const dataPtr_Type &data)
Set data for boundary conditions. 
 
BCInterfaceFunctionParserFile(const BCInterfaceFunctionParserFile &function)
 
BCInterfaceFunctionParser - LifeV boundary condition function wrapper for BCInterface. 
 
BCInterfaceFunctionParserFile - LifeV boundary condition function file wrapper for BCInterface...
 
BCInterfaceFunctionParser< BcHandlerType, PhysicalSolverType > * createBCInterfaceFunctionParserFile()
Factory create function. 
 
BCInterfaceFunction< bcHandler_Type, physicalSolver_Type > function_Type
 
double Real
Generic real data. 
 
std::map< std::string, std::vector< Real > > M_data
 
const std::string operator()(const char *VarName, const char *Default) const
 
BcHandlerType bcHandler_Type
 
BCInterfaceFunctionParserFile()
Empty Constructor. 
 
bool operator()(const char *VarName, bool Default) const
 
BCInterfaceFunction - Base class for BCInterface boundary functions. 
 
function_Type::dataPtr_Type dataPtr_Type
 
uint32_type UInt
generic unsigned integer (used mainly for addressing) 
 
unsigned vector_variable_size(const char *VarName) const