$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
00001 /* This file is part of the Palabos library. 00002 * 00003 * Copyright (C) 2011 FlowKit Sarl 00004 * Avenue de Chailly 23 00005 * 1012 Lausanne, Switzerland 00006 * E-mail contact: contact@flowkit.com 00007 * 00008 * The most recent release of Palabos can be downloaded at 00009 * <http://www.palabos.org/> 00010 * 00011 * The library Palabos is free software: you can redistribute it and/or 00012 * modify it under the terms of the GNU Affero General Public License as 00013 * published by the Free Software Foundation, either version 3 of the 00014 * License, or (at your option) any later version. 00015 * 00016 * The library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Affero General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Affero General Public License 00022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #ifndef IMAGE_WRITER_H 00026 #define IMAGE_WRITER_H 00027 00028 #include "core/globalDefs.h" 00029 #include "atomicBlock/dataField2D.h" 00030 #include "multiBlock/multiDataField2D.h" 00031 #include "atomicBlock/dataField3D.h" 00032 #include "multiBlock/multiDataField3D.h" 00033 #include "io/colormaps.h" 00034 #include <sstream> 00035 #include <iomanip> 00036 #include <vector> 00037 00038 namespace plb { 00039 00040 template<typename T> 00041 class ImageWriter { 00042 public: 00043 ImageWriter(std::string const& map); 00044 ImageWriter(std::string const& map, plint colorRange_, plint numColors_); 00045 void setMap(std::string const& map, plint colorRange_, plint numColors_); 00046 00047 void writePpm(std::string const& fName, 00048 ScalarField2D<T>& field, 00049 T minVal, T maxVal) const; 00050 void writeScaledPpm(std::string const& fName, 00051 ScalarField2D<T>& field) const; 00052 void writeGif(std::string const& fName, 00053 ScalarField2D<T>& field, 00054 T minVal, T maxVal) const; 00055 void writeGif(std::string const& fName, 00056 ScalarField2D<T>& field, 00057 T minVal, T maxVal, plint sizeX, plint sizeY) const; 00058 void writeScaledGif(std::string const& fName, 00059 ScalarField2D<T>& field) const; 00060 void writeScaledGif(std::string const& fName, 00061 ScalarField2D<T>& field, 00062 plint sizeX, plint sizeY) const; 00063 00064 void writePpm(std::string const& fName, 00065 MultiScalarField2D<T>& field, 00066 T minVal, T maxVal) const; 00067 void writeScaledPpm(std::string const& fName, 00068 MultiScalarField2D<T>& field) const; 00069 void writeGif(std::string const& fName, 00070 MultiScalarField2D<T>& field, 00071 T minVal, T maxVal) const; 00072 void writeGif(std::string const& fName, 00073 MultiScalarField2D<T>& field, 00074 T minVal, T maxVal, plint sizeX, plint sizeY) const; 00075 void writeScaledGif(std::string const& fName, 00076 MultiScalarField2D<T>& field) const; 00077 void writeScaledGif(std::string const& fName, 00078 MultiScalarField2D<T>& field, 00079 plint sizeX, plint sizeY) const; 00080 00081 00082 void writePpm(std::string const& fName, 00083 ScalarField3D<T>& field, 00084 T minVal, T maxVal) const; 00085 void writeScaledPpm(std::string const& fName, 00086 ScalarField3D<T>& field) const; 00087 void writeGif(std::string const& fName, 00088 ScalarField3D<T>& field, 00089 T minVal, T maxVal) const; 00090 void writeGif(std::string const& fName, 00091 ScalarField3D<T>& field, 00092 T minVal, T maxVal, plint sizeX, plint sizeY) const; 00093 void writeScaledGif(std::string const& fName, 00094 ScalarField3D<T>& field) const; 00095 void writeScaledGif(std::string const& fName, 00096 ScalarField3D<T>& field, 00097 plint sizeX, plint sizeY) const; 00098 00099 void writePpm(std::string const& fName, 00100 MultiScalarField3D<T>& field, 00101 T minVal, T maxVal) const; 00102 void writeScaledPpm(std::string const& fName, 00103 MultiScalarField3D<T>& field) const; 00104 void writeGif(std::string const& fName, 00105 MultiScalarField3D<T>& field, 00106 T minVal, T maxVal) const; 00107 void writeGif(std::string const& fName, 00108 MultiScalarField3D<T>& field, 00109 T minVal, T maxVal, plint sizeX, plint sizeY) const; 00110 void writeScaledGif(std::string const& fName, 00111 MultiScalarField3D<T>& field) const; 00112 void writeScaledGif(std::string const& fName, 00113 MultiScalarField3D<T>& field, 00114 plint sizeX, plint sizeY) const; 00115 00116 private: 00117 void writePpmImplementation ( 00118 std::string const& fName, 00119 ScalarField2D<T>& localField, T minVal, T maxVal) const; 00120 void imageMagickPpmToGif(std::string const& fName) const; 00121 void imageMagickResize(std::string const& fName, 00122 plint sizeX, plint sizeY) const; 00123 private: 00124 plint colorRange, numColors; 00125 ColorMap colorMap; 00126 }; 00127 00128 00130 00131 inline std::string createFileName(std::string name, plint number, plint width) { 00132 std::stringstream fNameStream; 00133 fNameStream << name << std::setfill('0') << std::setw(width) << number; 00134 return fNameStream.str(); 00135 } 00136 00137 } // namespace plb 00138 00139 #endif
1.6.3
1.6.3