| 137 | } |
| 138 | |
| 139 | af_err vectorFieldWrapper(const af_window window, const af_array points, |
| 140 | const af_array directions, |
| 141 | const af_cell* const props) { |
| 142 | try { |
| 143 | if (window == 0) { AF_ERROR("Not a valid window", AF_ERR_INTERNAL); } |
| 144 | |
| 145 | const ArrayInfo& pInfo = getInfo(points); |
| 146 | af::dim4 pDims = pInfo.dims(); |
| 147 | af_dtype pType = pInfo.getType(); |
| 148 | |
| 149 | const ArrayInfo& dInfo = getInfo(directions); |
| 150 | const af::dim4& dDims = dInfo.dims(); |
| 151 | af_dtype dType = dInfo.getType(); |
| 152 | |
| 153 | DIM_ASSERT(0, pDims == dDims); |
| 154 | DIM_ASSERT(0, pDims.ndims() == 2); |
| 155 | DIM_ASSERT(0, |
| 156 | pDims[1] == 2 || |
| 157 | pDims[1] == 3); // Columns:P 2 means 2D and 3 means 3D |
| 158 | |
| 159 | TYPE_ASSERT(pType == dType); |
| 160 | |
| 161 | makeContextCurrent(window); |
| 162 | |
| 163 | fg_chart chart = NULL; |
| 164 | |
| 165 | vector<af_array> pnts; |
| 166 | pnts.push_back(points); |
| 167 | |
| 168 | vector<af_array> dirs; |
| 169 | dirs.push_back(directions); |
| 170 | |
| 171 | switch (pType) { |
| 172 | case f32: |
| 173 | chart = setup_vector_field<float>(window, pnts, dirs, props); |
| 174 | break; |
| 175 | case s32: |
| 176 | chart = setup_vector_field<int>(window, pnts, dirs, props); |
| 177 | break; |
| 178 | case u32: |
| 179 | chart = setup_vector_field<uint>(window, pnts, dirs, props); |
| 180 | break; |
| 181 | case s16: |
| 182 | chart = setup_vector_field<short>(window, pnts, dirs, props); |
| 183 | break; |
| 184 | case u16: |
| 185 | chart = setup_vector_field<ushort>(window, pnts, dirs, props); |
| 186 | break; |
| 187 | case s8: |
| 188 | chart = setup_vector_field<schar>(window, pnts, dirs, props); |
| 189 | break; |
| 190 | case u8: |
| 191 | chart = setup_vector_field<uchar>(window, pnts, dirs, props); |
| 192 | break; |
| 193 | default: TYPE_ERROR(1, pType); |
| 194 | } |
| 195 | auto gridDims = forgeManager().getWindowGrid(window); |
| 196 |
no test coverage detected