]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add an access operator to BarycentricPolynomials.
authorDavid Wells <drwells@email.unc.edu>
Fri, 15 Jan 2021 15:23:12 +0000 (10:23 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 25 Jan 2021 20:00:43 +0000 (15:00 -0500)
It's ocassionally useful to access the polynomials constructed in a basis directly.

include/deal.II/simplex/barycentric_polynomials.h

index 6fe862635d7fc579675fe021b5cfed17d8b1cb0e..8596ef0744a90502d1a7b025bae1e507f2dccc98 100644 (file)
@@ -227,12 +227,17 @@ namespace Simplex
     static BarycentricPolynomials<dim>
     get_fe_p_basis(const unsigned int degree);
 
-    /*
+    /**
      * Constructor taking the polynomial @p degree as input.
      */
     BarycentricPolynomials(
       const std::vector<BarycentricPolynomial<dim>> &polynomials);
 
+    /**
+     * Access operator.
+     */
+    const BarycentricPolynomial<dim> &operator[](const std::size_t i) const;
+
     /**
      * @copydoc ScalarPolynomialsBase::evaluate()
      */
@@ -696,6 +701,14 @@ namespace Simplex
       }
     return result;
   }
+
+  template <int dim>
+  const BarycentricPolynomial<dim> &BarycentricPolynomials<dim>::
+                                    operator[](const std::size_t i) const
+  {
+    AssertIndexRange(i, polys.size());
+    return polys[i];
+  }
 } // namespace Simplex
 
 DEAL_II_NAMESPACE_CLOSE

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.