Skip to content
Snippets Groups Projects
Commit 38bda5b8 authored by Brad Barber's avatar Brad Barber
Browse files

Rebuild libqhull.a with qh_QHpointer=0 for qhull, rbox, etc.

Create libqhullp.a with qh_QHpointer=1 for qhullcpp.dll, etc.
  gcc has halved the cost of qh_QHpointer by using more space
Add <time.h> to user.h for CLOCKS_PER_SEC
Move ostream<<QhullFacetList from inline to compiled.
  It tripped a double define error like the other classes.
Remove ptr_intT from qh_matchvertices.  Not needed.
Fix name of qh_QHpointer
parent 0d5bb166
No related branches found
No related tags found
No related merge requests found
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2008-2010 C.B. Barber. All rights reserved. ** Copyright (C) 2008-2010 C.B. Barber. All rights reserved.
** $Id: //product/qhull/main/rel/cpp/QhullFacetList.cpp#22 $$Change: 1139 $ ** $Id: //product/qhull/main/rel/cpp/QhullFacetList.cpp#23 $$Change: 1171 $
** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ ** $DateTime: 2010/01/09 10:11:25 $$Author: bbarber $
** **
****************************************************************************/ ****************************************************************************/
...@@ -120,4 +120,10 @@ operator<<(ostream &os, const QhullFacetList::PrintVertices &pr) ...@@ -120,4 +120,10 @@ operator<<(ostream &os, const QhullFacetList::PrintVertices &pr)
return os; return os;
}//printVertices }//printVertices
std::ostream &
operator<<(ostream &os, const QhullFacetList &fs)
{
os << fs.printFacets(UsingLibQhull::NOqhRunId);
return os;
}//QhullFacetList
...@@ -97,6 +97,6 @@ public: ...@@ -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::PrintFacetList &p);
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetList::PrintFacets &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::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 #endif // QHULLFACETLIST_H
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
#//== Global namespace ========================================= #//== 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::PrintFacetSet &pr);
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintIdentifiers &p); std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintIdentifiers &p);
......
...@@ -7,15 +7,16 @@ TEMPLATE = lib ...@@ -7,15 +7,16 @@ TEMPLATE = lib
CONFIG += shared warn_on CONFIG += shared warn_on
CONFIG -= app_bundle CONFIG -= app_bundle
LIBS += -L../.. LIBS += -L../..
DEFINES += qh_QHpointer
build_pass:CONFIG(debug, debug|release):{ build_pass:CONFIG(debug, debug|release):{
TARGET = qhullcppd TARGET = qhullcppd
LIBS += libqhulld LIBS += libqhullpd # qh_QHpointer
PRE_TARGETDEPS += ../../libqhulld.a PRE_TARGETDEPS += ../../libqhullpd.a
OBJECTS_DIR = ../../tmp/libqhullcpp/Debug OBJECTS_DIR = ../../tmp/libqhullcpp/Debug
}else:build_pass:CONFIG(release, debug|release):{ }else:build_pass:CONFIG(release, debug|release):{
TARGET = qhullcpp TARGET = qhullcpp
LIBS += libqhull LIBS += libqhullp
PRE_TARGETDEPS += ../../libqhull.a PRE_TARGETDEPS += ../../libqhullp.a
OBJECTS_DIR = ../../tmp/libqhullcpp/Release OBJECTS_DIR = ../../tmp/libqhullcpp/Release
} }
QT -= gui QT -= gui
......
# -------------------------------------------------
# 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
...@@ -6,6 +6,7 @@ TEMPLATE = subdirs ...@@ -6,6 +6,7 @@ TEMPLATE = subdirs
CONFIG += ordered CONFIG += ordered
SUBDIRS += libqhull SUBDIRS += libqhull
SUBDIRS += libqhullp #qh_QHpointer
SUBDIRS += user_eg SUBDIRS += user_eg
SUBDIRS += user_eg2 SUBDIRS += user_eg2
SUBDIRS += qhull SUBDIRS += qhull
......
...@@ -8,6 +8,7 @@ TEMPLATE = app ...@@ -8,6 +8,7 @@ TEMPLATE = app
CONFIG += console qtestlib warn_on CONFIG += console qtestlib warn_on
CONFIG -= app_bundle CONFIG -= app_bundle
LIBS += -L../.. LIBS += -L../..
DEFINES += qh_QHpointer
build_pass:CONFIG(debug, debug|release):{ build_pass:CONFIG(debug, debug|release):{
LIBS += libqhullcppd LIBS += libqhullcppd
PRE_TARGETDEPS += ../../libqhullcppd.a PRE_TARGETDEPS += ../../libqhullcppd.a
......
...@@ -6,6 +6,7 @@ DESTDIR = ../.. ...@@ -6,6 +6,7 @@ DESTDIR = ../..
TEMPLATE = app TEMPLATE = app
CONFIG += console warn_on CONFIG += console warn_on
LIBS += -L../.. LIBS += -L../..
DEFINES += qh_QHpointer
build_pass:CONFIG(debug, debug|release):{ build_pass:CONFIG(debug, debug|release):{
LIBS += libqhullcppd LIBS += libqhullcppd
PRE_TARGETDEPS += ../../libqhullcppd.a PRE_TARGETDEPS += ../../libqhullcppd.a
......
...@@ -94,23 +94,26 @@ To do ...@@ -94,23 +94,26 @@ To do
- review all #pragma - review all #pragma
- review all FIXUP [^0-9] - review all FIXUP [^0-9]
- Number the FIXUPS - Number the FIXUPS
- Review ptr_intT in qh_matchvertices [poly.c]
- clean up warnings for libqhullcpp - clean up warnings for libqhullcpp
- user.h qh_qhPOINTER 0 for qhull -- need two static libraries - add labels to git for Qhull
- review os << QhullFacetSet vs QhullFacetList vs. QhullHyperplane vs. QhullPoint QhullRidge - Make backup
- generate static qhull for qhull.exe
- timer is off by 3 orders of magnitude
Need help Need help
- ConvexHull is a submodule to git. How to get rid of? - 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 configure and debian build. If possible, please keep qhull-2010.1/ clean
- Set up CMake. If possible, please use project/ instead of qhull-2010.1/ Use qhull-2010.1/project/ for build-related files
- The C++ interface needs a lot of work - 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. - 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 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 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 qhull 2010.1 2010/01/07
- Assign type to qh.old_qhstat and memT.tempstack [amorilia] - Assign type to qh.old_qhstat and memT.tempstack [amorilia]
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/*=========================== -included files ==============*/ /*=========================== -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 <setjmp.h>
#include <float.h> #include <float.h>
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
(all but top 50 and their callers 12/3/95) (all but top 50 and their callers 12/3/95)
copyright (c) 1993-2010 The Geometry Center. copyright (c) 1993-2010 The Geometry Center.
$Id: //product/qhull/main/rel/src/poly.c#25 $$Change: 1164 $ $Id: //product/qhull/main/rel/src/poly.c#26 $$Change: 1171 $
$DateTime: 2010/01/07 21:52:00 $$Author: bbarber $ $DateTime: 2010/01/09 10:11:25 $$Author: bbarber $
*/ */
#include "qhull_a.h" #include "qhull_a.h"
...@@ -958,9 +958,8 @@ boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA, ...@@ -958,9 +958,8 @@ boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA,
}while (*(++elemAp)); }while (*(++elemAp));
if (!skipBp) if (!skipBp)
skipBp= ++elemBp; skipBp= ++elemBp;
*skipB= SETindex_(verticesB, skipB); *skipB= SETindex_(verticesB, skipB); /* i.e., skipBp - verticesB */
/* WARN64 -- This expression on pointers returns 0 or 1 */ *same= !((skipA & 0x1) ^ (*skipB & 0x1)); /* result is 0 or 1 */
*same= !(int)((((ptr_intT)skipA & 0x1) ^ ((ptr_intT)*skipB & 0x1)));
trace4((qh ferr, 4054, "qh_matchvertices: matched by skip %d(v%d) and skip %d(v%d) same? %d\n", 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)); skipA, (*skipAp)->id, *skipB, (*(skipBp-1))->id, *same));
return(True); return(True);
......
...@@ -24,6 +24,8 @@ Code flags -- ...@@ -24,6 +24,8 @@ Code flags --
*/ */
#include <time.h>
#ifndef qhDEFuser #ifndef qhDEFuser
#define qhDEFuser 1 #define qhDEFuser 1
...@@ -571,7 +573,8 @@ stop after qh_JOGGLEmaxretry attempts ...@@ -571,7 +573,8 @@ stop after qh_JOGGLEmaxretry attempts
qh_QHpointer = 1 access globals via a pointer to allocated memory qh_QHpointer = 1 access globals via a pointer to allocated memory
enables qh_saveqhull() and qh_restoreqhull() 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 = 0 qh_qh and qh_qhstat are static data structures
only one instance of qhull() can be active at a time only one instance of qhull() can be active at a time
...@@ -582,13 +585,14 @@ stop after qh_JOGGLEmaxretry attempts ...@@ -582,13 +585,14 @@ stop after qh_JOGGLEmaxretry attempts
qh is defined in libqhull.h qh is defined in libqhull.h
qhmem is defined in mem.h qhmem is defined in mem.h
qhstat is defined in stat.h qhstat is defined in stat.h
C++ build defines qh_QHpointer [libqhullp.pro, libqhullcpp.pro]
see: see:
user_eg.c for an example user_eg.c for an example
FIXUP need to override for C++ (-Dqh_QHpointer=1) FIXUP need to override for C++ (-Dqh_QHpointer=1)
*/ */
#ifndef qh_QHpointer #ifndef qh_QHpointer
#define qh_QHpointer 1 #define qh_QHpointer 0
#endif #endif
#if 0 /* sample code */ #if 0 /* sample code */
qhT *oldqhA, *oldqhB; qhT *oldqhA, *oldqhB;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment