I can print out all those TotP, but cannot get Finish loop print out, why? If I put any statement below, which seems won't be executed, it is like it never jump out from the loop and die inside. Please teach, thanks.
You need to learn how to use the debugger. I did not see anything wrong with the posted code. Stepping into the code with debugger will tell you a lot.
The following makes no sense to me since you really don't create a 2D vector, but I don't see how it would cause a seg fault. It's just goofy. You might as well setup a single loop of x times y. for(vector<vector<long> >::size_type ix=0; ix<=nx; ++ix)
pore constructor looks okay, but it would be better to use std::fill.