//! If qh_QHpointer==0, invoke with placement new on qh_qh; //! Sets qh_qh and qh_qhstat. Need to reset before UsingLibQhull. //! Derived from qh_new_qhull[user.c] QhullQh:: QhullQh() { static boolT firstcall = True; if(firstcall){ if(qhmem.BUFinit!=0){ throw QhullError(10017, "Qhull error: qhmem already initialized by another class."); } qh_meminit(NULL); firstcall= False; } // QhullQh() and UsingLibQhull() are the same #if qh_QHpointer if(qh_qh){ if(qh old_qhstat){ throw QhullError(10041, "Qhull internal error: qh_qh.old_qhstat defined (%x) but qh_qh is active. qh_qh not restored correctly.", 0, 0, 0.0, qh old_qhstat); } qh old_qhstat= qh_qhstat; qh old_tempstack= qhmem.tempstack; qh_qhstat= 0; qhmem.tempstack= 0; } qh_qh= static_cast<qhT*>(this); #else if(strncmp(qh qhull, "qhull", 5) == 0){ throw QhullError(10022, "Qhull error: Qhull already initialized as run %d", qh run_id); } #endif // NOerrors -- Does not call qh_errexit() qh_initstatistics(); // NOerrors -- Does not call qh_errexit() qh_initqhull_start2(NULL, NULL, qh_FILEstderr); }//QhullQh
void setupMemory(int tracelevel, int numInts, int **intarray) { int i; if(numInts<0 || numInts*(int)sizeof(int)<0){ qh_fprintf(stderr, 6303, "qset does not currently support 64-bit ints. Integer overflow\n"); exit(1); } *intarray= qh_malloc(numInts * sizeof(int)); if(!*intarray){ qh_fprintf(stderr, 6304, "Failed to allocate %d bytes of memory\n", numInts * sizeof(int)); exit(1); } for(i= 0; i<numInts; i++){ (*intarray)[i] =i; } qh_meminit(stderr); qh_meminitbuffers(tracelevel, qh_MEMalign, 4 /*sizes*/, qh_MEMbufsize,qh_MEMinitbuf); qh_memsize(10); qh_memsize(20); qh_memsize(30); qh_memsize(40); qh_memsetup(); qh_fprintf(stderr, 8001, "SETelemsize is %d bytes for pointer-to-int\n", SETelemsize); }/*setupMemmory*/
//! Derived from qh_new_qhull[user.c] QhullQh:: QhullQh() : qhull_status(qh_ERRnone) , qhull_message() , error_stream(0) , output_stream(0) , factor_epsilon(QhullQh::default_factor_epsilon) , use_output_stream(false) { // NOerrors: TRY_QHULL_ not needed since these routines do not call qh_errexit() qh_meminit(this, NULL); qh_initstatistics(this); qh_initqhull_start2(this, NULL, NULL, qh_FILEstderr); // Initialize qhT this->ISqhullQh= True; }//QhullQh