Friday, July 26, 2013

compile errors in Linux VirtualLeaf installation

I will want to remember this for my next installation of VirtualLeaf (Merks et al. 2011).

For the linux installation from source code VirtualLeaf-v1.0.1-src.zip :

I followed the instructions found in Building Simulation Models of Developing Plant Organs Using VirtualLeaf by Merks and Guravage. One first needs to install Qt from qt-project.org per the instructions. Then download and extract VirtualLeaf.

Before compiling... you will need to modify the mesh.h header file (/home/precociousllama_youruser/VirtualLeaf-v1.0.1-src/src/mesh.h)
You can open mesh.h in any editor, and find the following:

  template<class op=""> void RandomlyLoopNodes(Op f) {

    MyUrand r(shuffled_nodes.size());
    random_shuffle(shuffled_nodes.begin(),shuffled_nodes.end(),r);

    for (vector<node>::const_iterator i=shuffled_nodes.begin();
  i!=shuffled_nodes.end();
  i++) {
      f(*shuffled_nodes[*i]);
    }
  }

  template<class op=""> void RandomlyLoopCells(Op f) {

    MyUrand r(shuffled_cells.size());
    random_shuffle(shuffled_cells.begin(),shuffled_cells.end(),r);

    for (vector<cell>::const_iterator i=shuffled_cells.begin();
  i!=shuffled_cells.end();
  i++) {
      f(*shuffled_cells[*i]);
    }
  }

This will cause errors in compilation as pointed out by the developer Merks (issue 6).

Comment this section out by adding "/*" at the beginning and "*/" at the end. So, that it looks like:
 /*
  template<class op=""> void RandomlyLoopNodes(Op f) {

    MyUrand r(shuffled_nodes.size());
    random_shuffle(shuffled_nodes.begin(),shuffled_nodes.end(),r);

    for (vector<node>::const_iterator i=shuffled_nodes.begin();
  i!=shuffled_nodes.end();
  i++) {
      f(*shuffled_nodes[*i]);
    }
  }

  template<class op=""> void RandomlyLoopCells(Op f) {

    MyUrand r(shuffled_cells.size());
    random_shuffle(shuffled_cells.begin(),shuffled_cells.end(),r);

    for (vector<cell>::const_iterator i=shuffled_cells.begin();
  i!=shuffled_cells.end();
  i++) {
      f(*shuffled_cells[*i]);
    }
  }
*/

Save mesh.h and continue with the compilation procedure.

If you get an error that says something along the lines of "qt3"

Check the versions of your qmake and qmake-qt4. You can do so in the Ubuntu command line with:

$ qmake -v

and

$ qmake-qt4 -v

and make sure the versions are the same. Then, try again!

I haven't done anything but look at the pretty pre-loaded models, but it's going to be awesome, for sure. Thanks Merks and Guravage!

Their original paper is titled: VirtualLeaf: An open-source framework for cell-based modeling of plant tissue growth and development. Roeland M.H. Merks*, Michael Guravage, Dirk Inze, and Gerrit T.S. Beemster. Plant Physiology February 2011.

No comments:

Post a Comment