| 117 | |
| 118 | |
| 119 | class BaseArray: |
| 120 | # |
| 121 | backend = None |
| 122 | |
| 123 | TypeMap = TypeMap.copy() |
| 124 | TypeMap.pop("g", None) |
| 125 | |
| 126 | def __len__(self): |
| 127 | return len(self.array) |
| 128 | |
| 129 | def __getitem__(self, i): |
| 130 | return self.array[i] |
| 131 | |
| 132 | def __setitem__(self, i, v): |
| 133 | self.array[i] = v |
| 134 | |
| 135 | @property |
| 136 | def mpidtype(self): |
| 137 | try: |
| 138 | return self.TypeMap[self.typecode] |
| 139 | except KeyError: |
| 140 | return MPI.DATATYPE_NULL |
| 141 | |
| 142 | def as_raw(self): |
| 143 | return self.array |
| 144 | |
| 145 | def as_mpi(self): |
| 146 | return (self.as_raw(), self.mpidtype) |
| 147 | |
| 148 | def as_mpi_c(self, count): |
| 149 | return (self.as_raw(), count, self.mpidtype) |
| 150 | |
| 151 | def as_mpi_v(self, cnt, dsp): |
| 152 | return (self.as_raw(), (cnt, dsp), self.mpidtype) |
| 153 | |
| 154 | |
| 155 | if array is not None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…