#include <math.h>
#include <cstdio>
const static float MINIMUM = -3.0f;
const static float MAXIMUM = 3.0f;
const static float STEP = 0.18f;
int main(int, char**) {
try {
af::Window myWindow(1024, 1024,
"2D Vector Field example: ArrayFire");
array dataRange =
seq(MINIMUM, MAXIMUM, STEP);
do {
myWindow(0, 0).
vectorField(points, saddle,
"Saddle point");
points, hbowl, "hilly bowl (in a loop with varying amplitude)");
}
while (!myWindow.
close());
fprintf(stderr,
"%s\n", e.
what());
throw;
}
return 0;
}
seq is used to create sequences for indexing af::array
array constant(T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype)
AFAPI array join(const int dim, const array &first, const array &second)
Join 2 arrays along dim.
A multi dimensional data container.
void show()
This function swaps the background buffer to current view and polls for any key strokes while the win...
dim_t elements() const
Get the total number of elements across all dimensions of the array.
void eval() const
Evaluate any JIT expressions to generate data for the array.
bool close()
Check if window is marked for close.
AFAPI array flat(const array &in)
AFAPI array sin(const array &in)
C++ Interface for sin.
An ArrayFire exception class.
AFAPI array tile(const array &in, const unsigned x, const unsigned y=1, const unsigned z=1, const unsigned w=1)
dim4 dims() const
Get dimensions of the array.
void vectorField(const array &points, const array &directions, const char *const title=NULL)
Renders the input arrays as a 2D or 3D vector field plot to the window.
virtual const char * what() const
Returns an error message for the exception in a string format.
array T() const
Get the transposed the array.
Window object to render af::arrays.
void grid(const int rows, const int cols)
Setup grid layout for multiview mode in a window.