• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ hier::Patch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中hier::Patch的典型用法代码示例。如果您正苦于以下问题:C++ Patch类的具体用法?C++ Patch怎么用?C++ Patch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Patch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: writeToVTK

// 输出网格到 VTK 文件
void MeshOpt::writeToVTK(hier::Patch<NDIM>& patch,
                         const double  time,
                         const double  dt,
                         const bool    initial_time)
{
    NULL_USE(dt);
    NULL_USE(time);
    NULL_USE(initial_time);

    const tbox::Pointer< hier::BlockPatchGeometry<NDIM> > pgeom =
            patch.getPatchGeometry();

    int block_index = pgeom->getBlockNumber();

    int patch_index = patch.getPatchNumber();

    std::stringstream bi, pi, df;
    bi << block_index;
    pi << patch_index;
    df << d_flag;

    std::string file_name = df.str() + "_block_ " + bi.str()+ "_patch_" +  pi.str()  + ".vtk";


    MsqError err;
    MeshImpl * mesh = createLocalMesh(patch);
    mesh->write_vtk(file_name.c_str(), err);

    return;
}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:31,代码来源:MeshOpt.C


示例2: tags

void PatchMultiblockTestStrategy::tagCellsInInputBoxes(
   hier::Patch& patch,
   int level_number,
   int tag_index)
{

   if (level_number < static_cast<int>(d_refine_level_boxes.size())) {

      std::shared_ptr<pdat::CellData<int> > tags(
         SAMRAI_SHARED_PTR_CAST<pdat::CellData<int>, hier::PatchData>(
            patch.getPatchData(tag_index)));
      TBOX_ASSERT(tags);
      tags->fillAll(0);

      const hier::Box pbox = patch.getBox();

      for (hier::BoxContainer::iterator k =
              d_refine_level_boxes[level_number].begin();
           k != d_refine_level_boxes[level_number].end(); ++k) {
         tags->fill(1, *k * pbox, 0);
      }

   }

}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:25,代码来源:PatchMultiblockTestStrategy.C


示例3: fine_box_list

void EdgeMultiblockTest::postprocessRefine(
   hier::Patch& fine,
   const hier::Patch& coarse,
   const std::shared_ptr<hier::VariableContext>& context,
   const hier::Box& fine_box,
   const hier::IntVector& ratio) const
{
   pdat::EdgeDoubleConstantRefine ref_op;

   hier::BoxContainer fine_box_list(fine_box);
   hier::BoxContainer empty_box_list;

   xfer::BoxGeometryVariableFillPattern fill_pattern;

   for (int i = 0; i < static_cast<int>(d_variables.size()); ++i) {

      int id = hier::VariableDatabase::getDatabase()->
         mapVariableAndContextToIndex(d_variables[i], context);

      std::shared_ptr<hier::PatchDataFactory> fine_pdf(
         fine.getPatchDescriptor()->getPatchDataFactory(id));

      std::shared_ptr<hier::BoxOverlap> fine_overlap(
         fill_pattern.computeFillBoxesOverlap(
            fine_box_list,
            empty_box_list,
            fine.getBox(),
            fine.getPatchData(id)->getGhostBox(),
            *fine_pdf));

      ref_op.refine(fine, coarse, id, id, *fine_overlap, ratio);
   }
}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:33,代码来源:EdgeMultiblockTest.C


示例4: disturbMesh

// 扰动网格
void MeshOpt::disturbMesh(hier::Patch<NDIM>& patch,
                          const double  time,
                          const double  dt,
                          const bool    initial_time)
{
    NULL_USE(dt);
    NULL_USE(time);
    NULL_USE(initial_time);

    tbox::Pointer< pdat::NodeData<NDIM,double> > coords_current
            = patch.getPatchData(d_coords_current_id);

    tbox::Pointer< pdat::NodeData<NDIM,bool> > fixed_info
            = patch.getPatchData(d_fixed_info_id);

    int count = -1;
    double dist = 0.01;
    for(pdat::NodeIterator<NDIM> ic((*coords_current).getBox()); ic; ic++)
    {
        dist *= -1;
        if((*fixed_info)(ic(),0) == false)
        {
            (*coords_current)(ic(),0) += dist;
            (*coords_current)(ic(),1) -= dist;
        }
        ++count;
    }

    // 表示已扰动
    d_flag = 1;

}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:33,代码来源:MeshOpt.C


示例5: setNodeInfo

/********************************************************************
 * 网格处理                                             *
 ********************************************************************/
 void MeshOpt::setNodeInfo(hier::Patch<NDIM>& patch)
{
    const hier::Index<NDIM> ifirst=patch.getBox().lower();
    const hier::Index<NDIM> ilast =patch.getBox().upper();

    int cols = ilast(0) - ifirst(0)+2;
    int rows = ilast(1) - ifirst(1)+2;

     int num_of_nodes = cols*rows;

    tbox::Array<bool> d_fixed_info(num_of_nodes,true);

    for(int row = 0; row < rows; row++)
    {
        for(int col = 0; col < cols; col++)
        {
            if(row == 0 || row == rows-1 || col == 0 || col == cols-1)
            {
                d_fixed_info[row*cols+col] = true;
            }
            else
                d_fixed_info[row*cols+col] = false;
        }
    }

    tbox::Pointer< pdat::NodeData<NDIM,bool> > fixed_info
            = patch.getPatchData(d_fixed_info_id);

    int count=-1;
    for(pdat::NodeIterator<NDIM> ic((*fixed_info).getBox()); ic; ic++)
    {
       (*fixed_info)(ic(),0) = d_fixed_info[++count];
    }
}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:37,代码来源:MeshOpt.C


示例6: getPatchDt

/*************************************************************************
* 步长构件: 计算并返回网格片上的稳定时间步长.  
*************************************************************************/
double MeshOpt::getPatchDt(hier::Patch<NDIM>& patch,
                           const double  time,
                           const bool    initial_time,
                           const int     flag_last_dt,
                           const double  last_dt,
                           const string& intc_name)
{

#ifdef DEBUG_CHECK_ASSERTIONS
    assert(intc_name=="TIME_STEP_SIZE");
#endif

    NULL_USE(flag_last_dt);
    NULL_USE(last_dt);

    tbox::Pointer< pdat::NodeData<NDIM,double> > coords_current =
            patch.getPatchData(d_coords_current_id);

#ifdef DEBUG_CHECK_ASSERTIONS
    assert(!coords_current.isNull());

#endif

#ifdef DEBUG_CHECK_ASSERTIONS
    assert(ghost_cells == d_zeroghosts);
#endif


    double stabdt = 0.1;


    return stabdt;

}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:37,代码来源:MeshOpt.C


示例7: NULL_USE

void EdgeMultiblockTest::initializeDataOnPatch(
   hier::Patch& patch,
   const std::shared_ptr<hier::PatchHierarchy> hierarchy,
   int level_number,
   const hier::BlockId& block_id,
   char src_or_dst)
{
   NULL_USE(hierarchy);
   NULL_USE(src_or_dst);

   if ((d_refine_option == "INTERIOR_FROM_SAME_LEVEL")
       || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL")
           && (level_number < d_finest_level_number))) {

      for (int i = 0; i < static_cast<int>(d_variables.size()); ++i) {

         std::shared_ptr<pdat::EdgeData<double> > edge_data(
            SAMRAI_SHARED_PTR_CAST<pdat::EdgeData<double>, hier::PatchData>(
               patch.getPatchData(d_variables[i], getDataContext())));
         TBOX_ASSERT(edge_data);

         hier::Box dbox = edge_data->getGhostBox();

         edge_data->fillAll((double)block_id.getBlockValue());

      }
   }
}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:28,代码来源:EdgeMultiblockTest.C


示例8: TBOX_ASSERT

/*
 *************************************************************************
 *
 * Tag cells for spherical octant problem
 *
 *************************************************************************
 */
void MblkGeometry::tagOctantCells(
   hier::Patch& patch,
   const int xyz_id,
   boost::shared_ptr<pdat::CellData<int> >& temp_tags,
   const double regrid_time,
   const int refine_tag_val)
{
   TBOX_ASSERT(d_geom_problem == "SPHERICAL_SHELL" &&
      d_sshell_type == "OCTANT");
   TBOX_ASSERT(temp_tags);

   boost::shared_ptr<pdat::NodeData<double> > xyz(
      BOOST_CAST<pdat::NodeData<double>, hier::PatchData>(
         patch.getPatchData(xyz_id)));
   TBOX_ASSERT(xyz);

   if (d_dim == tbox::Dimension(3)) {
      /*
       * Tag in X direction only
       */
      double xtag_loc_lo = d_sshell_rmin
         + (regrid_time * d_tag_velocity) - (0.5 * d_tag_width);
      double xtag_loc_hi = d_sshell_rmin
         + (regrid_time * d_tag_velocity) + (0.5 * d_tag_width);

      hier::Box pbox = patch.getBox();
      for (int k = pbox.lower(2); k <= pbox.upper(2) + 1; ++k) {
         for (int j = pbox.lower(1); j <= pbox.upper(1) + 1; ++j) {
            for (int i = pbox.lower(0); i <= pbox.upper(0) + 1; ++i) {
               hier::Index ic(i, j, k);
               pdat::NodeIndex node(ic, pdat::NodeIndex::LLL);
               hier::Index icm1(i - 1, j - 1, k - 1);
               pdat::CellIndex cell(icm1);

               double node_x_loc = (*xyz)(node, 0);

               if ((node_x_loc > xtag_loc_lo) &&
                   (node_x_loc < xtag_loc_hi)) {
                  (*temp_tags)(cell) = refine_tag_val;
               }
            }
         }
      }
   }

}
开发者ID:00liujj,项目名称:SAMRAI,代码行数:53,代码来源:MblkGeometry.C


示例9: patch_geom

void PoissonGaussianSolution::setGridData(
   hier::Patch& patch,
   pdat::CellData<double>& exact_data,
   pdat::CellData<double>& source_data)
{
   boost::shared_ptr<geom::CartesianPatchGeometry> patch_geom(
      BOOST_CAST<geom::CartesianPatchGeometry, hier::PatchGeometry>(
         patch.getPatchGeometry()));
   TBOX_ASSERT(patch_geom);

   const double* h = patch_geom->getDx();
   const double* xl = patch_geom->getXLower();
   const int* il = &patch.getBox().lower()[0];

   {
      /* Set cell-centered data. */
      double sl[SAMRAI::MAX_DIM_VAL]; // Like XLower, except for cell.
      int j;
      for (j = 0; j < d_dim.getValue(); ++j) {
         sl[j] = xl[j] + 0.5 * h[j];
      }
      pdat::CellData<double>::iterator iter(pdat::CellGeometry::begin(patch.getBox()));
      pdat::CellData<double>::iterator iterend(pdat::CellGeometry::end(patch.getBox()));
      if (d_dim == tbox::Dimension(2)) {
         double x, y;
         for ( ; iter != iterend; ++iter) {
            const pdat::CellIndex& index = *iter;
            x = sl[0] + (index[0] - il[0]) * h[0];
            y = sl[1] + (index[1] - il[1]) * h[1];
            exact_data(index) = exactFcn(x, y);
            source_data(index) = sourceFcn(x, y);
         }
      } else if (d_dim == tbox::Dimension(3)) {
         double x, y, z;
         for ( ; iter != iterend; ++iter) {
            const pdat::CellIndex& index = *iter;
            x = sl[0] + (index[0] - il[0]) * h[0];
            y = sl[1] + (index[1] - il[1]) * h[1];
            z = sl[2] + (index[2] - il[2]) * h[2];
            exact_data(index) = exactFcn(x, y, z);
            source_data(index) = sourceFcn(x, y, z);
         }
      }
   }
}       // End patch loop.
开发者ID:00liujj,项目名称:SAMRAI,代码行数:45,代码来源:PoissonGaussianSolution.C


示例10: xyz

void MblkGeometry::buildCartesianGridOnPatch(
   const hier::Patch& patch,
   const int xyz_id,
   const int level_number,
   const int block_number)
{

   boost::shared_ptr<pdat::NodeData<double> > xyz(
      BOOST_CAST<pdat::NodeData<double>, hier::PatchData>(
         patch.getPatchData(xyz_id)));

   TBOX_ASSERT(xyz);

   pdat::NodeIterator niend(pdat::NodeGeometry::end(patch.getBox()));
   for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(patch.getBox()));
        ni != niend; ++ni) {
      pdat::NodeIndex node = *ni;
      if (d_block_rotation[block_number] == 0) {

         (*xyz)(node, 0) =
            d_cart_xlo[block_number][0] + node(0) * d_dx[level_number][block_number][0];
         (*xyz)(node, 1) =
            d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][block_number][1];
         if (d_dim == tbox::Dimension(3)) {
            (*xyz)(node, 2) =
               d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][block_number][2];
         }
      }
      if (d_block_rotation[block_number] == 1) { // I sideways, J down

         (*xyz)(node, 0) =
            d_cart_xlo[block_number][0] - node(0) * d_dx[level_number][block_number][0];
         (*xyz)(node, 1) =
            d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][block_number][1];
         if (d_dim == tbox::Dimension(3)) {
            (*xyz)(node, 2) =
               d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][block_number][2];
         }
      }

   }

}
开发者ID:00liujj,项目名称:SAMRAI,代码行数:43,代码来源:MblkGeometry.C


示例11:

boost::shared_ptr<hier::PatchData>
CellDataFactory<TYPE>::allocate(
   const hier::Patch& patch) const
{
   TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch);

   return boost::make_shared<CellData<TYPE> >(
             patch.getBox(),
             d_depth,
             d_ghosts);
}
开发者ID:00liujj,项目名称:SAMRAI,代码行数:11,代码来源:CellDataFactory.C


示例12: initializePatchData

/*************************************************************************
* 初值构件: 初始化网格结点坐标
*************************************************************************/
void MeshOpt::initializePatchData( hier::Patch<NDIM>& patch,
                                   const double  time,
                                   const bool    initial_time,
                                   const string& intc_name)
{
#ifdef DEBUG_CHECK_ASSERTIONS
    assert(intc_name=="INIT");
#endif

    (void) time;

    if (initial_time) {
        tbox::Pointer< pdat::NodeData<NDIM,double> > coords_current =
                patch.getPatchData(d_coords_current_id);

#ifdef DEBUG_CHECK_ASSERTIONS
        assert(!coords_current.isNull());
#endif

#ifdef DEBUG_CHECK_ASSERTIONS
        assert(ghost_cells == d_zeroghosts);
#endif

        // 生成初始网格.
        if(!d_grid_tool.isNull()) {
            d_grid_tool->generateDeformingMeshForDomain(patch,
                                                        d_coords_current_id);
        }

        tbox::Pointer< pdat::NodeData<NDIM,bool> > fixed_info
                = patch.getPatchData(d_fixed_info_id);

        // 赋初值
        fixed_info->fillAll(false);

        // 设定结点类型
        setNodeInfo(patch);
    }

}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:43,代码来源:MeshOpt.C


示例13: pgeom

void
CommTester::putCoordinatesToDatabase(
   std::shared_ptr<tbox::Database>& coords_db,
   const hier::Patch& patch)
{

   std::shared_ptr<geom::CartesianPatchGeometry> pgeom(
      SAMRAI_SHARED_PTR_CAST<geom::CartesianPatchGeometry, hier::PatchGeometry>(
         patch.getPatchGeometry()));
/*
   if (pgeom) {
      pgeom->putBlueprintCoords(coords_db, patch.getBox());
   }
*/
   const tbox::Dimension& dim(patch.getDim());

   pdat::NodeData<double> coords(patch.getBox(), dim.getValue(),
                                 hier::IntVector::getZero(dim));

   const hier::Index& box_lo = patch.getBox().lower();
   const double* x_lo = pgeom->getXLower();
   const double* dx = pgeom->getDx();
   
   pdat::NodeIterator nend = pdat::NodeGeometry::end(patch.getBox());
   for (pdat::NodeIterator itr(pdat::NodeGeometry::begin(patch.getBox())); itr != nend; ++itr) {
      const pdat::NodeIndex& ni = *itr;
      for (int d = 0; d < dim.getValue(); ++d) {
         coords(ni, d) = x_lo[d] + (ni(d)-box_lo(d))*dx[d];
      }
   }

   coords_db->putString("type", "explicit");

   std::shared_ptr<tbox::Database> values_db = coords_db->putDatabase("values");

   int data_size = coords.getArrayData().getBox().size();

   values_db->putDoubleArray("x", coords.getPointer(0), data_size);
   if (dim.getValue() > 1) {
      values_db->putDoubleArray("y", coords.getPointer(1), data_size);
   }
   if (dim.getValue() > 2) {
      values_db->putDoubleArray("z", coords.getPointer(2), data_size);
   }
}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:45,代码来源:CommTester.C


示例14: transformMeshtoPatch

void MeshOpt::transformMeshtoPatch(MeshImpl * mesh, hier::Patch<NDIM>& patch, MsqError& err)
{
    std::vector<Mesh::VertexHandle>  vertices;
    mesh->get_all_vertices(vertices,err);
    size_t num_of_vertices = vertices.size();
//    std::cout << num_of_vertices << std::endl;

    std::vector<MsqVertex> coords(num_of_vertices);
    mesh->vertices_get_coordinates(arrptr(vertices),arrptr(coords),num_of_vertices,err);

    tbox::Pointer< pdat::NodeData<NDIM,double> > coords_current
            = patch.getPatchData(d_coords_current_id);

    int count = 0;
    for(pdat::NodeIterator<NDIM> ic((*coords_current).getBox()); ic; ic++)
    {
        (*coords_current)(ic(),0) = coords[count][0];
        (*coords_current)(ic(),1) =  coords[count][1];
        ++count;
    }

    return;

}
开发者ID:gotodo,项目名称:meshOptBasedjasmin,代码行数:24,代码来源:MeshOpt.C


示例15: tgcw

/*
 *************************************************************************
 *
 * Verify results of communication operations.  This test must be
 * consistent with data initialization and boundary operations above.
 *
 *************************************************************************
 */
bool EdgeMultiblockTest::verifyResults(
   const hier::Patch& patch,
   const std::shared_ptr<hier::PatchHierarchy> hierarchy,
   const int level_number,
   const hier::BlockId& block_id)
{

   tbox::plog << "\nEntering EdgeMultiblockTest::verifyResults..." << endl;
   tbox::plog << "level_number = " << level_number << endl;
   tbox::plog << "Patch box = " << patch.getBox() << endl;

   hier::IntVector tgcw(d_dim, 0);
   for (int i = 0; i < static_cast<int>(d_variables.size()); ++i) {
      tgcw.max(patch.getPatchData(d_variables[i], getDataContext())->
         getGhostCellWidth());
   }
   hier::Box pbox = patch.getBox();

   std::shared_ptr<pdat::EdgeData<double> > solution(
      new pdat::EdgeData<double>(pbox, 1, tgcw));

   hier::Box tbox(pbox);
   tbox.grow(tgcw);

   std::shared_ptr<hier::BaseGridGeometry> grid_geom(
      hierarchy->getGridGeometry());

   hier::BoxContainer singularity(
      grid_geom->getSingularityBoxContainer(block_id));

   hier::IntVector ratio =
      hierarchy->getPatchLevel(level_number)->getRatioToLevelZero();

   singularity.refine(ratio);

   bool test_failed = false;

   for (int i = 0; i < static_cast<int>(d_variables.size()); ++i) {

      double correct = (double)block_id.getBlockValue();

      std::shared_ptr<pdat::EdgeData<double> > edge_data(
         SAMRAI_SHARED_PTR_CAST<pdat::EdgeData<double>, hier::PatchData>(
            patch.getPatchData(d_variables[i], getDataContext())));
      TBOX_ASSERT(edge_data);
      int depth = edge_data->getDepth();

      hier::Box interior_box(pbox);
      interior_box.grow(hier::IntVector(d_dim, -1));

      for (int axis = 0; axis < d_dim.getValue(); ++axis) {
         pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(interior_box, axis));
         for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(interior_box, axis));
              ci != ciend; ++ci) {
            for (int d = 0; d < depth; ++d) {
               double result = (*edge_data)(*ci, d);

               if (!tbox::MathUtilities<double>::equalEps(correct, result)) {
                  tbox::perr << "Test FAILED: ...."
                             << " : edge index = " << *ci << endl;
                  tbox::perr << "    Variable = " << d_variable_src_name[i]
                             << " : depth index = " << d << endl;
                  tbox::perr << "    result = " << result
                             << " : correct = " << correct << endl;
                  test_failed = true;
               }
            }
         }
      }

      hier::Box gbox = edge_data->getGhostBox();

      for (int axis = 0; axis < d_dim.getValue(); ++axis) {
         hier::Box patch_edge_box =
            pdat::EdgeGeometry::toEdgeBox(pbox, axis);

         hier::BoxContainer tested_neighbors;

         hier::BoxContainer sing_edge_boxlist;
         for (hier::BoxContainer::iterator si = singularity.begin();
              si != singularity.end(); ++si) {
            sing_edge_boxlist.pushFront(
               pdat::EdgeGeometry::toEdgeBox(*si, axis));
         }

         for (hier::BaseGridGeometry::ConstNeighborIterator ne(
                 grid_geom->begin(block_id));
              ne != grid_geom->end(block_id); ++ne) {

            const hier::BaseGridGeometry::Neighbor& nbr = *ne;
            if (nbr.isSingularity()) {
               continue;
//.........这里部分代码省略.........
开发者ID:LLNL,项目名称:SAMRAI,代码行数:101,代码来源:EdgeMultiblockTest.C


示例16: TBOX_ASSERT

int SkeletonBoundaryUtilities2::checkBdryData(
   const string& varname,
   const hier::Patch& patch,
   int data_id,
   int depth,
   const hier::IntVector& gcw_to_check,
   const hier::BoundaryBox& bbox,
   int bcase,
   double bstate)
{
   TBOX_ASSERT(!varname.empty());
   TBOX_ASSERT(data_id >= 0);
   TBOX_ASSERT(depth >= 0);

   int num_bad_values = 0;

   int btype = bbox.getBoundaryType();
   int bloc = bbox.getLocationIndex();

   std::shared_ptr<hier::PatchGeometry> pgeom(patch.getPatchGeometry());

   std::shared_ptr<pdat::CellData<double> > vardata(
      SAMRAI_SHARED_PTR_CAST<pdat::CellData<double>, hier::PatchData>(
         patch.getPatchData(data_id)));
   TBOX_ASSERT(vardata);

   string bdry_type_str;
   if (btype == Bdry::EDGE2D) {
      bdry_type_str = "EDGE";
   } else if (btype == Bdry::NODE2D) {
      bdry_type_str = "NODE";
   } else {
      TBOX_ERROR(
         "Unknown btype " << btype
                          << " passed to SkeletonBoundaryUtilities2::checkBdryData()! "
                          << endl);
   }

   tbox::plog << "\n\nCHECKING 2D " << bdry_type_str << " BDRY DATA..." << endl;
   tbox::plog << "varname = " << varname << " : depth = " << depth << endl;
   tbox::plog << "bbox = " << bbox.getBox() << endl;
   tbox::plog << "btype, bloc, bcase = "
              << btype << ", = " << bloc << ", = " << bcase << endl;

   tbox::Dimension::dir_t idir;
   double valfact = 0.0, constval = 0.0, dxfact = 0.0;
   int offsign;

   get2dBdryDirectionCheckValues(idir, offsign,
      btype, bloc, bcase);

   if (btype == Bdry::EDGE2D) {

      if (bcase == BdryCond::FLOW) {
         valfact = 1.0;
         constval = 0.0;
         dxfact = 0.0;
      } else if (bcase == BdryCond::REFLECT) {
         valfact = -1.0;
         constval = 0.0;
         dxfact = 0.0;
      } else if (bcase == BdryCond::DIRICHLET) {
         valfact = 0.0;
         constval = bstate;
         dxfact = 0.0;
      } else {
         TBOX_ERROR(
            "Unknown bcase " << bcase
                             << " passed to SkeletonBoundaryUtilities2::checkBdryData()"
                             << "\n for " << bdry_type_str
                             << " at location " << bloc << endl);
      }

   } else if (btype == Bdry::NODE2D) {

      if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW) {
         valfact = 1.0;
         constval = 0.0;
         dxfact = 0.0;
      } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT) {
         valfact = -1.0;
         constval = 0.0;
         dxfact = 0.0;
      } else if (bcase == BdryCond::XDIRICHLET ||
                 bcase == BdryCond::YDIRICHLET) {
         valfact = 0.0;
         constval = bstate;
         dxfact = 0.0;
      } else {
         TBOX_ERROR(
            "Unknown bcase " << bcase
                             << " passed to SkeletonBoundaryUtilities2::checkBdryData()"
                             << "\n for " << bdry_type_str
                             << " at location " << bloc << endl);
      }

   }

   hier::Box gbox_to_check(
      vardata->getGhostBox() * pgeom->getBoundaryFillBox(bbox,
//.........这里部分代码省略.........
开发者ID:LLNL,项目名称:SAMRAI,代码行数:101,代码来源:SkeletonBoundaryUtilities2.C


示例17: NULL_USE

void SkeletonBoundaryUtilities2::fillNodeBoundaryData(
   const string& varname,
   std::shared_ptr<pdat::CellData<double> >& vardata,
   const hier::Patch& patch,
   const hier::IntVector& ghost_fill_width,
   const std::vector<int>& bdry_node_conds,
   const std::vector<double>& bdry_edge_values)
{
   NULL_USE(varname);

   TBOX_ASSERT(vardata);
   TBOX_ASSERT(static_cast<int>(bdry_node_conds.size()) == NUM_2D_NODES);
   TBOX_ASSERT(static_cast<int>(bdry_edge_values.size()) ==
      NUM_2D_EDGES * (vardata->getDepth()));

   if (!s_fortran_constants_stuffed) {
      stuff2dBdryFortConst();
   }

   const std::shared_ptr<hier::PatchGeometry> pgeom(
      patch.getPatchGeometry());

   const hier::Box& interior(patch.getBox());
   const hier::Index& ifirst(interior.lower());
   const hier::Index& ilast(interior.upper());

   const hier::IntVector& ghost_cells = vardata->getGhostCellWidth();

   hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells,
         ghost_fill_width);

   const std::vector<hier::BoundaryBox>& node_bdry =
      pgeom->getCodimensionBoundaries(Bdry::NODE2D);

   for (int i = 0; i < static_cast<int>(node_bdry.size()); ++i) {
      TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE2D);

      int bnode_loc = node_bdry[i].getLocationIndex();

      hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i],
                            interior,
                            gcw_to_fill));

      if (!fill_box.empty()) {
         const hier::Index& ibeg(fill_box.lower());
         const hier::Index& iend(fill_box.upper());

         SAMRAI_F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) (
            ifirst(0), ilast(0),
            ifirst(1), ilast(1),
            ibeg(0), iend(0),
            ibeg(1), iend(1),
            ghost_cells(0), ghost_cells(1),
            bnode_loc,
            bdry_node_conds[bnode_loc],
            &bdry_edge_values[0],
            vardata->getPointer(),
            vardata->getDepth());
      }

   }

}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:63,代码来源:SkeletonBoundaryUtilities2.C


