Fixed. Simplified

This commit is contained in:
Guilhem Lavaux 2008-12-02 11:22:30 -06:00
parent 1fea6371e6
commit 88157e5687
3 changed files with 40 additions and 58 deletions

40
lib/Makefile Normal file
View File

@ -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

View File

@ -7,46 +7,6 @@
using namespace CosmoTool; using namespace CosmoTool;
using namespace std; 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 class NetCDF_handle
{ {
public: public:

View File

@ -187,24 +187,6 @@ namespace CosmoTool
void loadArray(const char *fname, void loadArray(const char *fname,
T*& array, uint32_t *& dimList, uint32_t& rank); 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); ProgressiveDoubleOutput saveDoubleArrayProgressive(const char *fname, uint32_t *dimList, uint32_t rank);
}; };