diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..5fa3c6c --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,40 @@ +SHLIBS= libCosmoTool.so +CXX=g++ +CC=gcc +CXXFLAGS= -ggdb -O3 +CFLAGS= -ggdb -O3 +SOURCES= loadRamses.cpp yorick.cpp +LIBS= -lnetcdf_c++ -lnetcdf -lm + +all: $(SHLIBS) + +depend: $(SOURCES) + @echo "[DEPENDS] $^" + @$(CC) -M -MM $^ > .mydepends + +distclean: clean + @rm -f .mydepends + +clean: + @rm -f *.o + @rm -f $(PROGS) + +.mydepends: depend + +%.so: + @echo "[LINK SHARED] $@" + @$(CXX) -shared -o $@ $^ $(LIBS) + +%.prog: + @echo "[L] $@" + @$(CXX) -o $@ $^ $(LIBS) + +%.o: %.c + @echo "[C] $< ..." + @$(CC) -c -o $@ $< $(CFLAGS) + +%.o: %.cpp + @echo "[C++] $< ..." + @$(CXX) -c -o $@ $< $(CXXFLAGS) + +include .mydepends diff --git a/src/yorick.cpp b/src/yorick.cpp index 00fcdfc..3453390 100644 --- a/src/yorick.cpp +++ b/src/yorick.cpp @@ -7,46 +7,6 @@ using namespace CosmoTool; using namespace std; -OutputNetCDF::OutputNetCDF(NcFile *f, NcVar *v, long *dimList, uint32_t rank) -{ - this->outFile = f; - this->curVar = v; - this->dimList = dimList; - this->rank = rank; - this->counts = new long[rank]; - this->curPos = new long[rank]; - - for (long i = 0; i < rank; i++) - this->curPos[i] = 0; - - for (long i = 0; i < rank; i++) - this->counts[i] = 1; -} - -void OutputNetCDF::addDouble(double a) -{ - curVar->set_cur(curPos); - curVar->put(&a, counts); - - curPos[rank-1]++; - for (long i = rank-1; i >= 1; i--) - { - if (curPos[i] == dimList[i]) - { - curPos[i-1]++; - curPos[i] = 0; - } - } -} - -OutputNetCDF::~OutputNetCDF() -{ - delete counts; - delete dimList; - delete curPos; - delete outFile; -} - class NetCDF_handle { public: diff --git a/src/yorick.hpp b/src/yorick.hpp index 480c186..6a2cf94 100644 --- a/src/yorick.hpp +++ b/src/yorick.hpp @@ -187,24 +187,6 @@ namespace CosmoTool void loadArray(const char *fname, T*& array, uint32_t *& dimList, uint32_t& rank); - void saveFloatArray(const char *fname, - float *array, uint32_t *dimList, uint32_t rank); - void loadFloatArray(const char *fname, - float *&array, uint32_t *&dimList, uint32_t& rank) - throw (NoSuchFileException); - - void saveDoubleArray(const char *fname, - double *array, uint32_t *dimList, uint32_t rank); - void loadDoubleArray(const char *fname, - double *&array, uint32_t *&dimList, uint32_t& rank) - throw (NoSuchFileException); - - void loadIntArray(const char *fname, - int *&array, uint32_t *&dimList, uint32_t& rank) - throw (NoSuchFileException); - void saveIntArray(const char *fname, - int *array, uint32_t *dimList, uint32_t rank); - ProgressiveDoubleOutput saveDoubleArrayProgressive(const char *fname, uint32_t *dimList, uint32_t rank); };