[dune-pdelab] get no. of quadrature points

Shubhangi Gupta sgupta at geomar.de
Tue Jul 12 12:57:45 CEST 2016


Hello Oliver,

Thanks a lot! This worked..

Best wishes,
Shubhangi

On 12.07.2016 12:51, Oliver Sander wrote:
> 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
>>





More information about the dune-pdelab mailing list