From 54ce51bd89b568724c994bae98553b93ff40b03e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 23 Mar 1998 12:30:35 +0000 Subject: [PATCH] Clean up some quirks of gcc 2.7; introduce new ones of gcc 2.8 git-svn-id: https://svn.dealii.org/trunk@93 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/Todo | 6 -- deal.II/deal.II/include/grid/tria_iterator.h | 83 ++++++++++++++------ deal.II/deal.II/include/numerics/data_io.h | 16 +--- deal.II/deal.II/source/grid/tria.cc | 9 +-- deal.II/deal.II/source/numerics/data_io.cc | 15 ++++ 5 files changed, 77 insertions(+), 52 deletions(-) diff --git a/deal.II/deal.II/Todo b/deal.II/deal.II/Todo index 4086d29f8f..b0d40ed8f4 100644 --- a/deal.II/deal.II/Todo +++ b/deal.II/deal.II/Todo @@ -1,12 +1,6 @@ Replace the declaration of vector in tria.h by something real when gcc2.8 is available -Make some functions in the iterators inlined, if the compiler - accepts them in gcc2.8 - -Make the iterator functions (begin_*, end) templated with gcc2.8, - let the dimension then be templated (gcc2.8 chokes ober the return - type) Rewrite code like int flagged_cells = 0; diff --git a/deal.II/deal.II/include/grid/tria_iterator.h b/deal.II/deal.II/include/grid/tria_iterator.h index 1d14bf0c60..5eecf0e472 100644 --- a/deal.II/deal.II/include/grid/tria_iterator.h +++ b/deal.II/deal.II/include/grid/tria_iterator.h @@ -267,23 +267,13 @@ class TriaRawIterator : public bidirectional_iterator{ * You must not dereference invalid or * past the end iterators. */ - const Accessor & operator * () const { - // put this function here, since we can't - // inline it with gcc 2.7 - Assert (state() == valid, ExcDereferenceInvalidObject()); - return accessor; - }; - + const Accessor & operator * () const; + /** * Dereferencing operator, non-#const# * version. */ - Accessor & operator * () { - // put this function here, since we can't - // inline it with gcc 2.7 - Assert (state() == valid, ExcDereferenceInvalidObject()); - return accessor; - }; + Accessor & operator * (); /** * Dereferencing operator, returns a @@ -293,22 +283,13 @@ class TriaRawIterator : public bidirectional_iterator{ * There is a #const# and a non-#const# * version. */ - const Accessor * operator -> () const { - // put this function here, since we can't - // inline it with gcc 2.7 - return &(this->operator* ()); - }; - - + const Accessor * operator -> () const; + /** * Dereferencing operator, non-#const# * version. */ - Accessor * operator -> () { - // put this function here, since we can't - // inline it with gcc 2.7 - return &(this->operator* ()); - }; + Accessor * operator -> (); /*@}*/ /** @@ -417,7 +398,7 @@ class TriaRawIterator : public bidirectional_iterator{ */ DeclException0 (ExcAdvanceInvalidObject); /*@}*/ -// protected: // don't know why we can't declare this protected (gcc2.7 chokes!?) +// protected: // don't know why we can't declare this protected (gcc2.7/8 chokes!?) Accessor accessor; }; @@ -678,6 +659,52 @@ class TriaActiveIterator : public TriaIterator { + + +/*----------------------- Inline functions -------------------*/ + + + +template +inline +const Accessor & +TriaRawIterator::operator * () const { + Assert (state() == valid, ExcDereferenceInvalidObject()); + return accessor; +}; + + + + +template +inline +Accessor & +TriaRawIterator::operator * () { + Assert (state() == valid, ExcDereferenceInvalidObject()); + return accessor; +}; + + + +template +inline +const Accessor * +TriaRawIterator::operator -> () const { + return &(this->operator* ()); +}; + + + +template +inline +Accessor * +TriaRawIterator::operator -> () { + return &(this->operator* ()); +}; + + + + template inline IteratorState TriaRawIterator::state () const { @@ -717,6 +744,8 @@ ostream & operator << (ostream &out, const TriaRawIterator &i) { return out; }; + + template inline ostream & operator << (ostream &out, const TriaIterator &i) { @@ -724,6 +753,8 @@ ostream & operator << (ostream &out, const TriaIterator &i) { return out; }; + + template inline ostream & operator << (ostream &out, const TriaActiveIterator &i) { diff --git a/deal.II/deal.II/include/numerics/data_io.h b/deal.II/deal.II/include/numerics/data_io.h index b55ea675ec..b80676e563 100644 --- a/deal.II/deal.II/include/numerics/data_io.h +++ b/deal.II/deal.II/include/numerics/data_io.h @@ -330,23 +330,13 @@ class DataOut { * invalid object, but is needed for * the STL classes. */ - DataEntry () : - // don't know why we have - // to define here, gcc2.8 - // should be able to handle - // this in the .cc file - data(0), name(""), units("") {}; + DataEntry (); /** * Constructor */ - DataEntry (const dVector *data, const String name, const String units) : - // don't know why we have - // to define here, gcc2.8 - // should be able to handle - // this in the .cc file - data(data), name(name), units(units) {}; - + DataEntry (const dVector *data, const String name, const String units); + /** * Pointer to the data vector. */ diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index d19912d962..2d0b3ba87d 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -1443,13 +1443,8 @@ unsigned int Triangulation::max_adjacent_cells () const { for (unsigned vertex=0; vertex<(1<vertex_index(vertex)]; - // use max(.,.) when gcc2.8 is available - const unsigned short int max_entry = *(max_element (usage_count.begin(), - usage_count.end())); - if (max_entry > (1<::read_ucd (istream &in) { +template +DataOut::DataEntry::DataEntry () : + data(0), name(""), units("") {}; + + + +template +DataOut::DataEntry::DataEntry (const dVector *data, + const String name, + const String units) : + data(data), name(name), units(units) {}; + + + + template DataOut::DataOut () : dofs(0) {}; -- 2.39.5