SCM Repository
Annotation of /branches/pure-cfg/src/include/Diderot/diderot.h
Parent Directory
|
Revision Log
Revision 1196 - (view) (download) (as text)
1 : | jhr | 438 | /*! \file diderot.h |
2 : | * | ||
3 : | * \author John Reppy | ||
4 : | jhr | 441 | * |
5 : | * This is the interface to the Diderot runtime for the C target. For now, | ||
6 : | * we are targetting single-precision computations. | ||
7 : | jhr | 438 | */ |
8 : | |||
9 : | /* | ||
10 : | * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu) | ||
11 : | * All rights reserved. | ||
12 : | */ | ||
13 : | |||
14 : | #ifndef _DIDEROT_H_ | ||
15 : | #define _DIDEROT_H_ | ||
16 : | |||
17 : | jhr | 1196 | #include "Diderot/config.h" |
18 : | |||
19 : | jhr | 601 | /* gcc has a bug that breaks code that uses 8-byte vectors (e.g., vec2f_t), but clang |
20 : | * handles the code correctly. | ||
21 : | */ | ||
22 : | #if defined(__clang__) | ||
23 : | # define VEC2_OK | ||
24 : | #endif | ||
25 : | |||
26 : | jhr | 579 | #ifdef NDEBUG |
27 : | jhr | 440 | #define STATIC_INLINE static inline |
28 : | jhr | 579 | #else |
29 : | #define STATIC_INLINE static | ||
30 : | #endif | ||
31 : | jhr | 440 | |
32 : | jhr | 438 | #include <stdint.h> |
33 : | #include <stdbool.h> | ||
34 : | jhr | 558 | #include <stdlib.h> |
35 : | #include <math.h> | ||
36 : | jhr | 654 | #include <stdio.h> // for printing output |
37 : | jhr | 438 | |
38 : | jhr | 710 | #include "types.h" |
39 : | #include "strands.h" | ||
40 : | jhr | 438 | |
41 : | /* load image data from Nrrd files */ | ||
42 : | jhr | 561 | extern Status_t Diderot_LoadImage1D (Diderot_string_t name, Diderot_image1D_t **img); |
43 : | extern Status_t Diderot_LoadImage2D (Diderot_string_t name, Diderot_image2D_t **img); | ||
44 : | extern Status_t Diderot_LoadImage3D (Diderot_string_t name, Diderot_image3D_t **img); | ||
45 : | jhr | 438 | |
46 : | jhr | 439 | /* functions to get input-parameter values */ |
47 : | jhr | 438 | extern Status_t Diderot_InputString (const char *, const char **, bool); |
48 : | jhr | 561 | extern Status_t Diderot_Inputf (const char *, float *, bool); |
49 : | extern Status_t Diderot_InputVec3f (const char *, vec3f_t *, bool); | ||
50 : | jhr | 438 | |
51 : | jhr | 1196 | /* function to get information about the CPU configuration */ |
52 : | |||
53 : | typedef struct { | ||
54 : | int numHWNodes; //!< \brief number of (possibly multicore) processors | ||
55 : | int numHWCores; //!< \brief total number of (possibly | ||
56 : | //! mulithreaded) cores | ||
57 : | int numHWThreads; //!< \brief total number of hardware threads | ||
58 : | int numCoresPerNode; //!< \brief number of cores per thread | ||
59 : | int numThdsPerCore; //!< \brief number of threads per core | ||
60 : | } CPUInfo_t; | ||
61 : | |||
62 : | bool GetNumCPUs (CPUInfo_t *info); | ||
63 : | |||
64 : | |||
65 : | jhr | 561 | /********** scalar math functions **********/ |
66 : | |||
67 : | glk | 758 | STATIC_INLINE float minf (float a, float b) |
68 : | { | ||
69 : | return (a < b)? a : b; | ||
70 : | } | ||
71 : | |||
72 : | jhr | 561 | STATIC_INLINE float maxf (float a, float b) |
73 : | { | ||
74 : | return (a < b)? b : a; | ||
75 : | } | ||
76 : | |||
77 : | jhr | 756 | STATIC_INLINE float lerpf (float a, float b, float t) |
78 : | { | ||
79 : | return a + t*(b - a); | ||
80 : | } | ||
81 : | |||
82 : | jhr | 710 | /********** vector math functions **********/ |
83 : | jhr | 588 | |
84 : | jhr | 710 | #include "inline-vec2.h" |
85 : | #include "inline-vec3.h" | ||
86 : | #include "inline-vec4.h" | ||
87 : | jhr | 727 | #include "inline-matrix.h" |
88 : | jhr | 588 | |
89 : | |||
90 : | jhr | 560 | /********** other Diderot support functions **********/ |
91 : | |||
92 : | jhr | 710 | #include "inline-image.h" |
93 : | jhr | 449 | |
94 : | jhr | 438 | #endif /* !_DIDEROT_H_ */ |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |