Matrix& Matrix::operator=( FILE *rhs ){ int nR, nC; double *x ; returnValue returnvalue; x = 0; returnvalue = allocateDoublePointerFromFile(rhs, &x, nR, nC); if( returnvalue == SUCCESSFUL_RETURN && nR > 0 && nC > 0 ){ init( nR, nC, x ); if( x != 0 ) free(x); } else{ if( x != 0 ) free(x); ACADOINFO(returnvalue); } return *this; }
returnValue SIMexport::exportCode( const String& dirName, const String& _realString, const String& _intString, int _precision ) { if (!modelDimensionsSet()) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); set( QP_SOLVER, QP_NONE ); if ( setup( ) != SUCCESSFUL_RETURN ) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); int printLevel; get( PRINTLEVEL,printLevel ); // export mandatory source code files if ( exportAcadoHeader( dirName,commonHeaderName,_realString,_intString,_precision ) != SUCCESSFUL_RETURN ) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); if( integrator != 0 ) { String fileName( dirName ); fileName << "/integrator.c"; ExportFile integratorFile( fileName,commonHeaderName,_realString,_intString,_precision ); integrator->getCode( integratorFile ); if ( integratorFile.exportCode( ) != SUCCESSFUL_RETURN ) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); int measGrid; get( MEASUREMENT_GRID, measGrid ); int generateMatlabInterface; get( GENERATE_MATLAB_INTERFACE, generateMatlabInterface ); int debugMode; get( INTEGRATOR_DEBUG_MODE, debugMode ); if ( (BooleanType)generateMatlabInterface == BT_TRUE ) { String integrateInterface( dirName ); integrateInterface << "/integrate.c"; ExportMatlabIntegrator exportMexFun( INTEGRATOR_MEX_TEMPLATE, integrateInterface, commonHeaderName,_realString,_intString,_precision ); exportMexFun.configure((MeasurementGrid)measGrid == ONLINE_GRID, (BooleanType)debugMode, timingCalls, ((RungeKuttaExport*)integrator)->getNumStages()); exportMexFun.exportCode(); String rhsInterface( dirName ); rhsInterface << "/rhs.c"; ExportMatlabRhs exportMexFun2( RHS_MEX_TEMPLATE, rhsInterface, commonHeaderName,_realString,_intString,_precision ); exportMexFun2.configure(integrator->getNameFullRHS()); exportMexFun2.exportCode(); } } // export template for main file, if desired if ( (PrintLevel)printLevel >= HIGH ) acadoPrintf( "--> Exporting remaining files... " ); // export a basic Makefile, if desired int generateMakeFile; get( GENERATE_MAKE_FILE,generateMakeFile ); if ( (BooleanType)generateMakeFile == BT_TRUE ) if ( exportMakefile( dirName,"Makefile",_realString,_intString,_precision ) != SUCCESSFUL_RETURN ) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); // export the evaluation file int exportTest; get( GENERATE_TEST_FILE, exportTest ); if ( exportTest && exportEvaluation( dirName, String( "compare.c" ) ) != SUCCESSFUL_RETURN ) return ACADOERROR( RET_UNABLE_TO_EXPORT_CODE ); if ( (PrintLevel)printLevel >= HIGH ) acadoPrintf( "done.\n" ); if ( (PrintLevel)printLevel > NONE ) ACADOINFO( RET_CODE_EXPORT_SUCCESSFUL ); return SUCCESSFUL_RETURN; }