MCPcopy Create free account
hub / github.com/Kitware/VTK / ConvertToVTK

Method ConvertToVTK

Parallel/MPI4Py/vtkMPI4PyCommunicator.cxx:39–65  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

37
38//------------------------------------------------------------------------------
39vtkMPICommunicator* vtkMPI4PyCommunicator::ConvertToVTK(PyObject* comm)
40{
41 // Import mpi4py if it does not exist.
42 if (!PyMPIComm_Get)
43 {
44 if (import_mpi4py() < 0)
45 {
46 return nullptr;
47 }
48 }
49
50 if (!comm || !PyObject_TypeCheck(comm, &PyMPIComm_Type))
51 {
52 return nullptr;
53 }
54
55 MPI_Comm* mpiComm = PyMPIComm_Get(comm);
56 vtkMPICommunicator* vtkComm = vtkMPICommunicator::New();
57 vtkMPICommunicatorOpaqueComm opaqueComm(mpiComm);
58 if (!vtkComm->InitializeExternal(&opaqueComm))
59 {
60 vtkComm->Delete();
61 return nullptr;
62 }
63
64 return vtkComm;
65}
66
67//------------------------------------------------------------------------------
68void vtkMPI4PyCommunicator::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 4

import_mpi4pyFunction · 0.85
InitializeExternalMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50

Tested by

no test coverage detected