Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 415cffcf authored by Andreas Freise's avatar Andreas Freise

some code cleanup to remove compiler warning, fixing a bug with component...

some code cleanup to remove compiler warning, fixing a bug with component names function get_comp_name()
parent 506b83db
......@@ -108,6 +108,7 @@ static int closefn(void *handler) {
}
FILE *fmemopen(void *buf, size_t size, const char *mode) {
// This data is released on fclose.
fmem_t* mem = (fmem_t *) malloc(sizeof(fmem_t));
(void)mode; // silence compiler warning;
......
......@@ -52,6 +52,9 @@
#include<gsl/gsl_multimin.h>
// for suppressing 'unused parameter warings explicitly
#define UNUSED(x) (void)(x)
#if OS == MACOS
#include <stdint.h>
typedef struct timespec_kat
......@@ -2304,7 +2307,7 @@ typedef struct minimizerN {
double abserr;
int max_iter;
gsl_multimin_fminimizer_type *T;
const gsl_multimin_fminimizer_type *T;
gsl_multimin_fminimizer *s;
gsl_vector *ss, *x;
gsl_multimin_function minex_func;
......
......@@ -321,7 +321,7 @@ void knm_matrix_mult(zmatrix A, zmatrix B, zmatrix C) {
else
tmp = C;
size_t n, m, l;
long n, m, l;
for (n = 0; n < mem.num_fields; n++) {
for (m = 0; m < mem.num_fields; m++) {
......@@ -3038,8 +3038,8 @@ int set_k_modulator(int modulator_index) {
double gouy_1 = gouy(q1);
double gouy_2 = gouy(q2);
double w1 = w_size(q1, nr1);
double w2 = w_size(q2, nr2);
//double w1 = w_size(q1, nr1);
//double w2 = w_size(q2, nr2);
complex_t factor12 = complex_1;
complex_t factor21 = complex_1;
......
......@@ -2387,7 +2387,7 @@ void set_all_tems(void) {
*
* Returns 0 if ground/dump node
*/
int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy){
//int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy){
// if (NOT node->gnd_node) {
// // If q was traced away from a component, a node it will have the component index
// // set to it, so here we reverse it
......@@ -2401,7 +2401,7 @@ int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy)
// } else {
// return 0;
// }
}
//}
/***
* Gets the complex beam parameter at a node going from a component.
......@@ -2413,7 +2413,7 @@ int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy)
*
* Returns 0 if ground/dump node
*/
int get_node_q_from(node_t *node, int component_idx, complex_t *qx, complex_t *qy){
//int get_node_q_from(node_t *node, int component_idx, complex_t *qx, complex_t *qy){
// if (NOT node->gnd_node) {
// // If q was traced "from" a node it will have the component index
// // set to it
......@@ -2427,7 +2427,7 @@ int get_node_q_from(node_t *node, int component_idx, complex_t *qx, complex_t *q
// } else {
// return 0;
// }
}
//}
//! Returns factorial for n<=100
......@@ -2890,11 +2890,17 @@ const char *get_comp_name2(int type, int list_index){
case SAGNAC: return inter.sagnac_list[list_index].name;
case MODULATOR: return inter.modulator_list[list_index].name;
case DIODE: return inter.diode_list[list_index].name;
case SPACE: return inter.space_list[list_index].name;
case SPACE:
case SPACECONNECTION:
return inter.space_list[list_index].name;
case QFEEDBACK: return inter.slink_list[list_index].name;
case LIGHT_INPUT: return inter.light_in_list[list_index].name;
case GRATING: return inter.grating_list[list_index].name;
case SQUEEZER: return inter.squeezer_list[list_index].name;
case DBS: return inter.dbs_list[list_index].name;
default:
bug_error("type not handled");
}
return NULL;
}
......@@ -2910,6 +2916,10 @@ const char *get_comp_name(int type, void *comp){
case SPACECONNECTION:
return ((space_t*)comp)->name;
case QFEEDBACK: return ((slink_t*)comp)->name;
case LIGHT_INPUT: return ((light_in_t*)comp)->name;
case GRATING: return ((grating_t*)comp)->name;
case SQUEEZER: return ((squeezer_t*)comp)->name;
case DBS: return ((dbs_t*)comp)->name;
default:
bug_error("type not handled %i", type);
}
......@@ -4946,7 +4956,7 @@ int get_function_idx(char* name){
int strhash(char *key) {
size_t len = strlen(key);
int hash, i;
for(hash = i = 0; i < len; ++i)
for(hash = i = 0; i < (int)len; ++i)
{
hash += key[i];
hash += (hash << 10);
......
......@@ -146,8 +146,11 @@ int get_function_idx(char* name);
int strhash(char *key);
int get_node_q_from(node_t *node, int component_idx, complex_t *qx, complex_t *qy);
int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy);
// Andreas, removed at the function bodies have been
// commneted out for a while 08.11.2019
//int get_node_q_from(node_t *node, int component_idx, complex_t *qx, complex_t *qy);
//int get_node_q_to(node_t *node, int component_idx, complex_t *qx, complex_t *qy);
#if OS == __WIN_32__ || OS == __WIN_64__
const char *strcasestr(const char *s1, const char *s2);
......
......@@ -761,7 +761,11 @@ complex_t calc_dioptre_modulation_knn(int n, int n_, complex_t qin, double P,
void _fill_dioptre_mod_knn(signal_t *signal, double Px, double Py, node_t* nodes_options[][2],
size_t num_node_opts, int comp_index, ifo_matrix_vars_t* M_sig) {
int n_p2, n_m2, na, nb, nx, nd, d, i, j, k, n, m, sidx, f;
//int n_p2, n_m2,
UNUSED(num_node_opts);
UNUSED(comp_index);
int na, nb, nx, nd, d, i, j, k, n, m, sidx, f;
complex_t qin = complex_0;
complex_t qout = complex_0;
char xy_opts[2] = {'x', 'y'};
......@@ -780,7 +784,10 @@ void _fill_dioptre_mod_knn(signal_t *signal, double Px, double Py, node_t* nodes
if (!node_from->gnd_node && !node_to->gnd_node) {
for(j=0; j<2; j++){
char x_or_y = xy_opts[j];
// Andreas, removed at the function bodies have been
// commneted out for a while 08.11.2019
/*
if(x_or_y == 'x'){
get_node_q_to(node_from, comp_index, &qin, NULL);
get_node_q_from(node_to, comp_index, &qout, NULL);
......@@ -788,6 +795,7 @@ void _fill_dioptre_mod_knn(signal_t *signal, double Px, double Py, node_t* nodes
get_node_q_to(node_from, comp_index, NULL, &qin);
get_node_q_from(node_to, comp_index, NULL, &qout);
}
*/
for(k=0; k<inter.num_fields; k++){
get_tem_modes_from_field_index(&n, &m, k);
......@@ -4238,6 +4246,9 @@ void minimize(){
}
double fn_minimizerN(const gsl_vector *v, void *params) {
UNUSED(params);
assert(inter.minimizerN != NULL);
assert(v != NULL);
......@@ -4245,7 +4256,7 @@ double fn_minimizerN(const gsl_vector *v, void *params) {
int i = 0;
for(i=0; i<mini->N; i++) {
for(i=0; i < (int)mini->N; i++) {
// First set the value to try
*mini->variable[i] = gsl_vector_get(v, i);
......@@ -4287,7 +4298,7 @@ double fn_minimizerN(const gsl_vector *v, void *params) {
}
void minimize_nelder_mead(){
size_t iter = 0;
int iter = 0;
int status;
double size;
minimizerN_t *mini = inter.minimizerN;
......
......@@ -1661,9 +1661,9 @@ void print_progress(int num_points, int current_point) {
if(options.perl1) {
char str[LINE_LEN] = {0};
sprintf(str, "progress:%s\t%d\t%s\n", progress_action, progress_percentage, progress_message);
text_length = fprintf(pykat_file, str);
text_length = fprintf(pykat_file, "%s",str);
if(text_length != strlen(str)){
if(text_length != (int)strlen(str)){
bug_error("Missing text");
}
} else {
......
......@@ -144,6 +144,7 @@ int readDouble(int socketfd, double *d) {
* \todo complete documentation of arguments
*/
int receivecommands_sock(int sd, char *name) {
UNUSED(name);
char *buff;
int got;
long int nop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment