WYRDTEK Home Features Reference Downloads About

Features/Distributed Mesh Database Example

This example relates to the creation of a virtual database for storing polygonal mesh data, comprised of a grid of in-memory database servers. The examples/mesh subdirectory in the API distribution contains the relevent code.


Mesh Example
toroid rendered by mclient program

A current problem in scientific computing is to find a way of indexing and storing large grids of polygonal mesh data in a way that can be easily retrieved and rendered by different client applications.

The example application generates a series of toroids (see image), composed of triangular faces. Each object can be rotated in three dimensions and the intensity of radiation falling on each face from a point energy source is computed and stored.

The example shows how to index, store and retrieve mesh objects throughout a grid of in-memory database servers, using the database modeling, serialization, merging and network programming features of the exstreamspeed library.

The provided example client application renders the toroid mesh-data using xlib.



Process Architecture

The process architecture is composed of three components:

  1. A client program mclient that knows how to generate and render toroid mesh-data.
  2. A naming service nsvr that keeps track of where each mesh object has been stored and where newly created objects should be stored. nsvr persists it's index database to disk in case it has to be restarted.
  3. One or more mesh-data servers msvr that hold the mesh-data objects in memory.
Mesh Server Architecture

mclient stores new mesh-data objects by:

  1. Contacting the naming service nsvr to get a list of host and port numbers of mesh-data servers.
  2. Contacting each mesh-data server in the list and publishing each corresponding mesh-data object.

mclient retrieves mesh-data objects by:

  1. Contacting the naming service nsvr to get a list of host and port numbers of mesh-data servers that contain the required set of mesh-data objects.
  2. Contacting each mesh-data server in the list and retrieving each corresponding mesh-data object.


Database Design

A toroid mesh-data object is identified by it's three rotational angles XR, YR and ZR. Angles are represented by a number from 0 to 255, where 256 is a full 360-degree rotation.

The Mesh (root) class has two subclasses: MeshIndex and MeshData. A MeshIndex node is what mclient uses to communicate with nsvr in order to establish the host and port numbers of msvr servers, by mesh-data object id.

MeshData contains the actual mesh data. ZA is the z-coordinate of the observation point. MeshData contains a list of vertices in the Vertex child node - each vertex has an identifier (VId) and a corresponding x,y,z coordinate. The Face child node corresponds to the set of triangular faces that make-up the toroid - V0, V1 and V2 correspond to the vertex identifiers that compose each triangle. Intensity corresponds to the intensity of radiation from the energy point-source falling on the face and Distance is the distance of the face from the observation point.

Mesh Database Definition

Vertex uses an index type of ES_INDEX_NONE making vertex look-up by VId very fast. mclient uses a sorted iterator to retrieve Faces in descending distance order in render the toroid on the screen.

Quadrilateral or higher-order polynomial faces can be modeled by subclassing Face. This would not impact the structured of databases currently stored or affect their rendering.



The example is split into three binaries: mclient.c (mclientcpp.C), nsvr.c (nsvrcpp.C) and msvr.c (msvrcpp.C).

mclient accepts commands from stdin for generating, viewing, storing and retrieving mesh-data toroids.


[Back To Features]