Commit f7e5ad5c authored by Daniel Brown's avatar Daniel Brown

Fixed conflict in Makefile

parents b49ce86a 1a1fbed7
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Other #
#######################
# This file is system specific
kat_config.h
# ignore any backup files
*.bkp
# ignore cuba.h as it gets copied by the makefile from lib file
cuba.h
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
\ No newline at end of file
Please give : date name kat version filename: description
(especially for the bug fix)
open bugs
- bug with 'mod': missing phase like beam splitter, maybe minus
from direction of propagation, file???
- get_cavity does produce some 'nan' values is the
loss gets large, i.e. for a split PRC
110406 changed some strcasecmp to strcmp because for some outputs
the parser did not correctly catch all the probable errors
when e.g. BS and bs were used for different things.
This is not yet really fixed. See vajente110406
fixed bugs
------------
130905 func did not work with multiple occurences of the same
variable in the function definition. Error in the
string handlig in 'replace_string'
020905 retrace cavity stopped when cavity was instable
I had forgotten to set cav->stable=0 in the beginning
of get_cavity
010805 adf 0.99.1beta formul010805: formula a=s+t gives s+t+1
fixed 090805: in formulc.c function myfval:
param[(*(tokens+i))-'a'] = **(input+i); // added brackets 090508
Don't know the impact on previous versions
\ No newline at end of file
This diff is collapsed.
# $Id$
#
# test
# Source Makefile for Finesse
.PHONY: clean tags cover_report test_clean api_clean
# check to see if no argument was passed in, in which case assume linux
ifneq "$(ARCH)" "win"
ifneq "$(ARCH)" "mac"
ifneq "$(ARCH)" "linux"
ifneq "$(ARCH)" "condor"
$(shell echo No ARCH flag found. Assuming a linux system > /dev/stderr)
override ARCH = linux
endif
endif
endif
endif
# the default compiler
ifeq "$(CC)" ""
CC = gcc
endif
ifeq "$(ARCH)" "condor"
CC = condor_compile gcc
endif
# if we are compiling for windows, use the mingw compiler
ifeq "$(ARCH)" "win"
CC = $(MINGW_CC)
endif
ifeq "$(ARCH)" "win"
THREADS_CFLAGS =
endif
......@@ -38,39 +12,31 @@ ifeq "$(ARCH)" "linux"
THREADS_CFLAGS = -pthread
endif
GSL_CFLAGS = ${shell gsl-config --cflags} -DHAVE_INLINE
CUBA_CFLAGS = -L../lib/Cuba-3.0 -lcuba
ifeq "$(GSL_LIBS)" ""
ifeq "$(BUILD)" "win"
GSL_LIBS = ${shell gsl-config --libs} -static
else
GSL_LIBS = ${shell gsl-config --libs}
endif
endif
GIT = git
GREP = grep
KAT_CONFIG_H = kat_config.h
# many different versions of C compiler flags
ifeq "$(CC)" "icc"
WARN_CFLAGS = -Wall -wd981 -wd1572 -wd810
# disabled remarks:
# -wd981: operands are evaluated in unspecified order
# -wd1572: floating-point equality and inequality comparisons are unreliable
# -wd810: conversion from "double" to "int" may lose significant bits
BASE_CFLAGS = $(WARN_CFLAGS) $(THREADS_CFLAGS)
OPTIM_CFLAGS = -O3 -static -rcd -ipo -unroll4 -parallel -malign-double -DNDEBUG
FAST_CFLAGS = $(BASE_CFLAGS) $(OPTIM_CFLAGS) -axN
else
WARN_CFLAGS = -Wall -W -pipe
BASE_CFLAGS = $(WARN_CFLAGS) $(THREADS_CFLAGS)
OPTIM_CFLAGS = -O3 -ffast-math -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -DNDEBUG
# OPTIM_CFLAGS = -O3 -ffast-math -msse -msse2 -msse3 -m32 -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -DNDEBUG
FAST_CFLAGS = $(BASE_CFLAGS) $(OPTIM_CFLAGS) -malign-double -march=$(CPUARCH)
endif
# define the fast flags for the mac
ifeq "$(ARCH)" "mac"
# FAST_CFLAGS = $(BASE_CFLAGS) -arch ppc -arch i686 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 $(OPTIM_CFLAGS)
FAST_CFLAGS = $(BASE_CFLAGS) -arch x86_64 -arch i686 -mmacosx-version-min=10.5 $(OPTIM_CFLAGS)
endif
WARN_CFLAGS = -Wall -W -pipe -Wextra
BASE_CFLAGS = $(WARN_CFLAGS) $(THREADS_CFLAGS) $(CFLAGS)
#OPTIM_CFLAGS = -O3 -ffast-math -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -DNDEBUG
#FAST_CFLAGS = $(BASE_CFLAGS) $(OPTIM_CFLAGS)
FAST_CFLAGS = $(BASE_CFLAGS)
#use to be i486 for march in line below
SLOW_CFLAGS = $(BASE_CFLAGS) $(THREADS_CFLAGS) $(OPTIM_CFLAGS) -march=$(CPUARCH)
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -DDEBUG
SLOW_CFLAGS = $(THREADS_CFLAGS)
DEBUG_CFLAGS = -g -DDEBUG
NODEBUG_CFLAGS = $(BASE_CFLAGS) -DNDEBUG
PROF_CFLAGS = $(BASE_CFLAGS) -pg -g
PROF_CFLAGS = $(BASE_CFLAGS) -pg -g
COVER_CFLAGS = $(BASE_CFLAGS) -g -fprofile-arcs -ftest-coverage
TEST_CFLAGS = $(BASE_CFLAGS) -g -DTEST
TEST_COVER_CFLAGS = $(BASE_CFLAGS) -g -DTEST -fprofile-arcs -ftest-coverage
......@@ -83,6 +49,7 @@ KAT_SOURCES = kat.c \
kat_check.c \
kat_dump.c \
kat_fortran.c \
kat_server.c \
kat_gnu.c \
kat_init.c \
kat_io.c \
......@@ -92,17 +59,9 @@ KAT_SOURCES = kat.c \
kat_read.c \
kat_spa.c \
kat_klu.c \
dcuhre_all.c
# compile server mode only for linux and mac architecture
ifeq "$(ARCH)" "linux"
KAT_SOURCES += kat_server.c
endif
ifeq "$(ARCH)" "mac"
KAT_SOURCES += kat_server.c
endif
dcuhre_all.c \
md5.c \
base64.c
# the kat-specific objects
KAT_OBJECTS = $(KAT_SOURCES:.c=.o)
......@@ -110,8 +69,6 @@ KAT_OBJECTS = $(KAT_SOURCES:.c=.o)
KLUINCLUDES = -I../lib/KLUsparse/KLU/Include/ -I../lib/KLUsparse/AMD/Include/ -I../lib/KLUsparse/COLAMD/Include/ -I../lib/KLUsparse/BTF/Include/ -I../lib/KLUsparse/UFconfig/
INCLUDES = -I. $(KLUINCLUDES)
# the formulc objects
FORMULC_OBJECTS = ../lib/formulc/formulc.o ../lib/formulc/random.o
......@@ -125,33 +82,13 @@ KLU_LIBS = ../lib/KLUsparse/KLU/Lib/libklu.a ../lib/KLUsparse/BTF/Lib/libbtf.a .
LIBS += $(KLU_LIBS)
SERVER_LIBS = ../lib/libkatnet/libkatnet.a ../lib/libMNet/libMNet.a
ifeq "$(ARCH)" "linux"
LIBS += $(SERVER_LIBS)
endif
ifeq "$(ARCH)" "mac"
LIBS += $(SERVER_LIBS)
endif
ifeq "$(ARCH)" "linux"
# the general libraries and includes
ifeq "$(CC)" "icc"
#LIBS = -lf2c -limf
LIBS += -limf
else
LIBS += -static -lm
endif
endif
ifeq "$(ARCH)" "win"
LIBS += -lm
endif
LIBS += $(SERVER_LIBS)
# the mac-specific libraries
ifeq "$(ARCH)" "mac"
LIBS += -Wl -lm
else
LIBS += -lm
endif
......@@ -172,60 +109,52 @@ TEST_SOURCES = $(TEST_DIR)/CuTest.c $(TEST_DIR)/AllTests.c \
$(TEST_DIR)/kat_optics_test.c \
$(TEST_DIR)/kat_quant_test.c \
$(TEST_DIR)/kat_read_test.c \
$(TEST_DIR)/kat_spa_test.c
$(TEST_DIR)/kat_spa_test.c \
$(TEST_DIR)/md5.c \
$(TEST_DIR)/base64.c \
TEST_OBJECTS = $(TEST_SOURCES:.c=.o)
# the unix prerequisites
OBJECTS = $(KAT_OBJECTS) $(FORMULC_OBJECTS)
PREREQS = Makefile config #kat.h kat_inline.c f2c.h
ifeq "$(ARCH)" "linux"
PREREQS += kat_server.h
endif
ifeq "$(ARCH)" "mac"
PREREQS += kat_server.h
endif
PREREQS = Makefile #kat.h kat_inline.c f2c.h
PREREQS += $(OBJECTS)
# determine short SHA of git commit
GIT_SHA_CMD = $(GIT) rev-parse --verify HEAD --short
GIT_SHA = $(shell $(GIT_SHA_CMD))
# make kat_os_config.h and put an 'if exists' check *inside* its shell code
# rather than in the make code
# leave other config code in kat_config.h
# the default target
default: prof
default: kat
# compile objects from c code
%.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $<
$(CC) ${GSL_CFLAGS} $(FAST_CFLAGS) -c $(INCLUDES) $<
# make all
all: kat win test versionnumber
### unix targets ###
# make kat
kat: CFLAGS = $(FAST_CFLAGS)
kat: PROG = ../kat
kat: config $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(FAST_CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make fast
fast: kat
########################## below here untested!!
# make debug
debug: CFLAGS = $(DEBUG_CFLAGS)
debug: PROG = ../kat
debug: $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
debug: config $(PREREQS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make nodebug
nodebug: CFLAGS = $(NODEBUG_CFLAGS)
nodebug: PROG = ../kat
nodebug: $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
nodebug: config $(PREREQS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make test
$(TEST_OBJECTS): CFLAGS = $(BASE_CFLAGS) -g
......@@ -235,7 +164,7 @@ test: CFLAGS = $(TEST_CFLAGS)
test: PROG = ../kat
test: OBJECTS += $(TEST_OBJECTS)
test: $(PREREQS) $(TEST_OBJECTS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
../kat --test
# make test cover
......@@ -246,20 +175,20 @@ test_cover: CFLAGS = $(TEST_COVER_CFLAGS)
test_cover: PROG = ../kat
test_cover: OBJECTS += $(TEST_OBJECTS)
test_cover: $(PREREQS) $(TEST_OBJECTS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
../kat --test
# make prof
prof: CFLAGS = $(PROF_CFLAGS)
prof: PROG = ../kat
prof: $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make cover (use the code coverage tool, gcov)
cover: CFLAGS = $(COVER_CFLAGS)
cover: PROG = ../kat
cover: $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make a report of code coverage information
cover_report:
......@@ -270,13 +199,12 @@ cover_report:
slow: CFLAGS = $(SLOW_CFLAGS)
slow: PROG = ../kat
slow: config $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
# make versionnumber
versionnumber: CFLAGS = $(FAST_CFLAGS)
versionnumber: PROG := ../kat_$(GIT_SHA)
versionnumber: config $(PREREQS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJECTS) $(LIBS)
$(CC) $(FAST_CFLAGS) ${GSL_CFLAGS} -o $(PROG) $(OBJECTS) $(LIBS) ${GSL_LIBS} ${CUBA_CFLAGS}
### sundry other targets ###
......
TODO List
--------------------------------------------------------------------
Improve Speed:
- benchmark SuperLU to be used instead of the old sparse package
Finish Mirror Map implementation
Implement clipping from Virgo Book of Physics:
- pages 211-227
Gratings:
- manual: change node order to 1 input 2: zeroth order, 3 first order ...
- get_cavity: add gratings to computation of losses
General:
- check for angle sign convention: positive angles are counterclockwise!
---------------------------------------------------------------------
Probably done:
Server Mode:
- add option 'port port-number' to switch into 'server mode'
- check kat_calc.c and other files for changes required for 'server mode'
- write TCP-IP communication
---------------------------------------------------------------------
OLDER STUFF (to be checked and orderd soon!)
- grating : kat_aa getcavity closs, componentmatrix
Guardian output upper lower
Write info file with xaxis and out file data labels...
Gouy phase b -> a problem mal rechnen fuer commandos:
tem
pdtype
beam
fsig
ad
etc.....
add virgo physics book to references
known bugs:
o tem input parser schluckt z.B.
tem i1 0 0.5 90 !
o x3params mit 7 detectoren zerhackt den detector_type
fsig fuer andere freiheitsgrade
x3axis-video 100 % problem ...
input options to overwrite certain varianles
like kat -Pm1:phi:45 -Pm2:phi:50
in order to implement as a function into something else
Compile a mex file for matlab (octave??)
check for double pointers xaxis, link, function, lock ....
read_lock2, read_func2
fsig AA+freq -> north cavity, mc, malik
link,lock,func -> north cav
numric integral -> test, Lisa, test ros
manual -> manual, technical, examples, faq, ...
mode mismatch nur an m und bs : weniger fehler und schneller
(wie ist das mit Beugungseffekten? Auch nur bs und m?)
manual, README: please cite my article
manual: control matrix, catching range
k nur gamma=0 fuer transmission
vielleicht X^2 weglassen da prop gamma^2
odd modes weglassen wenn kein verkippen?
path fuer gauss merken in trace damit
rebuild auch retrace machen kann.
difraction losses in kopplungsfaktoren
I believe that in the long run I should include the following into Finesse
for computing the effects of thermal lenses:
- simple thermal lens model, and maybe optionally the possibility to read
a file. I guess that the simple model will do since there are
other problems that might yield more deviations from reality, see
below.
- more sophisticated "locking" methods. To simulate a real interferometer
with TEM modes is very tricky since the optical phases change when you
change a curvature somewhere. The method used now by Finesse (and also
Melody as far as I know) to simulate the longitudinal servo systems are not
really very smart and this can be a desaster in a measurement system that
depends on phase deviation of about 1e-7 or so.
- some pertubation method to compute the thermal lense depending on the
round trip power and vice versa. As this is a non-linear effect Finesse
can in principle not compute it. But as in melody I could
use some simple iteration to look for the equilibrium. Should not
be too difficult.
was macht "max" ins Handbuch
phase lock: kleine Phasenschieber. Loesen von
mehreren Locks durch Variation und Gleichungssystem?
Testen
beam analyser macht mode decomposition wenn (optional)
ein beam parameter angegeben wird, am besten benutzbar
als xparam
eta inn shotnoise ???
todo:
- "pseudo lock" set phase to zero (@f) at one side of a mirror
set relative phase (@f) between two fields at a BS
- rebuild , trace und so wiederholen nach tune_parameters
- xparam nach polygon erweitern
- unstable cav : data trotzdem plotten
- neues element, dass fsig als phasenmod/amp mod und
freq mod einfuegen kann.
- sum nach scale
- fuer mehrfach modulationen: MOD fuer f_user als carrier
- beam analyser mach das ueblich : schwerpunk finden,
hauptachsen, moden fitten, etc.
-----------------------
Leftovers:
guoy phase correction unabhaengig von nr??
guoy phase doppelt fuer:
- ks
- beam analyser
- ???
phase for spaces seperately!!
test simple propagation of modes
index of ref. -> rebuild comps
resonanz unabhaengig von qs
spce L tune richtig?
richtung winkel -> mathematisch positiv ist GEGEn den Urzeigersinn
which_... in tabelle
tem in table
q->q/n
split detetcor
rebuild ks halb
/*
* Copyright (C), 2000-2007 by the monit project group.
* All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "base64.h"
/* Private prototypes */
static int is_base64(char c);
static char encode(unsigned char u);
static unsigned char decode(char c);
/**
* Implementation of base64 encoding/decoding.
*
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com>
*
* @version \$Id: base64.c,v 1.19 2007/07/25 12:54:31 hauk Exp $
*
* @file
*/
/* ------------------------------------------------------------------ Public */
/**
* Base64 encode and return size data in 'src'. The caller must free the
* returned string.
* @param size The size of the data in src
* @param src The data to be base64 encode
* @return encoded string otherwise NULL
*/
char *encode_base64(int size, unsigned char *src) {
int i;
char *out, *p;
if (!src)
return NULL;
if (!size)
size = strlen((char *) src);
out = calloc(sizeof (char), size * 4 / 3 + 4);
p = out;
for (i = 0; i < size; i += 3) {
unsigned char b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0;
b1 = src[i];
if (i + 1 < size)
b2 = src[i + 1];
if (i + 2 < size)
b3 = src[i + 2];
b4 = b1 >> 2;
b5 = ((b1 & 0x3) << 4) | (b2 >> 4);
b6 = ((b2 & 0xf) << 2) | (b3 >> 6);
b7 = b3 & 0x3f;
*p++ = encode(b4);
*p++ = encode(b5);
if (i + 1 < size) {
*p++ = encode(b6);
} else {
*p++ = '=';
}
if (i + 2 < size) {
*p++ = encode(b7);
} else {
*p++ = '=';
}
}
return out;
}
/**
* Decode the base64 encoded string 'src' into the memory pointed to by
* 'dest'. The dest buffer is <b>not</b> NUL terminated.
* @param dest Pointer to memory for holding the decoded string.