Exemplo n.º 1
0
def get_facet_dof_permutations(n_fp, order):
    """
    Prepare DOF permutation vector for each possible facet orientation.
    """
    from sfepy.base.base import dict_to_array

    if n_fp == 2:
        mtx = make_line_matrix(order)
        ori_map = ori_line_to_iter
        fo = order - 1

    elif n_fp == 3:
        mtx = make_triangle_matrix(order)
        ori_map = ori_triangle_to_iter
        fo = order - 2

    elif n_fp == 4:
        mtx = make_square_matrix(order)
        ori_map = {}
        for key, val in six.iteritems(_quad_ori_groups):
            ori_map[key] = ori_square_to_iter[val]
        fo = order - 1

    else:
        raise ValueError('unsupported number of facet points! (%d)' % n_fp)

    dof_perms = {}
    for key, itfun in six.iteritems(ori_map):
        dof_perms[key] = [mtx[ii] for ii in itfun(fo)]

    dof_perms = dict_to_array(dof_perms)

    return dof_perms
Exemplo n.º 2
0
def get_facet_dof_permutations(n_fp, igs, order):
    """
    Prepare DOF permutation vector for each possible facet orientation.
    """
    from sfepy.base.base import dict_to_array

    if n_fp == 2:
        mtx = make_line_matrix(order)
        ori_map = ori_line_to_iter
        fo = order - 1

    elif n_fp == 3:
        mtx = make_triangle_matrix(order)
        ori_map = ori_triangle_to_iter
        fo = order - 2

    elif n_fp == 4:
        mtx = make_square_matrix(order)
        ori_map = {}
        for key, val in _quad_ori_groups.iteritems():
            ori_map[key] = ori_square_to_iter[val]
        fo = order - 1

    else:
        raise ValueError('unsupported number of facet points! (%d)' % n_fp)

    dof_perms = {}
    for ig in igs:
        dof_perms[ig] = {}
        for key, itfun in ori_map.iteritems():
            dof_perms[ig][key] = [mtx[ii] for ii in itfun(fo)]

        dof_perms[ig] = dict_to_array(dof_perms[ig])

    return dof_perms
Exemplo n.º 3
0
    def get_facet_dof_permutations(self, nodes):
        """
        Given description of facet DOF nodes, return the DOF
        permutations for all possible facet orientations.
        """
        int_coors, ori_maps = self.get_dof_orientation_maps(nodes)

        aux = get_facet_dof_permutations(int_coors, ori_maps)
        dof_perms = {}
        for ig, val in aux.iteritems():
            dof_perms[ig] = dict_to_array(val)

        return dof_perms
Exemplo n.º 4
0
    def get_facet_dof_permutations(self, nodes):
        """
        Given description of facet DOF nodes, return the DOF
        permutations for all possible facet orientations.
        """
        int_coors, ori_maps = self.get_dof_orientation_maps(nodes)

        aux = get_facet_dof_permutations(int_coors, ori_maps)
        dof_perms = {}
        for ig, val in aux.iteritems():
            dof_perms[ig] = dict_to_array(val)

        return dof_perms