CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Ray intersecting BoundaryMesh

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   January 4, 2016, 11:30
Default Ray intersecting BoundaryMesh
Join Date: Jul 2009
Location: Germany
Posts: 53
Rep Power: 9
David* is on a distinguished road

I try to compute the intersection point of a given line (2 points) and the polyBoundaryMesh of my OF case.

Following this thread (, I'm using an object of type Foam::indexedOctree<treeDataTriSurface>. I construct the required triSurface from the STLs used to generate the mesh.

Unfortunately, the STLs are not exactly identical to the BoundaryMesh, causing errors. Therefore, I tried to construct a Foam::indexedOctree<treeDataPrimitivePatch> from the BoundaryMesh patches to use as a basis, but failed. It should look something like this:
Foam::indexedOctree<treeDataPrimitivePatch>& octree1(???);
Foam::pointIndexHit pHit = octree1.findLine(insideP, outsideP);
Can you tell me how to create my object "octree1"? Or any alternative way of computing the intersection?

Thanks a lot!

Last edited by David*; January 21, 2016 at 11:17.
David* is offline   Reply With Quote

Old   February 16, 2016, 05:50
Join Date: Jul 2009
Location: Germany
Posts: 53
Rep Power: 9
David* is on a distinguished road
sorry for reply, the edit button is gone...
I fixed it using
#include "volFields.H"          // Diverse fields called by fvCFD.H
#include "fvCFD.H"              // OpenFOAM Finite Volume tools
#include "treeDataFace.H"       // Search faces

using namespace Foam;


    Foam::point outsideP(xEnd, yEnd, zEnd);
    Foam::point insideP(xStart, yStart, zStart);
    const Foam::fvPatchList& patches = mesh.boundary();

    forAll(patches, patchI)
        const polyPatch& polyPatch1 = patches[patchI].patch();

        treeBoundBox allBoundingBox(polyPatch1.points());

        const indexedOctree<treeDataFace> octree1
            treeDataFace(false, polyPatch1),
            allBoundingBox, // overall search domain
            8,      // maxLevel
            10,     // leafsize
            3.0     // duplicity

        pointIndexHit pHit = octree1.findLine(insideP, outsideP);

David* is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan Open Source Meshers: Gmsh, Netgen, CGNS, ... 3 October 22, 2015 11:05
Solar Ray Tracing and non conformal interface AlexBene FLUENT 0 May 21, 2015 04:31
Ray tracing gorlcjstk FLUENT 0 August 4, 2011 08:04
ray intersection with a curved surface gama Main CFD Forum 0 August 3, 2006 14:53
Self intersecting Carlos Saraiva CD-adapco 0 January 23, 2003 09:33

All times are GMT -4. The time now is 13:10.