int ClearAll( void ) { int result; result = CleanupAll(gIData); if (result) gIData = NULL; return result; }
PyObject* CleanUp( void ) { PyObject *OutObj = NULL; CleanupAll( gIData, gICs, gBds ); gIData = NULL; gICs = NULL; gBds = NULL; OutObj = Py_BuildValue("(i)", 1); assert(OutObj); return OutObj; }
/*----------------------------------------------------------------------------------------------- Description: Program start and end. Parameters: argc The number of strings in argv. argv A pointer to an array of null-terminated, C-style strings. Returns: 0 if program ended well, which it always does or it crashes outright, so returning 0 is fine Exception: Safe Creator: John Cox (2-13-2016) -----------------------------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { glutInit(&argc, argv); int width = 500; int height = 500; unsigned int displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL; displayMode = Defaults(displayMode, width, height); glutInitDisplayMode(displayMode); glutInitContextVersion(4, 4); glutInitContextProfile(GLUT_CORE_PROFILE); // enable this for automatic message reporting (see OpenGlErrorHandling.cpp) #define DEBUG #ifdef DEBUG glutInitContextFlags(GLUT_DEBUG); #endif glutInitWindowSize(width, height); glutInitWindowPosition(300, 200); int window = glutCreateWindow(argv[0]); glload::LoadTest glLoadGood = glload::LoadFunctions(); // ??check return value?? glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); if (!glload::IsVersionGEQ(3, 3)) { printf("Your OpenGL version is %i, %i. You must have at least OpenGL 3.3 to run this tutorial.\n", glload::GetMajorVersion(), glload::GetMinorVersion()); glutDestroyWindow(window); return 0; } if (glext_ARB_debug_output) { glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glDebugMessageCallbackARB(DebugFunc, (void*)15); } Init(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMainLoop(); CleanupAll(); return 0; }
PyObject* ClearAll( void ) { PyObject *OutObj = NULL; if (!CleanupAll(gIData)) { OutObj = Py_BuildValue("(i)", 0); assert(OutObj); } else { OutObj = Py_BuildValue("(i)", 1); assert(OutObj); gIData = NULL; } return OutObj; }
PyObject* CleanUp( void ) { PyObject *OutObj = NULL; if( CleanupAll( gIData, gICs, gBds ) ) { gIData = NULL; gICs = NULL; gBds = NULL; OutObj = Py_BuildValue("(i)", 1); assert(OutObj); } else { OutObj = Py_BuildValue("(i)", 0); assert(OutObj); } return OutObj; }
int main(int argc, char *argv[]) { AutoData *Data; doublereal u[3] = {0., 0., 0.}; integer ipar[3] = {0, 1, 2}; doublereal par[3] = {0., 14., 2.}; Data = (AutoData *)MALLOC(sizeof(AutoData)); BlankData(Data); DefaultData(Data); // Equilibrium points CreateSpecialPoint(Data,3,1,u,3,ipar,par,NULL,NULL,NULL,NULL); // 9 = Beginning point, 1 = branch label Data->iap.irs = 1; // Start from this point Data->print_input = 0; Data->print_output = 0; printf("\nEquilibrium points...\n"); AUTO(Data); system("touch d.ab"); system("cat fort.9 >> d.ab"); system("rm fort.9"); // Periodic orbits CleanupSolution(Data); DefaultData(Data); Data->iap.ips = 2; // BVP Data->iap.irs = 4; // Label of Hopf point Data->iap.ilp = 0; // No detection of folds Data->iap.nicp = 2; // Number of free parameters Data->iap.nmx = 150; // Number of points on branch Data->iap.npr = 30; // Output point and cycle after every npr steps Data->rap.dsmax = 0.5; // Maximum arclength stepsize Data->icp = (integer *)REALLOC(Data->icp,Data->iap.nicp*sizeof(integer)); Data->icp[1] = 10; // Adds period to free parameters printf("\nPeriodic orbits...\n"); AUTO(Data); system("touch d.ab"); system("cat fort.9 >> d.ab"); system("rm fort.9"); // Fold points CleanupSolution(Data); DefaultData(Data); Data->iap.irs = 2; // Label of limit point Data->iap.nicp = 2; // Number of free parameters Data->iap.isp = 1; // Turn on detection of branch points Data->iap.isw = 2; // Controls branch switching (?) Data->rap.dsmax = 0.5; // Maximum arclength stepsize Data->icp[1] = 2; // 3rd parameter is free printf("\nFold points...\n"); AUTO(Data); system("touch d.ab"); system("cat fort.9 >> d.ab"); system("rm fort.9"); // Fold points (reverse) CleanupSolution(Data); DefaultData(Data); Data->iap.irs = 2; // Label of limit point Data->iap.nicp = 2; // Number of free parameters Data->iap.isp = 1; // Turn on detection of branch points Data->iap.isw = 2; // Controls branch switching (?) Data->rap.dsmax = 0.5; // Maximum arclength stepsize Data->icp[1] = 2; // 3rd parameter is free Data->rap.ds = -0.01; // Stepsize (reverse) printf("\nFold points (reverse)...\n"); AUTO(Data); system("touch d.ab"); system("cat fort.9 >> d.ab"); system("rm fort.9"); // Hopf points (reverse) CleanupSolution(Data); DefaultData(Data); Data->iap.irs = 4; // Label of hopf point Data->iap.nicp = 2; // Number of free parameters Data->iap.isw = 2; // Controls branch switching (?) Data->rap.dsmax = 0.5; // Maximum arclength stepsize Data->icp[1] = 2; // 3rd parameter is free Data->rap.ds = -0.01; // Stepsize (reverse) printf("\nHopf points (reverse)...\n"); AUTO(Data); system("touch d.ab"); system("cat fort.9 >> d.ab"); system("rm fort.9"); CleanupAll(Data); return 0; }
int main(int argc, char *argv[]) { AutoData *Data; doublereal *cycle; doublereal *ups, *udotps, *rldot; doublereal period; integer i, j; doublereal u[3] = {0., 0., 0.}; integer ipar[4] = {0, 1, 2, 10}; doublereal par[4] = {280., 2.6666666666666665, 10., 0.4332}; Data = (AutoData *)MALLOC(sizeof(AutoData)); BlankData(Data); DefaultData(Data); Data->iap.irs = 1; Data->iap.ips = 2; Data->iap.ilp = 0; Data->iap.ndim = 3; Data->iap.nicp = 2; Data->iap.ntst = 20; Data->iap.ncol = 4; Data->iap.isp = 2; Data->rap.ds = -0.5; Data->rap.dsmin = 0.01; Data->rap.dsmax = 25.0; Data->rap.epsl = 1e-7; Data->rap.epsu = 1e-7; Data->rap.epss = 0.0001; Data->iap.nmx = 50; Data->rap.rl0 = 200.; Data->rap.rl1 = 400.; // Load data from lor.dat FILE *fp = fopen("lor.dat","r"); if (fp == NULL) { fprintf(stdout,"Error: Could not open lor.dat\n"); exit(1); } cycle = (doublereal *)MALLOC(4*117*sizeof(doublereal)); for (j=0; j<117; j++) { fscanf(fp,"%lf",&cycle[4*j]); for (i=0; i<3; i++) { fscanf(fp,"%lf",&cycle[1+i+j*4]); } } fclose(fp); // Tweak times period = cycle[4*116] - cycle[0]; for (i=116; i>=0; i--) cycle[4*i] = (cycle[4*i] - cycle[0])/period; ups = (doublereal *)MALLOC((Data->iap.ncol*Data->iap.ntst+1)*(Data->iap.ndim+1)*sizeof(doublereal)); udotps = (doublereal *)MALLOC((Data->iap.ncol*Data->iap.ntst+1)*Data->iap.ndim*sizeof(doublereal)); rldot = (doublereal *)MALLOC(Data->iap.nicp*sizeof(doublereal)); prepare_cycle(Data,cycle, 117, ups, udotps, rldot); Data->icp = (integer *)REALLOC(Data->icp,Data->iap.nicp*sizeof(integer)); Data->icp[1] = 10; // Create special point CreateSpecialPoint(Data,9,1,u,4,ipar,par,Data->icp,ups,udotps,rldot); AUTO(Data); CleanupAll(Data); return 0; }
//------------------------------------------------------------------------ // CTestFilter::~CTestFilter // Destructor //------------------------------------------------------------------------ // CTestFilter::~CTestFilter() { CleanupAll(); delete iTimeOut; }