19 #include "libmesh/libmesh_config.h" 
   20 #if defined(LIBMESH_HAVE_TRIANGLE) && defined(LIBMESH_HAVE_TETGEN) 
   23 #include "libmesh/elem_cutter.h" 
   24 #include "libmesh/elem.h" 
   25 #include "libmesh/replicated_mesh.h" 
   26 #include "libmesh/mesh_triangle_interface.h" 
   27 #include "libmesh/mesh_tetgen_interface.h" 
   28 #include "libmesh/auto_ptr.h"  
   32 unsigned int cut_cntr;
 
   39   _inside_mesh_2D(libmesh_make_unique<
ReplicatedMesh>(_comm_self,2)),
 
   41   _outside_mesh_2D(libmesh_make_unique<
ReplicatedMesh>(_comm_self,2)),
 
   43   _inside_mesh_3D(libmesh_make_unique<
ReplicatedMesh>(_comm_self,3)),
 
   45   _outside_mesh_3D(libmesh_make_unique<
ReplicatedMesh>(_comm_self,3)),
 
   59                             const std::vector<Real> & vertex_distance_func)
 const 
   61   libmesh_assert_equal_to (elem.n_vertices(), vertex_distance_func.size());
 
   63   for (
const auto & val : vertex_distance_func)
 
   74                              const std::vector<Real> & vertex_distance_func)
 const 
   76   libmesh_assert_equal_to (elem.n_vertices(), vertex_distance_func.size());
 
   78   for (
const auto & val : vertex_distance_func)
 
   89                          const std::vector<Real> & vertex_distance_func)
 const 
   91   libmesh_assert_equal_to (elem.n_vertices(), vertex_distance_func.size());
 
   94     vmin = vertex_distance_func.front(),
 
   97   for (
const auto & val : vertex_distance_func)
 
   99       vmin = std::min (vmin, val);
 
  100       vmax = std::max (vmax, val);
 
  104   return (vmin*vmax < 0.);
 
  110                             const std::vector<Real> & vertex_distance_func)
 
  113   libmesh_assert_equal_to (vertex_distance_func.size(), elem.
n_vertices());
 
  121     if (this->
is_outside(elem, vertex_distance_func))
 
  129     else if (this->
is_inside(elem, vertex_distance_func))
 
  145     case 1: this->
cut_1D(elem, vertex_distance_func); 
break;
 
  146     case 2: this->
cut_2D(elem, vertex_distance_func); 
break;
 
  147     case 3: this->
cut_3D(elem, vertex_distance_func); 
break;
 
  148     default: libmesh_error_msg(
"Invalid element dimension: " << elem.
dim());
 
  155                                           const std::vector<Real> & vertex_distance_func)
 
  170       libmesh_assert_less (el0, vertex_distance_func.size());
 
  171       libmesh_assert_less (el1, vertex_distance_func.size());
 
  174         d0 = vertex_distance_func[el0],
 
  175         d1 = vertex_distance_func[el1];
 
  180           libmesh_assert_not_equal_to (d0, d1);
 
  184           const Real d_star = d0 / (d0 - d1);
 
  189           const Real endpoint_tol = 0.01;
 
  191           if ( (d_star > endpoint_tol) &&
 
  192                (d_star < (1.-endpoint_tol)) )
 
  194               const Point x_star = (edge->point(0)*(1-d_star) +
 
  195                                     edge->point(1)*d_star);
 
  197               std::cout << 
"adding cut point (d_star, x_star) = " 
  198                         << d_star << 
" , " << x_star << std::endl;
 
  210                          const std::vector<Real> &)
 
  212   libmesh_not_implemented();
 
  218                          const std::vector<Real> & vertex_distance_func)
 
  220 #ifndef LIBMESH_HAVE_TRIANGLE 
  223   libMesh::err << 
"ERROR: current libMesh ElemCutter 2D implementation requires\n" 
  224                << 
"       the \"triangle\" library!\n" 
  226   libmesh_not_implemented();
 
  228 #else // OK, LIBMESH_HAVE_TRIANGLE 
  230   std::cout << 
"Inside cut face element!\n";
 
  240       if (vertex_distance_func[v] >= 0.)
 
  243       if (vertex_distance_func[v] <= 0.)
 
  298                          const std::vector<Real> & vertex_distance_func)
 
  300 #ifndef LIBMESH_HAVE_TETGEN 
  303   libMesh::err << 
"ERROR: current libMesh ElemCutter 3D implementation requires\n" 
  304                << 
"       the \"tetgen\" library!\n" 
  306   libmesh_not_implemented();
 
  308 #else // OK, LIBMESH_HAVE_TETGEN 
  310   std::cout << 
"Inside cut cell element!\n";
 
  320       if (vertex_distance_func[v] >= 0.)
 
  323       if (vertex_distance_func[v] <= 0.)
 
  355   std::ostringstream 
name;
 
  368     if (el->volume() > std::numeric_limits<Real>::epsilon())
 
  372     if (el->volume() > std::numeric_limits<Real>::epsilon())
 
  382 #endif // LIBMESH_HAVE_TRIANGLE && LIBMESH_HAVE_TETGEN