Skip to content

Commit f282546

Browse files
authored
Enable USE_UMFPACK in surface module on macOS CI (#6078)
* Fix some macro bugs * Comment unused chunk_count & Remove some logic that is always false * Comment unused merge_count & Fix a logic that is always true * Fix a bug & a logic that is always true * Remove a logic that is always true * Fix a bug about virtual function hiding * Deleted unused NodeCountHelper function * Fix extra bugs about virtual function hiding * Fix a bug about virtual function hiding * Fix for finding CHOLMOD & UMFPACK libraries * Address reviews * Add missing build argument * Addressed reviews
1 parent da7f34a commit f282546

17 files changed

+75
-99
lines changed

.ci/azure-pipelines/build/macos.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ steps:
33
# find the commit hash on a quick non-forced update too
44
fetchDepth: 10
55
- script: |
6-
brew install cmake pkg-config boost eigen flann glew libusb qhull vtk glew freeglut qt5 libpcap libomp google-benchmark cjson
6+
brew install cmake pkg-config boost eigen flann glew libusb qhull vtk glew freeglut qt5 libpcap libomp suite-sparse zlib google-benchmark cjson
77
brew install brewsci/science/openni
88
git clone https://github.com/abseil/googletest.git $GOOGLE_TEST_DIR # the official endpoint changed to abseil/googletest
99
cd $GOOGLE_TEST_DIR && git checkout release-1.8.1
@@ -18,6 +18,7 @@ steps:
1818
-DGTEST_INCLUDE_DIR="$GOOGLE_TEST_DIR/googletest/include" \
1919
-DQt5_DIR=/usr/local/opt/qt5/lib/cmake/Qt5 \
2020
-DPCL_ONLY_CORE_POINT_TYPES=ON \
21+
-DBUILD_surface_on_nurbs=ON -DUSE_UMFPACK=ON \
2122
-DBUILD_simulation=ON \
2223
-DBUILD_global_tests=ON \
2324
-DBUILD_benchmarks=ON \

surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_polyedgecurve.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ class ON_CLASS ON_PolyEdgeSegment : public ON_CurveProxy
195195
const ON_UUID& object_id
196196
);
197197

198+
using ON_CurveProxy::Trim; // Explicitly introduce the base class Trim function
198199
const ON_BrepEdge* Edge() const;
199-
const ON_BrepTrim* Trim() const;
200+
const ON_BrepTrim* Trim() const; // overload, not override
200201
const ON_Brep* Brep() const;
201202
const ON_BrepFace* Face() const;
202203
const ON_Surface* Surface() const;

surface/include/pcl/surface/on_nurbs/fitting_curve_2d_asdm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ namespace pcl
8888
updateCurve (double damp) override;
8989

9090
protected:
91+
using FittingCurve2dAPDM::addPointConstraint;
92+
using FittingCurve2dAPDM::assembleClosestPoints;
9193

9294
/** \brief Add minimization constraint: point-to-surface distance (squared-distance-minimization). */
9395
virtual void

surface/include/pcl/surface/on_nurbs/fitting_curve_2d_atdm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ namespace pcl
8282
updateCurve (double damp) override;
8383

