MPE++: An Object-Oriented Mesh Partitioning Environment in C++ ...

1 downloads 0 Views 65KB Size Report
In this work, an object-oriented mesh partitioning environment in C++, called MPE++, has been developed to facilitate research on mesh partitioning techniques ...
MPE++: An Object-Oriented Mesh Partitioning Environment in C++ Shang-Hsien Hsieh1), Yuan-Sen Yang1), Wei-Choung Cheng1), Ming-Der Lu1), and Elisa D. Sotelino2) 1) Department of Civil Engineering, National Taiwan University, Taipei, Taiwan, R.O.C. 2) School of Civil Engineering, Purdue University, West Lafayette, IN 47907-1284, U.S.A.

ABSTRACT In this work, an object-oriented mesh partitioning environment in C++, called MPE++, has been developed to facilitate research on mesh partitioning techniques for parallel finite element computations. This paper describes how MPE++ maps the physical models and algorithms in the problem domain of mesh partitioning into the object models in the software domain by using object-oriented techniques. The collaborative mechanism among the major object models in MPE++ is also presented and discussed. In addition, a simple example is used to demonstrate how MPE++ can be easily used to perform mesh partitioning tasks. INTRODUCTION In parallel finite element computations using domain decomposition approaches, mesh partitioning techniques are usually employed. The objective of mesh partitioning is to obtain a balanced distribution of workloads among processors and to minimize communication between processors so that significant speed-up can be achieved in the parallel computation. Although many mesh partitioning algorithms have been proposed in the literature (e.g., Farhat and Simon, 1993; Hendrickson and Leland, 1993; Karypis and Kumar, 1995), none of them can guarantee to produce partitions that generally meet all the needs of various parallel finite element solution strategies (Hsieh et al., 1997a). It is a common practice to implement a variety of partitioning algorithms for the analyst to select the most adequate one for the problem at hand. In addition, it has been found that the common criteria adopted in the development of most mesh partitioning algorithms do not necessarily lead to good load-balance among processors for a particular parallel solution strategy (Yang and Hsieh, 1997). Therefore, research is still needed on mesh partitioning algorithms that can take into account the computational properties of a parallel solution strategy for better parallel efficiency. In this work, an object-oriented mesh partitioning environment in C++, called MPE++, has been developed to facilitate research on mesh partitioning algorithms. By taking

advantage of object-oriented features in C++, MPE++ supports a flexible hierarchical data management scheme to ease the programming task in mesh partitioning research. It also provides a consistent and easy-to-use programming interface, which not only hides implementation details and complexity from the user, but also improves the clarity and expressiveness of programs. To facilitate evaluation and comparative studies of mesh partitioning algorithms, MPE++ provides a set of graphics tools for visualization of mesh partitioning results. In this paper, the emphasis is placed on the design of object classes in MPE++ and the collaborative mechanisms among different MPE++ object classes. A simple example is also given to demonstrate the application of MPE++. OBJECT CLASSES IN MPE++ Five major object classes are designed in MPE++: Mesh, FEGraph, Partitioning, Evaluation, and MpView object classes. This section discusses how they are used to model the physical entities and procedures in the problem domain of mesh partitioning. In mesh partitioning, a given finite element mesh, consisting of a set of elements and nodes, is partitioned into a number of submeshes. A submesh is a mesh with a subset of elements and nodes of the original (non-partitioned) mesh. Two object models are used in MPE++ to represent the finite element mesh and its submeshes: the physical model and the information model. The physical model uses a set of Element and Node objects to describe the physical properties of the original mesh, such as the geometric coordinates of nodes, the element type of each element, the topological relationships among elements and nodes, and the global numbering of elements and nodes. These properties represent unique global information across both the mesh and its partitions (submeshes) and do not change during the process of partitioning. On the other hand, the information model uses a set of ElementInfo and NodeInfo objects to maintain the local nodal and element information within each mesh (or submesh), such as the local numbering of nodes and elements and the local topological relationships among elements. For example, Fig. 1 shows that the local information within each submesh is different from the global one of the original mesh. 1

2 1

4

5

6

partition

3

4 8

mesh

2

1

1

2

3 7

1

3

1 4

3

2 9

5

2

4 2

6

submesh A

5

6

submesh B

Figure 1 An example of mesh partitioning In MPE++, the Mesh class, consisting of the ElementInfo and NodeInfo classes, is used to represent the information model of a mesh (or submesh). Each ElementInfo (or NodeInfo) object maintains a pointer to its corresponding Element (or Node) object in the physical model. Furthermore, each Mesh object maintains a list of pointers to its submeshes, while each submesh also maintains a pointer to its parent mesh (from which it is partitioned). With the present design, the process and results of mesh partitioning can then

