gem/oq-hazardlib — pull request #107 by monellid (2013-02-27 14:41:49+00:00)
Title: Multi Surface

This pr introduces a ``MultiSurface`` class meant to represent earthquake ruptures occurring over multiple disjoint fault surfaces. This is a requirement coming from the implementation of the PSHA model for Japan.

I explain below the steps I followed to introduce such a class:

1) the current ``geo.surface`` module has a base class named ``BaseSurface`` which defines all the methods required for hazard calculations (distance methods - ``get_min_distance()``, ... - and surface properties methods - ``get_top_edge_depth()``, ...) and a ``get_mesh()`` method that assumes the surface to be representable by a single ``RectangularMesh`` object. To relax this assumption I created a new ``BaseSurface`` abstract class which defines all the distances and surface properties methods but that does not assume any specific mesh representation, and I renamed the current ``BaseSurface`` to ``BaseQuadrilateralSurface`` which extends the new base surface class and define the get_mesh() method.

2) I created a new ``geo.surface.multi.MultiSurface`` class which extends the new ``BaseSurface``. The constructor simply accepts a list of instances of subclasses of ``BaseSurface``

I attach here a list of figures showing an example of ``MultiSurface`` taken from the PSHA model for Japan, you can see the set of fault surfaces and how the different distances look like.

![fault_surfaces](https://f.cloud.github.com/assets/351361/201224/d8f0b5c2-80ea-11e2-976a-03dbf5f42b36.png)
![minimum_distance](https://f.cloud.github.com/assets/351361/201236/23146554-80eb-11e2-922e-e6bd3fded80a.png)
![jb_distance](https://f.cloud.github.com/assets/351361/201239/3ea9884e-80eb-11e2-988e-0e63a5d8ece7.png)
![rx_distance](https://f.cloud.github.com/assets/351361/201241/48a60a02-80eb-11e2-9cb3-887ea8d3442f.png)
![closest_points](https://f.cloud.github.com/assets/351361/201246/6231969e-80eb-11e2-8618-adc2d6d6edaf.png)

While working on this pr, I discovered two bugs in ``geo.surface.planar.PlanarSurface.get_joyner_boore_distance`` and ``geo.surface.mesh.Mesh.get_joyner_boore_distance`` that I fixed.