template <int spacedim> class Manifold;
template <int spacedim> class FlatManifold;
+template <int dim, int spacedim> class StraightBoundary;
template <int, int, int> class TriaAccessor;
template <int spacedim> class TriaAccessor<0,1,spacedim>;
*/
static const FlatManifold<spacedim> flat_manifold;
+ /**
+ * Default boundary object. This is used
+ * for those objects for which no
+ * boundary description has been explicitly
+ * set using set_manifold().
+ */
+
+ static const StraightBoundary<dim,spacedim> straight_boundary;
/**
* Declare some symbolic names
* polygon/polyhedron defined by the boundary of the initial coarse
* triangulation.
*
- * @deprecated The functionality of this class is equivalent, but
- * less general, to that of FlatManifold<spacedim>. Please use
- * FlatManifold<spacedim> instead of this
- * class. StraightBoundary<dim,spacedim> will be removed in future
- * releases.
+ * The functionality of this class is equivalent, in most aspects,
+ * to that of FlatManifold<spacedim>. The only difference between
+ * this class and the FlatManifold<spacedim> class is that for this
+ * class the normal is well defined, and therefore there exist the
+ * specialized method which computes it.
*
* @ingroup boundary
*
* Heltai 2013, 2014
*/
template <int dim, int spacedim=dim>
-class StraightBoundary : public Boundary<dim,spacedim>
+class StraightBoundary : public FlatManifold<spacedim>
{
public:
/**
* Default constructor. Some compilers require this for some reasons.
*/
StraightBoundary ();
+
+ /**
+ * Given a vector of points, return the normals to the Manifold in
+ * those points. Input arguments must be of the same size.
+ */
+ virtual
+ void get_normals_at_points(std::vector<Point<spacedim> > &normals,
+ const std::vector<Point<spacedim> > &points) const;
+
+
} DEAL_II_DEPRECATED;
DEAL_II_NAMESPACE_CLOSE
{
// first get the normal vectors at the two vertices of this line
// from the boundary description
- const Manifold<dim> &boundary
- = line->get_boundary();
-
std::vector<Point<dim> > face_vertex_normals(2);
- boundary.get_normals_at_points (face_vertex_normals, points);
+ line->get_boundary().get_normals_at_points (face_vertex_normals, points);
// then transform them into interpolation points for a cubic
// polynomial
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/manifold.h>
+#include <deal.II/grid/tria_boundary.h>
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/magic_numbers.h>
#include <deal.II/fe/mapping_q1.h>
const FlatManifold<spacedim>
Triangulation<dim, spacedim>::flat_manifold = FlatManifold<spacedim>();
+template <int dim, int spacedim>
+const StraightBoundary<dim,spacedim>
+Triangulation<dim, spacedim>::straight_boundary = StraightBoundary<dim,spacedim>();
template <int dim, int spacedim>
const unsigned int
//if we have not found an entry
//connected with number, we return
//straight_boundary
- return flat_manifold;
+ return straight_boundary;
}
}
const Manifold<spacedim> &
Triangulation<dim, spacedim>::get_manifold (const types::manifold_id m_number) const
{
- //look, if there is a boundary stored at
- //boundary_id number.
+ //look, if there is a manifold stored at
+ //manifold_id number.
typename std::map<types::manifold_id, SmartPointer<const Manifold<spacedim>, Triangulation<dim, spacedim> > >::const_iterator it
= manifold.find(m_number);
{
//if we have not found an entry
//connected with number, we return
- //flat_manifold
- return flat_manifold;
+ //straight_boundary
+ return straight_boundary;
}
}
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
-
+
+#include <deal.II/base/tensor.h>
#include <deal.II/grid/tria_boundary.h>
DEAL_II_NAMESPACE_OPEN
StraightBoundary<dim, spacedim>::StraightBoundary ()
{}
+template <int dim, int spacedim>
+void
+StraightBoundary<dim, spacedim>::get_normals_at_points(std::vector<Point<spacedim> > &normals,
+ const std::vector<Point<spacedim> > &points) const
+{
+ AssertDimension(normals.size(), points.size());
+ switch(dim)
+ {
+ case 1:
+ Assert(false, ExcNotImplemented());
+ break;
+ case 2:
+ {
+ Assert(points.size() >= 2, ExcMessage("At least two points!"));
+ for(unsigned int i=0; i<points.size(); ++i)
+ {
+ Point<spacedim> t = points[1]-points[0];
+ Point<spacedim> n; n[0] = t[1]; n[1] = -t[0];
+ normals[i] = n;
+ }
+ }
+ break;
+ case 3:
+ {
+ AssertDimension(points.size(), 4);
+
+ const unsigned int vertices_per_face = GeometryInfo<3>::vertices_per_face;
+ static const unsigned int neighboring_vertices[4][2]=
+ { {1,2},{3,0},{0,3},{2,1}};
+ for (unsigned int vertex=0; vertex<vertices_per_face; ++vertex)
+ {
+ // first define the two tangent
+ // vectors at the vertex by
+ // using the two lines
+ // radiating away from this
+ // vertex
+ const Tensor<1,spacedim> tangents[2]
+ = { points[neighboring_vertices[vertex][0]]
+ - points[vertex],
+ points[neighboring_vertices[vertex][1]]
+ - points[vertex] };
+
+ // then compute the normal by
+ // taking the cross
+ // product. since the normal is
+ // not required to be
+ // normalized, no problem here
+ cross_product (normals[vertex],
+ tangents[0], tangents[1]);
+ };
+ }
+ break;
+ default:
+ Assert(false, ExcNotImplemented());
+ break;
+ }
+}
+
+
// explicit instantiations
#include "tria_boundary.inst"