We study accuracy, robustness and self-consistency of pixel-domain
simulations of the gravitational lensing effect on the primordial CMB
anisotropies due to the large-scale structure of the Universe. In particular,
we investigate dependence of the results precision on some crucial parameters
of such techniques and propose a semi-analytic framework to determine their
values so the required precision is a priori assured and the numerical workload
simultaneously optimized. Our focus is on the B-mode signal but we discuss also
other CMB observables, such as total intensity, T, and E-mode polarization,
emphasizing differences and similarities between all these cases. Our
semi-analytic considerations are backed up by extensive numerical results.
Those are obtained using a code, nicknamed lenS2HAT -- for Lensing using
Scalable Spherical Harmonic Transforms (S2HAT) -- which we have developed in
the course of this work. The code implements a version of the pixel-domain
approach of Lewis (2005) and permits performing the simulations at very high
resolutions and data volumes, thanks to its efficient parallelization provided
by the S2HAT library -- a parallel library for a calculation of the spherical
harmonic transforms. The code is made publicly available.Comment: 20 pages, 14 figures, submitted to A&A, matches version accepted for
publication in A&