← 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 02:22:00PM +0100, Johan Hake wrote:
> On Friday 16 January 2009 14:06:54 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())
> 
> Can someone enlight me why this is required? 
> 
> The return type of intersected_cells.size(), is, (no suprise) unsigned int, 
> _and_ whyt is this a problem on a 64 bits machine and not on a 32 bits????

size_t is defined in

  /usr/include/linux/types.h

to be __kernel_size_t which is defined to be either

  unsigned int   (in /usr/include/asm/posix_types_32.h)

or

  unsigned long  (in /usr/include/asm/posix_types_64.h)

So many things in DOLFIN (comparisons between size_t and dolfin::uint)
should really not work on my machine which is 64 bit but it does...

I think eventually we'll need to do something like

  typedef size_t uint;

in DOLFIN. Compatibility with std::* is more important than
compatibility with external libraries.

We'll need to copy the array of indices when calling MatSetValues or
convince PETSc to change to size_t (from int).

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References