KellyErrorEstimator< dim, spacedim >::PerThreadData Struct Reference

List of all members.

Public Member Functions

 PerThreadData (const unsigned int n_solution_vectors, const unsigned int n_components, const unsigned int max_n_q_points, const unsigned int subdomain_id, const unsigned int material_id)
void resize (const unsigned int n_components, const unsigned int max_n_q_points)

Public Attributes

std::vector< std::vector
< std::vector< double > > > 
phi
std::vector< std::vector
< std::vector< Tensor< 1, dim > > > > 
psi
std::vector< std::vector
< std::vector< Tensor< 1, dim > > > > 
neighbor_psi
std::vector< Point< dim > > normal_vectors
std::vector< doublecoefficient_values1
std::vector< Vector< double > > coefficient_values
std::vector< doubleJxW_values
const unsigned int subdomain_id
const unsigned int material_id


Detailed Description

template<int dim, int spacedim = dim>
struct KellyErrorEstimator< dim, spacedim >::PerThreadData

All small temporary data objects that are needed once per thread by the several functions of the error estimator are gathered in this struct. The reason for this structure is mainly that we have a number of functions that operate on cells or faces and need a number of small temporary data objects. Since these functions may run in parallel, we cannot make these objects member variables of the enclosing class. On the other hand, declaring them locally in each of these functions would require their reallocating every time we visit the next cell or face, which we found can take a significant amount of time if it happens often even in the single threaded case (10-20 per cent in our measurements); however, most importantly, memory allocation requires synchronisation in multithreaded mode. While that is done by the C++ library and has not to be handcoded, it nevertheless seriously damages the ability to efficiently run the functions of this class in parallel, since they are quite often blocked by these synchronisation points, slowing everything down by a factor of two or three.

Thus, every thread gets an instance of this class to work with and needs not allocate memory itself, or synchronise with other threads.

The sizes of the arrays are initialized with the maximal number of entries necessary for the hp case. Within the loop over individual cells, we then resize the arrays as necessary. Since for std::vector resizing to a smaller size doesn't imply memory allocation, this is fast.


Constructor & Destructor Documentation

template<int dim, int spacedim = dim>
KellyErrorEstimator< dim, spacedim >::PerThreadData::PerThreadData ( const unsigned int  n_solution_vectors,
const unsigned int  n_components,
const unsigned int  max_n_q_points,
const unsigned int  subdomain_id,
const unsigned int  material_id 
)

Constructor.


Member Function Documentation

template<int dim, int spacedim = dim>
void KellyErrorEstimator< dim, spacedim >::PerThreadData::resize ( const unsigned int  n_components,
const unsigned int  max_n_q_points 
)

Constructor.


Member Data Documentation

template<int dim, int spacedim = dim>
std::vector<std::vector<std::vector<double> > > KellyErrorEstimator< dim, spacedim >::PerThreadData::phi

A vector to store the jump of the normal vectors in the quadrature points for each of the solution vectors (i.e. a temporary value). This vector is not allocated inside the functions that use it, but rather globally, since memory allocation is slow, in particular in presence of multiple threads where synchronisation makes things even slower.

template<int dim, int spacedim = dim>
std::vector<std::vector<std::vector<Tensor<1,dim> > > > KellyErrorEstimator< dim, spacedim >::PerThreadData::psi

A vector for the gradients of the finite element function on one cell

Let psi be a short name for a grad u_h, where the third index be the component of the finite element, and the second index the number of the quadrature point. The first index denotes the index of the solution vector.

template<int dim, int spacedim = dim>
std::vector<std::vector<std::vector<Tensor<1,dim> > > > KellyErrorEstimator< dim, spacedim >::PerThreadData::neighbor_psi

The same vector for a neighbor cell

template<int dim, int spacedim = dim>
std::vector<Point<dim> > KellyErrorEstimator< dim, spacedim >::PerThreadData::normal_vectors

The normal vectors of the finite element function on one face

template<int dim, int spacedim = dim>
std::vector<double> KellyErrorEstimator< dim, spacedim >::PerThreadData::coefficient_values1

Two arrays needed for the values of coefficients in the jumps, if they are given.

template<int dim, int spacedim = dim>
std::vector<Vector<double> > KellyErrorEstimator< dim, spacedim >::PerThreadData::coefficient_values

template<int dim, int spacedim = dim>
std::vector<double> KellyErrorEstimator< dim, spacedim >::PerThreadData::JxW_values

Array for the products of Jacobian determinants and weights of quadraturs points.

template<int dim, int spacedim = dim>
const unsigned int KellyErrorEstimator< dim, spacedim >::PerThreadData::subdomain_id

The subdomain id we are to care for.

template<int dim, int spacedim = dim>
const unsigned int KellyErrorEstimator< dim, spacedim >::PerThreadData::material_id

The material id we are to care for.


The documentation for this struct was generated from the following file:

deal.II documentation generated on Sat Aug 15 16:52:04 2009 by doxygen 1.5.9