00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "writeFuns.H"
00029 #include <OpenFOAM/interpolatePointToCell.H>
00030
00031
00032
00033
00034 template<class Type>
00035 void Foam::writeFuns::insert
00036 (
00037 const List<Type>& source,
00038 DynamicList<floatScalar>& dest
00039 )
00040 {
00041 forAll(source, i)
00042 {
00043 insert(source[i], dest);
00044 }
00045 }
00046
00047
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 template<class Type>
00065 void Foam::writeFuns::write
00066 (
00067 std::ostream& os,
00068 const bool binary,
00069 const GeometricField<Type, fvPatchField, volMesh>& vvf,
00070 const vtkMesh& vMesh
00071 )
00072 {
00073 const fvMesh& mesh = vMesh.mesh();
00074
00075 const labelList& superCells = vMesh.topo().superCells();
00076
00077 label nValues = mesh.nCells() + superCells.size();
00078
00079 os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' '
00080 << nValues << " float" << std::endl;
00081
00082 DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nValues);
00083
00084 insert(vvf.internalField(), fField);
00085
00086 forAll(superCells, superCellI)
00087 {
00088 label origCellI = superCells[superCellI];
00089
00090 insert(vvf[origCellI], fField);
00091 }
00092 write(os, binary, fField);
00093 }
00094
00095
00096 template<class Type>
00097 void Foam::writeFuns::write
00098 (
00099 std::ostream& os,
00100 const bool binary,
00101 const GeometricField<Type, pointPatchField, pointMesh>& pvf,
00102 const vtkMesh& vMesh
00103 )
00104 {
00105 const fvMesh& mesh = vMesh.mesh();
00106 const vtkTopo& topo = vMesh.topo();
00107
00108 const labelList& addPointCellLabels = topo.addPointCellLabels();
00109 const label nTotPoints = mesh.nPoints() + addPointCellLabels.size();
00110
00111 os << pvf.name() << ' ' << pTraits<Type>::nComponents << ' '
00112 << nTotPoints << " float" << std::endl;
00113
00114 DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints);
00115
00116 insert(pvf, fField);
00117
00118 forAll(addPointCellLabels, api)
00119 {
00120 label origCellI = addPointCellLabels[api];
00121
00122 insert(interpolatePointToCell(pvf, origCellI), fField);
00123 }
00124 write(os, binary, fField);
00125 }
00126
00127
00128 template<class Type>
00129 void Foam::writeFuns::write
00130 (
00131 std::ostream& os,
00132 const bool binary,
00133 const GeometricField<Type, fvPatchField, volMesh>& vvf,
00134 const GeometricField<Type, pointPatchField, pointMesh>& pvf,
00135 const vtkMesh& vMesh
00136 )
00137 {
00138 const fvMesh& mesh = vMesh.mesh();
00139 const vtkTopo& topo = vMesh.topo();
00140
00141 const labelList& addPointCellLabels = topo.addPointCellLabels();
00142 const label nTotPoints = mesh.nPoints() + addPointCellLabels.size();
00143
00144 os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' '
00145 << nTotPoints << " float" << std::endl;
00146
00147 DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints);
00148
00149 insert(pvf, fField);
00150
00151 forAll(addPointCellLabels, api)
00152 {
00153 label origCellI = addPointCellLabels[api];
00154
00155 insert(vvf[origCellI], fField);
00156 }
00157 write(os, binary, fField);
00158 }
00159
00160
00161 template<class Type, template<class> class PatchField, class GeoMesh>
00162 void Foam::writeFuns::write
00163 (
00164 std::ostream& os,
00165 const bool binary,
00166 const PtrList<GeometricField<Type, PatchField, GeoMesh> >& flds,
00167 const vtkMesh& vMesh
00168 )
00169 {
00170 forAll(flds, i)
00171 {
00172 write(os, binary, flds[i], vMesh);
00173 }
00174 }
00175
00176
00177 template<class Type>
00178 void Foam::writeFuns::write
00179 (
00180 std::ostream& os,
00181 const bool binary,
00182 const volPointInterpolation& pInterp,
00183 const PtrList<GeometricField<Type, fvPatchField, volMesh> >& flds,
00184 const vtkMesh& vMesh
00185 )
00186 {
00187 forAll(flds, i)
00188 {
00189 write(os, binary, flds[i], pInterp.interpolate(flds[i])(), vMesh);
00190 }
00191 }
00192
00193
00194