| 1495 | /////////////////////////////// PUBLIC /////////////////////////////////////// |
| 1496 | |
| 1497 | void |
| 1498 | PatchMathOps::curl(Pointer<CellData<NDIM, double>> dst, |
| 1499 | const Pointer<CellData<NDIM, double>> src, |
| 1500 | const Pointer<Patch<NDIM>> patch) const |
| 1501 | { |
| 1502 | const Pointer<CartesianPatchGeometry<NDIM>> pgeom = patch->getPatchGeometry(); |
| 1503 | const double* const dx = pgeom->getDx(); |
| 1504 | |
| 1505 | double* const W = dst->getPointer(); |
| 1506 | const int W_ghosts = (dst->getGhostCellWidth()).max(); |
| 1507 | |
| 1508 | const double* const U = src->getPointer(); |
| 1509 | const int U_ghosts = (src->getGhostCellWidth()).max(); |
| 1510 | |
| 1511 | const Box<NDIM>& patch_box = patch->getBox(); |
| 1512 | |
| 1513 | #if !defined(NDEBUG) |
| 1514 | if (W_ghosts != (dst->getGhostCellWidth()).min()) |
| 1515 | { |
| 1516 | TBOX_ERROR("PatchMathOps::curl():\n" |
| 1517 | << " dst does not have uniform ghost cell widths" << std::endl); |
| 1518 | } |
| 1519 | |
| 1520 | if (U_ghosts != (src->getGhostCellWidth()).min()) |
| 1521 | { |
| 1522 | TBOX_ERROR("PatchMathOps::curl():\n" |
| 1523 | << " src does not have uniform ghost cell widths" << std::endl); |
| 1524 | } |
| 1525 | |
| 1526 | if (src == dst) |
| 1527 | { |
| 1528 | TBOX_ERROR("PatchMathOps::curl():\n" |
| 1529 | << " src == dst." << std::endl); |
| 1530 | } |
| 1531 | |
| 1532 | const Box<NDIM>& U_box = src->getGhostBox(); |
| 1533 | const Box<NDIM> U_box_shrunk = Box<NDIM>::grow(U_box, -1); |
| 1534 | |
| 1535 | if ((!U_box_shrunk.contains(patch_box.lower())) || (!U_box_shrunk.contains(patch_box.upper()))) |
| 1536 | { |
| 1537 | TBOX_ERROR("PatchMathOps::curl():\n" |
| 1538 | << " src has insufficient ghost cell width" << std::endl); |
| 1539 | } |
| 1540 | |
| 1541 | const int W_depth = dst->getDepth(); |
| 1542 | |
| 1543 | if ( |
| 1544 | #if (NDIM == 2) |
| 1545 | (W_depth != 1) |
| 1546 | #elif (NDIM == 3) |
| 1547 | (W_depth != NDIM) |
| 1548 | #else |
| 1549 | false |
| 1550 | #endif |
| 1551 | ) |
| 1552 | { |
| 1553 | TBOX_ERROR("PatchMathOps::curl():\n" |
| 1554 | << " dst has incorrect depth" << std::endl); |
no test coverage detected