@alexBB, if the numerical integration routines are causing an issue then it would be worthwhile posting them on the forum. Many more people are going to be familiar with these types of routines than with special functions like spherical harmonics, and going from 1-d to 2-d to 2-d on the surface of a sphere is not such a big issue.
It also sounds more like a "raw" C++ issue than a mathematical one. Some likely things to look out for:
- memory management: new and delete [] - roughly correspond to Fortran's ALLOCATE, DEALLOCATE
- conversion of Fortran to C++ (don't I know it!)
- C++ arrays start from 0, Fortran (by default, though it can be changed) from 1;
- ordering of multi-dimensional array elements in memory: A[i][j] - in C++ j changes fastest, in Fortran i changes fastest;
- although pointers exist in Fortran they aren't as big a feature as in C++.
- C++ passes function arguments by value (by default), Fortran by reference.