| 69 | return ngs.la.CreateParallelVector(self.pardofs) |
| 70 | |
| 71 | def N2P (self, ngs_vector, psc_vector=None): |
| 72 | if psc_vector is None: |
| 73 | psc_vector = psc.Vec().createMPI(self.nglob*self.es, bsize=self.es, comm=MPI.COMM_WORLD) |
| 74 | ngs_vector.Distribute() |
| 75 | locvec = psc.Vec().createWithArray(ngs_vector.FV().NumPy(), comm=MPI.COMM_SELF) |
| 76 | if "n2p_scat" not in self.__dict__: |
| 77 | self.n2p_scat = psc.Scatter().create(locvec, self.isetlocfree, psc_vector, self.iset) |
| 78 | psc_vector.set(0) |
| 79 | self.n2p_scat.scatter (locvec, psc_vector, addv=psc.InsertMode.ADD) # 1 max, 2 sum+keep |
| 80 | return psc_vector |
| 81 | |
| 82 | def P2N (self, psc_vector, ngs_vector=None): |
| 83 | if ngs_vector is None: |