Object oriented matrix classes for use in a finite element code using C

This paper presents a new method of writing finite element programs using the programming approach known as object oriented programming (OOP). More specifically, the C++ language is used to illustrate the key OOP concepts. In addition to the OOP finite element examples, a detailed discussion of OOP techniques in the creation of a generalized matrix library is presented. The C++ language is used in this paper because it is more suited to numerical programs than a pure OOP language such as Smalltalk. The efficiency, flexibility and maintainability of the C++ program are shown to be superior to a comparable version written in a non-OOP language, such as FORTRAN. The matrix library contains a number of matrix objects that are useful for specific types of matrix related problems. Different sparse storage schemes are implemented for each different type of matrix. A large number of functions are provided for each matrix type in order to implement many common matrix operations. In applications, the OOP paradigm allows the functions to be used in a very simple way that is common to all the matrix types. The sample finite element code included in this paper is primarily intended to illustrate the key concepts of OOP style. This paper explains how to set up a finite element hierarchy, material hierarchy and how to integrate this with the matrix hierarchy (library). Thus, a completely object oriented finite element program can be written.