Exemplo n.º 1
0
int main(int argc, char **argv) {

    /* program variables */
    unsigned int i,j,k,m,m_x,m_y; /* variables to iterate over */
    double x,y,z;
    double scanxy = 15e-6; /* the boundary of the region */
    double lambda_light = 632.8e-9; /* wavelength of light */
    int NSCAT = 65; /*the scatterer number*/
    int NSA = 50000; /* the simulation iteration for the angle for each scatter*/
    int var_x = 10;
    int var_y = 10;
    /*number of sets of the positions*/
    camera_t cam = {0.20,0.20,512,512}; /*initialize the cam struct*/
    double z0 = 0.13; /* the camera distance from the orginal plane*/
    field_t(*field)[NSCAT] = malloc((sizeof *field)*NSA);
    assert(field!=NULL);
    /* seed the scatterers */
    scatterer_t *scatts = malloc(NSCAT*sizeof(scatterer_t));
    assert(scatts!=NULL);
    /* the locations */
    scatterer_t *locations = malloc(NSCAT*sizeof(scatterer_t));
    assert(locations!=NULL);
    /*free path array*/
    double *free_path = malloc(NSA*NSCAT*sizeof(double));

    /* the radiation counting for NSCATS */
    int *visting_array = malloc(NSCAT*sizeof(int));
    bzero(visting_array,NSCAT*sizeof(int));

    /* To read the scatterers positions from the file into the scatterer array*/
    FILE *fp = fopen("Scatterers.txt","r");

    if (fp == 0) {
        fprintf(stderr, "failed to open the file");
        exit(1);
    }

    for (i = 0; i < NSCAT-1; ++i) {
        fscanf(fp,"%lf %lf %lf",&scatts[i].x,&scatts[i].y,&scatts[i].z);
        fscanf(fp,"\n");
        //printf("%12.12f %12.12f %12.12f\n",scatts[i].x,scatts[i].y,scatts[i].z);
    }
    fclose(fp);

    FILE *fp_counting = fopen("visting_counter_moving.txt","w");

    if (fp_counting == 0) {
        fprintf(stderr, "failed to open the file");
        exit(1);
    }

    FILE *fp_x = fopen("Scatterers_x_moving.txt","w");

    if (fp_x == 0) {
        fprintf(stderr, "failed to open the file");
        exit(1);
    }

    FILE *fp_y = fopen("Scatterers_y_moving.txt","w");

    if (fp_y == 0) {
        fprintf(stderr, "failed to open the file");
        exit(1);
    }

    index_bounds (*Matrix)[NSCAT-1] = malloc((sizeof *Matrix)*NSCAT);
    index_bounds *matrix;

    for(m = 0; m < var_x*var_y; ++m) {

        bzero(visting_array,NSCAT*sizeof(int));
        m_x = m/var_x;
        m_y = m%var_y;
        scatts[NSCAT-1].x = m_x*scanxy/var_x - scanxy/2.0;
        scatts[NSCAT-1].y = m_y*scanxy/var_y - scanxy/2.0;
        scatts[NSCAT-1].z = 500e-9;

        for (i = 0; i < NSCAT; ++i) {
            fprintf(fp_x,"%-12.12f ",scatts[i].x);
        }
        fprintf(fp_x,"\n");
        for (i = 0; i < NSCAT; ++i) {
            fprintf(fp_y,"%-12.12f ",scatts[i].y);
        }
        fprintf(fp_y,"\n");
        for (i = 0; i < NSCAT; ++i) {
            matrix = Matrix[i];
            conduc_matrix(NSCAT, scatts, i, matrix);
            for (k = 0; k < NSCAT-1; ++k) {
                printf("%12.12f   %d     %12.12f ||  ",Matrix[i][k].lower_bound,Matrix[i][k].index,Matrix[i][k].upper_bound);
            }
            printf("%d\n",i);
        }

        printf("%s\n","conductive matrix finished");
        //scatts[500].x = 5.0e-6;
        //scatts[500].y = 4.0e-6;
        //scatts[500].z = 0.2e-6;

        /* initialize the random number generator */
        int rseed = (int)time(NULL);
        const gsl_rng_type *T;
        gsl_rng *r;
        gsl_rng_env_setup();
        T = gsl_rng_default;
        r = gsl_rng_alloc(T);
        gsl_rng_set(r,rseed);

        /*
         *Create the path length array
         */
        for(i=0; i<NSA; ++i) {
            for (j = 0; j < NSCAT; ++j) {
                matrix = Matrix[j];
                field[i][j] = single_field_spp(j, scatts, NSCAT, r, free_path,(i*NSCAT + j),matrix);
                ++visting_array[field[i][j].scatterer_index];
            }
        }

        /**
         * Write the tmp array as a way to do the cross-correlation function.
         */

        //char *file_names = malloc(10*sizeof(char));
        //sprintf(file_names,"visting_counter_%d _ %d",NSCAT,m);

        for (i = 0; i < NSCAT; ++i) {
            fprintf(fp_counting,"%d ",visting_array[i]);
        }
        fprintf(fp_counting,"\n");
    }
    free(Matrix);
    fclose(fp_counting);
    fclose(fp_x);
    fclose(fp_y);
    free(scatts);
    free(locations);
    printf("%s","finished");

    return 0;
}
Exemplo n.º 2
0
selection_properties_t::selection_properties_t() : m_callback_registered(false), m_tracking_mode(cfg_selection_properties_tracking_mode),
m_column_name_width(75), m_column_field_width(125), m_autosizing_columns(true), m_edit_column(pfc_infinite),
m_edit_index(pfc_infinite), m_edge_style(cfg_selection_properties_edge_style), m_info_sections_mask(cfg_selection_properties_info_sections),
m_show_column_titles(cfg_selection_poperties_show_column_titles), m_show_group_titles(cfg_selection_poperties_show_group_titles)
{
	m_fields.add_item(field_t("Artist", "ARTIST"));
	m_fields.add_item(field_t("Title", "TITLE"));
	m_fields.add_item(field_t("Album", "ALBUM"));
	m_fields.add_item(field_t("Date", "DATE"));
	m_fields.add_item(field_t("Genre", "GENRE"));
	m_fields.add_item(field_t("Composer", "COMPOSER"));
	m_fields.add_item(field_t("Performer", "PERFORMER"));
	m_fields.add_item(field_t("Album Artist", "ALBUM ARTIST"));
	m_fields.add_item(field_t("Track Number", "TRACKNUMBER"));
	m_fields.add_item(field_t("Total Tracks", "TOTALTRACKS"));
	m_fields.add_item(field_t("Disc Number", "DISCNUMBER"));
	m_fields.add_item(field_t("Total Discs", "TOTALDISCS"));
	m_fields.add_item(field_t("Comment", "COMMENT"));
}