diff --git a/cpp/QhullFacetList.cpp b/cpp/QhullFacetList.cpp index bdba96d52871313729b721ae378ea2d381e4b9e2..8a074bcbbd79cd5776c530f5fe94d7187d74a4e1 100644 --- a/cpp/QhullFacetList.cpp +++ b/cpp/QhullFacetList.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2008-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullFacetList.cpp#22 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullFacetList.cpp#23 $$Change: 1171 $ +** $DateTime: 2010/01/09 10:11:25 $$Author: bbarber $ ** ****************************************************************************/ @@ -120,4 +120,10 @@ operator<<(ostream &os, const QhullFacetList::PrintVertices &pr) return os; }//printVertices +std::ostream & +operator<<(ostream &os, const QhullFacetList &fs) +{ + os << fs.printFacets(UsingLibQhull::NOqhRunId); + return os; +}//QhullFacetList diff --git a/cpp/QhullFacetList.h b/cpp/QhullFacetList.h index 2d678b3a08758aa65fbc254f0294eab2ec0e52fc..e817708b46cf10540e6a581289120521233e8573 100644 --- a/cpp/QhullFacetList.h +++ b/cpp/QhullFacetList.h @@ -97,6 +97,6 @@ public: std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList::PrintFacetList &p); std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList::PrintFacets &p); std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList::PrintVertices &p); -std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList &fs) { os << fs.printFacets(orgQhull::UsingLibQhull::NOqhRunId); return os; } +std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList &fs); #endif // QHULLFACETLIST_H diff --git a/cpp/QhullFacetSet.h b/cpp/QhullFacetSet.h index 57bfa4301b33d83f77d8ad563c50e331341c12d8..9e0e6cb3478fc6ded06e0c8db5c4c917cdc3c1d2 100644 --- a/cpp/QhullFacetSet.h +++ b/cpp/QhullFacetSet.h @@ -87,7 +87,7 @@ public: #//== Global namespace ========================================= -std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet &fs); // FIXUP QH10000 no 'const ...PrintFacetSet as below! { os << fs.print(orgQhull::UsingLibQhull::NOqhRunId, ""); } +std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet &fs); std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintFacetSet &pr); std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintIdentifiers &p); diff --git a/project/libqhullcpp/libqhullcpp.pro b/project/libqhullcpp/libqhullcpp.pro index 03791d9424d90924bd51b437a9efe3d28cd72452..549272a0c283a52b21989dfcad23e91391e14f19 100644 --- a/project/libqhullcpp/libqhullcpp.pro +++ b/project/libqhullcpp/libqhullcpp.pro @@ -7,15 +7,16 @@ TEMPLATE = lib CONFIG += shared warn_on CONFIG -= app_bundle LIBS += -L../.. +DEFINES += qh_QHpointer build_pass:CONFIG(debug, debug|release):{ TARGET = qhullcppd - LIBS += libqhulld - PRE_TARGETDEPS += ../../libqhulld.a + LIBS += libqhullpd # qh_QHpointer + PRE_TARGETDEPS += ../../libqhullpd.a OBJECTS_DIR = ../../tmp/libqhullcpp/Debug }else:build_pass:CONFIG(release, debug|release):{ TARGET = qhullcpp - LIBS += libqhull - PRE_TARGETDEPS += ../../libqhull.a + LIBS += libqhullp + PRE_TARGETDEPS += ../../libqhullp.a OBJECTS_DIR = ../../tmp/libqhullcpp/Release } QT -= gui diff --git a/project/libqhullp/libqhullp.pro b/project/libqhullp/libqhullp.pro new file mode 100644 index 0000000000000000000000000000000000000000..5a29ebfb5c14b947206520673c810d4a14bc40bc --- /dev/null +++ b/project/libqhullp/libqhullp.pro @@ -0,0 +1,101 @@ +# ------------------------------------------------- +# libqhullp.pro -- Qhull static library with qh_qhPointer +# ------------------------------------------------- + +DESTDIR = ../.. +TEMPLATE = lib +CONFIG += staticlib warn_on +CONFIG -= app_bundle qt +DEFINES += qh_QHpointer +# Appears to be needed for gcc 4.1, 4.2, and 4.3 with -O2 +#QMAKE_CFLAGS += -fno-strict-aliasing +QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings +QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors +#QMAKE_CFLAGS_DEBUG += -Wconversion # no workaround for bit-field conversion errors +build_pass:CONFIG(debug, debug|release):{ + TARGET = qhullpd + OBJECTS_DIR = ../../tmp/libqhullp/Debug +}else:build_pass:CONFIG(release, debug|release):{ + TARGET = qhullp + OBJECTS_DIR = ../../tmp/libqhullp/Release +} +MOC_DIR = ../../tmp/moc +RCC_DIR = ../../tmp/rcc + +VPATH= ../.. +SOURCES += src/geom.c +SOURCES += src/geom2.c +SOURCES += src/global.c +SOURCES += src/io.c +SOURCES += src/mem.c +SOURCES += src/merge.c +SOURCES += src/poly2.c +SOURCES += src/poly.c +SOURCES += src/libqhull.c +SOURCES += src/qset.c +SOURCES += src/random.c +SOURCES += src/rboxlib.c +SOURCES += src/stat.c +SOURCES += src/user.c +SOURCES += src/usermem.c +SOURCES += src/userprintf.c +OTHER_FILES += Announce.txt +OTHER_FILES += COPYING.txt +OTHER_FILES += File_id.diz +OTHER_FILES += html/index.htm +OTHER_FILES += html/qconvex.htm +OTHER_FILES += html/qdelau_f.htm +OTHER_FILES += html/qdelaun.htm +OTHER_FILES += html/qhalf.htm +OTHER_FILES += html/qh-code.htm +OTHER_FILES += html/qh-eg.htm +OTHER_FILES += html/qh-faq.htm +OTHER_FILES += html/qh-get.htm +OTHER_FILES += html/qh-impre.htm +OTHER_FILES += html/qh-optc.htm +OTHER_FILES += html/qh-optf.htm +OTHER_FILES += html/qh-optg.htm +OTHER_FILES += html/qh-opto.htm +OTHER_FILES += html/qh-optp.htm +OTHER_FILES += html/qh-optq.htm +OTHER_FILES += html/qh-optt.htm +OTHER_FILES += html/qh-quick.htm +OTHER_FILES += html/qhull.htm +OTHER_FILES += html/qhull.man +OTHER_FILES += html/qhull.txt +OTHER_FILES += html/qhull-cpp.xml +OTHER_FILES += html/qvoron_f.htm +OTHER_FILES += html/qvoronoi.htm +OTHER_FILES += html/rbox.htm +OTHER_FILES += html/rbox.man +OTHER_FILES += html/rbox.txt +OTHER_FILES += index.htm +OTHER_FILES += README.txt +OTHER_FILES += REGISTER.txt +OTHER_FILES += src/Changes.txt +OTHER_FILES += src/index.htm +OTHER_FILES += src/Make-config.sh +OTHER_FILES += src/Makefile.txt +OTHER_FILES += src/Mborland +OTHER_FILES += src/qh-geom.htm +OTHER_FILES += src/qh-globa.htm +OTHER_FILES += src/qh-io.htm +OTHER_FILES += src/qh-mem.htm +OTHER_FILES += src/qh-merge.htm +OTHER_FILES += src/qh-poly.htm +OTHER_FILES += src/qh-qhull.htm +OTHER_FILES += src/qh-set.htm +OTHER_FILES += src/qh-stat.htm +OTHER_FILES += src/qh-user.htm +HEADERS += src/geom.h +HEADERS += src/io.h +HEADERS += src/mem.h +HEADERS += src/merge.h +HEADERS += src/poly.h +# qhull.h is for backwards compatibility +HEADERS += src/libqhull.h +HEADERS += src/qhull_a.h +HEADERS += src/qset.h +HEADERS += src/random.h +HEADERS += src/stat.h +HEADERS += src/user.h diff --git a/project/qhull-all.pro b/project/qhull-all.pro index b4ba7392a61e34ec562e47ab73b3d594f3e41d79..7514ad557f3d4bd8f7f95c0bc0d224efc29b0371 100644 --- a/project/qhull-all.pro +++ b/project/qhull-all.pro @@ -6,6 +6,7 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS += libqhull +SUBDIRS += libqhullp #qh_QHpointer SUBDIRS += user_eg SUBDIRS += user_eg2 SUBDIRS += qhull diff --git a/project/qhulltest/qhulltest.pro b/project/qhulltest/qhulltest.pro index 06594d4cae88c2d5d890e09dd75b4b9a45c1916f..1fe9dee3e3fc6c29dba0578a0c6bea1c9e115cb7 100644 --- a/project/qhulltest/qhulltest.pro +++ b/project/qhulltest/qhulltest.pro @@ -8,6 +8,7 @@ TEMPLATE = app CONFIG += console qtestlib warn_on CONFIG -= app_bundle LIBS += -L../.. +DEFINES += qh_QHpointer build_pass:CONFIG(debug, debug|release):{ LIBS += libqhullcppd PRE_TARGETDEPS += ../../libqhullcppd.a diff --git a/project/user_eg3/user_eg3.pro b/project/user_eg3/user_eg3.pro index 4ec2412f2cda3e7137da3cb7328613b4b63b3bf6..cbd457fe61e56fafacb940e77f6bb060ff3514a4 100644 --- a/project/user_eg3/user_eg3.pro +++ b/project/user_eg3/user_eg3.pro @@ -6,6 +6,7 @@ DESTDIR = ../.. TEMPLATE = app CONFIG += console warn_on LIBS += -L../.. +DEFINES += qh_QHpointer build_pass:CONFIG(debug, debug|release):{ LIBS += libqhullcppd PRE_TARGETDEPS += ../../libqhullcppd.a diff --git a/src/Changes.txt b/src/Changes.txt index 76cc2903ba794f122f0f0021737d24d81fcc382c..7540ecf545575e30f8c92d72fd3c0fefb2fb7385 100644 --- a/src/Changes.txt +++ b/src/Changes.txt @@ -94,23 +94,26 @@ To do - review all #pragma - review all FIXUP [^0-9] - Number the FIXUPS - - Review ptr_intT in qh_matchvertices [poly.c] - clean up warnings for libqhullcpp - - user.h qh_qhPOINTER 0 for qhull -- need two static libraries - - review os << QhullFacetSet vs QhullFacetList vs. QhullHyperplane vs. QhullPoint QhullRidge - - generate static qhull for qhull.exe - - timer is off by 3 orders of magnitude + - add labels to git for Qhull + - Make backup Need help - ConvexHull is a submodule to git. How to get rid of? - - Set up configure and debian build. If possible, please use project/ instead of qhull-2010.1/ - - Set up CMake. If possible, please use project/ instead of qhull-2010.1/ - - The C++ interface needs a lot of work + - Set up configure and debian build. If possible, please keep qhull-2010.1/ clean + Use qhull-2010.1/project/ for build-related files + - Set up CMake. + - The C++ interface needs work. Give it a try and make it better. -qhull 2010.1 2010/01/08 +qhull 2010.1 2010/01/09 - Patched qh_gethash. See project/patch/qhull-2003.1 with patched poly.c and patch. Compared results of q_test, q_eg, and q_egtest with patched poly.c, qhull-2003.1 - Remove user_eg.exe and user_eg2.exe from Windows distribution + - Remove ptr_intT from qh_matchvertices. It was int since the beginning. + - Use qh_QHpointer=0 for libqhull.a, qhull, rbox, etc. + Use -Dqh_QHpointer for libqhullp.a, qhullcpp.dll, etc. + Cost of qh_QHpointer: [2003, msvc] 8% time 2% space, [2010, gcc] 4% time 4% space + - user.h requires <time.h> for CLOCKS_PER_SEC qhull 2010.1 2010/01/07 - Assign type to qh.old_qhstat and memT.tempstack [amorilia] diff --git a/src/libqhull.h b/src/libqhull.h index bab9c4d0f9528b157d6db67f7267a5dca1c2a5b1..9cec975f894264ba5351b825115cf50b07be508c 100644 --- a/src/libqhull.h +++ b/src/libqhull.h @@ -31,7 +31,7 @@ /*=========================== -included files ==============*/ -#include "user.h" /* user definable constants (e.g., qh_QHPOINTER) */ +#include "user.h" /* user definable constants (e.g., qh_QHpointer) */ #include <setjmp.h> #include <float.h> diff --git a/src/poly.c b/src/poly.c index 9bdb419c5d45fd4d26441d1d82170445a4fd063e..bc87bc645874f49c2dda18db06d1d3fb7f7d3e17 100644 --- a/src/poly.c +++ b/src/poly.c @@ -10,8 +10,8 @@ (all but top 50 and their callers 12/3/95) copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/poly.c#25 $$Change: 1164 $ - $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/poly.c#26 $$Change: 1171 $ + $DateTime: 2010/01/09 10:11:25 $$Author: bbarber $ */ #include "qhull_a.h" @@ -958,9 +958,8 @@ boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA, }while (*(++elemAp)); if (!skipBp) skipBp= ++elemBp; - *skipB= SETindex_(verticesB, skipB); - /* WARN64 -- This expression on pointers returns 0 or 1 */ - *same= !(int)((((ptr_intT)skipA & 0x1) ^ ((ptr_intT)*skipB & 0x1))); + *skipB= SETindex_(verticesB, skipB); /* i.e., skipBp - verticesB */ + *same= !((skipA & 0x1) ^ (*skipB & 0x1)); /* result is 0 or 1 */ trace4((qh ferr, 4054, "qh_matchvertices: matched by skip %d(v%d) and skip %d(v%d) same? %d\n", skipA, (*skipAp)->id, *skipB, (*(skipBp-1))->id, *same)); return(True); diff --git a/src/user.h b/src/user.h index 4a36cb71d063b810eb7b544fab7ea107a0837fc1..d203d7c2be3eeec6b86b13e872636a8d38803270 100644 --- a/src/user.h +++ b/src/user.h @@ -24,6 +24,8 @@ Code flags -- */ +#include <time.h> + #ifndef qhDEFuser #define qhDEFuser 1 @@ -571,7 +573,8 @@ stop after qh_JOGGLEmaxretry attempts qh_QHpointer = 1 access globals via a pointer to allocated memory enables qh_saveqhull() and qh_restoreqhull() - costs about 8% in time and 2% in space + [2010, gcc] costs about 4% in time and 4% in space + [2003, msvc] costs about 8% in time and 2% in space = 0 qh_qh and qh_qhstat are static data structures only one instance of qhull() can be active at a time @@ -582,13 +585,14 @@ stop after qh_JOGGLEmaxretry attempts qh is defined in libqhull.h qhmem is defined in mem.h qhstat is defined in stat.h + C++ build defines qh_QHpointer [libqhullp.pro, libqhullcpp.pro] see: user_eg.c for an example FIXUP need to override for C++ (-Dqh_QHpointer=1) */ #ifndef qh_QHpointer -#define qh_QHpointer 1 +#define qh_QHpointer 0 #endif #if 0 /* sample code */ qhT *oldqhA, *oldqhB;