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

SCM Repository

[diderot] View of /branches/vis12/test/hlic/main.c
ViewVC logotype

View of /branches/vis12/test/hlic/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1948 - (download) (as text) (annotate)
Sat Jul 7 04:34:11 2012 UTC (7 years, 3 months ago) by glk
File size: 1616 byte(s)
aesthetic tweaks, now using log
/*! \file main.c
 */

#include "hlic.h"

int main (int argc, const char **argv)
{
    HLIC_World_t *wrld = HLIC_Init ();

    HLIC_SetVerbose (wrld, true);

    HLIC_Initially (wrld);

    uint32_t nSteps = HLIC_Run (wrld, 0);

  // get results
    Nrrd *nData = nrrdNew();
    if (HLIC_OutputGet_out(wrld, nData)) {
      // error
	//fprintf(stderr, "Error getting nrrd data: %s\n", ((WorldPrefix_t *)wrld)->err);
	return 1;
    }

/*  (not needed for now)
    if ((nData->dim != 3) || (nData->axis[0].size != 3)) {
	printf("unknown output nrrd size\n");
    }
    else {
	float *p = (float *)nData->data;
	int minI = 0;
	int minJ = 0;
	float minV = p[2];
	int maxI = 0;
	int maxJ = 0;
	float maxV = p[2];

//	printf("result nrrd %dx%dx%d\n",
//	    (int)(nData->axis[0].size), (int)(nData->axis[1].size), (int)(nData->axis[2].size));
	for (int i = 0;  i < nData->axis[1].size;  i++) {
	    for (int j = 0;  j < nData->axis[2].size;  j++) {
		if (p[2] < minV) {
		    minI = i;  minJ = j;  minV = p[2];
		}
		if (p[2] > maxV) {
		    maxI = i;  maxJ = j;  maxV = p[2];
		}
		p += 3;
	    }
	}
	p = ((float *)nData->data) + 3 * (minI * nData->axis[2].size + minJ);
	printf("min at [%d,%d] = <%f, %f, %f>\n",
	    minI, minJ, p[0], p[1], minV);
	p = ((float *)nData->data) + 3 * (maxI * nData->axis[2].size + maxJ);
	printf("max at [%d,%d] = <%f, %f, %f>\n", maxI, maxJ, p[0], p[1], maxV);
    }
*/
    if (nrrdSave("out.nrrd", nData, NULL)) {
        char *err = biffGetDone(NRRD);
        fprintf(stderr, "Trouble saving nrrd struct: %s\n", err);
        return 1;
    }

    HLIC_Shutdown (wrld);

    return 0;
}

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