Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Analysis.AlgorithmBehavior/qhull-2012.1/src/libqhullcpp/QhullFacetSet.h @ 10207

Last change on this file since 10207 was 10207, checked in by ascheibe, 11 years ago

#1886 added a unit test for volume calculation and the qhull library

File size: 3.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (c) 2008-2012 C.B. Barber. All rights reserved.
4** $Id: //main/2011/qhull/src/libqhullcpp/QhullFacetSet.h#5 $$Change: 1464 $
5** $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
6**
7****************************************************************************/
8
9#ifndef QHULLFACETSET_H
10#define QHULLFACETSET_H
11
12#include "QhullSet.h"
13
14#include <ostream>
15
16namespace orgQhull {
17
18#//ClassRef
19    class               QhullFacet;
20
21#//Types
22    //! QhullFacetSet -- a set of Qhull facets, as a C++ class.  See QhullFacetList.h
23    class               QhullFacetSet;
24    typedef QhullSetIterator<QhullFacet>
25                        QhullFacetSetIterator;
26
27class QhullFacetSet : public QhullSet<QhullFacet> {
28
29private:
30#//Fields
31    bool                select_all;   //! True if include bad facets.  Default is false.
32
33public:
34#//Constructor
35                        //Conversion from setT* is not type-safe.  Implicit conversion for void* to T
36   explicit             QhullFacetSet(setT *s) : QhullSet<QhullFacet>(s), select_all(false) {}
37                        //Copy constructor copies pointer but not contents.  Needed for return by value and parameter passing.
38                        QhullFacetSet(const QhullFacetSet &o) : QhullSet<QhullFacet>(o), select_all(o.select_all) {}
39
40private:
41                        //!Disable default constructor and copy assignment.  See QhullSetBase
42                        QhullFacetSet();
43    QhullFacetSet      &operator=(const QhullFacetSet &);
44public:
45
46#//Conversion
47#ifndef QHULL_NO_STL
48    std::vector<QhullFacet> toStdVector() const;
49#endif //QHULL_NO_STL
50#ifdef QHULL_USES_QT
51    QList<QhullFacet>   toQList() const;
52#endif //QHULL_USES_QT
53
54#//GetSet
55    bool                isSelectAll() const { return select_all; }
56    void                selectAll() { select_all= true; }
57    void                selectGood() { select_all= false; }
58
59#//Read-only
60                        //! Filtered by facet.isGood().  May be 0 when !isEmpty().
61    int                 count() const;
62    bool                contains(const QhullFacet &f) const;
63    int                 count(const QhullFacet &f) const;
64                        //! operator==() does not depend on isGood()
65
66#//IO
67    // Not same as QhullFacetList#IO.  A QhullFacetSet is a component of a QhullFacetList.
68
69    struct PrintFacetSet{
70        const QhullFacetSet *facet_set;
71        const char     *print_message;
72        int             run_id;
73                        PrintFacetSet(int qhRunId, const char *message, const QhullFacetSet *s) : facet_set(s), print_message(message), run_id(qhRunId) {}
74    };//PrintFacetSet
75    const PrintFacetSet       print(int qhRunId, const char *message) const { return PrintFacetSet(qhRunId, message, this); }
76
77    struct PrintIdentifiers{
78        const QhullFacetSet *facet_set;
79        const char     *print_message;
80                        PrintIdentifiers(const char *message, const QhullFacetSet *s) : facet_set(s), print_message(message) {}
81    };//PrintIdentifiers
82    PrintIdentifiers    printIdentifiers(const char *message) const { return PrintIdentifiers(message, this); }
83
84};//class QhullFacetSet
85
86}//namespace orgQhull
87
88#//== Global namespace =========================================
89
90std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet &fs);
91std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintFacetSet &pr);
92std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintIdentifiers &p);
93
94#endif // QHULLFACETSET_H
Note: See TracBrowser for help on using the repository browser.