Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:56

0001 /****************************************************************************
0002 **
0003 ** Copyright (c) 2008-2020 C.B. Barber. All rights reserved.
0004 ** $Id: //main/2019/qhull/src/libqhullcpp/QhullUser.h#7 $$Change: 3010 $
0005 ** $DateTime: 2020/07/30 22:14:11 $$Author: bbarber $
0006 **
0007 ****************************************************************************/
0008 
0009 #ifndef QhullUser_H
0010 #define QhullUser_H
0011 
0012 #include "libqhull_r/qhull_ra.h"
0013 #include "libqhullcpp/QhullPoint.h"
0014 #include "libqhullcpp/PointCoordinates.h"
0015 
0016 #include <stdarg.h>
0017 #include <string>
0018 #include <vector>
0019 #include <istream>
0020 #include <ostream>
0021 #include <sstream>
0022 
0023 namespace orgQhull{
0024 
0025 #//!\name Defined here
0026     //! QhullUser -- custom C++ interfaces into Qhull (via qh_fprintf)
0027     class QhullUser;
0028     // qh_fprintf is defined below.  It replaces libqhull_r/userprintf_r.c
0029 
0030 #//!\name Used here
0031     class QhullQh;
0032 
0033     class QhullUser{
0034 
0035     private:
0036 #//!\name Fields
0037         QhullQh *       qh_qh;          //!< QhullQh/qhT for access to libqhull_r
0038         void *          previous_user;  //!< previous qh.cpp_user, restored on deconstruction
0039         std::vector<std::vector<double> > doubles_vector;  //! vectors for capturing ints and doubles
0040         std::vector<std::vector<int> >  ints_vector;
0041         std::vector<int>                fprintf_ints;
0042         std::vector<double>             fprintf_doubles;
0043         std::vector<int>                fprintf_codes;
0044         std::vector<std::string>        fprintf_strings;
0045         int             num_facets;
0046         int             num_neighbors;
0047         int             num_numbers;
0048         int             num_points;
0049         int             num_results;
0050         int             num_ridges;
0051         int             num_vectors;
0052         int             num_vertices;
0053         int             qhull_dim;
0054         int             delaunay_dim;   //! ints for capturing fprintf fields
0055 
0056     public:
0057 #//!\name Construct
0058                         QhullUser(QhullQh *qqh);
0059                         ~QhullUser();
0060     private:                // Disable default constructor, copy constructor, and assignment
0061                         QhullUser();
0062                         QhullUser(const QhullUser &);
0063         QhullUser &     operator=(const QhullUser &);
0064     private:
0065 
0066     public:
0067 #//!\name GetSet
0068         void            appendCode(int msgCode) { fprintf_codes.push_back(msgCode); }
0069         void            appendDouble(double a) { fprintf_doubles.push_back(a); }
0070         void            appendInt(int i) { fprintf_ints.push_back(i); }
0071         void            appendAndClearDoubles() { doubles_vector.push_back(fprintf_doubles); fprintf_doubles.clear(); }
0072         void            appendAndClearInts() { ints_vector.push_back(fprintf_ints); fprintf_ints.clear(); }
0073         void            clear();
0074         void            clearDoubles() { fprintf_doubles.clear(); }
0075         void            clearDoublesVector() { doubles_vector.clear(); }
0076         void            clearInts() { fprintf_ints.clear(); }
0077         void            clearIntsVector() { ints_vector.clear(); }
0078         const std::vector<int> &codes() const { return fprintf_codes; }
0079         int             delaunayDim() const { return delaunay_dim; }
0080         const std::vector<std::vector<double> > &doublesVector() const { return doubles_vector; }
0081         const std::vector<double> &doubles() const { return fprintf_doubles; }
0082         int             firstCode() const { return (fprintf_codes.size() == 0 ? -1 : fprintf_codes[0]); }
0083         const std::vector<int> &ints() const { return fprintf_ints; }
0084         const std::vector<std::vector<int> > &intsVector() const { return ints_vector; }
0085         int             numDoubles() const { return (int)doubles_vector.size();  }
0086         int             numFacets() const { return num_facets; }
0087         int             numInts() const { return (int)ints_vector.size(); }
0088         int             numNeighbors() const { return num_neighbors; }
0089         int             numNumbers() const { return num_numbers; }
0090         int             numPoints() const { return num_points; }
0091         int             numResults() const { return num_results; }
0092         int             numRidges() const { return num_ridges; }
0093         int             numVectors() const { return num_vectors; }
0094         int             numVertices() const { return num_vertices; }
0095         QhullQh *       qh() const { return qh_qh; }
0096         int             qhullDim() const { return qhull_dim; }
0097         void            setDelaunayDim(int i) { delaunay_dim= i; }
0098         void            setNumFacets(int i) { num_facets= i; }
0099         void            setNumResults(int i) { num_results= i; }
0100         void            setNumRidges(int i) { num_ridges= i; }
0101         void            setNumNeighbors(int i) { num_neighbors= i; }
0102         void            setNumNumbers(int i) { num_numbers= i; }
0103         void            setNumPoints(int i) { num_points= i; }
0104         void            setNumVectors(int i) { num_vectors= i; }
0105         void            setNumVertices(int i) { num_vertices= i; }
0106         void            setQhullDim(int i) { qhull_dim= i; }
0107 
0108 #//!\name Methods
0109         void            captureOn();
0110         void            captureOff();
0111 };//class QhullUser
0112 
0113 }//namespace orgQhull
0114 
0115 #endif // QhullUser_H