docs: def _ncores(meshes, twod):
      """Compute number of nodes in each direction."""
      nnpb = len(meshes)  # number of nodes per block
      nns = [1, 1, 1]  # number of nodes in x, y, z directions
      if twod is None or 'X' in twod:
          while (nnpb > 1 and
                 meshes[nns[0]]['X'][0, 0, 0] ==
                 meshes[nns[0] - 1]['X'][-1, 0, 0]):
              nns[0] += 1
              nnpb -= 1
      cpu = lambda icy: icy * nns[0]
      if twod is None or 'Y' in twod:
          while (nnpb > 1 and
                 meshes[cpu(nns[1])]['Y'][0, 0, 0] ==
                 meshes[cpu(nns[1] - 1)]['Y'][0, -1, 0]):
              nns[1] += 1
              nnpb -= nns[0]
      cpu = lambda icz: icz * nns[0] * nns[1]
      while (nnpb > 1 and
             meshes[cpu(nns[2])]['Z'][0, 0, 0] ==
             meshes[cpu(nns[2] - 1)]['Z'][0, 0, -1]):
          nns[2] += 1
          nnpb -= nns[0] * nns[1]
      return np.array(nns)