ENH: Updated utilities using lagrangian classes

This commit is contained in:
andy
2011-02-24 16:47:54 +00:00
parent bf172bbf57
commit af115c5d01
20 changed files with 223 additions and 427 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -283,7 +283,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
label tetFaceI = -1;
label tetPtI = -1;
cloud.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
mesh_.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
if (cellI != -1)
{
@ -309,7 +309,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
(
new trackedParticle
(
cloud,
mesh_,
keepPoint,
cellI,
tetFaceI,
@ -330,7 +330,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
labelList maxFeatureLevel(mesh_.nCells(), -1);
// Database to pass into trackedParticle::move
trackedParticle::trackData td(cloud, maxFeatureLevel);
trackedParticle::trackingData td(cloud, maxFeatureLevel);
// Track all particles to their end position (= starting feature point)
cloud.move(td, GREAT);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,7 +29,7 @@ License
Foam::trackedParticle::trackedParticle
(
const Cloud<trackedParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -40,7 +40,7 @@ Foam::trackedParticle::trackedParticle
const label j
)
:
Particle<trackedParticle>(c, position, cellI, tetFaceI, tetPtI),
particle(mesh, position, cellI, tetFaceI, tetPtI),
end_(end),
level_(level),
i_(i),
@ -50,12 +50,12 @@ Foam::trackedParticle::trackedParticle
Foam::trackedParticle::trackedParticle
(
const Cloud<trackedParticle>& c,
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
Particle<trackedParticle>(c, is, readFields)
particle(mesh, is, readFields)
{
if (readFields)
{
@ -89,7 +89,7 @@ Foam::trackedParticle::trackedParticle
bool Foam::trackedParticle::move
(
trackedParticle::trackData& td,
trackingData& td,
const scalar trackedParticle
)
{
@ -120,7 +120,7 @@ bool Foam::trackedParticle::move
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
trackingData& td,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
@ -130,42 +130,10 @@ bool Foam::trackedParticle::hitPatch
}
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
int&,
const label,
const scalar trackFraction,
const tetIndices& tetIs
)
{
return false;
}
void Foam::trackedParticle::hitWedgePatch
(
const wedgePolyPatch&,
trackedParticle::trackData& td
)
{
// Remove particle
td.keepParticle = false;
}
void Foam::trackedParticle::hitWedgePatch
(
const wedgePolyPatch&,
int&
)
{}
void Foam::trackedParticle::hitSymmetryPatch
(
const symmetryPolyPatch&,
trackedParticle::trackData& td
trackingData& td
)
{
// Remove particle
@ -176,15 +144,7 @@ void Foam::trackedParticle::hitSymmetryPatch
void Foam::trackedParticle::hitSymmetryPatch
(
const symmetryPolyPatch&,
int&
)
{}
void Foam::trackedParticle::hitCyclicPatch
(
const cyclicPolyPatch&,
trackedParticle::trackData& td
trackingData& td
)
{
// Remove particle
@ -195,15 +155,18 @@ void Foam::trackedParticle::hitCyclicPatch
void Foam::trackedParticle::hitCyclicPatch
(
const cyclicPolyPatch&,
int&
trackingData& td
)
{}
{
// Remove particle
td.keepParticle = false;
}
void Foam::trackedParticle::hitProcessorPatch
(
const processorPolyPatch&,
trackedParticle::trackData& td
trackingData& td
)
{
// Remove particle
@ -211,18 +174,10 @@ void Foam::trackedParticle::hitProcessorPatch
}
void Foam::trackedParticle::hitProcessorPatch
(
const processorPolyPatch&,
int&
)
{}
void Foam::trackedParticle::hitWallPatch
(
const wallPolyPatch& wpp,
trackedParticle::trackData& td,
trackingData& td,
const tetIndices&
)
{
@ -231,32 +186,15 @@ void Foam::trackedParticle::hitWallPatch
}
void Foam::trackedParticle::hitWallPatch
(
const wallPolyPatch& wpp,
int&,
const tetIndices&
)
{}
void Foam::trackedParticle::hitPatch
(
const polyPatch& wpp,
trackedParticle::trackData& td
)
{
// Remove particle
td.keepParticle = false;
}
void Foam::trackedParticle::hitPatch
(
const polyPatch& wpp,
int&
trackingData& td
)
{}
{
// Remove particle
td.keepParticle = false;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
@ -265,7 +203,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Particle<trackedParticle>&>(p)
os << static_cast<const particle&>(p)
<< token::SPACE << p.end_
<< token::SPACE << p.level_
<< token::SPACE << p.i_
@ -273,7 +211,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
}
else
{
os << static_cast<const Particle<trackedParticle>&>(p);
os << static_cast<const particle&>(p);
os.write
(
reinterpret_cast<const char*>(&p.end_),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ SourceFiles
#ifndef trackedParticle_H
#define trackedParticle_H
#include "Particle.H"
#include "particle.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ class trackedParticleCloud;
class trackedParticle
:
public Particle<trackedParticle>
public particle
{
// Private data
@ -74,35 +74,26 @@ public:
friend class Cloud<trackedParticle>;
//- Class used to pass tracking data to the trackToFace function
class trackData
class trackingData
:
public particle::TrackingData<Cloud<trackedParticle> >
{
//- Reference to the cloud containing this particle
Cloud<trackedParticle>& cloud_;
labelList& maxLevel_;
public:
bool switchProcessor;
bool keepParticle;
// Constructors
trackData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
trackingData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
:
cloud_(cloud),
particle::TrackingData<Cloud<trackedParticle> >(cloud),
maxLevel_(maxLevel)
{}
// Member functions
Cloud<trackedParticle>& cloud()
{
return cloud_;
}
labelList& maxLevel()
{
return maxLevel_;
@ -116,7 +107,7 @@ public:
//- Construct from components
trackedParticle
(
const Cloud<trackedParticle>& c,
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
@ -130,20 +121,39 @@ public:
//- Construct from Istream
trackedParticle
(
const Cloud<trackedParticle>& c,
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone
autoPtr<Particle<trackedParticle> > clone() const
autoPtr<particle> clone() const
{
return autoPtr<Particle<trackedParticle> >
(
new trackedParticle(*this)
);
return autoPtr<particle>(new trackedParticle(*this));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<trackedParticle> operator()(Istream& is) const
{
return autoPtr<trackedParticle>
(
new trackedParticle(mesh_, is, true)
);
}
};
// Member Functions
@ -170,7 +180,7 @@ public:
// Tracking
//- Track all particles to their end point
bool move(trackData&, const scalar);
bool move(trackingData&, const scalar);
//- Overridable function to handle the particle hitting a patch
@ -178,30 +188,17 @@ public:
bool hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
trackingData& td,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
);
bool hitPatch
(
const polyPatch&,
int&,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
);
//- Overridable function to handle the particle hitting a wedge
void hitWedgePatch
(
const wedgePolyPatch&,
trackedParticle::trackData& td
);
void hitWedgePatch
(
const wedgePolyPatch&,
int&
trackingData& td
);
//- Overridable function to handle the particle hitting a
@ -209,24 +206,14 @@ public:
void hitSymmetryPatch
(
const symmetryPolyPatch&,
trackedParticle::trackData& td
);
void hitSymmetryPatch
(
const symmetryPolyPatch&,
int&
trackingData& td
);
//- Overridable function to handle the particle hitting a cyclic
void hitCyclicPatch
(
const cyclicPolyPatch&,
trackedParticle::trackData& td
);
void hitCyclicPatch
(
const cyclicPolyPatch&,
int&
trackingData& td
);
//- Overridable function to handle the particle hitting a
@ -234,25 +221,14 @@ public:
void hitProcessorPatch
(
const processorPolyPatch&,
trackedParticle::trackData& td
);
void hitProcessorPatch
(
const processorPolyPatch&,
int&
trackingData& td
);
//- Overridable function to handle the particle hitting a wallPatch
void hitWallPatch
(
const wallPolyPatch&,
trackedParticle::trackData& td,
const tetIndices&
);
void hitWallPatch
(
const wallPolyPatch&,
int&,
trackingData& td,
const tetIndices&
);
@ -260,20 +236,13 @@ public:
void hitPatch
(
const polyPatch&,
trackedParticle::trackData& td
);
void hitPatch
(
const polyPatch&,
int&
trackingData& td
);
// Ostream Operator
friend Ostream& operator<<(Ostream&, const trackedParticle&);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,7 +33,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineParticleTypeNameAndDebug(trackedParticle, 0);
//defineParticleTypeNameAndDebug(trackedParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<trackedParticle>, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //