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