QhullVertexSet.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (c) 2009-2011 C.B. Barber. All rights reserved.
00004 ** $Id: //main/2011/qhull/src/libqhullcpp/QhullVertexSet.cpp#4 $$Change: 1382 $
00005 ** $DateTime: 2011/05/14 10:45:42 $$Author: bbarber $
00006 **
00007 ****************************************************************************/
00008 
00009 #//! QhullVertexSet -- Qhull's linked Vertexs, as a C++ class
00010 
00011 #include "QhullVertex.h"
00012 #include "QhullVertexSet.h"
00013 #include "QhullPoint.h"
00014 #include "QhullRidge.h"
00015 #include "QhullVertex.h"
00016 
00017 using std::string;
00018 using std::vector;
00019 
00020 #ifdef _MSC_VER  // Microsoft Visual C++ -- warning level 4
00021 #pragma warning( disable : 4611)  /* interaction between '_setjmp' and C++ object destruction is non-portable */
00022                                     /* setjmp should not be implemented with 'catch' */
00023 #endif
00024 
00025 namespace orgQhull {
00026 
00027 QhullVertexSet::
00028 QhullVertexSet(int qhRunId, facetT *facetlist, setT *facetset, bool allfacets)
00029 : QhullSet<QhullVertex>(0)
00030 , qhsettemp_qhull(0)
00031 , qhsettemp_defined(false)
00032 {
00033     UsingLibQhull q(qhRunId);
00034     int exitCode = setjmp(qh errexit);
00035     if(!exitCode){ // no object creation -- destructors skipped on longjmp()
00036         setT *vertices= qh_facetvertices(facetlist, facetset, allfacets);
00037         defineAs(vertices);
00038         qhsettemp_qhull= s_qhull_output;
00039         qhsettemp_defined= true;
00040     }
00041     q.maybeThrowQhullMessage(exitCode);
00042 }//QhullVertexSet facetlist facetset
00043 
00044 void QhullVertexSet::
00045 freeQhSetTemp()
00046 {
00047     if(qhsettemp_defined){
00048         UsingLibQhull q(qhsettemp_qhull, QhullError::NOthrow);
00049         if(q.defined()){
00050             int exitCode = setjmp(qh errexit);
00051             if(!exitCode){ // no object creation -- destructors skipped on longjmp()
00052                 qh_settempfree(referenceSetT()); // errors if not top of tempstack or if qhmem corrupted
00053             }
00054             q.maybeThrowQhullMessage(exitCode, QhullError::NOthrow);
00055         }
00056     }
00057 }//freeQhSetTemp
00058 
00059 QhullVertexSet::
00060 ~QhullVertexSet()
00061 {
00062     freeQhSetTemp();
00063 }//~QhullVertexSet
00064 
00065 }//namespace orgQhull
00066 
00067 #//Global functions
00068 
00069 using std::endl;
00070 using std::ostream;
00071 using orgQhull::QhullPoint;
00072 using orgQhull::QhullVertex;
00073 using orgQhull::QhullVertexSet;
00074 using orgQhull::QhullVertexSetIterator;
00075 using orgQhull::UsingLibQhull;
00076 
00078 ostream &
00079 operator<<(ostream &os, const QhullVertexSet::PrintIdentifiers &pr)
00080 {
00081     if(pr.print_message && *pr.print_message){
00082         os << pr.print_message;
00083     }
00084     for(QhullVertexSet::const_iterator i=pr.Vertex_set->begin(); i!=pr.Vertex_set->end(); ++i){
00085         const QhullVertex v= *i;
00086         os << " v" << v.id();
00087     }
00088     os << endl;
00089     return os;
00090 }//<<QhullVertexSet::PrintIdentifiers
00091 
00094 ostream &
00095 operator<<(ostream &os, const QhullVertexSet::PrintVertexSet &pr){
00096 
00097     os << pr.print_message;
00098     const QhullVertexSet *vs= pr.Vertex_set;
00099     QhullVertexSetIterator i= *vs;
00100     while(i.hasNext()){
00101         const QhullVertex v= i.next();
00102         const QhullPoint p= v.point();
00103         os << " p" << p.id(pr.run_id) << "(v" << v.id() << ")";
00104     }
00105     os << endl;
00106 
00107     return os;
00108 }//<< PrintVertexSet
00109 
00110 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libqhull
Author(s): Robert Krug
autogenerated on Tue Jun 18 2013 12:38:50