Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ CFLAGS += $(WARNINGS_CFLAGS)
LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES_CPP:.cpp=.o))
BINOBJECTS = $(addprefix $(OBJDIR)/, $(BINSOURCES_CPP:.cpp=.o))
LDFLAGS = $(MACHINE)
ifneq ($(CONDA_PREFIX),)
LDFLAGS += -Wl,-rpath,$(CONDA_PREFIX)/lib
endif

#### DERIVED CONDITIONALS AND VARIABLES ####
ifeq ($(shell hostname), uv100)
Expand All @@ -134,7 +137,7 @@ endif
all: libtrackcpp trackcpp python_package

#### GENERATES DEPENDENCY FILE ####
$(shell $(CXX) -MM $(CFLAGS) $(addprefix $(SRCDIR)/, $(LIBSOURCES_CPP)) $(addprefix $(SRCDIR)/, $(BINSOURCES_CPP)) | sed 's/.*\.o/$(OBJDIR)\/&/' > .depend)
$(shell $(CXX) -MM $(CFLAGS) $(INC) $(addprefix $(SRCDIR)/, $(LIBSOURCES_CPP)) $(addprefix $(SRCDIR)/, $(BINSOURCES_CPP)) | sed 's/.*\.o/$(OBJDIR)\/&/' > .depend)
-include .depend

libtrackcpp: $(OBJDIR)/libtrackcpp.a
Expand Down
2 changes: 1 addition & 1 deletion include/trackcpp/auxiliary.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void set_random_distribution(unsigned value);
double gen_random_number();


#if __GNUC__ < 6
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 6
bool isfinite(const double& v);
#endif

Expand Down
18 changes: 15 additions & 3 deletions python_package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,31 @@ INC += -I../include $(PYTHON_INCLUDES) $(NUMPY_INCLUDE)
INTERFACESRCS = $(INTERFACEOBJS:.o=.cpp)
INTERFACEHDRS = $(INTERFACEOBJS:.o=.h)

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SOFLAGS = -bundle -undefined dynamic_lookup
ifneq ($(CONDA_PREFIX),)
SOFLAGS += -Wl,-rpath,$(CONDA_PREFIX)/lib
endif
ARCHIVE_LINK = -Wl,-force_load,$(TRACKCPPLIB)
else
SOFLAGS = -shared
ARCHIVE_LINK = -Wl,--whole-archive $(TRACKCPPLIB) -Wl,--no-whole-archive
endif

.NOTPARALLEL:

all: trackcpp/_trackcpp.so

$(shell $(CXX) -MM $(INTERFACESRCS) > .depend)
$(shell $(CXX) -MM $(INC) $(INTERFACESRCS) > .depend)
-include .depend

trackcpp/_trackcpp.so: $(TRACKCPPLIB) $(OBJECTS)
$(CXX) -shared -Wl,--whole-archive $(TRACKCPPLIB) -Wl,--no-whole-archive $(OBJECTS) $(LIBS) -o trackcpp/_trackcpp.so
$(CXX) $(SOFLAGS) $(ARCHIVE_LINK) $(OBJECTS) $(LIBS) -o trackcpp/_trackcpp.so

trackcpp_wrap.cxx: $(SOURCES_I) $(INTERFACESRCS) $(INTERFACEHDRS)
[ -f ./numpy.i ] && echo "numpy.i already here, good" || \
wget https://raw.githubusercontent.com/numpy/numpy/v$(NUMPY_VERSION)/tools/swig/numpy.i
(command -v wget >/dev/null 2>&1 && wget https://raw.githubusercontent.com/numpy/numpy/v$(NUMPY_VERSION)/tools/swig/numpy.i || curl -sL -o numpy.i https://raw.githubusercontent.com/numpy/numpy/v$(NUMPY_VERSION)/tools/swig/numpy.i)
$(SWIG) -c++ -python $(INC) trackcpp.i && cp -f trackcpp.py trackcpp

install: uninstall all
Expand Down
8 changes: 4 additions & 4 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Status::type print_closed_orbit(const Accelerator& accelerator, const std::vecto
fprintf(fp, "# ebeam_energy[eV] : %f\n", accelerator.energy);
fprintf(fp, "# harmonic_number : %i\n", accelerator.harmonic_number);
fprintf(fp, "# cavity_state : %s\n", accelerator.cavity_on ? "on" : "off");
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]);
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on].c_str());
fprintf(fp, "# chamber_state : %s\n", accelerator.vchamber_on ? "on" : "off");
fprintf(fp, "\n");
fprintf(fp, "%-5s %-15s %-24s %-24s %-24s %-24s %-24s %-24s %-24s\n", "# idx", "fam_name", "s[m]", "rx[m]", "px[rad]", "ry[m]", "py[rad]", "de", "dl[m]");
Expand Down Expand Up @@ -70,7 +70,7 @@ Status::type print_tracking_linepass(const Accelerator& accelerator, const std::
fprintf(fp, "# ebeam_energy[eV] : %f\n", accelerator.energy);
fprintf(fp, "# harmonic_number : %i\n", accelerator.harmonic_number);
fprintf(fp, "# cavity_state : %s\n", accelerator.cavity_on ? "on" : "off");
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]);
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on].c_str());
fprintf(fp, "# chamber_state : %s\n", accelerator.vchamber_on ? "on" : "off");
fprintf(fp, "\n");

Expand Down Expand Up @@ -104,7 +104,7 @@ Status::type print_tracking_ringpass(const Accelerator& accelerator, const std::
fprintf(fp, "# ebeam_energy[eV] : %f\n", accelerator.energy);
fprintf(fp, "# harmonic_number : %i\n", accelerator.harmonic_number);
fprintf(fp, "# cavity_state : %s\n", accelerator.cavity_on ? "on" : "off");
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]);
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on].c_str());
fprintf(fp, "# chamber_state : %s\n", accelerator.vchamber_on ? "on" : "off");
fprintf(fp, "\n");

Expand Down Expand Up @@ -135,7 +135,7 @@ Status::type print_dynapgrid(const Accelerator& accelerator, const std::vector<D
fprintf(fp, "# ebeam_energy[eV] : %f\n", accelerator.energy);
fprintf(fp, "# harmonic_number : %i\n", accelerator.harmonic_number);
fprintf(fp, "# cavity_state : %s\n", accelerator.cavity_on ? "on" : "off");
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]);
fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on].c_str());
fprintf(fp, "# chamber_state : %s\n", accelerator.vchamber_on ? "on" : "off");
fprintf(fp, "\n");
if (print_tunes) {
Expand Down
2 changes: 2 additions & 0 deletions src/trackcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

bool verbose_on = true;

#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 6
bool isfinite(const double& v) {
return std::isfinite(v);
}
#endif

std::string get_timestamp() {

Expand Down
Loading