//! 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
Example #2
0
//! 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