Go to the documentation of this file.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 #include "lagrangianWriter.H"
00027 #include "writeFuns.H"
00028 #include <lagrangian/Cloud.H>
00029 #include <lagrangian/passiveParticle.H>
00030
00031
00032
00033
00034 Foam::lagrangianWriter::lagrangianWriter
00035 (
00036 const vtkMesh& vMesh,
00037 const bool binary,
00038 const fileName& fName,
00039 const word& cloudName,
00040 const bool dummyCloud
00041 )
00042 :
00043 vMesh_(vMesh),
00044 binary_(binary),
00045 fName_(fName),
00046 cloudName_(cloudName),
00047 os_(fName.c_str())
00048 {
00049 const fvMesh& mesh = vMesh_.mesh();
00050
00051
00052 writeFuns::writeHeader(os_, binary_, mesh.time().caseName());
00053 os_ << "DATASET POLYDATA" << std::endl;
00054
00055 if (dummyCloud)
00056 {
00057 nParcels_ = 0;
00058
00059 os_ << "POINTS " << nParcels_ << " float" << std::endl;
00060 }
00061 else
00062 {
00063 Cloud<passiveParticle> parcels(mesh, cloudName_, false);
00064
00065 nParcels_ = parcels.size();
00066
00067 os_ << "POINTS " << nParcels_ << " float" << std::endl;
00068
00069 DynamicList<floatScalar> partField(3*parcels.size());
00070
00071 forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
00072 {
00073 writeFuns::insert(elmnt().position(), partField);
00074 }
00075 writeFuns::write(os_, binary_, partField);
00076 }
00077 }
00078
00079
00080
00081
00082 void Foam::lagrangianWriter::writeParcelHeader(const label nFields)
00083 {
00084 os_ << "POINT_DATA " << nParcels_ << std::endl
00085 << "FIELD attributes " << nFields
00086 << std::endl;
00087 }
00088
00089
00090