inline void BCInterfaceFunctionParserFile< BcHandlerType, PhysicalSolverType >::setData ( const dataPtr_Type& data ) { #ifdef HAVE_LIFEV_DEBUG debugStream ( 5022 ) << "BCInterfaceFunctionFile::loadData fileName: " << data->baseString() << "\n"; #endif std::vector< std::string > stringsVector; boost::split ( stringsVector, data->baseString(), boost::is_any_of ( "[" ) ); //Load data from file GetPot dataFile ( stringsVector[0] ); //Set variables UInt variablesNumber = dataFile.vector_variable_size ( "variables" ); M_variables.clear(); M_variables.reserve ( variablesNumber ); std::vector< Real > scale; scale.reserve ( variablesNumber ); for ( UInt j ( 0 ); j < variablesNumber; ++j ) { M_variables.push_back ( dataFile ( "variables", "unknown", j ) ); scale.push_back ( dataFile ( "scale", 1.0, j ) ); } #ifdef HAVE_LIFEV_DEBUG std::stringstream output; output << "BCInterfaceFunctionFile::loadData variables: "; for ( UInt j (0); j < variablesNumber; ++j ) { output << M_variables[j] << " "; } output << "\n scale: "; for ( UInt j (0); j < variablesNumber; ++j ) { output << scale[j] << " "; } debugStream ( 5022 ) << output.str() << "\n"; #endif //Load loop flag M_loop = dataFile ( "loop", false ); //Load data UInt dataLines = dataFile.vector_variable_size ( "data" ) / variablesNumber; M_data.clear(); for ( UInt j ( 0 ); j < variablesNumber; ++j ) { M_data[M_variables[j]].reserve ( dataLines ); } for ( UInt i ( 0 ); i < dataLines; ++i ) for ( UInt j ( 0 ); j < variablesNumber; ++j ) { M_data[M_variables[j]].push_back ( scale[j] * dataFile ( "data", 0.0, i * variablesNumber + j ) ); } #ifdef HAVE_LIFEV_DEBUG output.str (""); output << " loop: " << M_loop << "\n"; output << " data:"; for ( UInt i (0); i < dataLines; ++i ) { if (i > 0) { output << " "; } for ( UInt j (0); j < variablesNumber; ++j ) { output << " " << M_data[ M_variables[j] ][i]; } output << "\n"; } debugStream ( 5022 ) << output.str(); #endif //Initialize iterator M_dataIterator = M_data[M_variables[0]].begin(); //Update the data container (IT IS A COPY!) with the correct base string for the BCInterfaceFunctionParser if ( stringsVector.size() < 2 ) { data->setBaseString ( dataFile ( "function", "Undefined" ) ); } else { boost::replace_all ( stringsVector[1], "]", "" ); data->setBaseString ( dataFile ( ( "function" + stringsVector[1] ).c_str(), "Undefined" ) ); } // Now data contains the real base string functionParser_Type::setData ( data ); #ifdef HAVE_LIFEV_DEBUG debugStream ( 5022 ) << " function: " << data->baseString() << "\n"; #endif }