本文整理汇总了C++中ExportStatementBlock::addComment方法的典型用法代码示例。如果您正苦于以下问题:C++ ExportStatementBlock::addComment方法的具体用法?C++ ExportStatementBlock::addComment怎么用?C++ ExportStatementBlock::addComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExportStatementBlock
的用法示例。
在下文中一共展示了ExportStatementBlock::addComment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCode
returnValue ThreeSweepsERKExport::getCode( ExportStatementBlock& code
)
{
int useOMP;
get(CG_USE_OPENMP, useOMP);
if ( useOMP )
{
getDataDeclarations( code, ACADO_LOCAL );
code << "#pragma omp threadprivate( "
<< getAuxVariable().getFullName() << ", "
<< rk_xxx.getFullName() << ", "
<< rk_ttt.getFullName() << ", "
<< rk_kkk.getFullName() << ", "
<< rk_forward_sweep.getFullName() << ", "
<< rk_backward_sweep.getFullName()
<< " )\n\n";
}
int sensGen;
get( DYNAMIC_SENSITIVITY,sensGen );
if( exportRhs ) {
code.addFunction( rhs );
code.addFunction( diffs_rhs );
code.addFunction( diffs_sweep3 );
}
double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
code.addComment(std::string("Fixed step size:") + toString(h));
code.addFunction( integrate );
return SUCCESSFUL_RETURN;
}
示例2: getCode
returnValue DiscreteTimeExport::getCode( ExportStatementBlock& code
)
{
if( NX1 > 0 ) {
code.addFunction( lin_input );
code.addStatement( "\n\n" );
}
if( NX2 > 0 ) {
code.addFunction( rhs );
code.addStatement( "\n\n" );
code.addFunction( diffs_rhs );
code.addStatement( "\n\n" );
}
if( !equidistantControlGrid() ) {
ExportVariable numStepsV( "numSteps", numSteps, STATIC_CONST_INT );
code.addDeclaration( numStepsV );
code.addLinebreak( 2 );
}
double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
code.addComment(String("Fixed step size:") << String(h));
code.addFunction( integrate );
if( NX2 != NX ) {
prepareFullRhs();
code.addFunction( fullRhs );
}
return SUCCESSFUL_RETURN;
}
示例3: getCode
returnValue LiftedERKExport::getCode( ExportStatementBlock& code
)
{
// int printLevel;
// get( PRINTLEVEL,printLevel );
//
// if ( (PrintLevel)printLevel >= HIGH )
// acadoPrintf( "--> Exporting %s... ",fileName.getName() );
int useOMP;
get(CG_USE_OPENMP, useOMP);
if ( useOMP )
{
getDataDeclarations( code, ACADO_LOCAL );
code << "#pragma omp threadprivate( "
<< getAuxVariable().getFullName() << ", "
<< rk_xxx.getFullName() << ", "
<< rk_ttt.getFullName() << ", "
<< rk_kkk.getFullName()
<< " )\n\n";
}
int sensGen;
get( DYNAMIC_SENSITIVITY,sensGen );
if( exportRhs ) {
code.addFunction( rhs );
code.addFunction( diffs_rhs );
code.addFunction( alg_rhs );
solver->getCode( code ); // solver for the algebraic equations
}
else {
return ACADOERRORTEXT( RET_NOT_YET_IMPLEMENTED, "Externally defined dynamics not yet supported for the lifted ERK integrator!");
}
double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
code.addComment(std::string("Fixed step size:") + toString(h));
code.addFunction( integrate );
// if ( (PrintLevel)printLevel >= HIGH )
// acadoPrintf( "done.\n" );
return SUCCESSFUL_RETURN;
}
示例4: getCode
returnValue ExplicitRungeKuttaExport::getCode( ExportStatementBlock& code
)
{
// int printLevel;
// get( PRINTLEVEL,printLevel );
//
// if ( (PrintLevel)printLevel >= HIGH )
// acadoPrintf( "--> Exporting %s... ",fileName.getName() );
int useOMP;
get(CG_USE_OPENMP, useOMP);
if ( useOMP )
{
getDataDeclarations( code, ACADO_LOCAL );
code << "#pragma omp threadprivate( "
<< getAuxVariable().getFullName() << ", "
<< rk_xxx.getFullName() << ", "
<< rk_ttt.getFullName() << ", "
<< rk_kkk.getFullName()
<< " )\n\n";
}
int sensGen;
get( DYNAMIC_SENSITIVITY,sensGen );
if( exportRhs ) {
code.addFunction( rhs );
code.addFunction( diffs_rhs );
}
double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
code.addComment(std::string("Fixed step size:") + toString(h));
code.addFunction( integrate );
// if ( (PrintLevel)printLevel >= HIGH )
// acadoPrintf( "done.\n" );
return SUCCESSFUL_RETURN;
}
示例5: getCode
returnValue DiscreteTimeExport::getCode( ExportStatementBlock& code
)
{
int useOMP;
get(CG_USE_OPENMP, useOMP);
if ( useOMP ) {
ExportVariable max = getAuxVariable();
max.setName( "auxVar" );
max.setDataStruct( ACADO_LOCAL );
if( NX2 > 0 ) {
rhs.setGlobalExportVariable( max );
diffs_rhs.setGlobalExportVariable( max );
}
if( NX3 > 0 ) {
rhs3.setGlobalExportVariable( max );
diffs_rhs3.setGlobalExportVariable( max );
}
getDataDeclarations( code, ACADO_LOCAL );
stringstream s;
s << "#pragma omp threadprivate( "
<< max.getFullName() << ", "
<< rk_xxx.getFullName();
if( NX1 > 0 ) {
if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev1.getFullName();
s << ", " << rk_diffsNew1.getFullName();
}
if( NX2 > 0 || NXA > 0 ) {
if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev2.getFullName();
s << ", " << rk_diffsNew2.getFullName();
}
if( NX3 > 0 ) {
if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev3.getFullName();
s << ", " << rk_diffsNew3.getFullName();
s << ", " << rk_diffsTemp3.getFullName();
}
s << " )" << endl << endl;
code.addStatement( s.str().c_str() );
}
if( NX1 > 0 ) {
code.addFunction( lin_input );
code.addStatement( "\n\n" );
}
if( NX2 > 0 ) {
code.addFunction( rhs );
code.addStatement( "\n\n" );
code.addFunction( diffs_rhs );
code.addStatement( "\n\n" );
}
if( NX3 > 0 ) {
code.addFunction( rhs3 );
code.addStatement( "\n\n" );
code.addFunction( diffs_rhs3 );
code.addStatement( "\n\n" );
}
if( !equidistantControlGrid() ) {
ExportVariable numStepsV( "numSteps", numSteps, STATIC_CONST_INT );
code.addDeclaration( numStepsV );
code.addLinebreak( 2 );
}
double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
code.addComment(std::string("Fixed step size:") + toString(h));
code.addFunction( integrate );
return SUCCESSFUL_RETURN;
}