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 1115 - (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 :     /* gcc has a bug that breaks code that uses 8-byte vectors (e.g., vec2f_t), but clang
18 :     * handles the code correctly.
19 :     */
20 :     #if defined(__clang__)
21 :     # define VEC2_OK
22 :     #endif
23 :    
24 :     #ifdef NDEBUG
25 :     #define STATIC_INLINE static inline
26 :     #else
27 :     #define STATIC_INLINE static
28 :     #endif
29 :    
30 :     #include <stdint.h>
31 :     #include <stdbool.h>
32 :     #include <stdlib.h>
33 :     #include <math.h>
34 :     #include <stdio.h> // for printing output
35 :    
36 :     #include "types.h"
37 :     #include "strands.h"
38 :    
39 :     /* load image data from Nrrd files */
40 :     extern Status_t Diderot_LoadImage1D (Diderot_string_t name, Diderot_image1D_t **img);
41 :     extern Status_t Diderot_LoadImage2D (Diderot_string_t name, Diderot_image2D_t **img);
42 :     extern Status_t Diderot_LoadImage3D (Diderot_string_t name, Diderot_image3D_t **img);
43 :    
44 :     /* functions to get input-parameter values */
45 :     extern Status_t Diderot_InputString (const char *, const char **, bool);
46 :     extern Status_t Diderot_Inputf (const char *, float *, bool);
47 :     extern Status_t Diderot_InputVec3f (const char *, vec3f_t *, bool);
48 :    
49 :     /********** scalar math functions **********/
50 :    
51 :     STATIC_INLINE float minf (float a, float b)
52 :     {
53 :     return (a < b)? a : b;
54 :     }
55 :    
56 :     STATIC_INLINE float maxf (float a, float b)
57 :     {
58 :     return (a < b)? b : a;
59 :     }
60 :    
61 :     STATIC_INLINE float lerpf (float a, float b, float t)
62 :     {
63 :     return a + t*(b - a);
64 :     }
65 :    
66 :     /********** vector math functions **********/
67 :    
68 :     #include "inline-vec2.h"
69 :     #include "inline-vec3.h"
70 :     #include "inline-vec4.h"
71 :     #include "inline-matrix.h"
72 :    
73 :    
74 :     /********** other Diderot support functions **********/
75 :    
76 :     #include "inline-image.h"
77 :    
78 :     #endif /* !_DIDEROT_H_ */

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