(self)
return T_mapping
Return the function that deforms the points within the unit cube.

        :rtype: callable
Return the function that deforms the points within the unit cube.
Return the function that deforms the points within the unit cube .
def T(self):
        """
        Return the function that deforms the points within the unit cube.

        :rtype: callable
        """
        def T_mapping(points):
            (n_rows, n_cols) = points.shape
            (dim_n_mu, dim_m_mu, dim_t_mu) = self.array_mu_x.shape

            # Initialization. In order to exploit the contiguity in memory the
            # following are transposed
            bernstein_x = np.zeros((dim_n_mu, n_rows))
            bernstein_y = np.zeros((dim_m_mu, n_rows))
            bernstein_z = np.zeros((dim_t_mu, n_rows))
            shift_points = np.zeros((n_cols, n_rows))

            # TODO check no-loop implementation
            #bernstein_x = (
            #    np.power(mesh_points[:, 0][:, None], range(dim_n_mu)) *
            #    np.power(1 - mesh_points[:, 0][:, None], range(dim_n_mu-1, -1, -1)) *
            #    special.binom(np.array([dim_n_mu-1]*dim_n_mu), np.arange(dim_n_mu))
            #)
            for i in range(0, dim_n_mu):
                aux1 = np.power((1 - points[:, 0]), dim_n_mu - 1 - i)
                aux2 = np.power(points[:, 0], i)
                bernstein_x[i, :] = (special.binom(dim_n_mu - 1, i) *
                                     np.multiply(aux1, aux2))

            for i in range(0, dim_m_mu):
                aux1 = np.power((1 - points[:, 1]), dim_m_mu - 1 - i)
                aux2 = np.power(points[:, 1], i)
                bernstein_y[i, :] = special.binom(dim_m_mu - 1,
                                                  i) * np.multiply(aux1, aux2)

            for i in range(0, dim_t_mu):
                aux1 = np.power((1 - points[:, 2]), dim_t_mu - 1 - i)
                aux2 = np.power(points[:, 2], i)
                bernstein_z[i, :] = special.binom(dim_t_mu - 1,
                                                  i) * np.multiply(aux1, aux2)

            aux_x = 0.
            aux_y = 0.
            aux_z = 0.

            for j in range(0, dim_m_mu):
                for k in range(0, dim_t_mu):
                    bernstein_yz = np.multiply(bernstein_y[j, :],
                                               bernstein_z[k, :])
                    for i in range(0, dim_n_mu):
                        aux = np.multiply(bernstein_x[i, :], bernstein_yz)
                        aux_x += aux * self.array_mu_x[i, j, k]
                        aux_y += aux * self.array_mu_y[i, j, k]
                        aux_z += aux * self.array_mu_z[i, j, k]

            shift_points[0, :] += aux_x
            shift_points[1, :] += aux_y
            shift_points[2, :] += aux_z
            return shift_points.T + points

        return T_mapping
def T ( self ) : def T_mapping ( points ) : ( n_rows , n_cols ) = points . shape ( dim_n_mu , dim_m_mu , dim_t_mu ) = self . array_mu_x . shape # Initialization. In order to exploit the contiguity in memory the # following are transposed bernstein_x = np . zeros ( ( dim_n_mu , n_rows ) ) bernstein_y = np . zeros ( ( dim_m_mu , n_rows ) ) bernstein_z = np . zeros ( ( dim_t_mu , n_rows ) ) shift_points = np . zeros ( ( n_cols , n_rows ) ) # TODO check no-loop implementation #bernstein_x = ( #    np.power(mesh_points[:, 0][:, None], range(dim_n_mu)) * #    np.power(1 - mesh_points[:, 0][:, None], range(dim_n_mu-1, -1, -1)) * #    special.binom(np.array([dim_n_mu-1]*dim_n_mu), np.arange(dim_n_mu)) #) for i in range ( 0 , dim_n_mu ) : aux1 = np . power ( ( 1 - points [ : , 0 ] ) , dim_n_mu - 1 - i ) aux2 = np . power ( points [ : , 0 ] , i ) bernstein_x [ i , : ] = ( special . binom ( dim_n_mu - 1 , i ) * np . multiply ( aux1 , aux2 ) ) for i in range ( 0 , dim_m_mu ) : aux1 = np . power ( ( 1 - points [ : , 1 ] ) , dim_m_mu - 1 - i ) aux2 = np . power ( points [ : , 1 ] , i ) bernstein_y [ i , : ] = special . binom ( dim_m_mu - 1 , i ) * np . multiply ( aux1 , aux2 ) for i in range ( 0 , dim_t_mu ) : aux1 = np . power ( ( 1 - points [ : , 2 ] ) , dim_t_mu - 1 - i ) aux2 = np . power ( points [ : , 2 ] , i ) bernstein_z [ i , : ] = special . binom ( dim_t_mu - 1 , i ) * np . multiply ( aux1 , aux2 ) aux_x = 0. aux_y = 0. aux_z = 0. for j in range ( 0 , dim_m_mu ) : for k in range ( 0 , dim_t_mu ) : bernstein_yz = np . multiply ( bernstein_y [ j , : ] , bernstein_z [ k , : ] ) for i in range ( 0 , dim_n_mu ) : aux = np . multiply ( bernstein_x [ i , : ] , bernstein_yz ) aux_x += aux * self . array_mu_x [ i , j , k ] aux_y += aux * self . array_mu_y [ i , j , k ] aux_z += aux * self . array_mu_z [ i , j , k ] shift_points [ 0 , : ] += aux_x shift_points [ 1 , : ] += aux_y shift_points [ 2 , : ] += aux_z return shift_points . T + points return T_mapping