本文整理汇总了C++中hier::Patch::getPatchData方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::getPatchData方法的具体用法?C++ Patch::getPatchData怎么用?C++ Patch::getPatchData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hier::Patch
的用法示例。
在下文中一共展示了Patch::getPatchData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: tagCellsInInputBoxes
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);
}
}
}
示例3: initializeDataOnPatch
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());
}
}
}
示例4: 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];
}
}
示例5: postprocessRefine
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);
}
}
示例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;
}
示例7: 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);
}
}
示例8: tagOctantCells
/*
*************************************************************************
*
* 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;
}
}
}
}
}
}
示例9: buildCartesianGridOnPatch
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];
}
}
}
}
示例10: 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;
}
示例11: buildSShellGridOnPatch
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;
//.........这里部分代码省略.........
示例12: gbox_to_check
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,
//.........这里部分代码省略.........
示例13: 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],
fgeom->getDx(),
cgeom->getDx(),
fdata->getPointer(0, d),
cdata->getPointer(0, d));
SAMRAI_F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (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(1, d),
cdata->getPointer(1, d));
SAMRAI_F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (ifirstc(0),
ifirstc(1), ifirstc(2),
ilastc(0), ilastc(1), ilastc(2),
filo(0), filo(1), filo(2),
//.........这里部分代码省略.........
示例14: buildWedgeGridOnPatch
void MblkGeometry::buildWedgeGridOnPatch(
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);
const hier::Index ifirst = patch.getBox().lower();
const hier::Index ilast = patch.getBox().upper();
hier::IntVector nghost_cells = xyz->getGhostCellWidth();
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_nx = nd_imax - nd_imin + 1;
int nd_ny = nd_jmax - nd_jmin + 1;
//int nd_nz = nd_kmax - nd_kmin + 1;
int nd_nxny = nd_nx * nd_ny;
//int nd_nel = nd_nx*nd_ny*nd_nz;
double dx[SAMRAI::MAX_DIM_VAL];
dx[0] = d_dx[level_number][block_number][0];
dx[1] = d_dx[level_number][block_number][1];
double* x = xyz->getPointer(0);
double* y = xyz->getPointer(1);
int nd_kmin;
int nd_kmax;
dx[2] = d_dx[level_number][block_number][2];
double* z = 0;
if (d_dim == tbox::Dimension(3)) {
nd_kmin = ifirst(2) - nghost_cells(2);
nd_kmax = ilast(2) + 1 + nghost_cells(2);
dx[2] = d_dx[level_number][block_number][2];
z = xyz->getPointer(2);
} else {
nd_kmin = 0;
nd_kmax = 0;
}
//
// ----------- set the wedge nodal positions
//
for (int k = nd_kmin; k <= nd_kmax; ++k) {
for (int j = nd_jmin; j <= nd_jmax; ++j) {
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_wedge_rmin[block_number] + dx[0] * (i);
double th = d_wedge_thmin + dx[1] * (j);
double xx = r * cos(th);
double yy = r * sin(th);
x[ind] = xx;
y[ind] = yy;
if (d_dim == tbox::Dimension(3)) {
double zz = d_wedge_zmin + dx[2] * (k);
z[ind] = zz;
}
}
}
}
}
示例15: dim
void
CartesianCellDoubleConservativeLinearRefine::refine(
hier::Patch& fine,
const hier::Patch& coarse,
const int dst_component,
const int src_component,
const hier::Box& fine_box,
const hier::IntVector& ratio) const
{
const tbox::Dimension& dim(fine.getDim());
TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio);
std::shared_ptr<pdat::CellData<double> > cdata(
SAMRAI_SHARED_PTR_CAST<pdat::CellData<double>, hier::PatchData>(
coarse.getPatchData(src_component)));
std::shared_ptr<pdat::CellData<double> > fdata(
SAMRAI_SHARED_PTR_CAST<pdat::CellData<double>, hier::PatchData>(
fine.getPatchData(dst_component)));
TBOX_ASSERT(cdata);
TBOX_ASSERT(fdata);
TBOX_ASSERT(cdata->getDepth() == fdata->getDepth());
const hier::Box cgbox(cdata->getGhostBox());
const hier::Index& cilo = cgbox.lower();
const hier::Index& cihi = cgbox.upper();
const hier::Index& filo = fdata->getGhostBox().lower();
const hier::Index& fihi = fdata->getGhostBox().upper();
const std::shared_ptr<CartesianPatchGeometry> cgeom(
SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
coarse.getPatchGeometry()));
const std::shared_ptr<CartesianPatchGeometry> fgeom(
SAMRAI_SHARED_PTR_CAST<CartesianPatchGeometry, hier::PatchGeometry>(
fine.getPatchGeometry()));
TBOX_ASSERT(cgeom);
TBOX_ASSERT(fgeom);
const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio);
const hier::Index& ifirstc = coarse_box.lower();
const hier::Index& ilastc = coarse_box.upper();
const hier::Index& ifirstf = fine_box.lower();
const hier::Index& ilastf = fine_box.upper();
const hier::IntVector tmp_ghosts(dim, 0);
std::vector<double> diff0(cgbox.numberCells(0) + 1);
pdat::CellData<double> slope0(cgbox, 1, tmp_ghosts);
for (int d = 0; d < fdata->getDepth(); ++d) {
if ((dim == tbox::Dimension(1))) {
SAMRAI_F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (ifirstc(0),
ilastc(0),
ifirstf(0), ilastf(0),
cilo(0), cihi(0),
filo(0), fihi(0),
&ratio[0],
cgeom->getDx(),
fgeom->getDx(),
cdata->getPointer(d),
fdata->getPointer(d),
&diff0[0], slope0.getPointer());
} else if ((dim == tbox::Dimension(2))) {
std::vector<double> diff1(cgbox.numberCells(1) + 1);
pdat::CellData<double> slope1(cgbox, 1, tmp_ghosts);
SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (ifirstc(0),
ifirstc(1), ilastc(0), ilastc(1),
ifirstf(0), ifirstf(1), ilastf(0), ilastf(1),
cilo(0), cilo(1), cihi(0), cihi(1),
filo(0), filo(1), fihi(0), fihi(1),
&ratio[0],
cgeom->getDx(),
fgeom->getDx(),
cdata->getPointer(d),
fdata->getPointer(d),
&diff0[0], slope0.getPointer(),
&diff1[0], slope1.getPointer());
} else if ((dim == tbox::Dimension(3))) {
std::vector<double> diff1(cgbox.numberCells(1) + 1);
pdat::CellData<double> slope1(cgbox, 1, tmp_ghosts);
std::vector<double> diff2(cgbox.numberCells(2) + 1);
pdat::CellData<double> slope2(cgbox, 1, tmp_ghosts);
SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) (ifirstc(0),
ifirstc(1), ifirstc(2),
ilastc(0), ilastc(1), ilastc(2),
ifirstf(0), ifirstf(1), ifirstf(2),
ilastf(0), ilastf(1), ilastf(2),
cilo(0), cilo(1), cilo(2),
cihi(0), cihi(1), cihi(2),
filo(0), filo(1), filo(2),
fihi(0), fihi(1), fihi(2),
&ratio[0],
cgeom->getDx(),
fgeom->getDx(),
cdata->getPointer(d),
//.........这里部分代码省略.........