<commit_before>/*----------------------------   boundary-function.h     ---------------------------*/
/*      $Id$                 */
/*      Copyright <NAME>, University of Heidelberg, 1998 */
#ifndef __tria_boundary_H
#define __tria_boundary_H
/*----------------------------   boundary-function.h     ---------------------------*/

#include <base/point.h>
#include <grid/geometry_info.h>



/**
 * Workaround for a bug in egcs snapshot 1998/08/03.
 */
template <int dim> struct BoundaryHelper;

template <> struct BoundaryHelper<1> {
				     // actually, this does not make much
				     // sense, but declaring a zero-sized
				     // array is forbidden nowadays
    typedef const Point<1> *PointArray[1];
};

template <> struct BoundaryHelper<2> {
    typedef const Point<2> *PointArray[GeometryInfo<2>::vertices_per_face];
};



/**
 *   This class is used to represent a boundary to a triangulation.
 *   When a triangulation creates a new vertex on the boundary of the
 *   domain, it determines the new vertex' coordinates through the
 *   following code (here in two dimensions):
 *   \begin{verbatim}
 *     ...
 *     const Point<2> *neighbors[2] = {&neighbor1, &neighbor2};
 *     Point<2> new_vertex = boundary.in_between (neighbors);
 *     ...
 *   \end{verbatim}
 *   #neighbor1# and #neighbor2# are the two vertices bounding the old
 *   line on the boundary, which is to be subdivided. #boundary# is an
 *   object of type #Boundary<dim>#.
 *
 *   In 3D, a new vertex may be placed on the middle of a line or on
 *   the middle of a side. In the both cases, an array with four points
 *   has to be passed to #in_between#; in the latter case the two end
 *   points of the line have to be given consecutively twice, as
 *   elements 0 and 1, and 2 and 3, respectively.
 *   
 *   There are specialisations, #StraightBoundary<dim>#, which places
 *   the new point right into the middle of the given points, and
 *   #HyperBallBoundary<dim># creating a hyperball with given radius
 *   around a given center point.
 *
 *   @author <NAME>, 1998
 */
template <int dim>
class Boundary {
  public:
				     /**
				      *  Typedef an array of the needed number
				      *  of old points.
				      */
    typedef typename BoundaryHelper<dim>::PointArray PointArray;
    
				     /**
				      *  This function calculates the position
				      *  of the new vertex.
				      */
    virtual Point<dim> in_between (const PointArray &neighbors) const = 0;
};<commit_msg>Add support for 3D and resurrect an original part of the code which was dropped because egcs produced an internal compiler error over it.<commit_after>/*----------------------------   boundary-function.h     ---------------------------*/
/*      $Id$                 */
/*      Copyright <NAME>, University of Heidelberg, 1998 */
#ifndef __tria_boundary_H
#define __tria_boundary_H
/*----------------------------   boundary-function.h     ---------------------------*/

#include <base/point.h>
#include <grid/geometry_info.h>



/**
 * Workaround for a bug in egcs snapshot 1998/08/03.
 */
template <int dim> struct BoundaryHelper;

template <> struct BoundaryHelper<1> {
				     // actually, this does not make much
				     // sense, but declaring a zero-sized
				     // array is forbidden nowadays
    typedef const Point<1> *PointArray[1];
};

template <> struct BoundaryHelper<2> {
    typedef const Point<2> *PointArray[GeometryInfo<2>::vertices_per_face];
};

template <> struct BoundaryHelper<3> {
    typedef const Point<3> *PointArray[GeometryInfo<3>::vertices_per_face];
};


/**
 *   This class is used to represent a boundary to a triangulation.
 *   When a triangulation creates a new vertex on the boundary of the
 *   domain, it determines the new vertex' coordinates through the
 *   following code (here in two dimensions):
 *   \begin{verbatim}
 *     ...
 *     const Point<2> *neighbors[2] = {&neighbor1, &neighbor2};
 *     Point<2> new_vertex = boundary.in_between (neighbors);
 *     ...
 *   \end{verbatim}
 *   #neighbor1# and #neighbor2# are the two vertices bounding the old
 *   line on the boundary, which is to be subdivided. #boundary# is an
 *   object of type #Boundary<dim>#.
 *
 *   In 3D, a new vertex may be placed on the middle of a line or on
 *   the middle of a side. In the both cases, an array with four points
 *   has to be passed to #in_between#; in the latter case the two end
 *   points of the line have to be given consecutively twice, as
 *   elements 0 and 1, and 2 and 3, respectively.
 *   
 *   There are specialisations, #StraightBoundary<dim>#, which places
 *   the new point right into the middle of the given points, and
 *   #HyperBallBoundary<dim># creating a hyperball with given radius
 *   around a given center point.
 *
 *   @author <NAME>, 1998
 */
template <int dim>
class Boundary {
  public:
				     /**
				      *  Typedef an array of the needed number
				      *  of old points to compute the new
				      *  middle point of a face. This does not
				      *  make much sense in 1D, so we set the
				      *  array size to a dummy value.
				      */
    typedef typename BoundaryHelper<dim>::PointArray PointArray;
// this is the way it should be, but egcs throws an internal compiler error
// on this, so we invented the above workaround    
//    typedef const Point<dim>* PointArray[((dim==1) ?
//					  1 :
//					  GeometryInfo<dim>::vertices_per_face)];
    
				     /**
				      *  This function calculates the position
				      *  of the new vertex.
				      */
    virtual Point<dim> in_between (const PointArray &neighbors) const = 0;
};
{'fraction_non_alphanumeric': 0.1314946619217082, 'fraction_numerical': 0.013701067615658364, 'mean_word_length': 2.351818723911747, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5926703', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1559, 'n_words': 621}