$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 00026 #ifndef VTK_DATA_OUTPUT_H 00027 #define VTK_DATA_OUTPUT_H 00028 00029 #include "core/globalDefs.h" 00030 #include <string> 00031 #include <fstream> 00032 #include <sstream> 00033 #include <vector> 00034 00035 #include "core/serializer.h" 00036 #include "atomicBlock/dataField2D.h" 00037 #include "multiBlock/multiDataField2D.h" 00038 #include "atomicBlock/dataField3D.h" 00039 #include "multiBlock/multiDataField3D.h" 00040 #include "core/array.h" 00041 00042 namespace plb { 00043 00044 class VtkDataWriter3D { 00045 public: 00046 VtkDataWriter3D(std::string const& fileName_); 00047 ~VtkDataWriter3D(); 00048 void writeHeader(Box3D domain, Array<double,3> origin, double deltaX); 00049 void startPiece(Box3D domain); 00050 void endPiece(); 00051 void writeFooter(); 00052 template<typename T> 00053 void writeDataField( DataSerializer const* serializer, 00054 std::string const& name, plint nDim ); 00055 private: 00056 VtkDataWriter3D(VtkDataWriter3D const& rhs); 00057 VtkDataWriter3D operator=(VtkDataWriter3D const& rhs); 00058 private: 00059 std::string fileName; 00060 std::ofstream *ostr; 00061 }; 00062 00063 template<typename T> 00064 class VtkImageOutput2D { 00065 public: 00066 VtkImageOutput2D(std::string fName, double deltaX_=1.); 00067 VtkImageOutput2D(std::string fName, double deltaX_, Array<double,2> offset); 00068 ~VtkImageOutput2D(); 00069 template<typename TConv> 00070 void writeData( plint nx, plint ny, plint nDim, 00071 DataSerializer const* serializer, std::string const& name ); 00072 template<typename TConv> 00073 void writeData(ScalarField2D<T>& scalarField, 00074 std::string scalarFieldName, TConv scalingFactor=(T)1); 00075 template<typename TConv> 00076 void writeData(MultiScalarField2D<T>& scalarField, 00077 std::string scalarFieldName, TConv scalingFactor=(T)1); 00078 template<plint n, typename TConv> 00079 void writeData(TensorField2D<T,n>& tensorField, 00080 std::string tensorFieldName, TConv scalingFactor=(T)1); 00081 template<plint n, typename TConv> 00082 void writeData(MultiTensorField2D<T,n>& tensorField, 00083 std::string tensorFieldName, TConv scalingFactor=(T)1); 00084 template<typename TConv> 00085 void writeData(NTensorField2D<T>& nTensorField, 00086 std::string nTensorFieldName, TConv scalingFactor=(T)1); 00087 template<typename TConv> 00088 void writeData(MultiNTensorField2D<T>& nTensorField, 00089 std::string nTensorFieldName, TConv scalingFactor=(T)1); 00090 private: 00091 void writeHeader(plint nx_, plint ny_); 00092 void writeFooter(); 00093 private: 00094 std::string fullName; 00095 VtkDataWriter3D vtkOut; 00096 double deltaX; 00097 Array<T,2> offset; 00098 bool headerWritten; 00099 plint nx, ny; 00100 }; 00101 00102 template<typename T> 00103 class VtkImageOutput3D { 00104 public: 00105 VtkImageOutput3D(std::string fName, double deltaX_=1.); 00106 VtkImageOutput3D(std::string fName, double deltaX_, Array<double,3> offset); 00107 ~VtkImageOutput3D(); 00108 template<typename TConv> 00109 void writeData( plint nx, plint ny, plint nz, plint nDim, 00110 DataSerializer const* serializer, std::string const& name ); 00111 template<typename TConv> 00112 void writeData( Box3D boundingBox_, plint nDim, 00113 DataSerializer const* serializer, std::string const& name ); 00114 template<typename TConv> 00115 void writeData(ScalarField3D<T>& scalarField, 00116 std::string scalarFieldName, TConv scalingFactor=(T)1); 00117 template<typename TConv> 00118 void writeData(MultiScalarField3D<T>& scalarField, 00119 std::string scalarFieldName, TConv scalingFactor=(T)1); 00120 template<plint n, typename TConv> 00121 void writeData(TensorField3D<T,n>& tensorField, 00122 std::string tensorFieldName, TConv scalingFactor=(T)1); 00123 template<plint n, typename TConv> 00124 void writeData(MultiTensorField3D<T,n>& tensorField, 00125 std::string tensorFieldName, TConv scalingFactor=(T)1); 00126 template<typename TConv> 00127 void writeData(NTensorField3D<T>& nTensorField, 00128 std::string nTensorFieldName, TConv scalingFactor=(T)1); 00129 template<typename TConv> 00130 void writeData(MultiNTensorField3D<T>& nTensorField, 00131 std::string nTensorFieldName, TConv scalingFactor=(T)1); 00132 private: 00133 void writeHeader(plint nx_, plint ny_, plint nz_); 00134 void writeHeader(Box3D boundingBox_); 00135 void writeFooter(); 00136 private: 00137 std::string fullName; 00138 VtkDataWriter3D vtkOut; 00139 double deltaX; 00140 Array<T,3> offset; 00141 bool headerWritten; 00142 Box3D boundingBox; 00143 }; 00144 00145 } // namespace plb 00146 00147 #endif // VTK_DATA_OUTPUT_H
1.6.3
1.6.3