[dune-pdelab] get no. of quadrature points
Oliver Sander
oliver.sander at tu-dresden.de
Tue Jul 12 12:51:19 CEST 2016
Hi Shubhangi,
a QuadratureRule is basically a std::vector, so rule.size() will give you the number of quadrature points.
Best,
Oliver
On 12.07.2016 12:46, Shubhangi Gupta wrote:
> Hello everyone,
>
> I was wondering, before looping over the quadrature points in a local operator, how can I get the total number of quadrature points?
>
> Context:
> I am trying to evaluate some variables on each quadrature point as a post process:
> Something like:
> _____________________________________________________________________________________
> // Loop over each volume
> LeafIterator beginElem = gv.template begin< 0 , Dune::Interior_Partition >();
> LeafIterator endElem = gv.template end< 0 , Dune::Interior_Partition >();
>
> // Iterate over each element
> for ( LeafIterator self = beginElem; self!= endElem; ++self )
> {
> int elementNumber = indexSet.index(*self);
>
> // matrix for storing the variables at each quadrature point of the current volume
> std::vector< std::vector<double> > vars( no_of_vars );
> for (size_type i=0; i< no_of_vars ; i++){
> vars[i] = std::vector<double> ( *no_of_quadrature_points* , 0. );
> }
>
> // select quadrature rule
> Dune::GeometryType gt = (*self).geometry().type();
> const Dune::QuadratureRule<DF,dim>& rule = Dune::QuadratureRules<DF,dim>::rule(gt,2/*intorder*/);
> // loop over quadrature points
> for (typename Dune::QuadratureRule<DF,dim>::const_iterator it=rule.begin(); it!=rule.end(); ++it){
> .... SOME_CALCULATIONS_FOR_THE_VARS ....
> }
> }
> _____________________________________________________________________________________
>
>
> Thanks in advance, and best regards,
> Shubhangi
>
>
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-pdelab
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20160712/6c6cfe49/attachment.sig>
More information about the dune-pdelab
mailing list