8484
protected:
85+
using FittingCurve2dAPDM::addPointConstraint;
86+
using FittingCurve2dAPDM::assembleClosestPoints;
87+
8588
/** \brief Add minimization constraint: point-to-surface distance (tangent-distance-minimization). */
8689
virtual void
8790
addPointConstraint (const double &param, const Eigen::Vector2d &point, const Eigen::Vector2d &normal,

surface/include/pcl/surface/on_nurbs/fitting_curve_2d_sdm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ namespace pcl
8787
updateCurve (double damp) override;
8888

8989
protected:
90+
using FittingCurve2dPDM::addPointConstraint;
9091

9192
/** \brief Add minimization constraint: point-to-surface distance (squared-distance-minimization). */
9293
virtual void

surface/include/pcl/surface/on_nurbs/fitting_curve_2d_tdm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ namespace pcl
8989
updateCurve (double damp) override;
9090

9191
protected:
92+
using FittingCurve2dPDM::addPointConstraint;
93+
9294
/** \brief Add minimization constraint: point-to-surface distance (tangent-distance-minimization). */
9395
virtual void
9496
addPointConstraint (const double &param, const Eigen::Vector2d &point, const Eigen::Vector2d &normal,

surface/include/pcl/surface/on_nurbs/fitting_surface_tdm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace pcl
5050
class FittingSurfaceTDM : public FittingSurface
5151
{
5252
public:
53+
using FittingSurface::assemble;
5354

5455
/** \brief Parameters with TDM extensions for fitting */
5556
struct ParameterTDM : public FittingSurface::Parameter
@@ -94,6 +95,9 @@ namespace pcl
9495
updateSurf (double damp) override;
9596

9697
protected:
98+
using FittingSurface::assembleInterior;
99+
using FittingSurface::assembleBoundary;
100+
using FittingSurface::addPointConstraint;
97101

98102
/** \brief Assemble point-to-surface constraints for interior points. */
99103
virtual void

surface/src/3rdparty/opennurbs/opennurbs_3dm_settings.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,8 +3049,7 @@ static bool ON_3dmSettings_Read_v1_TCODE_VIEWPORT(ON_BinaryArchive& file, ON_3dm
30493049
double clipdist = 0.0;
30503050
double snapsize = 0.0;
30513051

3052-
int chunk_count = 0;// debugging counter
3053-
for ( chunk_count = 0; rc; chunk_count++ )
3052+
while ( rc )
30543053
{
30553054
rc = file.BeginRead3dmBigChunk( &tcode, &big_value );
30563055
if (!rc )
@@ -3159,8 +3158,7 @@ bool ON_3dmSettings::Read_v1( ON_BinaryArchive& file )
31593158
ON__INT64 big_value;
31603159
rc = file.SeekFromStart(32)?true:false; // skip 32 byte header
31613160

3162-
int chunk_count = 0; // debugging counter
3163-
for ( chunk_count = 0; rc; chunk_count++ )
3161+
while ( rc )
31643162
{
31653163
rc = file.BeginRead3dmBigChunk( &tcode, &big_value );
31663164
if ( !rc )

surface/src/3rdparty/opennurbs/opennurbs_material.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ void ON_TextureMapping::Dump( ON_TextLog& text_log ) const
15051505
case single:
15061506
text_log.Print("single texture space\n");
15071507
break;
1508-
case clspt_projection:
1508+
case divided:
15091509
text_log.Print("divided texture space\n");
15101510
break;
15111511
default:
@@ -2359,7 +2359,7 @@ ON__UINT32 ON_TextureMapping::MappingCRC() const
23592359
case ON_TextureMapping::cylinder_mapping:
23602360
case ON_TextureMapping::sphere_mapping:
23612361
case ON_TextureMapping::box_mapping:
2362-
case ON_TextureMapping::force_32bit_mapping_projection:
2362+
case ON_TextureMapping::force_32bit_mapping_type:
23632363
default:
23642364
break;
23652365
}

surface/src/3rdparty/opennurbs/opennurbs_math.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,8 +1280,6 @@ ON_TransformPointList(
12801280

12811281
if ( !ON_IsValidPointList( dim, is_rat, count, stride, point ) )
12821282
return false;
1283-
if ( xform.m_xform == NULL )
1284-
return false;
12851283
if (count == 0)
12861284
return true;
12871285

@@ -1381,8 +1379,6 @@ ON_TransformPointList(
13811379

13821380
if ( !ON_IsValidPointList( dim, is_rat, count, stride, point ) )
13831381
return false;
1384-
if ( xform.m_xform == NULL )
1385-
return false;
13861382
if (count == 0)
13871383
return true;
13881384

@@ -1507,8 +1503,6 @@ ON_TransformVectorList(
15071503

15081504
if ( !ON_IsValidPointList( dim, 0, count, stride, vector ) )
15091505
return false;
1510-
if ( xform.m_xform == NULL )
1511-
return false;
15121506
if (count == 0)
15131507
return true;
15141508

@@ -1556,8 +1550,6 @@ ON_TransformVectorList(
15561550

15571551
if ( !ON_IsValidPointList( dim, 0, count, stride, vector ) )
15581552
return false;
1559-
if ( xform.m_xform == NULL )
1560-
return false;
15611553
if (count == 0)
15621554
return true;
15631555

surface/src/3rdparty/opennurbs/opennurbs_mesh.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,7 +3689,6 @@ bool ON_Mesh::CombineIdenticalVertices(
36893689
ON_SimpleArray<int> remap_array(vertex_count);
36903690

36913691
int remap_vertex_count = 0;
3692-
int merge_count = 0;
36933692
int i0, i1, k;
36943693

36953694
struct tagMESHPOINTS mp;
@@ -3738,8 +3737,6 @@ bool ON_Mesh::CombineIdenticalVertices(
37383737
{
37393738
if ( CompareMeshPoint( mp.p0+index[i0], mp.p0+index[i1], &mp ) )
37403739
break;
3741-
else
3742-
merge_count++;
37433740
}
37443741
for ( /*empty*/; i0 < i1; i0++ )
37453742
{

surface/src/3rdparty/opennurbs/opennurbs_nurbssurface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ ON_BOOL32 ON_NurbsSurface::SetDomain(
143143
)
144144
{
145145
bool rc = false;
146-
if ( m_order[dir] >= 2 && m_cv_count[dir] >= m_order[dir] && m_knot && t0 < t1 ) {
146+
if ( m_order[dir] >= 2 && m_cv_count[dir] >= m_order[dir] && nullptr != m_knot[dir] && t0 < t1 ) {
147147
const double k0 = m_knot[dir][m_order[dir]-2];
148148
const double k1 = m_knot[dir][m_cv_count[dir]-1];
149149
if ( k0 == t0 && k1 == t1 )

surface/src/3rdparty/opennurbs/opennurbs_nurbsvolume.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ ON__UINT32 ON_NurbsCage::DataCRC(ON__UINT32 current_remainder) const
533533
for ( j = 0; j < m_cv_count[1]; j++ )
534534
{
535535
cv = CV(i,j,0);
536-
for (k = 0; i < m_cv_count[2]; k++ )
536+
for (k = 0; k < m_cv_count[2]; k++ )
537537
{
538538
current_remainder = ON_CRC32(current_remainder,sizeof_cv,cv);
539539
cv += m_cv_stride[2];

surface/src/3rdparty/opennurbs/opennurbs_object.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,8 @@ void ON_ClassId::ConstructorHelper( const char* sClassName,
840840
{
841841
for ( ON_ClassId* p = m_p0; p; p = p->m_pNext )
842842
{
843-
if ( !p->m_pBaseClassId && p->m_sBaseClassName ) {
843+
if ( 0 == p->m_pBaseClassId && 0 != p->m_sBaseClassName[0] &&
844+
0 == p->m_sBaseClassName[sizeof(p->m_sBaseClassName) / sizeof(p->m_sBaseClassName[0]) - 1] ) {
844845
if ( !strcmp( m_sClassName, p->m_sBaseClassName ) )
845846
p->m_pBaseClassId = this;
846847
}

surface/src/3rdparty/opennurbs/opennurbs_point.cpp

Lines changed: 48 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -668,60 +668,52 @@ ON_3dVector::PerpendicularTo(
668668
void ON_2dPoint::Transform( const ON_Xform& xform )
669669
{
670670
double xx,yy,ww;
671-
if ( xform.m_xform ) {
672-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][3];
673-
if ( ww != 0.0 )
674-
ww = 1.0/ww;
675-
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][3]);
676-
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][3]);
677-
x = xx;
678-
y = yy;
679-
}
671+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][3];
672+
if ( ww != 0.0 )
673+
ww = 1.0/ww;
674+
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][3]);
675+
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][3]);
676+
x = xx;
677+
y = yy;
680678
}
681679

682680
void ON_3dPoint::Transform( const ON_Xform& xform )
683681
{
684682
double xx,yy,zz,ww;
685-
if ( xform.m_xform ) {
686-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3];
687-
if ( ww != 0.0 )
688-
ww = 1.0/ww;
689-
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]);
690-
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]);
691-
zz = ww*(xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]);
692-
x = xx;
693-
y = yy;
694-
z = zz;
695-
}
683+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3];
684+
if ( ww != 0.0 )
685+
ww = 1.0/ww;
686+
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]);
687+
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]);
688+
zz = ww*(xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]);
689+
x = xx;
690+
y = yy;
691+
z = zz;
696692
}
697693

