← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Merge update to IntersectionDetector and attempt to fix buildbot error.

 

On Fri, Jan 16, 2009 at 2:22 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> On Fri, Jan 16, 2009 at 02:06:54PM +0100, Harish Narayanan wrote:
>> Harish Narayanan wrote:
>> > Anders Logg wrote:
>> >> On Fri, Jan 16, 2009 at 01:16:45PM +0100, Harish Narayanan wrote:
>> >>> DOLFIN wrote:
>> >>>> One or more new changesets pushed to the primary dolfin repository.
>> >>>> A short summary of the last three changesets is included below.
>> >>>>
>> >>>> changeset:   5579:f90965f4a6e518162a8b0dc857228d8b8bbf1624
>> >>>> tag:         tip
>> >>>> parent:      5577:c4cd050190c69bad85e19f49ee57c1d973e42c7e
>> >>>> parent:      5578:ce32197ca04ec1e1aeb52d73f6edaa3599332bd3
>> >>>> user:        Anders Logg <logg@xxxxxxxxx>
>> >>>> date:        Wed Jan 14 22:08:42 2009 +0100
>> >>>> files:       dolfin/mesh/IntersectionDetector.cpp
>> >>>> description:
>> >>>> Merge update to IntersectionDetector and attempt to fix buildbot error.
>> >>> Did you run into something like the following? Because that is what I am
>> >>> seeing now when I try to compile DOLFIN. Does this need gcc 4.3+ to work?
>> >> No, the problem I fixed was the functions at the bottom of
>> >> IntersectionDetector.cpp (which are used in the case HAS_GTS is not
>> >> defined).
>> >>
>> >> Your problem seems to be different and looks compiler-related.
>> >>
>> >> Can you try breaking up the offending line in parts to see what causes
>> >> the error:
>> >>
>> >>   cout << "Found " << intersected_cells.size() << " cells in Omega0" << endl;
>> >>
>> >> Change to
>> >>
>> >>   cout << "Found ";
>> >>   cout << intersected_cells.size();
>> >>   cout << " cells in Omega0";
>> >>   cout << endl;
>> >
>> > I did that, and as expected, it's the cout << intesected_cells.size();
>> > line that causes it to fail.
>> >
>> > dolfin/mesh/IntersectionDetector.cpp: In member function 'void
>> > dolfin::IntersectionDetector::new_intersection(const dolfin::Mesh&,
>> > std::vector<dolfin::uint, std::allocator<dolfin::uint> >&)':
>> > dolfin/mesh/IntersectionDetector.cpp:129: error: ambiguous overload for
>> > 'operator<<' in 'dolfin::cout << intersected_cells. std::vector<_Tp,
>> > _Alloc>::size [with _Tp = dolfin::uint, _Alloc =
>> > std::allocator<dolfin::uint>]()'
>> > ./dolfin/log/LogStream.h:29: note: candidates are: dolfin::LogStream&
>> > dolfin::LogStream::operator<<(const char*) <near match>
>> > ./dolfin/log/LogStream.h:30: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(const std::string&) <near match>
>> > ./dolfin/log/LogStream.h:31: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(int)
>> > ./dolfin/log/LogStream.h:32: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(unsigned int)
>> > ./dolfin/log/LogStream.h:33: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(double)
>> > ./dolfin/log/LogStream.h:34: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(dolfin::complex)
>> > ./dolfin/log/LogStream.h:35: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(const dolfin::LogStream&) <near match>
>> > ./dolfin/log/LogStream.h:37: note:                 dolfin::LogStream&
>> > dolfin::LogStream::operator<<(dolfin::real)
>> > dolfin/mesh/Point.h:111: note:                 dolfin::LogStream&
>> > dolfin::operator<<(dolfin::LogStream&, const dolfin::Point&)
>>
>> ... and typecasting it to uint resolves the problem.
>>
>> uint(intersected_cells.size())
>
> ok, the problem is that std::vector::size does not return unsigned int
> on your machine.
>
> dolfin::uint is a typedef that should preferrably be the same as
> whatever the STL classes use (size_t?).

I suspect that would move the problems elsewhere.
Most of our external dependencies use int many places
where dolfin uses uint, and if sizeof(uint) != sizeof(size_t)
we'll have big problems with moving arrays of uint to
arrays of size_t.

The real problem in this case is probably that the dolfin
log system doesn't build on the standard C++ streams,
but has hardcoded its own C implementation of writing
a small set of types.

LogStream should probably inherit std::ostream or
something. The way LogStream is built seems to
severely restrict the features you can use vs what
std::cout would allow.

Martin


Follow ups

References