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

SCM Repository

[diderot] View of /branches/vis15/src/lib/include/diderot/world.hxx
ViewVC logotype

View of /branches/vis15/src/lib/include/diderot/world.hxx

Parent Directory Parent Directory | Revision Log Revision Log

Revision 4797 - (download) (as text) (annotate)
Mon Oct 24 16:59:27 2016 UTC (2 years, 10 months ago) by jhr
File size: 2923 byte(s)
working on parallel target
/*! \file world.hxx
 * \author John Reppy

 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.


#include <iostream>
#include <teem/biff.h>
#include <teem/nrrd.h>

namespace diderot {

    // stages of execution of a program
    enum execution_state {
        POST_NEW = 0,                       // world allocated, but not initialized
        POST_INIT = 1,                      // Init function has been called
        POST_CREATE = 2,                    // globals and strands have been initialized
        RUNNING = 3,                        // program is running
        DONE = 4                            // program has terminated

    // the base struct for the world type
    struct world_base {
        std::string         _name;          // the program name
        biffMsg             *_errors;       // holds error messages (if any)
        execution_state     _stage;         // current stage of program execution
        bool                _verbose;       // true if running in verbose mode
        bool                _is_array;      // are the strands in an array or collection?
        uint32_t            _naxes;         // depth of iteration nesting
        uint32_t            *_base;         // nAxes array of base indices
        uint32_t            *_size;         // nAxes array of iteration sizes
        std::ofstream       *_printTo;      // file to direct printed output to (default is cout).
        double              _run_time;      // total time in seconds spent running Diderot code
        struct scheduler    *_sched;        // scheduler info for parallel target

        world_base (std::string const &name, bool isArr, int nAxes);
        ~world_base ();

        std::ostream & print()
            return (this->_printTo == nullptr) ? std::cout : *this->_printTo;

        void error (const char *fmt, ...);

	const char *get_errors ()
	    return biffMsgStrGet(this->_errors);

      //! Load a nrrd file into memory
      //! \param filename the path to the nrrd file
      //! \return the pointer to the nrrd file
        Nrrd *load_nrrd_file (std::string const &filename);

      //! Check that a nrrd has the expected structure for loading into a dynamic sequence
      //! \param nin the nrrd to check
      //! \param nValuesPerElem the expected number of values per element
      //! \return true on error, false otherwise
	bool check_seq_nrrd (const Nrrd *nin, uint32_t nValuesPerElem);

      //! Normalize the meta-data of a nrrd
      //! return true on error, false otherwise
	bool normalize_nrrd_meta_data (Nrrd *nin);

    }; // struct world_base

} // namespace diderot

#endif // !_DIDEROT_WORLD_HXX_

ViewVC Help
Powered by ViewVC 1.0.0