コード例 #1
0
    def _permutation_load(tensor, directory, filename, form, form_name,
                          mpi_comm):
        if form_name not in _permutation_storage:
            if not PickleIO.exists_file(directory, "." + form_name):
                raise OSError
            else:
                V_0 = wrapping.form_argument_space(form, 0)
                V_0__dof_map_reader_mapping = wrapping.build_dof_map_reader_mapping(
                    V_0)
                V_0__dof_map_writer_mapping = PickleIO.load_file(
                    directory, "." + form_name)
                vector_permutation = dict(
                )  # from index at time of saving to current index
                writer_vec = _vector_load(directory, filename, mpi_comm)
                writer_row_start, writer_row_end = writer_vec.getOwnershipRange(
                )
                for writer_row in range(writer_row_start, writer_row_end):
                    (global_cell_index,
                     cell_dof) = V_0__dof_map_writer_mapping[writer_row]
                    vector_permutation[
                        writer_row] = V_0__dof_map_reader_mapping[
                            global_cell_index][cell_dof]
                _permutation_storage[form_name] = vector_permutation

        return _permutation_storage[form_name]
コード例 #2
0
    def _permutation_load(tensor, directory, filename, form, form_name, mpi_comm):
        if form_name not in _permutation_storage:
            if not PickleIO.exists_file(directory, "." + form_name):
                raise OSError
            else:
                V_0 = wrapping.form_argument_space(form, 0)
                V_1 = wrapping.form_argument_space(form, 1)
                V_0__dof_map_reader_mapping = wrapping.build_dof_map_reader_mapping(V_0)
                V_1__dof_map_reader_mapping = wrapping.build_dof_map_reader_mapping(V_1)
                (V_0__dof_map_writer_mapping, V_1__dof_map_writer_mapping) = PickleIO.load_file(
                    directory, "." + form_name)
                matrix_row_permutation = dict()  # from row index at time of saving to current row index
                matrix_col_permutation = dict()  # from col index at time of saving to current col index
                writer_mat = _matrix_load(directory, filename, mpi_comm)
                writer_row_start, writer_row_end = writer_mat.getOwnershipRange()
                for writer_row in range(writer_row_start, writer_row_end):
                    (global_cell_index, cell_dof) = V_0__dof_map_writer_mapping[writer_row]
                    matrix_row_permutation[writer_row] = V_0__dof_map_reader_mapping[global_cell_index][cell_dof]
                    writer_cols, _ = writer_mat.getRow(writer_row)
                    for writer_col in writer_cols:
                        if writer_col not in matrix_col_permutation:
                            (global_cell_index, cell_dof) = V_1__dof_map_writer_mapping[writer_col]
                            matrix_col_permutation[writer_col] = V_1__dof_map_reader_mapping[
                                global_cell_index][cell_dof]
                _permutation_storage[form_name] = (matrix_row_permutation, matrix_col_permutation)

        return _permutation_storage[form_name]