dipetkov / eems

Estimating Effective Migration Surfaces
GNU General Public License v2.0
102 stars 28 forks source link

Problem compiling runeems_snps #8

Closed mcrossley3 closed 8 years ago

mcrossley3 commented 8 years ago

Hi Dr. Petkova, I am running into a problem setting up runeems_snps due to its requirement of boost 1.57 or higher. I have an older ubuntu version that only allows up to boost 1.54, and setting up a newer ubuntu version would hardly be feasible for us.

This is the error report I get when trying to compile the program:

habitat.cpp: In member function ‘void Habitat::generate_outer(const string&)’: habitat.cpp:27:8: error: ‘is_valid’ is not a member of ‘boost::geometry’ if (!boost::geometry::is_valid(domain)) { ^ make: *\ [habitat.o] Error 1

I'm wondering if you have a work-around for this - e.g. a way to compile the runeems_snps program with boost 1.54? Thanks for your help, -Mike

dipetkov commented 8 years ago

Boost 1.54 does not have the is_valid function. Fortunately, this function is not crucial and you can comment it out. Specifically, make the following change in habitat.cpp (lines 27 to 30):

// Correction is limited to fixing the orientation and a closing point (if necessary)                   
boost::geometry::correct(domain);
//  if (!boost::geometry::is_valid(domain)) {
//    cerr << "  The habitat is not a valid ring (a simple closed polygon)" << endl; exit(1);
//  }

This simply comments out the check performed by boost::geometry::is_valid.

Explanation: The domain is the habitat outline. It should be specified in datapath.outer as a sequence of vertices/points that form a closed polygon without holes (i.e., a ring). The function boost::geometry::correct makes two simple corrections if necessary: it can close the polygon (the first vertex is also the last) and it can reverse its orientation. For example, the vertices (0,0), (0,1), (1,1), (1,0) define an (open) square; the vertices (0,0), (0,1), (1,1), (1,0), (0.0) define a close square.

It is also important that the ring geometry does not self intersect. For example, (0,0),(1,1),(1,0),(0,1) is not a valid ring because the two segments cross each other.