* missing TriangulationInfoCacheFlags flag), an Assertion is thrown.
*
* Notice that this class only notices if the underlying Triangulation has
- * changed due to a Triangulation::Signals::any_change() signal beeing triggered.
+ * changed due to a Triangulation::Signals::any_change() signal being triggered.
*
* If the triangulation changes due to a MappingQEulerian being passed to this
* class, or because you manually change some vertex locations, then some of
* TriangulationInfoCacheFlags. If you provide the optional `mapping`
* argument, then this is used whenever a mapping is required.
*
- * @param tria The triangulation to work on
+ * @param tria The triangulation for which to store information
* @param flags TriangulationInfoCacheFlags that specify what to cache
* @param mapping The mapping to use when computing cached objects
*/
DEAL_II_NAMESPACE_OPEN
/**
- * The enum type given to the TriangulationInfoCache class to select what
- * information to cache.
- *
- * You can select more than one flag by concatenation using the bitwise or
- * <code>operator|(TriangulationInfoCacheFlags,TriangulationInfoCacheFlags)</code>.
- *
- * @author Luca Heltai, 2017.
- */
+ * The enum type given to the TriangulationInfoCache class to select what
+ * information to cache.
+ *
+ * You can select more than one flag by concatenation using the bitwise or
+ * <code>operator|(TriangulationInfoCacheFlags,TriangulationInfoCacheFlags)</code>.
+ *
+ * @author Luca Heltai, 2017.
+ */
enum TriangulationInfoCacheFlags
{
/**
/**
- * Output operator which outputs assemble flags as a set of or'd text values.
- *
- * @ref TriangulationInfoCacheFlags
- */
+ * Output operator which outputs assemble flags as a set of or'd text values.
+ *
+ * @ref TriangulationInfoCacheFlags
+ */
template <class StreamType>
inline
StreamType &operator << (StreamType &s, TriangulationInfoCacheFlags u)
/**
- * Global operator which returns an object in which all bits are set which are
- * either set in the first or the second argument. This operator exists since
- * if it did not then the result of the bit-or <tt>operator |</tt> would be an
- * integer which would in turn trigger a compiler warning when we tried to
- * assign it to an object of type TriangulationInfoCacheFlags.
- *
- * @ref TriangulationInfoCacheFlags
- */
+ * Global operator which returns an object in which all bits are set which are
+ * either set in the first or the second argument. This operator exists since
+ * if it did not then the result of the bit-or <tt>operator |</tt> would be an
+ * integer which would in turn trigger a compiler warning when we tried to
+ * assign it to an object of type TriangulationInfoCacheFlags.
+ *
+ * @ref TriangulationInfoCacheFlags
+ */
inline
TriangulationInfoCacheFlags
operator | (TriangulationInfoCacheFlags f1, TriangulationInfoCacheFlags f2)
/**
- * Global operator which sets the bits from the second argument also in the
- * first one.
- *
- * @ref TriangulationInfoCacheFlags
- */
+ * Global operator which sets the bits from the second argument also in the
+ * first one.
+ *
+ * @ref TriangulationInfoCacheFlags
+ */
inline
TriangulationInfoCacheFlags &
operator |= (TriangulationInfoCacheFlags &f1, TriangulationInfoCacheFlags f2)
/**
- * Global operator which returns an object in which all bits are set which are
- * set in the first as well as the second argument. This operator exists since
- * if it did not then the result of the bit-and <tt>operator &</tt> would be
- * an integer which would in turn trigger a compiler warning when we tried to
- * assign it to an object of type TriangulationInfoCacheFlags.
- *
- * @ref TriangulationInfoCacheFlags
- */
+ * Global operator which returns an object in which all bits are set which are
+ * set in the first as well as the second argument. This operator exists since
+ * if it did not then the result of the bit-and <tt>operator &</tt> would be
+ * an integer which would in turn trigger a compiler warning when we tried to
+ * assign it to an object of type TriangulationInfoCacheFlags.
+ *
+ * @ref TriangulationInfoCacheFlags
+ */
inline
TriangulationInfoCacheFlags
operator & (TriangulationInfoCacheFlags f1, TriangulationInfoCacheFlags f2)
/**
- * Global operator which clears all the bits in the first argument if they are
- * not also set in the second argument.
- *
- * @ref TriangulationInfoCacheFlags
- */
+ * Global operator which clears all the bits in the first argument if they are
+ * not also set in the second argument.
+ *
+ * @ref TriangulationInfoCacheFlags
+ */
inline
TriangulationInfoCacheFlags &
operator &= (TriangulationInfoCacheFlags &f1, TriangulationInfoCacheFlags f2)
// ---------------------------------------------------------------------
//
-// Copyright (C) 2016 by the deal.II authors
+// Copyright (C) 2017 by the deal.II authors
//
// This file is part of the deal.II library.
//
DEAL_II_NAMESPACE_OPEN
template<int dim, int spacedim>
-TriangulationInfoCache<dim,spacedim>::TriangulationInfoCache(const Triangulation<dim, spacedim> &tria,
+TriangulationInfoCache<dim,spacedim>::TriangulationInfoCache(
+ const Triangulation<dim, spacedim> &tria,
const TriangulationInfoCacheFlags &flags,
const Mapping<dim, spacedim> &mapping) :
tria(&tria),
{
update();
});
+
+ if(tria.n_active_cells()>0)
+ update();
}
+
+
template<int dim, int spacedim>
void TriangulationInfoCache<dim,spacedim>::update(bool topology_is_unchanged)
{
- if (cache_vertex_to_cell_map & flags)
- {
- vertex_to_cells = GridTools::vertex_to_cell_map(*tria);
- }
+ if(topology_is_unchanged == false) {
+ if (cache_vertex_to_cell_map & flags)
+ vertex_to_cells = GridTools::vertex_to_cell_map(*tria);
+ }
}
template<int dim, int spacedim>