Skip to content

Commit 4c8a291

Browse files
authored
Merge pull request #126 from arrayfire/devel
Release 0.9.2
2 parents c6bea12 + 175a6b2 commit 4c8a291

19 files changed

+2416
-1059
lines changed

CMakeModules/FindFontConfig.cmake

+14-6
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
# Redistribution and use is allowed according to the terms of the BSD license.
1111
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
1212

13-
if ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
13+
IF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
1414
# in cache already
1515
SET(Fontconfig_FIND_QUIETLY TRUE)
16-
endif ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
16+
ENDIF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
1717

1818
# use pkg-config to get the directories and then use these values
1919
# in the FIND_PATH() and FIND_LIBRARY() calls
20-
if(NOT WIN32)
21-
find_package(PkgConfig)
20+
IF (NOT WIN32)
21+
FIND_PACKAGE(PkgConfig)
2222

2323
pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig)
24-
endif(NOT WIN32)
24+
ENDIF (NOT WIN32)
2525

2626
FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
2727
PATHS
@@ -32,6 +32,10 @@ FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
3232
${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config
3333
)
3434

35+
IF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)
36+
MESSAGE(FATAL_ERROR "FontConfig header files not found")
37+
ENDIF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)
38+
3539
FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
3640
PATHS
3741
/usr/local
@@ -44,7 +48,11 @@ FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
4448
lib
4549
)
4650

47-
include(FindPackageHandleStandardArgs)
51+
IF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)
52+
MESSAGE(FATAL_ERROR "FontConfig library files not found")
53+
ENDIF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)
54+
55+
INCLUDE(FindPackageHandleStandardArgs)
4856
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
4957

5058
# show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view

CMakeModules/Version.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ENDIF()
99

1010
SET(FG_VERSION_MAJOR "0")
1111
SET(FG_VERSION_MINOR "9")
12-
SET(FG_VERSION_PATCH "0")
12+
SET(FG_VERSION_PATCH "2")
1313

1414
SET(FG_VERSION "${FG_VERSION_MAJOR}.${FG_VERSION_MINOR}.${FG_VERSION_PATCH}")
1515
SET(FG_API_VERSION_CURRENT ${FG_VERSION_MAJOR}${FG_VERSION_MINOR})

docs/images/gfx_palette.png

-82.8 KB
Binary file not shown.

examples/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ OPTION(BUILD_EXAMPLES_CUDA "Turn off/on building cuda examples" ON)
77
OPTION(BUILD_EXAMPLES_OPENCL "Turn off/on building opencl examples" ON)
88
OPTION(USE_SYSTEM_CL2HPP "Use cl2.hpp header installed on the system" OFF)
99

10-
INCLUDE(build_cl2hpp)
10+
IF(NOT USE_SYSTEM_CL2HPP)
11+
INCLUDE(build_cl2hpp)
12+
ENDIF()
1113

1214
MACRO(BUILD_EXAMPLE EX_NAME EX_SRC COMPUTE_NAME FG_LIBS COMPUTE_LIBS)
1315
IF(${COMPUTE_NAME} STREQUAL "cuda")
@@ -22,7 +24,9 @@ MACRO(BUILD_EXAMPLE EX_NAME EX_SRC COMPUTE_NAME FG_LIBS COMPUTE_LIBS)
2224
RUNTIME_OUTPUT_DIRECTORY ${DIR_NAME}
2325
FOLDER "Examples/${COMPUTE_NAME}")
2426
IF(${COMPUTE_NAME} STREQUAL "opencl")
25-
ADD_DEPENDENCIES(example_${EX_NAME}_${COMPUTE_NAME} cl2hpp)
27+
IF(NOT USE_SYSTEM_CL2HPP)
28+
ADD_DEPENDENCIES(example_${EX_NAME}_${COMPUTE_NAME} cl2hpp)
29+
ENDIF()
2630
ENDIF()
2731
ENDMACRO()
2832

examples/cpu/surface.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717

1818
using namespace std;
1919

20-
static const float XMIN = -8.0f;
21-
static const float XMAX = 8.f;
22-
static const float YMIN = -8.0f;
23-
static const float YMAX = 8.f;
20+
static const float XMIN = -32.0f;
21+
static const float XMAX = 32.0f;
22+
static const float YMIN = -32.0f;
23+
static const float YMAX = 32.0f;
2424

