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
@ -28,10 +28,6 @@ License
#include "DynamicList.H"
#include "polyMesh.H"
#include "Cloud.H"
#include "passiveParticle.H"
#include "IDLList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,11 +41,9 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Sample singly connected segment. Returns false if end_ reached.
bool Foam::faceOnlySet::trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells,
DynamicList<label>& samplingFaces,
@ -61,6 +55,10 @@ bool Foam::faceOnlySet::trackToBoundary
const vector smallVec = tol*offset;
const scalar smallDist = mag(smallVec);
passiveParticle& singleParticle = *particles.first();
particle::TrackingData<passiveParticleCloud> trackData(particles);
// Alias
const point& trackPt = singleParticle.position();
@ -68,7 +66,7 @@ bool Foam::faceOnlySet::trackToBoundary
{
point oldPoint = trackPt;
singleParticle.trackToFace(end_);
singleParticle.trackToFace(end_, trackData);
if (singleParticle.face() != -1 && mag(oldPoint - trackPt) > smallDist)
{
@ -212,18 +210,20 @@ void Foam::faceOnlySet::calcSamples
}
// Initialize tracking starting from trackPt
Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>());
passiveParticleCloud particles(mesh());
passiveParticle singleParticle
(
particles,
mesh(),
trackPt,
trackCellI
);
particles.addParticle(&singleParticle);
bool reachedBoundary = trackToBoundary
(
singleParticle,
particles,
samplingPts,
samplingCells,
samplingFaces,

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,16 +36,13 @@ SourceFiles
#include "sampledSet.H"
#include "DynamicList.H"
#include "passiveParticleCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class passiveParticle;
template<class Type> class Particle;
/*---------------------------------------------------------------------------*\
Class faceOnlySet Declaration
\*---------------------------------------------------------------------------*/
@ -71,7 +68,7 @@ class faceOnlySet
// reached
bool trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells,
DynamicList<label>& samplingFaces,

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
@ -38,8 +38,6 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Rework faceOnlySet samples.
// Take two consecutive samples
void Foam::midPointSet::genSamples()
{
// Generate midpoints.
@ -112,6 +110,7 @@ void Foam::midPointSet::genSamples()
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::midPointSet::midPointSet

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
@ -42,8 +42,6 @@ namespace Foam
{
// Forward declaration of classes
class passiveParticle;
template<class Type> class particle;
class meshSearch;
/*---------------------------------------------------------------------------*\

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
@ -42,8 +42,6 @@ namespace Foam
{
// Forward declaration of classes
class passiveParticle;
template<class Type> class particle;
class meshSearch;
/*---------------------------------------------------------------------------*\

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
@ -28,10 +28,6 @@ License
#include "DynamicList.H"
#include "polyMesh.H"
#include "Cloud.H"
#include "passiveParticle.H"
#include "IDLList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,7 +44,7 @@ namespace Foam
// Sample till hits boundary.
bool Foam::polyLineSet::trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
label& sampleI,
DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells,
@ -56,6 +52,10 @@ bool Foam::polyLineSet::trackToBoundary
DynamicList<scalar>& samplingCurveDist
) const
{
passiveParticle& singleParticle = *particles.first();
particle::TrackingData<passiveParticleCloud> trackData(particles);
// Alias
const point& trackPt = singleParticle.position();
@ -70,7 +70,7 @@ bool Foam::polyLineSet::trackToBoundary
do
{
singleParticle.stepFraction() = 0;
singleParticle.track(sampleCoords_[sampleI+1]);
singleParticle.track(sampleCoords_[sampleI+1], trackData);
}
while
(
@ -260,18 +260,18 @@ void Foam::polyLineSet::calcSamples
//
// Initialize tracking starting from sampleI
Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>());
passiveParticleCloud particles(mesh());
passiveParticle singleParticle
(
particles,
mesh(),
trackPt,
trackCellI
);
bool bReached = trackToBoundary
(
singleParticle,
particles,
sampleI,
samplingPts,
samplingCells,

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
@ -37,16 +37,13 @@ SourceFiles
#include "sampledSet.H"
#include "DynamicList.H"
#include "passiveParticleCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class passiveParticle;
template<class Type> class Particle;
/*---------------------------------------------------------------------------*\
Class polyLineSet Declaration
\*---------------------------------------------------------------------------*/
@ -68,7 +65,7 @@ class polyLineSet
// Returns false if end of samples reached.
bool trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
label& sampleI,
DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells,

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
@ -28,10 +28,6 @@ License
#include "DynamicList.H"
#include "polyMesh.H"
#include "Cloud.H"
#include "passiveParticle.H"
#include "IDLList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,9 +41,6 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Finds along line (samplePt + t * offset) next sample beyond or equal to
// currentPt.
// Updates samplePt, sampleI
bool Foam::uniformSet::nextSample
(
const point& currentPt,
@ -82,10 +75,9 @@ bool Foam::uniformSet::nextSample
}
// Sample singly connected segment. Returns false if end_ reached.
bool Foam::uniformSet::trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
point& samplePt,
label& sampleI,
DynamicList<point>& samplingPts,
@ -99,9 +91,13 @@ bool Foam::uniformSet::trackToBoundary
const vector smallVec = tol*offset;
const scalar smallDist = mag(smallVec);
passiveParticle& singleParticle = *particles.first();
// Alias
const point& trackPt = singleParticle.position();
particle::TrackingData<passiveParticleCloud> trackData(particles);
while(true)
{
// Find next samplePt on/after trackPt. Update samplePt, sampleI
@ -161,7 +157,7 @@ bool Foam::uniformSet::trackToBoundary
do
{
singleParticle.stepFraction() = 0;
singleParticle.track(samplePt);
singleParticle.track(samplePt, trackData);
if (debug)
{
@ -309,19 +305,16 @@ void Foam::uniformSet::calcSamples
while(true)
{
// Initialize tracking starting from trackPt
Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>());
passiveParticleCloud particles(mesh());
passiveParticle singleParticle
(
particles,
trackPt,
trackCellI
);
// Initialize tracking starting from trackPt
passiveParticle singleParticle(mesh(), trackPt, trackCellI);
particles.addParticle(&singleParticle);
bool reachedBoundary = trackToBoundary
(
singleParticle,
particles,
samplePt,
sampleI,
samplingPts,

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
@ -34,6 +34,7 @@ SourceFiles
#ifndef uniformSet_H
#define uniformSet_H
#include "passiveParticleCloud.H"
#include "sampledSet.H"
#include "DynamicList.H"
@ -42,10 +43,6 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class passiveParticle;
template<class Type> class Particle;
/*---------------------------------------------------------------------------*\
Class uniformSet Declaration
\*---------------------------------------------------------------------------*/
@ -85,7 +82,7 @@ class uniformSet
// reached
bool trackToBoundary
(
Particle<passiveParticle>& singleParticle,
passiveParticleCloud& particles,
point& samplePt,
label& sampleI,
DynamicList<point>& samplingPts,

View File

@ -29,6 +29,7 @@ License
#include "globalIndex.H"
#include "treeDataCell.H"
#include "treeDataFace.H"
#include "meshTools.H"
#include "addToRunTimeSelectionTable.H"