#include <deal.II/base/config.h>
#include <deal.II/base/subscriptor.h>
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/thread_management.h>
+#include <deal.II/base/subscriptor.h>
#include <deal.II/base/point.h>
DEAL_II_NAMESPACE_OPEN
virtual
Point<spacedim> normal_vector(const Point<spacedim> point) const;
+ protected:
+
+ /**
+ * Returns the support points of the Gauss-Lobatto quadrature
+ * formula used for intermediate points.
+ *
+ * @note Since the manifold description is closely tied to the unit
+ * cell support points of MappingQ, new boundary descriptions need
+ * to explicitly use these Gauss-Lobatto points and not equidistant
+ * points.
+ */
+ const std::vector<Point<1> > &
+ get_line_support_points (const unsigned int n_intermediate_points) const;
+
+ private:
+
+ /**
+ * Point generator for the intermediate points on a boundary.
+ */
+ mutable std::vector<std_cxx1x::shared_ptr<QGaussLobatto<1> > > points;
+
+
+ /**
+ * Mutex for protecting the points array.
+ */
+ mutable Threads::Mutex mutex;
};
{
case 2:
{
- const double dx=1./(n+1);
- double x = dx;
- for(unsigned int i=0; i<n; ++i, x+=dx)
+ // Use interior points of QGaussLobatto quadrature formula
+ // support points for consistency with MappingQ
+ const std::vector<Point<1> > &line_points = this->get_line_support_points(n);
+
+ for(unsigned int i=0; i<n; ++i)
{
+ const double x = line_points[i+1][0];
w[1] = x; w[0] = (1-x);
points[i] = get_new_point(surrounding_points, w);
}
static_cast<unsigned int>(std::sqrt(static_cast<double>(n)));
// is n a square number
Assert(m*m==n, ExcInternalError());
- const double ds=1./(m+1);
- double y=ds;
- for (unsigned int i=0; i<m; ++i, y+=ds)
+
+ const std::vector<Point<1> > &line_points = this->get_line_support_points(m);
+
+ for (unsigned int i=0; i<m; ++i)
{
- double x=ds;
- for (unsigned int j=0; j<m; ++j, x+=ds)
+ const double y=line_points[1+i][0];
+ for (unsigned int j=0; j<m; ++j)
{
- w[0] = (1-x); w[1] = x*(1-y);
- w[2] = y*(1-x); w[3] = x*y;
+ const double x=line_points[1+j][0];
+
+ w[0] = (1-x)*(1-y);
+ w[1] = x*(1-y);
+ w[2] = (1-x)*y ;
+ w[3] = x*y ;
points[i*m+j]=get_new_point(surrounding_points, w);
}
}
}
+template <int spacedim>
+const std::vector<Point<1> > &
+Manifold<spacedim>::
+get_line_support_points (const unsigned int n_intermediate_points) const
+{
+ if (points.size() <= n_intermediate_points ||
+ points[n_intermediate_points].get() == 0)
+ {
+ Threads::Mutex::ScopedLock lock(mutex);
+ if (points.size() <= n_intermediate_points)
+ points.resize(n_intermediate_points+1);
+
+ // another thread might have created points in the meantime
+ if (points[n_intermediate_points].get() == 0)
+ {
+ std_cxx1x::shared_ptr<QGaussLobatto<1> >
+ quadrature (new QGaussLobatto<1>(n_intermediate_points+2));
+ points[n_intermediate_points] = quadrature;
+ }
+ }
+ return points[n_intermediate_points]->get_points();
+}
+
+
/* -------------------------- FlatManifold --------------------- */