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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1714 - (download) (as text) (annotate)
Sat Mar 10 00:00:50 2012 UTC (7 years, 6 months ago) by jhr
File size: 2520 byte(s)
  Working on library generation
/*! \file world.h
 *
 * \author John Reppy
 */

/*
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */

#ifndef _DIDEROT_WORLD_H_
#define _DIDEROT_WORLD_H_

#ifndef _DIDEROT_TYPES_H_
#include "types.h"
#endif

typedef struct struct_world Diderot_World_t;

//! the integer typed used to represent the strand status array.
#if defined(DIDEROT_TARGET_CL)
typedef uint32_t StatusInt_t;
#else
typedef uint8_t StatusInt_t;
#endif

/* The World_t structure type varies across targets, but all targets share the same prefix. */
#define STRUCT_WORLD_PREFIX                                                                     \
    const char          *name;          /*!< the program name */                                \
    bool                isArray;        /*!< are the strands in an array or collection? */	\
    int32_t		nStrandTys;	/*!< number of strand types in the program. */		\
    Strand_t		*strandDesc;	/*!< nStrandTys array of strand descriptors */		\
    uint32_t            nDims;          /*!< depth of iteration nesting */                      \
    int32_t             *base;          /*!< nDims array of base indices */                     \
    uint32_t            *size;          /*!< nDims array of iteration sizes */                  \
    uint32_t            numStrands;     /*!< number of strands in the world */                  \
    size_t              outputSzb;      /*!< the output size of the strands */                  \
    StatusInt_t         *status;        /*!< array of strand status flags */

/*! \brief a structure type for accessing the common fields of a world. */
typedef struct {
    STRUCT_WORLD_PREFIX
} WorldPrefix_t;

/*! \brief get the strand in state.
 *  \param wrld the world pointer.
 *  \param i the strand index
 *  \return a pointer to the strand's state.
 */
extern void *Diderot_InState (Diderot_World_t *wrld, uint32_t i);

/*! \brief get the strand out state.
 *  \param wrld the world pointer.
 *  \param i the strand index
 *  \return a pointer to the strand's state.
 */
extern void *Diderot_OutState (Diderot_World_t *wrld, uint32_t i);

/*! \brief is a strand active?
 *  \param wrld the world pointer.
 *  \param i the strand index
 *  \return true if the strand is active.
 */
STATIC_INLINE bool Diderot_IsActive (Diderot_World_t *wrld, uint32_t i)
{
    WorldPrefix_t *hdr = (WorldPrefix_t *)wrld;
    assert (i < hdr->numStrands);
    return !hdr->status[i];
}

#endif /* !_DIDEROT_WORLD_H_ */

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