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