mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added writePositions
This commit is contained in:
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user