CASM  1.1.0
A Clusters Approach to Statistical Mechanics
QhullVertex.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/QhullVertex.cpp#1 $$Change: 1981 $
5 ** $DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #
10 
11 #include "Qhull.h"
12 #include "QhullPoint.h"
13 #include "QhullFacetSet.h"
14 #include "QhullVertex.h"
15 #include "QhullFacet.h"
16 
17 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
18 #pragma warning( disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
19 #pragma warning( disable : 4996) // function was declared deprecated(strcpy, localtime, etc.)
20 #endif
21 
22 namespace orgQhull {
23 
24 #
25 vertexT QhullVertex::
26 s_empty_vertex= {0,0,0,0,0,
27  0,0,0,0,0,
28  0};
29 
30 #
31 
32 QhullVertex::QhullVertex(const Qhull &q)
33 : qh_vertex(&s_empty_vertex)
34 , qh_qh(q.qh())
35 {
36 }//Default
37 
38 QhullVertex::QhullVertex(const Qhull &q, vertexT *v)
39 : qh_vertex(v ? v : &s_empty_vertex)
40 , qh_qh(q.qh())
41 {
42 }//vertexT
43 
44 #
45 
48 QhullFacetSet QhullVertex::
49 neighborFacets() const
50 {
51  if(!neighborFacetsDefined()){
52  throw QhullError(10034, "Qhull error: neighboring facets of vertex %d not defined. Please call Qhull::defineVertexNeighborFacets() beforehand.", id());
53  }
54  return QhullFacetSet(qh_qh, qh_vertex->neighbors);
55 }//neighborFacets
56 
57 }//namespace orgQhull
58 
59 #
60 
61 using std::endl;
62 using std::ostream;
63 using std::string;
64 using std::vector;
65 using orgQhull::QhullPoint;
66 using orgQhull::QhullFacet;
67 using orgQhull::QhullFacetSet;
68 using orgQhull::QhullFacetSetIterator;
69 using orgQhull::QhullVertex;
70 
72 ostream &
73 operator<<(ostream &os, const QhullVertex::PrintVertex &pr)
74 {
75  QhullVertex v= *pr.vertex;
76  QhullPoint p= v.point();
77  if(*pr.print_message){
78  os << pr.print_message << " ";
79  }else{
80  os << "- ";
81  }
82  os << "p" << p.id() << " (v" << v.id() << "): ";
83  const realT *c= p.coordinates();
84  for(int k= p.dimension(); k--; ){
85  os << " " << *c++; // FIXUP QH11010 %5.2g
86  }
87  if(v.getVertexT()->deleted){
88  os << " deleted";
89  }
90  if(v.getVertexT()->delridge){
91  os << " ridgedeleted";
92  }
93  os << endl;
94  if(v.neighborFacetsDefined()){
95  QhullFacetSetIterator i= v.neighborFacets();
96  if(i.hasNext()){
97  os << " neighborFacets:";
98  countT count= 0;
99  while(i.hasNext()){
100  if(++count % 100 == 0){
101  os << endl << " ";
102  }
103  QhullFacet f= i.next();
104  os << " f" << f.id();
105  }
106  os << endl;
107  }
108  }
109  return os;
110 }//<< PrintVertex
111 
Index count
ostream & operator<<(ostream &os, const QhullVertex::PrintVertex &pr)
Duplicate of qh_printvertex [io_r.c].
Definition: QhullVertex.cpp:73
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:20