Example #1
0
CTCSys::CTCSys()
{
	EventEndProcess = TRUE;
	IR.Acquisition = TRUE;
	IR.UpdateImage = TRUE;
	IR.Inspection = FALSE;
	OPENF("c:\\Projects\\RunTest.txt");
}
Example #2
0
MachineVision::MachineVision()
{
	ProcessEventEnd = TRUE;
	UpdateImage = TRUE;
	UpdateGraphics = TRUE;
	Acquisition = FALSE;
	DisplaySelection = FIELD;
	OPENF("c:\\Projects\\RunTest.txt");
}
Example #3
0
static void write_q_unformatted (char *qfile)
{
    int np, nk, nz, nq, ierr;
    int i, j, k, n, *indices;
    char buff[129];
    void *qdata;
    float *qf = 0;
    double *qd = 0;

    printf ("\nwriting unformatted Q file to %s\n", qfile);
    printf ("  in %s-precision\n", use_double ? "double" : "single");

    for (np = 0, nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            nk = whole ? (int)Zones[nz].nverts :
                (int)(Zones[nz].dim[0] * Zones[nz].dim[1]);
            if (np < nk) np = nk;
        }
    }
    indices = (int *) malloc (3 * nblocks * sizeof(int));
    if (use_double) {
        qdata = (void *) malloc (5 * np * sizeof(double));
        qd = (double *)qdata;
    }
    else {
        qdata = (void *) malloc (5 * np * sizeof(float));
        qf = (float *)qdata;
    }
    if (NULL == indices || NULL == qdata)
        FATAL ("write_q_unformatted", "malloc failed for working arrays");

    unlink (qfile);
    strcpy (buff, qfile);
    for (n = (int)strlen(buff); n < 128; n++)
        buff[n] = ' ';
    buff[128] = 0;
    n = 0;
    OPENF (&n, buff, 128);

    if (mblock || nblocks > 1) {
        n = 1;
        WRITEIF (&n, &nblocks, &ierr);
    }
    for (np = 0, nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            for (n = 0; n < 3; n++)
                indices[np++] = (int)Zones[nz].dim[n];
        }
    }
    WRITEIF (&np, indices, &ierr);

    for (nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            printf ("  zone %d ... ", nz+1);
            fflush (stdout);
            compute_solution (nz);
            if (whole) {
                np = (int)Zones[nz].nverts;
                nk = 1;
            }
            else {
                np = (int)(Zones[nz].dim[0] * Zones[nz].dim[1]);
                nk = (int)Zones[nz].dim[2];
            }
            if (use_double) {
                n = 4;
                WRITEDF (&n, reference, &ierr);
                for (k = 0; k < nk; k++) {
                    for (nq = 0, j = 0; j < 5; j++) {
                        i = k * np;
                        for (n = 0; n < np; n++, i++)
                            qd[nq++] = q[j][i];
                    }
                    WRITEDF (&nq, qd, &ierr);
                }
            }
            else {
                for (n = 0; n < 4; n++)
                    qf[n] = (float)reference[n];
                WRITEFF (&n, qf, &ierr);
                for (k = 0; k < nk; k++) {
                    for (nq = 0, j = 0; j < 5; j++) {
                        i = k * np;
                        for (n = 0; n < np; n++, i++)
                            qf[nq++] = (float)q[j][i];
                    }
                    WRITEFF (&nq, qf, &ierr);
                }
            }
            puts ("done");
        }
    }
    CLOSEF ();
    free (indices);
    free (qdata);
}
Example #4
0
static void write_xyz_unformatted (char *xyzfile)
{
    int n, i, ierr, *indices;
    int nz, k, nk, np;
    char buff[129];
    VERTEX *verts;
    void *xyz;
    float *xyzf;
    double *xyzd;

    printf ("\nwriting unformatted XYZ file to %s\n", xyzfile);
    printf ("  in %s-precision", use_double ? "double" : "single");
    if (use_iblank) printf (" with iblank array");
    putchar ('\n');

    for (np = 0, nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            nk = whole ? (int)Zones[nz].nverts :
                (int)(Zones[nz].dim[0] * Zones[nz].dim[1]);
            if (np < nk) np = nk;
        }
    }
    indices = (int *) malloc (3 * nblocks * sizeof(int));
    if (use_double) {
        xyz = (void *) malloc (3 * np * sizeof(double));
        xyzd = (double *)xyz;
    }
    else {
        xyz = (void *) malloc (3 * np * sizeof(float));
        xyzf = (float *)xyz;
    }
    if (NULL == indices || NULL == xyz)
        FATAL ("write_xyx_unformatted", "malloc failed for working arrays");

    unlink (xyzfile);
    strcpy (buff, xyzfile);
    for (n = (int)strlen(buff); n < 128; n++)
        buff[n] = ' ';
    buff[128] = 0;
    n = 0;
    OPENF (&n, buff, 128);

    if (mblock || nblocks > 1) {
        n = 1;
        WRITEIF (&n, &nblocks, &ierr);
    }
    for (n = 0, nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            for (i = 0; i < 3; i++)
                indices[n++] = (int)Zones[nz].dim[i];
        }
    }
    WRITEIF (&n, indices, &ierr);

    for (nz = 0; nz < nZones; nz++) {
        if (Zones[nz].type == CGNS_ENUMV(Structured)) {
            printf ("  zone %d - %d x %d x %d ... ", nz+1,
                (int)Zones[nz].dim[0], (int)Zones[nz].dim[1],
		(int)Zones[nz].dim[2]);
            fflush (stdout);
            if (use_iblank) compute_iblank (nz);
            if (whole) {
                np = (int)Zones[nz].nverts;
                nk = 1;
            }
            else {
                np = (int)(Zones[nz].dim[0] * Zones[nz].dim[1]);
                nk = (int)Zones[nz].dim[2];
            }
            for (k = 0; k < nk; k++) {
                verts = &Zones[nz].verts[k*np];
                if (use_double) {
                    for (i = 0, n = 0; n < np; n++)
                        xyzd[i++] = verts[n].x;
                    for (n = 0; n < np; n++)
                        xyzd[i++] = verts[n].y;
                    for (n = 0; n < np; n++)
                        xyzd[i++] = verts[n].z;
                    if (use_iblank)
                        WRITEGDF (&np, xyzd, &iblank[k*np], &ierr);
                    else
                        WRITEDF (&i, xyzd, &ierr);
                }
                else {
                    for (i = 0, n = 0; n < np; n++)
                        xyzf[i++] = (float)verts[n].x;
                    for (n = 0; n < np; n++)
                        xyzf[i++] = (float)verts[n].y;
                    for (n = 0; n < np; n++)
                        xyzf[i++] = (float)verts[n].z;
                    if (use_iblank)
                        WRITEGFF (&np, xyzf, &iblank[k*np], &ierr);
                    else
                        WRITEFF (&i, xyzf, &ierr);
                }
            }
            puts ("done");
        }
    }
    CLOSEF ();
    free (indices);
    free (xyz);
}