Hi! May be somebody could explain or give a reference on how to use a type as a function parameter. I am using the deal.II library. There is next member function there:
Code:
template<int dim>
template<typename InputVector, class DH>
static void KellyErrorEstimator< dim >::estimate(const Mapping< dim > & mapping,
		const DH & dof,
		const Quadrature< dim-1 > & quadrature,
		const typename FunctionMap< dim >::type & neumann_bc,
		const InputVector & solution,
		Vector< float > & error,
		const std::vector< bool > & component_mask = std::vector< bool >(),
		const Function< dim > *  	coefficients = 0,
		const unsigned int  	n_threads = multithread_info.n_default_threads,
		const unsigned int  	subdomain_id = numbers::invalid_unsigned_int,
		const unsigned int  	material_id = numbers::invalid_unsigned_int	 
	) 			[inline, static]
For my question parameter const typename FunctionMap< dim >::type & neumann_bc is important. The declaration of its type is
Code:
typedef std::map<unsigned char, const Function<dim>*> FunctionMap< dim >::type
I undestand it as the reference to the name of the type is given to the function as a parameter. Is it possible to use a type or its reference as a parameter? This structure is compiled perfectly in the next configuration
Code:
typename FunctionMap<dim>::type neumann_boundary;
KellyErrorEstimator<dim>::estimate (dof_handler, dealii::QGauss<dim-1>(feq1+1), neumann_boundary, solution, estimated_error_per_cell);
Here we are creating an object neumann_boundary of the type "type map".
However, if i change it to
Code:
typedef FunctionMap<dim>::type neumann_boundary;
or
Code:
typedef typename FunctionMap<dim>::type neumann_boundary;
i got an error. So, what's going on when one transfers to a function a type as a parameter?