698694
void ON_4dPoint::Transform( const ON_Xform& xform )
699695
{
700696
double xx,yy,zz,ww;
701-
if ( xform.m_xform ) {
702-
xx = xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]*w;
703-
yy = xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]*w;
704-
zz = xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]*w;
705-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3]*w;
706-
x = xx;
707-
y = yy;
708-
z = zz;
709-
w = ww;
710-
}
697+
xx = xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]*w;
698+
yy = xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]*w;
699+
zz = xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]*w;
700+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3]*w;
701+
x = xx;
702+
y = yy;
703+
z = zz;
704+
w = ww;
711705
}
712706

713707
void ON_2fPoint::Transform( const ON_Xform& xform )
714708
{
715709
double xx,yy,ww;
716-
if ( xform.m_xform ) {
717-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][3];
718-
if ( ww != 0.0 )
719-
ww = 1.0/ww;
720-
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][3]);
721-
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][3]);
722-
x = (float)xx;
723-
y = (float)yy;
724-
}
710+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][3];
711+
if ( ww != 0.0 )
712+
ww = 1.0/ww;
713+
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][3]);
714+
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][3]);
715+
x = (float)xx;
716+
y = (float)yy;
725717
}
726718

727719
void ON_2fPoint::Rotate(
@@ -767,32 +759,28 @@ void ON_3fPoint::Rotate(
767759
void ON_3fPoint::Transform( const ON_Xform& xform )
768760
{
769761
double xx,yy,zz,ww;
770-
if ( xform.m_xform ) {
771-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3];
772-
if ( ww != 0.0 )
773-
ww = 1.0/ww;
774-
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]);
775-
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]);
776-
zz = ww*(xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]);
777-
x = (float)xx;
778-
y = (float)yy;
779-
z = (float)zz;
780-
}
762+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3];
763+
if ( ww != 0.0 )
764+
ww = 1.0/ww;
765+
xx = ww*(xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]);
766+
yy = ww*(xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]);
767+
zz = ww*(xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]);
768+
x = (float)xx;
769+
y = (float)yy;
770+
z = (float)zz;
781771
}
782772

783773
void ON_4fPoint::Transform( const ON_Xform& xform )
784774
{
785775
double xx,yy,zz,ww;
786-
if ( xform.m_xform ) {
787-
xx = xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]*w;
788-
yy = xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]*w;
789-
zz = xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]*w;
790-
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3]*w;
791-
x = (float)xx;
792-
y = (float)yy;
793-
z = (float)zz;
794-
w = (float)ww;
795-
}
776+
xx = xform.m_xform[0][0]*x + xform.m_xform[0][1]*y + xform.m_xform[0][2]*z + xform.m_xform[0][3]*w;
777+
yy = xform.m_xform[1][0]*x + xform.m_xform[1][1]*y + xform.m_xform[1][2]*z + xform.m_xform[1][3]*w;
778+
zz = xform.m_xform[2][0]*x + xform.m_xform[2][1]*y + xform.m_xform[2][2]*z + xform.m_xform[2][3]*w;
779+
ww = xform.m_xform[3][0]*x + xform.m_xform[3][1]*y + xform.m_xform[3][2]*z + xform.m_xform[3][3]*w;
780+
x = (float)xx;
781+
y = (float)yy;
782+
z = (float)zz;
783+
w = (float)ww;
796784
}
797785

798786
double ON_3fPoint::Fuzz(

surface/src/3rdparty/opennurbs/opennurbs_rtree.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,22 +1472,6 @@ std::size_t ON_RTree::SizeOf() const
14721472
}
14731473

14741474

1475-
static void NodeCountHelper( const ON_RTreeNode* node, std::size_t& node_count, std::size_t& wasted_branch_count, std::size_t& leaf_count )
1476-
{
1477-
if ( 0 == node )
1478-
return;
1479-
node_count++;
1480-
wasted_branch_count += (ON_RTree_MAX_NODE_COUNT - node->m_count);
1481-
if ( node->m_level > 0 )
1482-
{
1483-
for ( int i = 0; i < node->m_count; i++ )
1484-
{
1485-
NodeCountHelper(node->m_branch[i].m_child,node_count,wasted_branch_count,leaf_count);
1486-
}
1487-
}
1488-
else
1489-
leaf_count += node->m_count;
1490-
}
14911475

14921476
void ON_RTree::RemoveAll()
14931477
{

surface/src/on_nurbs/on_nurbs.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ set(ON_NURBS_SOURCES
4949

5050
set(USE_UMFPACK 0 CACHE BOOL "Use UmfPack for solving sparse systems of equations (e.g. in surface/on_nurbs)")
5151
if(USE_UMFPACK)
52+
find_package(CHOLMOD REQUIRED)
53+
find_package(UMFPACK REQUIRED)
5254
set(ON_NURBS_SOURCES ${ON_NURBS_SOURCES} src/on_nurbs/nurbs_solve_umfpack.cpp)
53-
set(ON_NURBS_LIBRARIES ${ON_NURBS_LIBRARIES} cholmod umfpack)
55+
set(ON_NURBS_LIBRARIES ${ON_NURBS_LIBRARIES} SuiteSparse::CHOLMOD SuiteSparse::UMFPACK)
5456
else()
5557
set(ON_NURBS_SOURCES ${ON_NURBS_SOURCES} src/on_nurbs/nurbs_solve_eigen.cpp)
5658
endif()

0 commit comments

Comments
 (0)