changed $ptr to $faceptr to match the changed output in closemeshKD