Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
64912831
Commit
64912831
authored
Mar 19, 2016
by
Henry Weller
Browse files
sampledSet/face: Improved robustness of face selection
parent
1b93e52c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sampling/sampledSet/face/faceOnlySet.C
View file @
64912831
...
...
@@ -47,17 +47,13 @@ bool Foam::faceOnlySet::trackToBoundary
(
passiveParticleCloud
&
particleCloud
,
passiveParticle
&
singleParticle
,
const
scalar
smallDist
,
DynamicList
<
point
>&
samplingPts
,
DynamicList
<
label
>&
samplingCells
,
DynamicList
<
label
>&
samplingFaces
,
DynamicList
<
scalar
>&
samplingCurveDist
)
const
{
// distance vector between sampling points
const
vector
offset
=
end_
-
start_
;
const
vector
smallVec
=
tol
*
offset
;
const
scalar
smallDist
=
mag
(
smallVec
);
particle
::
TrackingData
<
passiveParticleCloud
>
trackData
(
particleCloud
);
// Alias
...
...
@@ -101,7 +97,7 @@ void Foam::faceOnlySet::calcSamples
DynamicList
<
scalar
>&
samplingCurveDist
)
const
{
//
d
istance vector between sampling points
//
D
istance vector between sampling points
if
(
mag
(
end_
-
start_
)
<
SMALL
)
{
FatalErrorInFunction
...
...
@@ -138,13 +134,12 @@ void Foam::faceOnlySet::calcSamples
}
// Get first tracking point. Use bPoint, bFaceI if provided.
point
trackPt
;
label
trackCellI
=
-
1
;
label
trackFaceI
=
-
1
;
//
Info
<< "before getTrackingPoint : bPoint:" << bPoint
// << " bFaceI:" << bFaceI << endl;
//
Pout
<< "before getTrackingPoint : bPoint:" << bPoint
//
<< " bFaceI:" << bFaceI << endl;
getTrackingPoint
(
...
...
@@ -152,25 +147,25 @@ void Foam::faceOnlySet::calcSamples
bPoint
,
bFaceI
,
smallDist
,
trackPt
,
trackCellI
,
trackFaceI
);
//
Info
<< "after getTrackingPoint : "
// << " trackPt:" << trackPt
// << " trackCellI:" << trackCellI
// << " trackFaceI:" << trackFaceI
// << endl;
//
Pout
<< "after getTrackingPoint : "
//
<< " trackPt:" << trackPt
//
<< " trackCellI:" << trackCellI
//
<< " trackFaceI:" << trackFaceI
//
<< endl;
if
(
trackCellI
==
-
1
)
{
// Line start_ - end_ does not intersect domain at all.
// (or is along edge)
// Set points and cell/face labels to empty lists
//Info<< "calcSamples : Both start_ and end_ outside domain"
// << endl;
// Pout<< "calcSamples : Both start_ and end_ outside domain"
// << endl;
return
;
}
...
...
@@ -181,11 +176,11 @@ void Foam::faceOnlySet::calcSamples
trackFaceI
=
findNearFace
(
trackCellI
,
trackPt
,
smallDist
);
}
//
Info
<< "calcSamples : got first point to track from :"
// << " trackPt:" << trackPt
// << " trackCell:" << trackCellI
// << " trackFace:" << trackFaceI
// << endl;
//
Pout
<< "calcSamples : got first point to track from :"
//
<< " trackPt:" << trackPt
//
<< " trackCell:" << trackCellI
//
<< " trackFace:" << trackFaceI
//
<< endl;
//
// Track until hit end of all boundary intersections
...
...
@@ -200,11 +195,11 @@ void Foam::faceOnlySet::calcSamples
// index in bHits; current boundary intersection
label
bHitI
=
1
;
while
(
true
)
while
(
true
)
{
if
(
trackFaceI
!=
-
1
)
{
//
Info
<< "trackPt:" << trackPt << " on face so use." << endl;
//
Pout
<< "trackPt:" << trackPt << " on face so use." << endl;
samplingPts
.
append
(
trackPt
);
samplingCells
.
append
(
trackCellI
);
samplingFaces
.
append
(
trackFaceI
);
...
...
@@ -223,32 +218,27 @@ void Foam::faceOnlySet::calcSamples
(
particleCloud
,
singleParticle
,
smallDist
,
samplingPts
,
samplingCells
,
samplingFaces
,
samplingCurveDist
);
//
f
ill sampleSegments
//
F
ill sampleSegments
for
(
label
i
=
samplingPts
.
size
()
-
1
;
i
>=
startSegmentI
;
--
i
)
{
samplingSegments
.
append
(
segmentI
);
}
if
(
!
reachedBoundary
)
{
//
Info
<< "calcSamples : Reached end of samples: "
// << " samplePt now:" << singleParticle.position()
// << endl;
//
Pout
<< "calcSamples : Reached end of samples: "
//
<< " samplePt now:" << singleParticle.position()
//
<< endl;
break
;
}
// Go past boundary intersection where tracking stopped
// Use coordinate comparison instead of face comparison for
// accuracy reasons
bool
foundValidB
=
false
;
while
(
bHitI
<
bHits
.
size
())
...
...
@@ -257,15 +247,15 @@ void Foam::faceOnlySet::calcSamples
(
bHits
[
bHitI
].
hitPoint
()
-
singleParticle
.
position
())
&
normOffset
;
//
Info
<< "Finding next boundary : "
// << "bPoint:" << bHits[bHitI].hitPoint()
// << " tracking:" << singleParticle.position()
// << " dist:" << dist
// << endl;
//
Pout
<< "Finding next boundary : "
//
<< "bPoint:" << bHits[bHitI].hitPoint()
//
<< " tracking:" << singleParticle.position()
//
<< " dist:" << dist
//
<< endl;
if
(
dist
>
smallDist
)
{
//
h
itpoint is past tracking position
//
H
it
-
point is past tracking position
foundValidB
=
true
;
break
;
}
...
...
@@ -275,7 +265,7 @@ void Foam::faceOnlySet::calcSamples
}
}
if
(
!
foundValidB
)
if
(
!
foundValidB
||
bHitI
==
bHits
.
size
()
-
1
)
{
// No valid boundary intersection found beyond tracking position
break
;
...
...
src/sampling/sampledSet/face/faceOnlySet.H
View file @
64912831
...
...
@@ -70,6 +70,7 @@ class faceOnlySet
(
passiveParticleCloud
&
particleCloud
,
passiveParticle
&
singleParticle
,
const
scalar
smallDist
,
DynamicList
<
point
>&
samplingPts
,
DynamicList
<
label
>&
samplingCells
,
DynamicList
<
label
>&
samplingFaces
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment