def _extend_3d(self, axis, delta, npoints, normal):
        imax, jmax, kmax = self.real_shape
        need_normal = False
        if axis == 'i':
            new_shape = (imax + npoints, jmax, kmax)
            if imax < 2:
                need_normal = True
        elif axis == 'j':
            new_shape = (imax, jmax + npoints, kmax)
            if jmax < 2:
                need_normal = True
        else:
            new_shape = (imax, jmax, kmax + npoints)
            if kmax < 2:
                need_normal = True

        # Select normal if necessary.
        if need_normal:
            if normal is None:
                min1, max1, min2, max2, min3, max3 = self.extent
                delta1 = max1 - min1
                delta2 = max2 - min2
                delta3 = max3 - min3
                if delta1 <= delta2:
                    if delta1 <= delta3:
                        normal = (1., 0., 0.)
                    else:
                        normal = (0., 0., 1.)
                elif delta2 <= delta3:
                    normal = (0., 1., 0.)
                else:
                    normal = (0., 0., 1.)
            elif len(normal) != 3:
                raise ValueError('normal needs 3 elements')
        else:
            normal = (0., 0., 0.)

        # Extend.
        grid = GridCoordinates()
        if self.x is not None:
            grid.x = self._extrap_3d(axis, delta, npoints, self.x, new_shape,
                                     normal[0])
            grid.y = self._extrap_3d(axis, delta, npoints, self.y, new_shape,
                                     normal[1])
        else:
            grid.r = self._extrap_3d(axis, delta, npoints, self.r, new_shape,
                                     normal[0])
            grid.t = self._extrap_3d(axis, delta, npoints, self.t, new_shape,
                                     normal[1])
        grid.z = self._extrap_3d(axis, delta, npoints, self.z, new_shape,
                                 normal[2])
        grid.ghosts = copy.copy(self._ghosts)
        return grid
3D (index space) extension.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/datatypes/domain/grid.py/GridCoordinates._extend_3d