25-
const float DX = 0.5;
25+
const float DX = 0.25;
2626
const size_t XSIZE = (XMAX-XMIN)/DX;
2727
const size_t YSIZE = (YMAX-YMIN)/DX;
2828

2929
void genSurface(float dx, std::vector<float> &vec )
3030
{
3131
vec.clear();
32-
for(float x=XMIN; x < XMAX; x+=dx){
33-
for(float y=YMIN; y < YMAX; y+=dx){
32+
for(float x=XMIN; x < XMAX; x+=dx) {
33+
for(float y=YMIN; y < YMAX; y+=dx) {
3434
vec.push_back(x);
3535
vec.push_back(y);
3636
float z = sqrt(x*x+y*y) + 2.2204e-16;
@@ -50,7 +50,7 @@ int main(void)
5050
wnd.makeCurrent();
5151

5252
forge::Chart chart(FG_CHART_3D);
53-
chart.setAxesLimits(-10.f, 10.f, -10.f, 10.f, -0.5f, 1.f);
53+
chart.setAxesLimits(XMIN-2.0f, XMAX+2.0f, YMIN-2.0f, YMAX+2.0f, -0.5f, 1.f);
5454
chart.setAxesTitles("x-axis", "y-axis", "z-axis");
5555

5656
forge::Surface surf = chart.surface(XSIZE, YSIZE, forge::f32);

include/fg/chart.h

+32-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ FGAPI fg_err fg_set_chart_axes_limits(fg_chart pHandle,
7878
const float pYmin, const float pYmax,
7979
const float pZmin, const float pZmax);
8080

81+
/**
82+
Get axes data ranges
83+
84+
\param[out] pXmin is x-axis minimum data value
85+
\param[out] pXmax is x-axis maximum data value
86+
\param[out] pYmin is y-axis minimum data value
87+
\param[out] pYmax is y-axis maximum data value
88+
\param[out] pZmin is z-axis minimum data value
89+
\param[out] pZmax is z-axis maximum data value
90+
\param[in] pHandle is chart handle
91+
92+
\ingroup chart_functions
93+
*/
94+
FGAPI fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
95+
float* pYmin, float* pYmax,
96+
float* pZmin, float* pZmax,
97+
const fg_chart pHandle);
8198
/**
8299
Set legend position for Chart
83100
@@ -268,7 +285,21 @@ class Chart {
268285
*/
269286
FGAPI void setAxesLimits(const float pXmin, const float pXmax,
270287
const float pYmin, const float pYmax,
271-
const float pZmin=-1, const float pZmax=1);
288+
const float pZmin=0, const float pZmax=0);
289+
290+
/**
291+
Get axes data ranges
292+
293+
\param[out] pXmin is x-axis minimum data value
294+
\param[out] pXmax is x-axis maximum data value
295+
\param[out] pYmin is y-axis minimum data value
296+
\param[out] pYmax is y-axis maximum data value
297+
\param[out] pZmin is z-axis minimum data value
298+
\param[out] pZmax is z-axis maximum data value
299+
*/
300+
FGAPI void getAxesLimits(float* pXmin, float* pXmax,
301+
float* pYmin, float* pYmax,
302+
float* pZmin = NULL, float* pZmax = NULL);
272303

273304
/**
274305
Set legend position for Chart

include/fg/defines.h

+11-9
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,19 @@ typedef enum {
121121

122122
/**
123123
Color maps
124-
125-
\image html gfx_palette.png
126124
*/
127125
typedef enum {
128-
FG_COLOR_MAP_DEFAULT = 0, ///< Default [0-255] grayscale colormap
129-
FG_COLOR_MAP_SPECTRUM = 1, ///< Spectrum color
130-
FG_COLOR_MAP_COLORS = 2, ///< Pure Colors
131-
FG_COLOR_MAP_RED = 3, ///< Red color map
132-
FG_COLOR_MAP_MOOD = 4, ///< Mood color map
133-
FG_COLOR_MAP_HEAT = 5, ///< Heat color map
134-
FG_COLOR_MAP_BLUE = 6 ///< Blue color map
126+
FG_COLOR_MAP_DEFAULT = 0, ///< Default [0-255] grayscale colormap
127+
FG_COLOR_MAP_SPECTRUM = 1, ///< Visual spectrum (390nm-830nm) in sRGB colorspace
128+
FG_COLOR_MAP_RAINBOW = 2, ///< Rainbow color map
129+
FG_COLOR_MAP_RED = 3, ///< Red color map
130+
FG_COLOR_MAP_MOOD = 4, ///< Mood color map
131+
FG_COLOR_MAP_HEAT = 5, ///< Heat color map
132+
FG_COLOR_MAP_BLUE = 6, ///< Blue color map
133+
FG_COLOR_MAP_INFERNO = 7, ///< perceptually uniform shades of black-red-yellow
134+
FG_COLOR_MAP_MAGMA = 8, ///< perceptually uniform shades of black-red-white
135+
FG_COLOR_MAP_PLASMA = 9, ///< perceptually uniform shades of blue-red-yellow
136+
FG_COLOR_MAP_VIRIDIS = 10, ///< perceptually uniform shades of blue-green-yellow
135137
} fg_color_map;
136138

137139
typedef enum {

src/api/c/chart.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,28 @@ fg_err fg_set_chart_axes_limits(fg_chart pHandle,
7272
return FG_ERR_NONE;
7373
}
7474

75+
fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
76+
float* pYmin, float* pYmax,
77+
float* pZmin, float* pZmax,
78+
const fg_chart pHandle)
79+
{
80+
try {
81+
float xmin, xmax, ymin, ymax, zmin, zmax;
82+
getChart(pHandle)->getAxesLimits(&xmin, &xmax, &ymin, &ymax, &zmin, &zmax);
83+
84+
// Check for NULLs and assign
85+
if(pXmin) *pXmin = xmin;
86+
if(pXmax) *pXmax = xmax;
87+
if(pYmin) *pYmin = ymin;
88+
if(pYmax) *pYmax = ymax;
89+
if(pZmin) *pZmin = zmin;
90+
if(pZmax) *pZmax = zmax;
91+
}
92+
CATCHALL
93+
94+
return FG_ERR_NONE;
95+
}
96+
7597
fg_err fg_set_chart_legend_position(fg_chart pHandle, const float pX, const float pY)
7698
{
7799
try {

src/api/cpp/chart.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@ void Chart::setAxesLimits(const float pXmin, const float pXmax,
6262
} CATCH_INTERNAL_TO_EXTERNAL
6363
}
6464

65+
void Chart::getAxesLimits(float* pXmin, float* pXmax,
66+
float* pYmin, float* pYmax,
67+
float* pZmin, float* pZmax)
68+
{
69+
try {
70+
float xmin, xmax, ymin, ymax, zmin, zmax;
71+
getChart(mValue)->getAxesLimits(&xmin, &xmax, &ymin, &ymax, &zmin, &zmax);
72+
73+
// Check for NULLs and assign
74+
if(pXmin) *pXmin = xmin;
75+
if(pXmax) *pXmax = xmax;
76+
if(pYmin) *pYmin = ymin;
77+
if(pYmax) *pYmax = ymax;
78+
if(pZmin) *pZmin = zmin;
79+
if(pZmax) *pZmax = zmax;
80+
} CATCH_INTERNAL_TO_EXTERNAL
81+
}
82+
6583
void Chart::setLegendPosition(const float pX, const float pY)
6684
{
6785
try {

src/backend/chart.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ class Chart {
6565
mChart->setAxesLimits(pXmin, pXmax, pYmin, pYmax, pZmin, pZmax);
6666
}
6767

68+
inline void getAxesLimits(float* pXmin, float* pXmax,
69+
float* pYmin, float* pYmax,
70+
float* pZmin, float* pZmax) {
71+
mChart->getAxesLimits(pXmin, pXmax, pYmin, pYmax, pZmin, pZmax);
72+
}
73+
6874
inline void setLegendPosition(const unsigned pX, const unsigned pY) {
6975
mChart->setLegendPosition(pX, pY);
7076
}

0 commit comments

Comments
 (0)