2.2.2. The concept of Interface

Before describing in detail the MeshViz Interface features, it is important to understand the concept of interface used to define the mesh data structures. This is a key concept in MeshViz Interface which must be understood before going any further. This concept provides a simple and convenient way to delegate the definition of the mesh to the application so that MeshViz Interface can adapt to any kind of mesh data structure.

[Tip]

All interface class names start with the Mi prefix

An interface is a C++ class similar to an interface in the Java™ language. However, as this is not a concept of the C++ language, we will describe below the particular properties of what we call an interface:

Some methods have a default implementation in order to avoid a tedious derivation. Two types of default implementation exist:

The concept of interface is often used with multiple inheritance. For instance if the application contains an existing class AppCell defining a cell, this class can be derived to implement the MiCell( C++ | Java ) interface. In this case, the new class AppMiCell inherits both from MiCell( C++ | Java ) and AppCell like in the following graph:


In this example, the AppMiCell class implements the pure virtual method getNumNodes() by returning the inherited protected member numNodes of AppCell. The user application passes a pointer or a reference to this new AppMiCell class to the MeshViz extraction module.

Thanks to the particular properties described above, the multiple C++ inheritance used here does not introduce any multiple member inheritance as can happen when using classical multiple inheritance. Moreover, the new class AppMiCell usually does not need additional members.

[Tip]

Note for C++ experts:

In some cases the inheritance of the interface must be declared as virtual:

class AppMiCell: virtual public MiCell, public AppCell

{

//…

}

The inherited interface must be first in the list of inherited class

[Tip]

Note for Java experts:

An interface class in MeshViz Interface corresponds to a Java abstract class without member.