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

SCM Repository

[diderot] Annotation of /branches/vis12/src/include/Diderot/world.h
ViewVC logotype

Annotation of /branches/vis12/src/include/Diderot/world.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1640 - (view) (download) (as text)
Original Path: trunk/src/include/Diderot/world.h

1 : jhr 1640 /*! \file world.h
2 :     *
3 :     * \author John Reppy
4 :     */
5 :    
6 :     /*
7 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     * All rights reserved.
9 :     */
10 :    
11 :     #ifndef _DIDEROT_WORLD_H_
12 :     #define _DIDEROT_WORLD_H_
13 :    
14 :     #ifndef _DIDEROT_TYPES_H_
15 :     #include "types.h"
16 :     #endif
17 :    
18 :     typedef struct struct_world Diderot_World_t;
19 :    
20 :     //! the integer typed used to represent the strand status array.
21 :     #if defined(DIDEROT_TARGET_CL)
22 :     typedef uint32_t StatusInt_t;
23 :     #else
24 :     typedef uint8_t StatusInt_t;
25 :     #endif
26 :    
27 :     /* The World_t structure type varies across targets, but all targets share the same prefix. */
28 :     #define STRUCT_WORLD_PREFIX \
29 :     const char *name; /*!< the program name */ \
30 :     bool isArray; /*!< is the initialization an array or collection? */ \
31 :     uint32_t nDims; /*!< depth of iteration nesting */ \
32 :     int32_t *base; /*!< nDims array of base indices */ \
33 :     uint32_t *size; /*!< nDims array of iteration sizes */ \
34 :     uint32_t numStrands; /*!< number of strands in the world */ \
35 :     size_t outputSzb; /*!< the output size of the strands */ \
36 :     StatusInt_t *status; /*!< array of strand status flags */
37 :    
38 :     /*! \brief a structure type for accessing the common fields of a world. */
39 :     typedef struct {
40 :     STRUCT_WORLD_PREFIX
41 :     } WorldPrefix_t;
42 :    
43 :     /*! \brief get the strand in state.
44 :     * \param wrld the world pointer.
45 :     * \param i the strand index
46 :     * \return a pointer to the strand's state.
47 :     */
48 :     extern void *Diderot_InState (Diderot_World_t *wrld, uint32_t i);
49 :    
50 :     /*! \brief get the strand out state.
51 :     * \param wrld the world pointer.
52 :     * \param i the strand index
53 :     * \return a pointer to the strand's state.
54 :     */
55 :     extern void *Diderot_OutState (Diderot_World_t *wrld, uint32_t i);
56 :    
57 :     /*! \brief is a strand active?
58 :     * \param wrld the world pointer.
59 :     * \param i the strand index
60 :     * \return true if the strand is active.
61 :     */
62 :     STATIC_INLINE bool Diderot_IsActive (Diderot_World_t *wrld, uint32_t i)
63 :     {
64 :     WorldPrefix_t *hdr = (WorldPrefix_t *)wrld;
65 :     assert (i < hdr->numStrands);
66 :     return !hdr->status[i];
67 :     }
68 :    
69 :     #endif /* !_DIDEROT_WORLD_H_ */

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