MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / grad

Method grad

ibtk/src/math/PatchMathOps.cpp:2987–3124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2985} // div
2986
2987void
2988PatchMathOps::grad(Pointer<CellData<NDIM, double>> dst,
2989 const double alpha,
2990 const Pointer<CellData<NDIM, double>> src1,
2991 const double beta,
2992 const Pointer<CellData<NDIM, double>> src2,
2993 const Pointer<Patch<NDIM>> patch,
2994 const int l) const
2995{
2996 const Pointer<CartesianPatchGeometry<NDIM>> pgeom = patch->getPatchGeometry();
2997 const double* const dx = pgeom->getDx();
2998
2999 double* const G = dst->getPointer();
3000 const int G_ghosts = (dst->getGhostCellWidth()).max();
3001
3002 const double* const U = src1->getPointer(l);
3003 const int U_ghosts = (src1->getGhostCellWidth()).max();
3004
3005 const Box<NDIM>& patch_box = patch->getBox();
3006
3007#if !defined(NDEBUG)
3008 if (G_ghosts != (dst->getGhostCellWidth()).min())
3009 {
3010 TBOX_ERROR("PatchMathOps::grad():\n"
3011 << " dst does not have uniform ghost cell widths" << std::endl);
3012 }
3013
3014 const int G_depth = dst->getDepth();
3015
3016 if (G_depth != NDIM)
3017 {
3018 TBOX_ERROR("PatchMathOps::grad():\n"
3019 << " dst has incorrect depth" << std::endl);
3020 }
3021
3022 if (U_ghosts != (src1->getGhostCellWidth()).min())
3023 {
3024 TBOX_ERROR("PatchMathOps::grad():\n"
3025 << " src1 does not have uniform ghost cell widths" << std::endl);
3026 }
3027
3028 if (src1 == dst)
3029 {
3030 TBOX_ERROR("PatchMathOps::grad():\n"
3031 << " src1 == dst." << std::endl);
3032 }
3033
3034 if ((src1 == src2) && (beta != 0.0))
3035 {
3036 TBOX_ERROR("PatchMathOps::grad():\n"
3037 << " src1 == src2 but beta is nonzero." << std::endl);
3038 }
3039
3040 const Box<NDIM>& U_box = src1->getGhostBox();
3041 const Box<NDIM> U_box_shrunk = Box<NDIM>::grow(U_box, -1);
3042
3043 if ((!U_box_shrunk.contains(patch_box.lower())) || (!U_box_shrunk.contains(patch_box.upper())))
3044 {

Callers 15

applyMethod · 0.45
applyProjectionMethod · 0.45
setupSolverVectorsMethod · 0.45
regridProjectionMethod · 0.45
regridProjectionMethod · 0.45
computeResidualMethod · 0.45
applyMethod · 0.45

Calls 2

getDepthMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected