View Issue Details

IDProjectCategoryView StatusLast Update
0000212OpenFOAMBugpublic2013-11-11 14:27
Reporteruser203Assigned Touser4 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSUbuntuOS Version10.04
Summary0000212: Using the octreeLine getIntersections() function prevents any code from compiling
DescriptionI wanted to quickly gather a list of cells that are intersected by a line. I created an octreeDataCell object to hold the cells, then generated an octree of those objects. I can successfully create an octreeLine object using my octree and 2 points but when I try to use getIntersections() as described in the doxygen documentation (http://foam.sourceforge.net/doc/Doxygen/html/classFoam_1_1octreeLine.html) it fails to compile and outputs numerous errors. (See attached file for output.) This will occur regardless of the type of the octree.
Steps To ReproduceCreate an octree object of any type.
Create an octreeLine object from that octree.
In the code use the getIntersections() method as outlined at http://foam.sourceforge.net/doc/Doxygen/html/classFoam_1_1octreeLine.html
Compile the code with wmake.
Additional InformationI'm trying to do some simple shadowing in openFOAM using ray-casting. Obviously I'd rather use the built in octree classes to speed this process up rather than doing a brute force check of every patch face. This failure to compile is blocking any future work. Thank you for your time.
TagsNo tags attached.

Activities

user203

2011-06-07 15:39

 

errorOut.txt (14,507 bytes)   
Making dependency list for source file rayCast.C
SOURCE=rayCast.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/software/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude     -I/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude     -I/software/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/cfdTools      -I/software/OpenFOAM/OpenFOAM-1.7.x/src/dynamicMesh/boundaryMesh        -I/software/OpenFOAM/OpenFOAM-1.7.x/src/meshes/meshShapes  -IlnInclude -I. -I/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude -I/software/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rayCast.o
In file included from /usr/include/c++/4.4/algorithm:62,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:32,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.H:429,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/List.H:43,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/labelList.H:36,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/Pstream.H:43,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/OPstream.H:35,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from rayCast.C:28:
/usr/include/c++/4.4/bits/stl_algo.h: In function �const _Tp& std::__median(const _Tp&, const _Tp&, const _Tp&) [with _Tp = Foam::pointHitSort]�:
/usr/include/c++/4.4/bits/stl_algo.h:2268:   instantiated from �void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = Foam::pointHitSort*, _Size = long int]�
/usr/include/c++/4.4/bits/stl_algo.h:5220:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_algo.h:89: error: no match for �operator<� in �__a < __b�
/usr/include/c++/4.4/bits/stl_algo.h:90: error: no match for �operator<� in �__b < __c�
/usr/include/c++/4.4/bits/stl_algo.h:92: error: no match for �operator<� in �__a < __c�
/usr/include/c++/4.4/bits/stl_algo.h:96: error: no match for �operator<� in �__a < __c�
/usr/include/c++/4.4/bits/stl_algo.h:98: error: no match for �operator<� in �__b < __c�
/usr/include/c++/4.4/bits/stl_algo.h: In function �_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _Tp) [with _RandomAccessIterator = Foam::pointHitSort*, _Tp = Foam::pointHitSort]�:
/usr/include/c++/4.4/bits/stl_algo.h:2268:   instantiated from �void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = Foam::pointHitSort*, _Size = long int]�
/usr/include/c++/4.4/bits/stl_algo.h:5220:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_algo.h:2209: error: no match for �operator<� in �* __first < __pivot�
/usr/include/c++/4.4/bits/stl_algo.h:2212: error: no match for �operator<� in �__pivot < * __last�
/usr/include/c++/4.4/bits/stl_algo.h: In function �void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�:
/usr/include/c++/4.4/bits/stl_algo.h:2178:   instantiated from �void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:5222:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_algo.h:2106: error: no match for �operator<� in �__val < * __first�
/usr/include/c++/4.4/bits/stl_algo.h: In function �void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�:
/usr/include/c++/4.4/bits/stl_algo.h:5067:   instantiated from �void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:2256:   instantiated from �void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = Foam::pointHitSort*, _Size = long int]�
/usr/include/c++/4.4/bits/stl_algo.h:5220:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_algo.h:1906: error: no match for �operator<� in �* __i < * __first�
/usr/include/c++/4.4/bits/stl_algo.h: In function �void std::__unguarded_linear_insert(_RandomAccessIterator, _Tp) [with _RandomAccessIterator = Foam::pointHitSort*, _Tp = Foam::pointHitSort]�:
/usr/include/c++/4.4/bits/stl_algo.h:2112:   instantiated from �void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:2178:   instantiated from �void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:5222:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_algo.h:2067: error: no match for �operator<� in �__val < * __next�
In file included from /usr/include/c++/4.4/bits/stl_algo.h:62,
                 from /usr/include/c++/4.4/algorithm:62,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:32,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.H:429,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/List.H:43,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/labelList.H:36,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/Pstream.H:43,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/OPstream.H:35,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/parRun.H:35,
                 from /software/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from rayCast.C:28:
/usr/include/c++/4.4/bits/stl_heap.h: In function �void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = Foam::pointHitSort*, _Distance = long int, _Tp = Foam::pointHitSort]�:
/usr/include/c++/4.4/bits/stl_heap.h:394:   instantiated from �void std::make_heap(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:1904:   instantiated from �void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:5067:   instantiated from �void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:2256:   instantiated from �void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = Foam::pointHitSort*, _Size = long int]�
/usr/include/c++/4.4/bits/stl_algo.h:5220:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_heap.h:232: error: no match for �operator<� in �*(__first + ((long unsigned int)(((long unsigned int)__secondChild) * 56ul))) < *(__first + ((((long unsigned int)__secondChild) + 0xffffffffffffffffffffffffffffffffu) * 56u))�
/usr/include/c++/4.4/bits/stl_heap.h: In function �void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = Foam::pointHitSort*, _Distance = long int, _Tp = Foam::pointHitSort]�:
/usr/include/c++/4.4/bits/stl_heap.h:244:   instantiated from �void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = Foam::pointHitSort*, _Distance = long int, _Tp = Foam::pointHitSort]�
/usr/include/c++/4.4/bits/stl_heap.h:394:   instantiated from �void std::make_heap(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:1904:   instantiated from �void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:5067:   instantiated from �void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/usr/include/c++/4.4/bits/stl_algo.h:2256:   instantiated from �void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = Foam::pointHitSort*, _Size = long int]�
/usr/include/c++/4.4/bits/stl_algo.h:5220:   instantiated from �void std::sort(_RAIter, _RAIter) [with _RAIter = Foam::pointHitSort*]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/UList.C:123:   instantiated from �void Foam::sort(Foam::UList<T>&) [with T = Foam::pointHitSort]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:74:   instantiated from �void Foam::octreeLine<Type>::calcSortedIntersections() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:120:   instantiated from �bool Foam::octreeLine<Type>::getNextLeaf() [with Type = Foam::octreeDataCell]�
/software/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude/octreeLine.C:169:   instantiated from �bool Foam::octreeLine<Type>::getIntersection() [with Type = Foam::octreeDataCell]�
rayCast.C:375:   instantiated from here
/usr/include/c++/4.4/bits/stl_heap.h:134: error: no match for �operator<� in �*(__first + ((long unsigned int)(((long unsigned int)__parent) * 56ul))) < __value�
make: *** [Make/linux64GccDPOpt/rayCast.o] Error 1
errorOut.txt (14,507 bytes)   

user203

2011-06-08 14:59

  ~0000422

I found the issue and fixed the problem.

When the intersections the octreeLine finds are sorted, (line 74 of octreeLine.C) you perform a c++ std::sort on the intersections. The problem is that those intersections are of type pointHitSort, which do not have a "<" operator defined, which is what the standard sort uses to sort the entries.

Simply adding,

        bool operator<(const pointHitSort& rhs) const
        {
            return inter_.distance() < rhs.inter().distance();
        }

to pointHitSort.H solves my problem.

This bug report can be closed, thanks.

user4

2011-06-08 15:20

  ~0000423

I've pushed it into 89fc6e632d0c2ad967e836f4d315aad1f79ae1ad

Thanks for reporting.

Mattijs

Issue History

Date Modified Username Field Change
2011-06-07 15:39 user203 New Issue
2011-06-07 15:39 user203 File Added: errorOut.txt
2011-06-08 14:59 user203 Note Added: 0000422
2011-06-08 15:20 user4 Note Added: 0000423
2011-06-08 15:20 user4 Status new => resolved
2011-06-08 15:20 user4 Fixed in Version => 1.7.x
2011-06-08 15:20 user4 Resolution open => fixed
2011-06-08 15:20 user4 Assigned To => user4