polaroid-pp

Schlieren and contour plot tool
git clone https://git.0xfab.ch/polaroid-pp.git
Log | Files | Refs | Submodules | README | LICENSE

commit c06a4a2a1eb2ba5d6c14258d906bdcb41d274c26
parent d308c93a5d2fef2df16a23c972e1b02fa40b72f7
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date:   Wed, 27 Apr 2016 10:32:54 +0200

cleaning up

Diffstat:
MMakefile | 28+++++++++++++++-------------
MMakefile.config | 10+++++-----
Ainclude/PhotoPaper.h | 27+++++++++++++++++++++++++++
Rsrc/Polaroid.h -> include/Polaroid.h | 0
Dsrc/PhotoPNG.h | 75---------------------------------------------------------------------------
Dsrc/PhotoPaper.h | 26--------------------------
6 files changed, 47 insertions(+), 119 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,14 +1,16 @@ include ./Makefile.config -CC = g++ +CC = mpic++ -# SRC = Polaroid.cpp PhotoPaper.cpp -# HDR = Polaroid.h PhotoPaper.h IdealSchlieren.h -SRC = src/Polaroid.cpp -HDR = src/Polaroid.h src/PhotoPaper.h +HDR = $(wildcard src/*.h) +SRC = $(wildcard src/*.cpp) OBJ = ${SRC:.cpp=.o} -Polaroid: $(HDR) $(OBJ) liball +polaroidCamera: Polaroid + + +Polaroid: $(HDR) $(OBJ) third_party + ar rcs lib/libPolaroid.a $(OBJ) # schlierenCamera: all schlierenCamera.cpp # $(CC) $(CPPFLAGS) $(INC) -o schlierenCamera schlierenCamera.cpp $(OBJ) $(LIB) -lz -lpng -lhdf5 -lWaveletCompressor @@ -20,13 +22,13 @@ Polaroid: $(HDR) $(OBJ) liball # (cd test; make all) %.o: %.cpp - $(CC) $(CPPFLAGS) $(INC) -c $< -o $@ + g++ $(CPPFLAGS) $(INC) -c $< -o $@ -liball: +third_party: (cd third_party; make all) -# clean: -# find . -iname "*~" -exec rm -f {} \; -# rm -f $(OBJ) schlierenCamera hsvCamera -# (cd lib; make clean) -# (cd test; make clean) +clean: + find . -iname "*~" -exec rm -f {} \; + rm -f $(OBJ) + rm -f lib/libPolaroid.a + (cd third_party; make clean) diff --git a/Makefile.config b/Makefile.config @@ -1,7 +1,7 @@ config ?= release bs ?= 16 align ?= 16 -omp ?= 1 +omp ?= 0 hdf ?= 1 cubismz ?= 1 prec ?= float @@ -34,11 +34,11 @@ ifeq "$(prec)" "float" endif ifneq "$(config)" "release" - CFLAGS = -g -O0 - CPPFLAGS = -g -O0 + CFLAGS += -g -O0 + CPPFLAGS += -g -O0 else - CFLAGS = -O3 -DNDEBUG - CPPFLAGS = -O3 -DNDEBUG + CFLAGS += -O3 -DNDEBUG + CPPFLAGS += -O3 -DNDEBUG endif LIB += -lm -lz -ldl diff --git a/include/PhotoPaper.h b/include/PhotoPaper.h @@ -0,0 +1,27 @@ +// File : PhotoPaper.h +// Date : Tue Apr 26 14:45:19 2016 +// Author : Fabian Wermelinger +// Description: Photo Paper Base +// Copyright 2016 ETH Zurich. All Rights Reserved. +#ifndef PHOTOPAPER_H_B0K8P9TO +#define PHOTOPAPER_H_B0K8P9TO + +#include "Types.h" + +class PhotoPaper +{ +protected: + int m_width, m_height; + +public: + PhotoPaper(const int width, const int height) : m_width(width), m_height(height) {}; + virtual ~PhotoPaper() {}; + + virtual void make_new(const int width, const int height) = 0; + virtual void write() = 0; + virtual void set_pixel(const int x, const int y, const double phi) = 0; + virtual std::string suffix() const = 0; + virtual void set_description(const char* const desc) { } +}; + +#endif /* PHOTOPAPER_H_B0K8P9TO */ diff --git a/src/Polaroid.h b/include/Polaroid.h diff --git a/src/PhotoPNG.h b/src/PhotoPNG.h @@ -1,75 +0,0 @@ -// File : PhotoPNG.h -// Date : Tue Apr 26 14:46:18 2016 -// Author : Fabian Wermelinger -// Description: PNG Photos -// Copyright 2016 ETH Zurich. All Rights Reserved. -#ifndef PHOTOPNG_H_7DZT9TLW -#define PHOTOPNG_H_7DZT9TLW - -#include "PhotoPaper.h" -#include "pngwriter.h" - -class PNG_MONOCHROME : public PNG_HSV -{ -public: - PNG_MONOCHROME(const std::string filename="mono.png", const double saturation=1.0, const double value=1.0, const double bg=1.0) : - PNG_HSV(filename, saturation, value, bg) - { } - - inline void set_pixel(const int x, const int y, const double phi) - { - if (m_png) m_png->plot(x+1, y+1, phi, phi, phi); - } -}; - -class PNG_RGB : public PNG_HSV -{ - PNG_RGB(const std::string filename="rgb.png", const double saturation=1.0, const double value=1.0, const double bg=1.0) : - PNG_HSV(filename, saturation, value, bg) - { } - - inline void set_pixel(const int x, const int y, const double R, const double G, const double B) - { - if (m_png) m_png->plot(x+1, y+1, R, G, B); - } -}; - -class PNG_HSV : public PhotoPaper -{ -public: - PNG_HSV(const std::string filename="hsv.png", const double saturation=1.0, const double value=1.0, const double bg=1.0); - virtual ~PNG_HSV() - { - if (m_png) m_png->close(); - _dispose(); - } - - void make_new(const int width, const int height); - inline void set_pixel(const int x, const int y, const double phi) - { - const double hue = 2./3. * (1.0 - phi); - if (m_png) m_png->plotHSV(x+1, y+1, hue, m_saturation, m_value); - } - inline void set_description(const char* const desc) { m_description = desc; } - inline void write() - { - if (m_png) - { - m_png->settext(m_title.c_str(), m_author.c_str(), m_description.c_str(), m_software.c_str()); - m_png->write_png(); - } - } - inline void set_filename(const std::string new_name) { m_filename=new_name; m_title=new_name; } - inline std::string suffix() const { return std::string(".png"); } - -protected: - pngwriter* m_png; - int m_width, m_height; - double m_saturation, m_value, m_background; - std::string m_filename; - std::string m_title, m_author, m_description, m_software; - - inline void _dispose() { delete m_png; m_png=0; } -}; - -#endif /* PHOTOPNG_H_7DZT9TLW */ diff --git a/src/PhotoPaper.h b/src/PhotoPaper.h @@ -1,26 +0,0 @@ -// File : PhotoPaper.h -// Date : Tue Apr 26 14:45:19 2016 -// Author : Fabian Wermelinger -// Description: Photo Paper Base -// Copyright 2016 ETH Zurich. All Rights Reserved. -#ifndef PHOTOPAPER_H_B0K8P9TO -#define PHOTOPAPER_H_B0K8P9TO - -#include "Types.h" - -class PhotoPaper -{ -protected: - int m_width, m_height; - -public: - PhotoPaper(const int width=256, const int height=256) : m_width(width), m_height(height) {}; - virtual ~PhotoPaper() {}; - - virtual void make_new(const int width, const int height) = 0; - virtual void set_pixel(const int x, const int y, const double phi) = 0; - virtual inline std::string suffix() const = 0; - virtual void set_description(const char* const desc) { } -}; - -#endif /* PHOTOPAPER_H_B0K8P9TO */