← Back to team overview

dolfin team mailing list archive

Re: PyDOLFIN, SWIG and overloaded constructor

 

Whether or not something is being run in parallel should be determined by the number of processes,

  uint dolfin::MPI::num_processes()

Garth

Evan Lezar wrote:
Hi

I have added a constructor to PETScMatrix to allow me to control whether the matrix is to be created in parallel or not. The declarations are given below

/// Create empty matrix
explicit PETScMatrix(Type type=default_matrix);

/// Create an empty matrix explicitly setting the parallel flag
explicit PETScMatrix(bool is_parallel, Type type=default_matrix);

The idea is that I use

S = PETScMatrix(False) If I want to create a matrix that is local. The problem is that swig can't differentiate between Type and bool (and uint for the PETScMatrix(uint M, uint N, Type type=default_matrix); constructor). I have seen that it is possible to rename PETScMatrix(bool) to PETScMatrix_bool(bool) for example so that the python call would be

S = PETScMatrix_bool(False),

but I can't seem to get this working.  Any suggestions?

Thanks
Evan


------------------------------------------------------------------------

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev



Follow ups

References