/* write_pipe writes the given parameter set to the given pipe parameters: fd: the file descriptor of the pipe to write to parameters: the parameter set to pipe returns: nothing notes: todo: */ void write_pipe (int fd, double parameters[]) { write_pipe_int(fd, ip.num_dims); // Write the number of dimensions, i.e. parameters per set, being sent write_pipe_int(fd, 1); // Write that one parameter set is being sent if (write(fd, parameters, sizeof(double) * ip.num_dims) == -1) { term->failed_pipe_write(); exit(EXIT_PIPE_WRITE_ERROR); } }
/* write_pipe writes the given parameter set to the given pipe parameters: fd: the file descriptor of the pipe to write to parameters: the parameter set to pipe returns: nothing notes: todo: */ void write_pipe (int fd, double* sets[], int num_sets) { write_pipe_int(fd, NUM_PARS); write_pipe_int(fd, num_sets); for (int i = 0; i < num_sets; i++) { if (write(fd, sets[i], sizeof(double) * NUM_PARS) == -1) { term->failed_pipe_write(); exit(EXIT_PIPE_WRITE_ERROR); } } }
/* write_pipe writes the given parameter set to the given pipe parameters: fd: the file descriptor of the pipe to write to parameters: the parameter set to pipe returns: nothing notes: todo: */ void write_pipe (int fd, parameters& pr, int i) { write_pipe_int(fd, DIM); // Write the number of dimensions, i.e. parameters per set, being sent write_pipe_int(fd, NUM_SETS_PER_SIM); for (int j = 0 ; j < NUM_SETS_PER_SIM; j ++){ if (write(fd, pr.data[i * NUM_SETS_PER_SIM + j], sizeof(double) * DIM) == -1) { term->failed_pipe_write(); exit(EXIT_PIPE_WRITE_ERROR); } } }