Also contains a patch from Wolfgang with changes to the instantiation file.
Background: In release mode, GNU-4.8.x (OSX) seem to optimize away the calls when
specializing the template functions and then symbol definitions seem to be different
between debug and optimized modes. This causes undefined linkage for release mode.
References:
[1] https://groups.google.com/forum/#!topic/dealii/c2qjAsuJ7Mc
[2] https://code.google.com/p/dealii/issues/detail?id=137
[3] https://groups.google.com/forum/#!msg/dealii/6RXRR-iac0Y/Tjzwg1rFRMQJ
}
+//----------------------------------------------------------------------//
+
+ template <class G>
+ template <int dim, int spacedim>
+ dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >
+ TriaObjects<G>::next_free_single_object (const dealii::Triangulation<dim,spacedim> &tria)
+ {
+ // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+ int pos=next_free_single,
+ last=used.size()-1;
+ if (!reverse_order_next_free_single)
+ {
+ // first sweep forward, only use really single slots, do not use
+ // pair slots
+ for (; pos<last; ++pos)
+ if (!used[pos])
+ if (used[++pos])
+ {
+ // this was a single slot
+ pos-=1;
+ break;
+ }
+ if (pos>=last)
+ {
+ reverse_order_next_free_single=true;
+ next_free_single=used.size()-1;
+ pos=used.size()-1;
+ }
+ else
+ next_free_single=pos+1;
+ }
+ else
+ {
+ // second sweep, use all slots, even
+ // in pairs
+ for (; pos>=0; --pos)
+ if (!used[pos])
+ break;
+ if (pos>0)
+ next_free_single=pos-1;
+ else
+ // no valid single object anymore
+ return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, -1, -1);
+ }
+
+ return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, 0, pos);
+ }
+
+
+
+ template <class G>
+ template <int dim, int spacedim>
+ dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >
+ TriaObjects<G>::next_free_pair_object (const dealii::Triangulation<dim,spacedim> &tria)
+ {
+ // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+ int pos=next_free_pair,
+ last=used.size()-1;
+ for (; pos<last; ++pos)
+ if (!used[pos])
+ if (!used[++pos])
+ {
+ // this was a pair slot
+ pos-=1;
+ break;
+ }
+ if (pos>=last)
+ // no free slot
+ return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, -1, -1);
+ else
+ next_free_pair=pos+2;
+
+ return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, 0, pos);
+ }
+
+
// declaration of explicit specializations
{
namespace Triangulation
{
- template <class G>
- template <int dim, int spacedim>
- dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >
- TriaObjects<G>::next_free_single_object (const dealii::Triangulation<dim,spacedim> &tria)
- {
- // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-
- int pos=next_free_single,
- last=used.size()-1;
- if (!reverse_order_next_free_single)
- {
- // first sweep forward, only use really single slots, do not use
- // pair slots
- for (; pos<last; ++pos)
- if (!used[pos])
- if (used[++pos])
- {
- // this was a single slot
- pos-=1;
- break;
- }
- if (pos>=last)
- {
- reverse_order_next_free_single=true;
- next_free_single=used.size()-1;
- pos=used.size()-1;
- }
- else
- next_free_single=pos+1;
- }
-
- if (reverse_order_next_free_single)
- {
- // second sweep, use all slots, even
- // in pairs
- for (; pos>=0; --pos)
- if (!used[pos])
- break;
- if (pos>0)
- next_free_single=pos-1;
- else
- // no valid single object anymore
- return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, -1, -1);
- }
-
- return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, 0, pos);
- }
-
-
-
- template <class G>
- template <int dim, int spacedim>
- dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >
- TriaObjects<G>::next_free_pair_object (const dealii::Triangulation<dim,spacedim> &tria)
- {
- // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-
- int pos=next_free_pair,
- last=used.size()-1;
- for (; pos<last; ++pos)
- if (!used[pos])
- if (!used[++pos])
- {
- // this was a pair slot
- pos-=1;
- break;
- }
- if (pos>=last)
- // no free slot
- return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, -1, -1);
- else
- next_free_pair=pos+2;
-
- return dealii::TriaRawIterator<dealii::TriaAccessor<G::dimension,dim,spacedim> >(&tria, 0, pos);
- }
-
-
template<class G>
void
TriaObjects<G>::reserve_space (const unsigned int new_objects_in_pairs,
for (deal_II_dimension : DIMENSIONS)
{
#if deal_II_dimension >= 2
- template dealii::TriaRawIterator<dealii::TriaAccessor<1,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<1>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<1> >::next_free_single_object (const dealii::Triangulation<deal_II_dimension> &tria);
- template dealii::TriaRawIterator<dealii::TriaAccessor<1,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<1>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<1> >::next_free_pair_object (const dealii::Triangulation<deal_II_dimension> &tria);
- template dealii::TriaRawIterator<dealii::TriaAccessor<2,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<2>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<2> >::next_free_single_object (const dealii::Triangulation<deal_II_dimension> &tria);
- template dealii::TriaRawIterator<dealii::TriaAccessor<2,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<2>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<2> >::next_free_pair_object (const dealii::Triangulation<deal_II_dimension> &tria);
#endif
#if deal_II_dimension >= 3
- template dealii::TriaRawIterator<dealii::TriaAccessor<3,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<3>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<3> >::next_free_single_object (const dealii::Triangulation<deal_II_dimension> &tria);
- template dealii::TriaRawIterator<dealii::TriaAccessor<3,deal_II_dimension,deal_II_dimension> >
+ template dealii::TriaRawIterator<dealii::TriaAccessor<TriaObject<3>::dimension,deal_II_dimension,deal_II_dimension> >
TriaObjects<TriaObject<3> >::next_free_pair_object (const dealii::Triangulation<deal_II_dimension> &tria);
template dealii::Triangulation<deal_II_dimension>::raw_hex_iterator