Exemplo n.º 1
0
boost::shared_ptr<hier::BoxOverlap>
OuterfaceGeometry::calculateOverlap(
   const hier::BoxGeometry& dst_geometry,
   const hier::BoxGeometry& src_geometry,
   const hier::Box& src_mask,
   const hier::Box& fill_box,
   const bool overwrite_interior,
   const hier::Transformation& transformation,
   const bool retry,
   const hier::BoxContainer& dst_restrict_boxes) const
{

   TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask);

   const FaceGeometry* t_dst_face =
      dynamic_cast<const FaceGeometry *>(&dst_geometry);
   const OuterfaceGeometry* t_dst_oface =
      dynamic_cast<const OuterfaceGeometry *>(&dst_geometry);
   const OuterfaceGeometry* t_src =
      dynamic_cast<const OuterfaceGeometry *>(&src_geometry);

   boost::shared_ptr<hier::BoxOverlap> over;

   if ((t_src != 0) && (t_dst_face != 0)) {
      over = doOverlap(*t_dst_face, *t_src, src_mask, fill_box,
            overwrite_interior,
            transformation, dst_restrict_boxes);
   } else if ((t_src != 0) && (t_dst_oface != 0)) {
      over = doOverlap(*t_dst_oface, *t_src, src_mask, fill_box,
            overwrite_interior,
            transformation, dst_restrict_boxes);
   } else if (retry) {
      over = src_geometry.calculateOverlap(dst_geometry, src_geometry,
            src_mask, fill_box, overwrite_interior,
            transformation, false,
            dst_restrict_boxes);
   }
   return over;

}
/*
 *************************************************************************
 *
 * Calculate the overlap according to the desired pattern
 *
 *************************************************************************
 */
std::shared_ptr<hier::BoxOverlap>
FirstLayerCellVariableFillPattern::calculateOverlap(
   const hier::BoxGeometry& dst_geometry,
   const hier::BoxGeometry& src_geometry,
   const hier::Box& dst_patch_box,
   const hier::Box& src_mask,
   const hier::Box& fill_box,
   const bool overwrite_interior,
   const hier::Transformation& transformation) const
{
   TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask);

   hier::BoxContainer stencil_boxes;
   computeStencilBoxes(stencil_boxes, dst_patch_box);

   return dst_geometry.calculateOverlap(src_geometry,
      src_mask,
      fill_box,
      overwrite_interior,
      transformation,
      stencil_boxes);

}