MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / vectorFieldWrapper

Function vectorFieldWrapper

src/api/c/vector_field.cpp:139–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139af_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

Callers 3

af_draw_vector_field_ndFunction · 0.85
af_draw_vector_field_3dFunction · 0.85
af_draw_vector_field_2dFunction · 0.85

Calls 5

makeContextCurrentFunction · 0.85
getWindowGridMethod · 0.80
dimsMethod · 0.45
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected