Commit 6adf0cbc authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge remote branch 'OpenCFD/master' into olesenm

parents c508b2fe 9bb6e5ac
......@@ -375,6 +375,44 @@ int main(int argc, char *argv[])
// mesh wrapper; does subsetting and decomposition
vtkMesh vMesh(mesh, cellSetName);
// Scan for all possible lagrangian clouds
HashSet<fileName> allCloudDirs;
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
fileNameList cloudDirs
(
readDir
(
runTime.timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY
)
);
forAll(cloudDirs, i)
{
IOobjectList sprayObjs
(
mesh,
runTime.timeName(),
cloud::prefix/cloudDirs[i]
);
IOobject* positionsPtr = sprayObjs.lookup("positions");
if (positionsPtr)
{
if (allCloudDirs.insert(cloudDirs[i]))
{
Info<< "At time: " << runTime.timeName()
<< " detected cloud directory : " << cloudDirs[i]
<< endl;
}
}
}
}
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
......@@ -926,38 +964,33 @@ int main(int argc, char *argv[])
//
//---------------------------------------------------------------------
fileNameList cloudDirs
(
readDir
forAllConstIter(HashSet<fileName>, allCloudDirs, iter)
{
const fileName& cloudName = iter.key();
// Always create the cloud directory.
mkDir(fvPath/cloud::prefix/cloudName);
fileName lagrFileName
(
runTime.timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY
)
);
fvPath/cloud::prefix/cloudName/cloudName
+ "_" + timeDesc + ".vtk"
);
Info<< " Lagrangian: " << lagrFileName << endl;
forAll(cloudDirs, i)
{
IOobjectList sprayObjs
(
mesh,
runTime.timeName(),
cloud::prefix/cloudDirs[i]
cloud::prefix/cloudName
);
IOobject* positionsPtr = sprayObjs.lookup("positions");
if (positionsPtr)
{
mkDir(fvPath/cloud::prefix/cloudDirs[i]);
fileName lagrFileName
(
fvPath/cloud::prefix/cloudDirs[i]/cloudDirs[i]
+ "_" + timeDesc + ".vtk"
);
Info<< " Lagrangian: " << lagrFileName << endl;
wordList labelNames(sprayObjs.names(labelIOField::typeName));
Info<< " labels :";
print(Info, labelNames);
......@@ -999,18 +1032,19 @@ int main(int argc, char *argv[])
vMesh,
binary,
lagrFileName,
cloudDirs[i]
cloudName,
false
);
// Write number of fields
writer.writeParcelHeader
(
labelNames.size()
+ scalarNames.size()
+ vectorNames.size()
+ sphereNames.size()
+ symmNames.size()
+ tensorNames.size()
+ scalarNames.size()
+ vectorNames.size()
+ sphereNames.size()
+ symmNames.size()
+ tensorNames.size()
);
// Fields
......@@ -1021,6 +1055,20 @@ int main(int argc, char *argv[])
writer.writeIOField<symmTensor>(symmNames);
writer.writeIOField<tensor>(tensorNames);
}
else
{
lagrangianWriter writer
(
vMesh,
binary,
lagrFileName,
cloudName,
true
);
// Write number of fields
writer.writeParcelHeader(0);
}
}
}
......
......@@ -36,7 +36,8 @@ Foam::lagrangianWriter::lagrangianWriter
const vtkMesh& vMesh,
const bool binary,
const fileName& fName,
const word& cloudName
const word& cloudName,
const bool dummyCloud
)
:
vMesh_(vMesh),
......@@ -51,19 +52,28 @@ Foam::lagrangianWriter::lagrangianWriter
writeFuns::writeHeader(os_, binary_, mesh.time().caseName());
os_ << "DATASET POLYDATA" << std::endl;
Cloud<passiveParticle> parcels(mesh, cloudName_, false);
if (dummyCloud)
{
nParcels_ = 0;
nParcels_ = parcels.size();
os_ << "POINTS " << nParcels_ << " float" << std::endl;
}
else
{
Cloud<passiveParticle> parcels(mesh, cloudName_, false);
os_ << "POINTS " << parcels.size() << " float" << std::endl;
nParcels_ = parcels.size();
DynamicList<floatScalar> partField(3*parcels.size());
os_ << "POINTS " << nParcels_ << " float" << std::endl;
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{
writeFuns::insert(elmnt().position(), partField);
DynamicList<floatScalar> partField(3*parcels.size());
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
{
writeFuns::insert(elmnt().position(), partField);
}
writeFuns::write(os_, binary_, partField);
}
writeFuns::write(os_, binary_, partField);
}
......
......@@ -80,7 +80,8 @@ public:
const vtkMesh&,
const bool binary,
const fileName&,
const word&
const word&,
const bool dummyCloud
);
......
......@@ -165,11 +165,6 @@ void Foam::vtkPV3blockMesh::convertMeshEdges
continue;
}
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
// search each block
forAll(blkMesh, blockI)
{
......
......@@ -91,7 +91,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
{
OPstream::write
(
Pstream::blocking,
Pstream::scheduled,
slave,
reinterpret_cast<const char*>
(
......@@ -105,7 +105,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
{
IPstream::read
(
Pstream::blocking,
Pstream::scheduled,
Pstream::masterNo(),
reinterpret_cast<char*>(sourceSol.begin()),
sourceSol.byteSize()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment