@norihiro-w, @TomFischer 
I see. If most of the wrapper classes have finalization function,  I would prefer to remove this general function, put a empty finalization function in each related class, which may not need that function. Besides, for the matrix finalization in PETSc, an argument is needed. 

BTW, in the current version,  MathLib::finalizeMatrixAssembly()  is defined as MathLib::FinalizeMatrixAssembly()  (the first character of the name is capital), and your matrix test function actually calls the  finalizeMatrixAssembly()  of LisMatrix. If these names 
are unified, one get compile error of function being double defined.