parallel.py

Define classes and functions for parallel computations within PETGEM.

petgem.parallel.createParallelDenseMatrix(dimension1, dimension2, communicator=None)[source]

Create a parallel dense matrix in petsc format. :param int dimension1: matrix dimension (rows). :param int dimension2: matrix dimension (columns). :param str communicator: mpi communicator. :return: parallel matrix. :rtype: petsc parallel and dense matrix.

petgem.parallel.createParallelMatrix(dimension1, dimension2, nnz, matrix_type, communicator=None)[source]

Create a parallel sparse matrix in petsc format. :param int dimension1: matrix dimension (rows). :param int dimension2: matrix dimension (columns). :param int nnz: not zero pattern for allocation. :param int matrix_type: matrix type for parallel computations. :param str communicator: mpi communicator. :return: parallel matrix. :rtype: petsc AIJ parallel matrix.

petgem.parallel.createParallelVector(size, vector_type, communicator=None)[source]

Create a parallel vector in petsc format. :param int size: vector size. :param int vector_type: vector type for parallel computations. :param str communicator: mpi communicator. :return: parallel vector. :rtype: petsc parallel vector.

petgem.parallel.createSequentialDenseMatrixWithArray(dimension1, dimension2, data)[source]

Given an input array, create a sequential dense matrix in petsc format. :param int dimension1: matrix dimension (rows). :param int dimension2: matrix dimension (columns). :param ndarray data: data to be exported. :return: parallel matrix. :rtype: petsc parallel and dense matrix.

petgem.parallel.createSequentialVector(size, vector_type, communicator=None)[source]

Create a sequential vector in petsc format. :param int size: vector size. :param int vector_type: vector type for parallel computations. :param str communicator: mpi communicator. :return: sequential vector. :rtype: petsc sequential vector.

petgem.parallel.createSequentialVectorWithArray(data)[source]

Given an input array, create a sequential vector in petsc format. :param ndarray data: data to be exported. :return: parallel matrix. :rtype: petsc parallel and dense matrix.

petgem.parallel.readPetscMatrix(input_file, communicator=None)[source]

Read a Petsc matrix which format is defined by two files: input_file.dat and input_file.info :param str input_file: file name to be readed. :param str communicator: mpi communicator. :return: petsc_matrix. :rtype: petsc sparse matrix.

petgem.parallel.readPetscVector(input_file, communicator=None)[source]

Read a Petsc vector which format is defined by two files: input_file.dat and input_file.info. :param str input_file: file name to be readed. :param str communicator: mpi communicator. :return: petsc_vector. :rtype: petsc vector.

petgem.parallel.unitary_test()[source]

Unitary test for parallel.py script.

petgem.parallel.writeDenseMatrix(output_file, data, communicator=None)[source]

Write a Petsc dense matrix which format is defined by two files: output_file.dat and output_file.info. :param str output_file: file name to be saved. :param petsc matrix data: dense matrix to be saved. :param str communicator: mpi communicator. :return: None.

petgem.parallel.writeParallelDenseMatrix(output_file, data, communicator=None)[source]

Write a Petsc parallel dense matrix which format is defined by two files: output_file.dat and output_file.info. :param str output_file: file name to be saved. :param petsc matrix data: dense matrix to be saved. :param str communicator: mpi communicator. :return: None.

petgem.parallel.writePetscVector(output_file, data, communicator=None)[source]

Write a Petsc vector which format is defined by two files: output_file.dat and output_file.info. :param str output_file: file name to be saved. :param petsc vector data: array to be saved. :param str communicator: mpi communicator. :return: None.