added writePositions

This commit is contained in:
andy
2009-03-16 17:42:28 +00:00
parent 706e425432
commit 0ccaf7aae7
2 changed files with 54 additions and 27 deletions

View File

@ -30,6 +30,7 @@ License
#include "PstreamCombineReduceOps.H"
#include "mapPolyMesh.H"
#include "Time.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -320,6 +321,25 @@ void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::writePositions() const
{
OFstream pObj
(
this->db().time().path()/this->name() + "_positions.obj"
);
forAllConstIter(typename Cloud<ParticleType>, *this, pIter)
{
const ParticleType& p = pIter();
pObj<< "v " << p.position().x() << " " << p.position().y() << " "
<< p.position().z() << nl;
}
pObj.flush();
}
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
#include "CloudIO.C"

View File

@ -46,6 +46,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of functions
template<class ParticleType>
class Cloud;
@ -173,44 +174,47 @@ public:
return IDLList<ParticleType>::size();
};
const const_iterator begin() const
{
return IDLList<ParticleType>::begin();
};
const const_iterator cbegin() const
{
return IDLList<ParticleType>::cbegin();
};
// Iterators
const const_iterator end() const
{
return IDLList<ParticleType>::end();
};
const const_iterator begin() const
{
return IDLList<ParticleType>::begin();
};
const const_iterator cend() const
{
return IDLList<ParticleType>::cend();
};
const const_iterator cbegin() const
{
return IDLList<ParticleType>::cbegin();
};
iterator begin()
{
return IDLList<ParticleType>::begin();
};
const const_iterator end() const
{
return IDLList<ParticleType>::end();
};
iterator end()
{
return IDLList<ParticleType>::end();
};
const const_iterator cend() const
{
return IDLList<ParticleType>::cend();
};
iterator begin()
{
return IDLList<ParticleType>::begin();
};
iterator end()
{
return IDLList<ParticleType>::end();
};
// Edit
void clear()
{
return IDLList<ParticleType>::clear();
};
// Edit
//- Transfer particle to cloud
void addParticle(ParticleType* pPtr);
@ -262,6 +266,9 @@ public:
IOstream::compressionType cmp
) const;
//- Write positions to <cloudName>_positions.obj file
void writePositions() const;
// Ostream Operator