mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: minor update of particle methods
This commit is contained in:
@ -38,8 +38,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef passivePositionParticle_H
|
||||
#define passivePositionParticle_H
|
||||
#ifndef Foam_passivePositionParticle_H
|
||||
#define Foam_passivePositionParticle_H
|
||||
|
||||
#include "particle.H"
|
||||
#include "IOstream.H"
|
||||
@ -82,7 +82,6 @@ public:
|
||||
location_(position())
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from components (supplied location)
|
||||
passivePositionParticle
|
||||
(
|
||||
@ -98,7 +97,6 @@ public:
|
||||
location_(position)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Istream
|
||||
passivePositionParticle
|
||||
(
|
||||
@ -165,39 +163,39 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return current particle position
|
||||
inline const point& location() const
|
||||
//- The cached particle position
|
||||
const point& location() const noexcept
|
||||
{
|
||||
return location_;
|
||||
}
|
||||
|
||||
//- Write the particle position and cell id
|
||||
// Uses cached location() instead of calculated position()
|
||||
virtual void writePosition(Ostream& os) const
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
return location_;
|
||||
os << location() << token::SPACE << cell();
|
||||
}
|
||||
else
|
||||
{
|
||||
positionsCompat1706 p;
|
||||
|
||||
const size_t s =
|
||||
(
|
||||
offsetof(positionsCompat1706, facei)
|
||||
- offsetof(positionsCompat1706, position)
|
||||
);
|
||||
|
||||
p.position = location();
|
||||
p.celli = cell();
|
||||
|
||||
os.write(reinterpret_cast<const char*>(&p.position), s);
|
||||
}
|
||||
|
||||
//- Write the particle position and cell id
|
||||
virtual void writePosition(Ostream& os) const
|
||||
{
|
||||
// Use cached location() instead of calculated position()
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << location() << token::SPACE << cell();
|
||||
}
|
||||
else
|
||||
{
|
||||
positionsCompat1706 p;
|
||||
|
||||
const size_t s =
|
||||
(
|
||||
offsetof(positionsCompat1706, facei)
|
||||
- offsetof(positionsCompat1706, position)
|
||||
);
|
||||
|
||||
p.position = location();
|
||||
p.celli = cell();
|
||||
|
||||
os.write(reinterpret_cast<const char*>(&p.position), s);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check(FUNCTION_NAME);
|
||||
}
|
||||
// Check state of Ostream
|
||||
os.check(FUNCTION_NAME);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user