be described through the tree structure formed by the Mesh objects of submeshes and their parent mesh. Many graph-based partitioning algorithms require that the finite element mesh be transformed into a corresponding graph, such as dual graph, communication graph, or node graph (Hsieh et al., 1995). Therefore, MPE++ uses the FEGraph class and its derived classes to model the corresponding graph representations of a finite element mesh. Each FEGraph object consists of a set of FEGEdge and FEGVertex objects. The Partitioning class and its derived classes are used to model various mesh partitioning algorithms (or procedures). In MPE++, partitioning algorithms are encapsulated as classes instead of functions. This design allows for flexible combinations of different mesh partitioning approaches and algorithms. For example, recursive partitioning approaches, such as the Sequential-cut and Two-way approaches (Hsieh et al., 1995), may use one of many mesh partitioning algorithms, e.g., the spectral algorithm (Hsieh et al., 1995) or the greedy algorithm (Farhat, 1998), as the kernel partitioning algorithm. In MPE++, some Partitioning objects are designed to take another Partitioning object as its kernel algorithm through the input arguments of its object constructor. The Evaluation class computes some numerical statistics for assessing the quality of mesh partitioning results. Because no standard criteria can be easily defined for evaluating the partitioning results yet (Hsieh et al., 1997), the present implementation of the Evaluation class in MPE++ only supports computations of some commonly used parameters to help estimating the quality of mesh partitioning results. For example, the computed parameters include the total number of interface nodes among submeshes, the number of boundary nodes of each submesh, average number of adjacent submeshes of each submesh, etc. The MpView class supports three-dimensional (3D) computer graphics for visualization of mesh partitioning results as well as the (non-partitioned) finite element mesh. Within the MpView class, the submeshes are displayed in different colors and may be examined individually in a sequential order. Through either specific hot keys or the mouse, the MpView class also allows for rotating, translating, and zooming the 3D submesh objects to facilitate examination of partitioning results. The implementation of the MpView class is based on the OpenGL graphics library (OpenGL ARB, 1992). It can be easily ported across computer platforms supporting OpenGL (e.g., Microsoft Windows 95/NT and SGI Irix environments). In addition, a graphics tool named OGLViewMP has been developed using the MpView class (Hsieh et al., 1997b). COLLABORATIVE MECHANISM IN MPE++ The mesh partitioning task can be divided into three phases: modeling phase, partitioning phase, and evaluation phase. In this section, Fig. 2 is used to illustrate the collaborative mechanism among the major object classes in MPE++ throughout the three phases. In Fig. 2, each rectangle denotes an object or a model, the underlined word within each rectangle denotes the class name of the object, and the solid line denotes the relationship between objects. In the modeling phase, the physical model of the finite element mesh is constructed first. The Mesh object, which represents the information model of the mesh, can then be constructed based on the physical model. In the partitioning phase, the Partitioning object takes the Mesh object as its input data. If a graph-based partitioning algorithm is to be used, the corresponding FEGraph object of

the Mesh object is constructed. After the mesh is partitioned into a specified number of submeshes by a specified partitioning algorithm, the Partitioning object sends the partitioning results to the Mesh object and asks the Mesh object to create its submeshes (also Mesh objects). In the evaluation phase, the Mesh object (with its submesh objects) is passed into the Evaluating object and/or the MpView object for evaluation of partitioning results. Numerical statistics on the partitioning results can then be queried from the Evaluation object, while the MpView object provides a set of tools for graphics visualization of partitioning results. Physical Model Elements Element Element

Nodes Node Node

create Mesh

Mesh

Partitioning

Information Model partition ElementInfos Element Element

GR algorithm RST algorithm : :

NodeInfos Node Node

create submeshes

Evaluation

Mesh

# of interface nodes

Information Model parent & child

: :

evaluate

parent & child visualize

Mesh (submesh)

Mesh (submesh)

Information Model

Information Model

MpView subselect.me

Graphics

Figure 2 Collaborative mechanism among major object classes in MPE++ DEMONSTRATION EXAMPLE Figure 3 shows an example C++ program for mesh partitioning that can be easily constructed with the support of MPE++. In the modeling phase of mesh partitioning, the InData object class in MPE++ encapsulates the tedious operations of reading mesh data from files (which formats are defined by MPE++). After reading the mesh data from files, the InData object (named in_data in this case) constructs a Mesh object and returns the handle of the Mesh object. In the partitioning phase, several partitioning algorithms are supported by the Partitioning class. In this example, the GReedy partitioning algorithm (Farhat, 1988) is selected and a GR_Partitioning object, named GR, is created. With the handle of the Mesh object and the number of partitions specified, the GR_Partitioning object

performs the mesh partitioning task. In the evaluation phase, an Evaluation object, named eva, is constructed to automatically compute various statistics related to partitioning results. The statistics can then be queried through the member functions of the object. In addition, an MpView object, named view, is created for visualization of partitioning results using interactive computer graphics (see Fig. 4). void main () { InData in_data("test"); Mesh* mesh = in_data.mesh();

// Modeling Phase. // Read mesh data from files

// Partitioning Phase. // Create a Partitioning object // Partition the mesh into 8 submeshes // Evaluation Phase. Evaluation eva(mesh); // Evaluate partitioning results cout

Suggest Documents