Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /trunk/src/include/Diderot/diderot.h
ViewVC logotype

Annotation of /trunk/src/include/Diderot/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1232 - (view) (download) (as text)

1 : jhr 1115 /*! \file diderot.h
2 :     *
3 :     * \author John Reppy
4 :     *
5 :     * This is the interface to the Diderot runtime for the C target. For now,
6 :     * we are targetting single-precision computations.
7 :     */
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 1232 #include "Diderot/config.h"
18 :    
19 : jhr 1115 /* 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 :     #ifdef NDEBUG
27 :     #define STATIC_INLINE static inline
28 :     #else
29 :     #define STATIC_INLINE static
30 :     #endif
31 :    
32 :     #include <stdint.h>
33 :     #include <stdbool.h>
34 :     #include <stdlib.h>
35 :     #include <math.h>
36 :     #include <stdio.h> // for printing output
37 :    
38 :     #include "types.h"
39 :     #include "strands.h"
40 :    
41 :     /* load image data from Nrrd files */
42 :     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 :    
46 :     /* functions to get input-parameter values */
47 :     extern Status_t Diderot_InputString (const char *, const char **, bool);
48 : jhr 1232 extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool);
49 :     extern Status_t Diderot_InputVec2 (const char *, Diderot_vec2_t *, bool);
50 :     extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *, bool);
51 : jhr 1115
52 : jhr 1232 /* function to get information about the CPU configuration */
53 :    
54 :     typedef struct {
55 :     int numHWNodes; //!< \brief number of (possibly multicore) processors
56 :     int numHWCores; //!< \brief total number of (possibly
57 :     //! mulithreaded) cores
58 :     int numHWThreads; //!< \brief total number of hardware threads
59 :     int numCoresPerNode; //!< \brief number of cores per thread
60 :     int numThdsPerCore; //!< \brief number of threads per core
61 :     } CPUInfo_t;
62 :    
63 :     bool GetNumCPUs (CPUInfo_t *info);
64 :    
65 :    
66 : jhr 1115 /********** scalar math functions **********/
67 :    
68 :     STATIC_INLINE float minf (float a, float b)
69 :     {
70 :     return (a < b)? a : b;
71 :     }
72 :    
73 :     STATIC_INLINE float maxf (float a, float b)
74 :     {
75 :     return (a < b)? b : a;
76 :     }
77 :    
78 :     STATIC_INLINE float lerpf (float a, float b, float t)
79 :     {
80 :     return a + t*(b - a);
81 :     }
82 :    
83 :     /********** vector math functions **********/
84 :    
85 :     #include "inline-vec2.h"
86 :     #include "inline-vec3.h"
87 :     #include "inline-vec4.h"
88 :     #include "inline-matrix.h"
89 :    
90 :    
91 :     /********** other Diderot support functions **********/
92 :    
93 :     #include "inline-image.h"
94 :    
95 :     #endif /* !_DIDEROT_H_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0