Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Surface_reconstruction_points_3, macports, eigen problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Surface_reconstruction_points_3, macports, eigen problem


Chronological Thread 
  • From: Philipp Moeller <>
  • To:
  • Subject: Re: [cgal-discuss] Surface_reconstruction_points_3, macports, eigen problem
  • Date: Wed, 27 Jun 2012 16:20:21 +0200

Dror Atariah
<>
writes:

>> I've tried the example on MacOS 10.7.4, with the default clang 3.1 from
>> Apple and the two days ago released Eigen 3.1 and it works fine.
> I tried to compile with the newest release of Eigen (3.1.0) and it didn't
> work and returned:
>
> ... snip error message ...
>
> Returning to the alpha version compiled without errors. BTW, in order to
> switch between the version I edited "include_directories (BEFORE
> "~/Library/eigen3.1.0/")" in the CMakeLists.txt file.
>
>> AFAIK the default compiler for 10.6.8 is llvm-gcc-4.2 which is rather
>> ancient, but should be fine. Can you be a little bit more specific about
>> what happens, e.g. compile in debug and add a stack trace here so we
>> have an idea in which direction to look?
> How can I find out which compiler I use? How can I compile in debug etc.?
> I'd love to add any further needed piece of detail, but I'll need help
> finding it...

I have attached a patched Eigen_solver_traits.h that should allow you to
compile with Eigen 3.1. Overwrite the old one in your CGAL installation
with this one and recompile the example.

// Copyright (c) 2012  INRIA Bordeaux Sud-Ouest (France), All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s)     : Gael Guennebaud

#ifndef CGAL_EIGEN_SOLVER_TRAITS_H
#define CGAL_EIGEN_SOLVER_TRAITS_H

#include <CGAL/basic.h> // include basic.h before testing #defines

#include <Eigen/Sparse>
#include <CGAL/Eigen_matrix.h>
#include <CGAL/Eigen_vector.h>
#include <boost/shared_ptr.hpp>

namespace CGAL {


namespace internal {
  template <class EigenSolver,class FT>
  struct Get_eigen_matrix{
    typedef Eigen_sparse_matrix<FT> type;
  };
  
  template <class FT,class EigenMatrix>
  struct Get_eigen_matrix< ::Eigen::ConjugateGradient<EigenMatrix>,FT>{
    typedef Eigen_sparse_symmetric_matrix<FT> type;
  };

  template <class FT,class EigenMatrix>
  struct Get_eigen_matrix< ::Eigen::SimplicialCholesky<EigenMatrix>,FT>{
    typedef Eigen_sparse_symmetric_matrix<FT> type;
  };
} //internal 
  
/// The class Eigen_solver_traits
/// is a generic traits class for solving asymmetric or symmetric positive definite (SPD)
/// sparse linear systems using one of the Eigen solvers.
/// The default solver is the iterative bi-congugate gradient stabilized solver
/// Eigen::BiCGSTAB for double.
///
/// @heading Is Model for the Concepts: Model of the SparseLinearAlgebraTraits_d concept.

template<class EigenSolverT = Eigen::BiCGSTAB<Eigen_sparse_matrix<double>::EigenType> >
class Eigen_solver_traits
{
  typedef typename EigenSolverT::Scalar Scalar;
// Public types
public:
   typedef Scalar                                                       NT;
   typedef typename internal::Get_eigen_matrix<EigenSolverT,NT>::type   Matrix;
   typedef Eigen_vector<Scalar>                                         Vector;
   

// Public operations
public:

   Eigen_solver_traits(): m_solver_sptr(new EigenSolverT)
   {
   }
   
   EigenSolverT& solver() { return *m_solver_sptr; }

   /// Solve the sparse linear system "A*X = B".
   /// Return true on success. The solution is then (1/D) * X.
   ///
   /// @commentheading Preconditions:
   /// - A.row_dimension()    == B.dimension().
   /// - A.column_dimension() == X.dimension().
   bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D)
   {
      D = 1;          // Eigen does not support homogeneous coordinates

      m_solver_sptr->compute(A.eigen_object());
       
      if(m_solver_sptr->info() != Eigen::Success)
         return false;
         
      X = m_solver_sptr->solve(B);

      return m_solver_sptr->info() == Eigen::Success;
   }
protected:
  boost::shared_ptr<EigenSolverT> m_solver_sptr;

};

} //namespace CGAL

#endif // CGAL_EIGEN_SOLVER_TRAITS_H

If this doesn't help, you should compile the example in debug mode. To
do that use "cmake-gui ." and set the build type to "Debug". Then
recompile and run the example with:

gdb ./poisson_reconstruction_example
gdb) run
... wait for crash ...
gdb) backtrace
... watch in awe ...

This should get us a step further to the culprit.

HTH,
Philipp



Archive powered by MHonArc 2.6.18.

Top of Page