Hi Joshua,
this is already fixed in the subversion archive. If you want to only
apply the fix, add the word "inline" at the correct spots:
--- timer.h (revision 21859)
+++ timer.h (revision 21860)
@@ -563,15 +563,22 @@
/* ---------------- inline functions ----------------- */
+
#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
-const Timer::TimeMinMaxAvg & Timer::get_data() const
+inline
+const Timer::TimeMinMaxAvg &
+Timer::get_data() const
{
return mpi_data;
}
+
+
template <class STREAM>
-void Timer::print_data(STREAM & stream) const
+inline
+void
+Timer::print_data(STREAM & stream) const
{
unsigned int my_id =
dealii::Utilities::System::get_this_mpi_process(mpi_communicator);
if (my_id==0)
I hope that helps.
--
Timo Heister
http://num.math.uni-goettingen.de/~heister
On Thu, Sep 30, 2010 at 2:45 AM, White, Joshua A. <[email protected]> wrote:
> Hi All,
>
> I have a base class called NewtonKrylov, from which a bunch of sub-classes
> are derived for specific nonlinear formulations. In the base class I have a
> TimerOutput object to keep track of timing statistics. After recently
> updating my copy of deal.II, I began to get a linking error having to do with
> the Timer::get_data() function:
>
> :: lib/geocentric :: 3d :: Remaking lib/Makefile.dep
> :: lib/geocentric :: 3d :: optimized/MT :: main.cc
> :: lib/geocentric :: 3d :: optimized/MT :: newton-krylov.cc
> :: lib/geocentric :: 3d :: optimized/MT :: nk-faulted-geostatic.cc
> :: lib/geocentric :: 3d :: optimized/MT :: nk-geostatic.cc
> :: lib/geocentric :: 3d :: optimized/MT :: nk-hydrogeo-2.cc
> :: lib/geocentric :: 3d :: optimized/MT :: nk-hydrogeo-3.cc
> :: lib/geocentric :: 3d :: MT :: Linking geocentric
> lib/3d/newton-krylov.o: In function `dealii::Timer::get_data() const':
> newton-krylov.cc:(.text+0x0): multiple definition of
> `dealii::Timer::get_data() const'
> lib/3d/main.o:main.cc:(.text+0x0): first defined here
> lib/3d/nk-faulted-geostatic.o: In function `dealii::Timer::get_data() const':
> nk-faulted-geostatic.cc:(.text+0x0): multiple definition of
> `dealii::Timer::get_data() const'
> lib/3d/main.o:main.cc:(.text+0x0): first defined here
>
> ... and so on .....
>
> I noticed that get_data() is defined in the header file (timer.h) and I
> believe it is therefore being included in multiple compilation units (one for
> each NewtonKrylov subclass), triggering the above multiple definition error.
> If I move the definition of get_data() to timer.cc this issue goes away. Is
> there a specific reason that get_data() is defined in the header, rather than
> the .cc file? My suspicion is that it was originally meant to be inlined,
> but that this is no longer the case.
>
> If anyone has any other insights, either as to changes I should make within
> my code or to the Timer implementation, I'd appreciate hearing them!
>
> Best,
> Josh
> _______________________________________________
> dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
>
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii