void CleverNodeInjection<TYPE>::coarsen(
    SAMRAI::hier::Patch& coarse,
    const SAMRAI::hier::Patch& fine,
    const int dst_component,
    const int src_component,
    const SAMRAI::hier::Box& coarse_box,
    const SAMRAI::hier::IntVector& ratio) const
{
  boost::shared_ptr<CleverNodeData<TYPE> > fine_data(
      SHARED_PTR_CAST(CleverNodeData<TYPE> ,
        fine.getPatchData(src_component)));

  boost::shared_ptr<CleverNodeData<TYPE> > coarse_data(
      SHARED_PTR_CAST(CleverNodeData<TYPE> ,
        coarse.getPatchData(dst_component)));

  const SAMRAI::hier::Box coarse_ghost_box =
    SAMRAI::pdat::NodeGeometry::toNodeBox(coarse_data->getGhostBox());
  const SAMRAI::hier::Box fine_ghost_box = 
    SAMRAI::pdat::NodeGeometry::toNodeBox(fine_data->getGhostBox());

   const hier::Index filo = fine_data->getGhostBox().lower();
   const hier::Index fihi = fine_data->getGhostBox().upper();
   const hier::Index cilo = coarse_data->getGhostBox().lower();
   const hier::Index cihi = coarse_data->getGhostBox().upper();

   const hier::Index ifirstc = coarse_box.lower();
   const hier::Index ilastc = coarse_box.upper();

  for(int depth = 0; depth < coarse_data->getDepth(); depth++) {
    if (fine.getDim() == SAMRAI::tbox::Dimension(2)) {
         F90_FUNC(conavgclevernodedoub2d, CONAVGCLEVERNODEDOUB2D)
           (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1),
            filo(0), filo(1), fihi(0), fihi(1),
            cilo(0), cilo(1), cihi(0), cihi(1),
            &ratio[0],
            fine_data->getPointer(depth),
            coarse_data->getPointer(depth));
    } else {
      TBOX_ERROR("CleverNodeInjection error...\n"
          << "dim != 2 not supported." << std::endl);
    }
  }
}
bool CleverSideDataFactory<TYPE>::validCopyTo(
    const boost::shared_ptr<SAMRAI::hier::PatchDataFactory>& dst_pdf) const
{
  bool valid_copy = false;

  boost::shared_ptr<CleverSideDataFactory> side_data_factory(
      SHARED_PTR_CAST(CleverSideDataFactory,
        dst_pdf));

  if(side_data_factory) {
    valid_copy = true;
  }

  return valid_copy;
}
Example #3
0
 // template<class Y> df_shared_ptr(df_shared_ptr<Y> const & r) : boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag()) {}
    template<class Y> df_shared_ptr(df_shared_ptr<Y> const & r) : boost::shared_ptr<T>(SHARED_PTR_CAST(df_shared_ptr<Y>,r)) {}