I am working on a task for which the object oriented (OO) approach fits well. I am doing it in MATLAB, since I am in the prototyping phase. However, I know that later I will surely have to perform larger scale computations (my university has a cluster). On method is to use mex functions for the computational heavy parts. But it does not work well for MATLAB classes. The other option is to write the code in C++, whose OOP is different from that of MATLAB, but there are many similarities, and the idea is the same. How easy is to use then OpenMP, MPI, PETSC, etc with C++ classes to parallelize my code? The third option would be to neglect OOP, but then I sacrifice the elegance and extensibility and of my program. My questions:
1) Do you recommend me to remain with OOP, or switch to the procedural way?
2) Which parallelization technique do you recommend me (OpenMP, MPI, PETSC, etc.)? I do not want to invest enormous amount of time in it. I am quite skilled in MATLAB, but have only a basic knowledge in C and nothing in C++.
EDIT
From one of the comments it turned out that there is no difference if I use standard variables or objects. So to reformulate question 1)
1) Is it sure that OOP does not make my life harder when I am going to do the parallelization? I will create a specific application not a general tool; in this case how much OO C++ is difficult to learn? I won't need special data structures, just the loops, if statements and the call of parallelization libraries. Is that a viable solution just to make the class methods parallel (so that the implementation remains hidden from outside) or a complete rewriting is required?
I left my Matlab code in the office and is lengthy but the main point is that I want to use parallel assembly of finite element matrices and need other methods that cannot be vectorized. Can I do something like this: for i from 1 to nElem do perform operations on object_array[i].someProperty end? In OpenMP the #pragma parallel for could do the job since the variables are independent in the loop, but does it also work for objects?
– Zoltan Csati Nov 19 '15 at 20:48