示例18: TBOX_ERROR

void MblkGeometry::buildSShellGridOnPatch(
   const hier::Patch& patch,
   const hier::Box& domain,
   const int xyz_id,
   const int level_number,
   const int block_number)
{

   bool xyz_allocated = patch.checkAllocated(xyz_id);
   if (!xyz_allocated) {
      TBOX_ERROR("xyz data not allocated" << std::endl);
      //patch.allocatePatchData(xyz_id);
   }

   boost::shared_ptr<pdat::NodeData<double> > xyz(
      BOOST_CAST<pdat::NodeData<double>, hier::PatchData>(
         patch.getPatchData(xyz_id)));

   TBOX_ASSERT(xyz);

   if (d_dim == tbox::Dimension(3)) {

      const hier::Index ifirst = patch.getBox().lower();
      const hier::Index ilast = patch.getBox().upper();
      hier::IntVector nghost_cells = xyz->getGhostCellWidth();

      //int imin = ifirst(0);
      //int imax = ilast(0)  + 1;
      //int jmin = ifirst(1);
      //int jmax = ilast(1)  + 1;
      //int kmin = ifirst(2);
      //int kmax = ilast(2)  + 1;
      //int nx   = imax - imin + 1;
      //int ny   = jmax - jmin + 1;
      //int nxny = nx*ny;

      int nd_imin = ifirst(0) - nghost_cells(0);
      int nd_imax = ilast(0) + 1 + nghost_cells(0);
      int nd_jmin = ifirst(1) - nghost_cells(1);
      int nd_jmax = ilast(1) + 1 + nghost_cells(1);
      int nd_kmin = ifirst(2) - nghost_cells(2);
      int nd_kmax = ilast(2) + 1 + nghost_cells(2);
      int nd_nx = nd_imax - nd_imin + 1;
      int nd_ny = nd_jmax - nd_jmin + 1;
      int nd_nxny = nd_nx * nd_ny;

      double* x = xyz->getPointer(0);
      double* y = xyz->getPointer(1);
      double* z = xyz->getPointer(2);

      bool found = false;

      int nrad = (domain.upper(0) - domain.lower(0) + 1);
      int nth = (domain.upper(1) - domain.lower(1) + 1);
      int nphi = (domain.upper(2) - domain.lower(2) + 1);

      /*
       * If its a solid shell, its a single block and dx = dr, dth, dphi
       */
      if (d_sshell_type == "SOLID") {

         d_dx[level_number][block_number][0] = (d_sshell_rmax - d_sshell_rmin) / (double)nrad;
         d_dx[level_number][block_number][1] =
            2.0 * tbox::MathUtilities<double>::Abs(d_sangle_thmin)
            / (double)nth;
         d_dx[level_number][block_number][2] =
            2.0 * tbox::MathUtilities<double>::Abs(d_sangle_thmin)
            / (double)nphi;

         //
         // step in a radial direction in x and set y and z appropriately
         // for a solid angle we go -th to th and -phi to phi
         //
         for (int k = nd_kmin; k <= nd_kmax; ++k) {
            for (int j = nd_jmin; j <= nd_jmax; ++j) {

               double theta = d_sangle_thmin + j * d_dx[level_number][block_number][1]; // dx used for dth
               double phi = d_sangle_thmin + k * d_dx[level_number][block_number][2];

               double xface = cos(theta) * cos(phi);
               double yface = sin(theta) * cos(phi);
               double zface = sin(phi);

               for (int i = nd_imin; i <= nd_imax; ++i) {

                  int ind = POLY3(i,
                        j,
                        k,
                        nd_imin,
                        nd_jmin,
                        nd_kmin,
                        nd_nx,
                        nd_nxny);

                  double r = d_sshell_rmin + d_dx[level_number][block_number][0] * (i);

                  double xx = r * xface;
                  double yy = r * yface;
                  double zz = r * zface;

//.........这里部分代码省略.........
开发者ID:00liujj,项目名称:SAMRAI,代码行数:101,代码来源:MblkGeometry.C


示例19: dim

void
CartesianSideFloatWeightedAverage::coarsen(
   hier::Patch& coarse,
   const hier::Patch& fine,
   const int dst_component,
   const int src_component,
   const hier::Box& coarse_box,
   const hier::IntVector& ratio) const
{
   const tbox::Dimension& dim(fine.getDim());

   TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio);

   std::shared_ptr<pdat::SideData<float> > fdata(
      SAMRAI_SHARED_PTR_CAST<pdat::SideData<float>, hier::PatchData>(
         fine.getPatchData(src_component)));
   std::shared_ptr<pdat::SideData<float> > cdata(
      SAMRAI_SHARED_PTR_CAST<pdat::SideData<float>, hier::PatchData>(
         coarse.getPatchData(dst_component)));
   TBOX_ASSERT(fdata);
   TBOX_ASSERT(cdata);
   TBOX_ASSERT(cdata->getDepth() == fdata->getDepth());
   const hier::IntVector& directions = cdata->getDirectionVector();
   TBOX_ASSERT(directions ==
      hier::IntVector::min(directions, fdata->getDirectionVector()));

   const hier::Index& filo = fdata->getGhostBox().lower();
   const hier::Index& fihi = fdata->getGhostBox().upper();
   const hier::Index& cilo = cdata->getGhostBox().lower();
   const hier::Index& cihi = cdata->getGhostBox().upper();

   const std::shared_ptr<CartesianPatchGeometry> fgeom(
      SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
         fine.getPatchGeometry()));
   const std::shared_ptr<CartesianPatchGeometry> cgeom(
      SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
         coarse.getPatchGeometry()));

   TBOX_ASSERT(fgeom);
   TBOX_ASSERT(cgeom);

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

   for (int d = 0; d < cdata->getDepth(); ++d) {
      if ((dim == tbox::Dimension(1))) {
         if (directions(0)) {
            SAMRAI_F77_FUNC(cartwgtavgsideflot1d, CARTWGTAVGSIDEFLOT1D) (ifirstc(0),
               ilastc(0),
               filo(0), fihi(0),
               cilo(0), cihi(0),
               &ratio[0],
               fgeom->getDx(),
               cgeom->getDx(),
               fdata->getPointer(0, d),
               cdata->getPointer(0, d));
         }
      } else if ((dim == tbox::Dimension(2))) {
         if (directions(0)) {
            SAMRAI_F77_FUNC(cartwgtavgsideflot2d0, CARTWGTAVGSIDEFLOT2D0) (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],
               fgeom->getDx(),
               cgeom->getDx(),
               fdata->getPointer(0, d),
               cdata->getPointer(0, d));
         }
         if (directions(1)) {
            SAMRAI_F77_FUNC(cartwgtavgsideflot2d1, CARTWGTAVGSIDEFLOT2D1) (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],
               fgeom->getDx(),
               cgeom->getDx(),
               fdata->getPointer(1, d),
               cdata->getPointer(1, d));
         }
      } else if ((dim == tbox::Dimension(3))) {
         if (directions(0)) {
            SAMRAI_F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (ifirstc(0),
               ifirstc(1), ifirstc(2),
               ilastc(0), ilastc(1), ilastc(2),
               filo(0), filo(1), filo(2),
               fihi(0), fihi(1), fihi(2),
               cilo(0), cilo(1), cilo(2),
               cihi(0), cihi(1), cihi(2),
               &ratio[0],
               fgeom->getDx(),
               cgeom->getDx(),
               fdata->getPointer(0, d),
               cdata->getPointer(0, d));
         }
         if (directions(1)) {
            SAMRAI_F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (ifirstc(0),
               ifirstc(1), ifirstc(2),
               ilastc(0), ilastc(1), ilastc(2),
               filo(0), filo(1), filo(2),
//.........这里部分代码省略.........
开发者ID:LLNL,项目名称:SAMRAI,代码行数:101,代码来源:CartesianSideFloatWeightedAverage.C


示例20: dim

void
CartesianFaceDoubleWeightedAverage::coarsen(
   hier::Patch& coarse,
   const hier::Patch& fine,
   const int dst_component,
   const int src_component,
   const hier::Box& coarse_box,
   const hier::IntVector& ratio) const
{
   const tbox::Dimension& dim(fine.getDim());

   TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio);

   std::shared_ptr<pdat::FaceData<double> > fdata(
      SAMRAI_SHARED_PTR_CAST<pdat::FaceData<double>, hier::PatchData>(
         fine.getPatchData(src_component)));
   std::shared_ptr<pdat::FaceData<double> > cdata(
      SAMRAI_SHARED_PTR_CAST<pdat::FaceData<double>, hier::PatchData>(
         coarse.getPatchData(dst_component)));
   TBOX_ASSERT(fdata);
   TBOX_ASSERT(cdata);
   TBOX_ASSERT(cdata->getDepth() == fdata->getDepth());

   const hier::Index& filo = fdata->getGhostBox().lower();
   const hier::Index& fihi = fdata->getGhostBox().upper();
   const hier::Index& cilo = cdata->getGhostBox().lower();
   const hier::Index& cihi = cdata->getGhostBox().upper();

   const std::shared_ptr<CartesianPatchGeometry> fgeom(
      SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
         fine.getPatchGeometry()));
   const std::shared_ptr<CartesianPatchGeometry> cgeom(
      SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
         coarse.getPatchGeometry()));

   TBOX_ASSERT(fgeom);
   TBOX_ASSERT(cgeom);

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

   for (int d = 0; d < cdata->getDepth(); ++d) {
      if ((dim == tbox::Dimension(1))) {
         SAMRAI_F77_FUNC(cartwgtavgfacedoub1d, CARTWGTAVGFACEDOUB1D) (ifirstc(0),
            ilastc(0),
            filo(0), fihi(0),
            cilo(0), cihi(0),
            &ratio[0],
            fgeom->getDx(),
            cgeom->getDx(),
            fdata->getPointer(0, d),
            cdata->getPointer(0, d));
      } else if ((dim == tbox::Dimension(2))) {
         SAMRAI_F77_FUNC(cartwgtavgfacedoub2d0, CARTWGTAVGFACEDOUB2D0) (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],
            fgeom->getDx(),
            cgeom->getDx(),
            fdata->getPointer(0, d),
            cdata->getPointer(0, d));
         SAMRAI_F77_FUNC(cartwgtavgfacedoub2d1, CARTWGTAVGFACEDOUB2D1) (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],
            fgeom->getDx(),
            cgeom->getDx(),
            fdata->getPointer(1, d),
            cdata->getPointer(1, d));
      } else if ((dim == tbox::Dimension(3))) {
         SAMRAI_F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (ifirstc(0),
            ifirstc(1), ifirstc(2),
            ilastc(0), ilastc(1), ilastc(2),
            filo(0), filo(1), filo(2),
            fihi(0), fihi(1), fihi(2),
            cilo(0), cilo(1), cilo(2),
            cihi(0), cihi(1), cihi(2),
            &ratio[0],
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ hls::stream类代码示例发布时间:2022-05-31
下一篇:
C++ hier::Box类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap