cleanup refine_mesh code in core.cc

Avoid initializing unused vectors, cleaner SolutionTransfer code,
formatting.