Contour Line Generation with HPX

Contour lines are essential in the mapping and comprehension of hurricane data. However, larger sets of data require more time to be processed. This issue is compounded by the increasing granularity of information output by modern models and can be a significant expenditure of computational resources and time when executed serially. To address this issue, I use the HPX library to generate contour lines on multiple processors simultaneously.

To generate the contour lines, the ADCIRC binary file first is read from an external file and then the contour threads are queued with one thread running for every chosen height. To understand how the data is processed, we must first analyze what an ADCIRC domain is. This data format is characterized by a lattice of triangles defined by elements and nodes. The nodes have multiple attributes which may represent any arbitrary form of data, with two attributes usually corresponding to spatial data. These two attributes represent the geographical longitude and latitude in our implementation, serving as x and y coordinates respectively. An additional user-defined attribute serves as the z-coordinate, in this case the elevation of a node. Elements in groups of three represent the indices of the nodes used to create the triangles. One node can be used by many triangles but one element is only used by one triangle as one of its three vertices.
After the ADCIRC domain is transferred from the hard disk to the general memory, unique pointers corresponding to unique vectors in the main thread are passed to every contour thread. This operation is thread-safe because a separate vector is written to by each thread. The line segments are generated by passing a plane for the assigned contour height through every triangle in the lattice. This operation occurs as the triangles are being input from the memory to avoid storage overhead.
After each triangle has been processed, the individual segments are added to a k-d tree and radial search determines which endpoints are close enough to be connected. The thread is only terminated when adjacent endpoints are not found after processing the entire set.
After all of the possible endpoints have been combined for every contour height, the program writes the individual contours to a shapefile. By producing the contours in parallel, large batches of data can be processed and output quickly, which encourages more frequent evaluations of model outputs and decreases development time. The algorithm also groups like contours together, allowing boundary conditions to be created and evaluated for a set wind speed, in addition to the interpolation of processed data between timesteps.


A map of storm surge on the eastern seaboard with contour lines:


GD Star Rating
Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *