Reason for declaration of enumerator in OpenFOAM
Jul 7, 2016 at 4:30pm UTC
Hello.
I want to implement something new in OpenFOAM, but I have trouble to
understanding existing code.
Problem starts at line 161, file KinematicParcel.H. Declaration of enumerator. Does anyone have idea why this is declared? I have attached other relevant files, but I don't see why this is used.
https://www.dropbox.com/s/xzkfpxhifajoz1e/dr.zip?dl=0
This is very important to me to understand, because this enumerator is used in file CollidingCloud.C (lines 53 - 57) which I need to modify.
Any help, any tip is appreciated.
Regards,
Darko
Jul 7, 2016 at 4:37pm UTC
Hi,
I am sorry, but I think you would get comments much faster and easier if you posted your code directly on this forum.
However, the choice is up to you. Welcome to C++ forum :)
Jul 7, 2016 at 5:35pm UTC
All right. I wanted to give more information, so I have posted in this way. I will try to rephrase question.
If I have declaration in one file,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
template <class CloudType>
class TrackingData
:
public ParcelType::template TrackingData<CloudType>
{
public :
enum trackPart
{
tpVelocityHalfStep,
tpLinearTrack,
tpRotationalTrack
};
private :
// Private data
// Interpolators for continuous phase fields
//- Density interpolator
autoPtr<interpolation<scalar>> rhoInterp_;
//- Velocity interpolator
autoPtr<interpolation<vector>> UInterp_;
//- Curl interpolator
autoPtr<interpolation<vector> > CurlUInterp_;
//- Dynamic viscosity interpolator
autoPtr<interpolation<scalar>> muInterp_;
//- Local gravitational or other body-force acceleration
const vector& g_;
// label specifying which part of the integration
// algorithm is taking place
trackPart part_;
public :
// Constructors
//- Construct from components
inline TrackingData
(
CloudType& cloud,
trackPart part = tpLinearTrack
);
what would be purpose of declaring
1 2 3 4 5 6
enum trackPart
{
tpVelocityHalfStep,
tpLinearTrack,
tpRotationalTrack
};
in previous code? For example, there is usage
1 2
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, solution_.trackTime());
What do I get with this enumerator? What is the basic intention of enumerators? What do I miss?
Also, there is usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
template <class CloudType>
template <class TrackData>
void Foam::CollidingCloud<CloudType>::moveCollide
(
TrackData& td,
const scalar deltaT
)
{
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, deltaT);
// td.part() = TrackData::tpRotationalTrack;
// CloudType::move(td);
this ->updateCellOccupancy();
this ->collision().collide();
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
}
I hope I was clear.
Topic archived. No new replies allowed.