| 118 | |
| 119 | |
| 120 | void MemoryViewReader::prepared(PointTableRef) |
| 121 | { |
| 122 | int xyz = 0; |
| 123 | for (const FullField& f : m_fields) |
| 124 | { |
| 125 | if (f.m_name == "X") |
| 126 | xyz |= 1; |
| 127 | else if (f.m_name == "Y") |
| 128 | xyz |= 2; |
| 129 | else if (f.m_name == "Z") |
| 130 | xyz |= 4; |
| 131 | } |
| 132 | if (xyz != 0 && xyz != 7) |
| 133 | throwError("Fields must contain all or none of X, Y and Z."); |
| 134 | if (xyz == 0 && !m_shape.valid()) |
| 135 | throwError("Fields don't contain X, Y and Z and no shape " |
| 136 | "was provided."); |
| 137 | if (xyz == 7 && m_shape.valid()) |
| 138 | throwError("Can't provide `shape` option when Fields contain " |
| 139 | "X, Y and Z."); |
| 140 | if (xyz == 0) |
| 141 | { |
| 142 | if (m_order == Order::RowMajor) |
| 143 | { |
| 144 | m_xDiv = 1; |
| 145 | m_yDiv = m_shape.columns(); |
| 146 | m_zDiv = m_shape.columns() * m_shape.rows(); |
| 147 | |
| 148 | m_xIter = m_shape.columns(); |
| 149 | m_yIter = m_shape.columns() * m_shape.rows(); |
| 150 | m_zIter = m_shape.columns() * m_shape.rows() * m_shape.depth(); |
| 151 | } |
| 152 | else // Column Major |
| 153 | { |
| 154 | m_xDiv = m_shape.depth() * m_shape.rows(); |
| 155 | m_yDiv = m_shape.depth(); |
| 156 | m_zDiv = 1; |
| 157 | |
| 158 | m_xIter = m_shape.depth() * m_shape.rows() * m_shape.columns(); |
| 159 | m_yIter = m_shape.depth() * m_shape.rows(); |
| 160 | m_zIter = m_shape.depth(); |
| 161 | } |
| 162 | } |
| 163 | m_prepared = true; |
| 164 | } |
| 165 | |
| 166 | |
| 167 | void MemoryViewReader::ready(PointTableRef) |