Reference documentation for deal.II version Git 7e3e0f8 2017-12-13 08:28:15 -0500
Public Member Functions | Private Attributes | List of all members
GridTools::Cache< dim, spacedim > Class Template Reference

#include <deal.II/grid/grid_tools_cache.h>

Inheritance diagram for GridTools::Cache< dim, spacedim >:
[legend]

Public Member Functions

 Cache (const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
 
 ~Cache ()
 
void mark_for_update (const CacheUpdateFlags &flags=update_all)
 
const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_vertex_to_cell_map () const
 
const std::vector< std::vector< Tensor< 1, spacedim > > > & get_vertex_to_cell_centers_directions () const
 
const std::map< unsigned int, Point< spacedim > > & get_used_vertices () const
 
const Triangulation< dim, spacedim > & get_triangulation () const
 
const Mapping< dim, spacedim > & get_mapping () const
 
const KDTree< spacedim > & get_vertex_kdtree () const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&)
 
void subscribe (const char *identifier=nullptr) const
 
void unsubscribe (const char *identifier=nullptr) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

CacheUpdateFlags update_flags
 
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
 
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
 
std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > vertex_to_cells
 
std::vector< std::vector< Tensor< 1, spacedim > > > vertex_to_cell_centers
 
KDTree< spacedim > vertex_kdtree
 
std::map< unsigned int, Point< spacedim > > used_vertices
 
boost::signals2::connection tria_signal
 

Additional Inherited Members

- Static Public Member Functions inherited from Subscriptor
static::ExceptionBase & ExcInUse (int arg1, char *arg2, std::string &arg3)
 
static::ExceptionBase & ExcNoSubscriber (char *arg1, char *arg2)
 

Detailed Description

template<int dim, int spacedim = dim>
class GridTools::Cache< dim, spacedim >

A class that caches computationally intensive information about a Triangulation.

This class attaches a signal to the Triangulation passed at construction time to keep track about refinement changes, and allows the user to query some of the data structures constructed using functions in the GridTools namespace which are computed only once, and then cached inside this class for faster access whenever the triangulation has not changed.

Notice that this class only notices if the underlying Triangulation has changed due to a Triangulation::Signals::any_change() signal being triggered.

If the triangulation changes for other reasons, for example because you use it in conjunction with a MappingQEulerian object that sees the vertices through its own transformation, or because you manually change some vertex locations, then some of the structures in this class become obsolete, and you will have to mark them as outdated, by calling the method mark_for_update() manually.

Author
Luca Heltai, 2017.

Definition at line 114 of file grid_tools.h.

Constructor & Destructor Documentation

template<int dim, int spacedim>
GridTools::Cache< dim, spacedim >::Cache ( const Triangulation< dim, spacedim > &  tria,
const Mapping< dim, spacedim > &  mapping = StaticMappingQ1<dim,spacedim>::mapping 
)

Constructor.

If you provide the optional mapping argument, then this is used whenever a mapping is required.

Parameters
triaThe triangulation for which to store information
mappingThe mapping to use when computing cached objects

Definition at line 25 of file grid_tools_cache.cc.

template<int dim, int spacedim>
GridTools::Cache< dim, spacedim >::~Cache ( )

Destructor.

Definition at line 39 of file grid_tools_cache.cc.

Member Function Documentation

template<int dim, int spacedim>
void GridTools::Cache< dim, spacedim >::mark_for_update ( const CacheUpdateFlags flags = update_all)

Make sure that the objects marked for update are recomputed during subsequent calls to the get_* functions defined in this class.

Notice that no work is performed when you call this function. The actual data structures are computed the next time you call the corresponding get_* method.

Parameters
flagsWhat to mark for update

Definition at line 50 of file grid_tools_cache.cc.

template<int dim, int spacedim>
const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > & GridTools::Cache< dim, spacedim >::get_vertex_to_cell_map ( ) const

Return the cached vertex_to_cell_map as computed by GridTools::vertex_to_cell_map().

Definition at line 59 of file grid_tools_cache.cc.

template<int dim, int spacedim>
const std::vector< std::vector< Tensor< 1, spacedim > > > & GridTools::Cache< dim, spacedim >::get_vertex_to_cell_centers_directions ( ) const

Return the cached vertex_to_cell_centers_directions as computed by GridTools::vertex_to_cell_centers_directions().

Definition at line 73 of file grid_tools_cache.cc.

template<int dim, int spacedim>
const std::map< unsigned int, Point< spacedim > > & GridTools::Cache< dim, spacedim >::get_used_vertices ( ) const

Return the cached map of used vertices, as computed by GridTools::extract_used_vertices().

Definition at line 88 of file grid_tools_cache.cc.

template<int dim, int spacedim>
const Triangulation< dim, spacedim > & GridTools::Cache< dim, spacedim >::get_triangulation ( ) const
inline

Return a reference to the stored triangulation.

Definition at line 193 of file grid_tools_cache.h.

template<int dim, int spacedim>
const Mapping< dim, spacedim > & GridTools::Cache< dim, spacedim >::get_mapping ( ) const
inline

Return a reference to the stored mapping.

Definition at line 202 of file grid_tools_cache.h.

template<int dim, int spacedim>
const KDTree< spacedim > & GridTools::Cache< dim, spacedim >::get_vertex_kdtree ( ) const

Return the cached vertex_kdtree object, constructed with the vertices of the stored triangulation.

Definition at line 102 of file grid_tools_cache.cc.

Member Data Documentation

template<int dim, int spacedim = dim>
CacheUpdateFlags GridTools::Cache< dim, spacedim >::update_flags
mutableprivate

Keep track of what needs to be updated next.

Definition at line 141 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
SmartPointer<const Triangulation<dim,spacedim>, Cache<dim,spacedim> > GridTools::Cache< dim, spacedim >::tria
private

A pointer to the Triangulation.

Definition at line 147 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
SmartPointer<const Mapping<dim,spacedim>, Cache<dim,spacedim> > GridTools::Cache< dim, spacedim >::mapping
private

Mapping to use when computing on the Triangulation.

Definition at line 153 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
std::vector< std::set<typename Triangulation<dim,spacedim>::active_cell_iterator> > GridTools::Cache< dim, spacedim >::vertex_to_cells
mutableprivate

Store vertex to cell map information, as generated by GridTools::vertex_to_cell_map()

Definition at line 161 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
std::vector<std::vector<Tensor<1,spacedim> > > GridTools::Cache< dim, spacedim >::vertex_to_cell_centers
mutableprivate

Store vertex to cell center directions, as generated by GridTools::vertex_to_cell_centers_directions().

Definition at line 167 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
KDTree<spacedim> GridTools::Cache< dim, spacedim >::vertex_kdtree
mutableprivate

A KDTree object constructed with the vertices of the triangulation.

Definition at line 173 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
std::map<unsigned int, Point<spacedim> > GridTools::Cache< dim, spacedim >::used_vertices
mutableprivate

Store the used vertices of the Triangulation, as generated by GridTools::extract_used_vertices().

Definition at line 180 of file grid_tools_cache.h.

template<int dim, int spacedim = dim>
boost::signals2::connection GridTools::Cache< dim, spacedim >::tria_signal
private

Storage for the status of the triangulation signal.

Definition at line 185 of file grid_tools_cache.h.


The documentation for this class was generated from the following files: