Skip to content

Commit

Permalink
Feature more3d: adapt headers to new patch_transform_corner(2)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbrandt committed Jul 26, 2023
1 parent d1e21e1 commit 5710a11
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
12 changes: 8 additions & 4 deletions src/forestclaw2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,17 @@ int fclaw2d_patch_corner_neighbors (fclaw2d_domain_t * domain,
void fclaw2d_patch_corner_swap (int *cornerno, int *rcornerno);

/** Transform a patch coordinate into a neighbor patch's coordinate system.
* This function assumes that the two patches are of the SAME size.
* This function assumes that the two patches are of the SAME size and that the
* patches lie in coordinate systems with the same orientation.
* It is LEGAL to call this function for both local and ghost patches.
* \param [in] ipatch The patch that the input coordinates are relative to.
* \param [in] opatch The patch that the output coordinates are relative to.
* \param [in] icorner Corner number of this patch to transform across.
* This function assumes ocorner == icorner ^ 3, so
* ocorner is the opposite corner of icorner.
* \param [in] is_block_boundary Set to true for a block corner.
* \param [in] mx Number of cells along x direction of patch.
* \param [in] my Number of cells along y direction of patch.
* This function assumes \a mx == \a my.
* \param [in] based Indices are 0-based for corners and 1-based for cells.
* \param [in,out] i Integer coordinate along x-axis in \a based .. \a mx.
* \param [in,out] j Integer coordinate along y-axis in \a based .. \a my.
Expand All @@ -608,15 +610,17 @@ void fclaw2d_patch_transform_corner (fclaw2d_patch_t * ipatch,
int based, int *i, int *j);

/** Transform a patch coordinate into a neighbor patch's coordinate system.
* This function assumes that the neighbor patch is smaller (HALF size).
* This function assumes that the neighbor patch is smaller (HALF size) and that
* the patches lie in coordinate systems with the same orientation.
* It is LEGAL to call this function for both local and ghost patches.
* \param [in] ipatch The patch that the input coordinates are relative to.
* \param [in] opatch The patch that the output coordinates are relative to.
* \param [in] icorner Corner number of this patch to transform across.
* This function assumes ocorner == icorner ^ 3, so
* ocorner is the opposite corner of icorner.
* \param [in] is_block_boundary Set to true for a block corner.
* \param [in] mx Number of cells along x direction of patch.
* \param [in] my Number of cells along y direction of patch.
* This function assumes \a mx == \a my.
* \param [in] based Indices are 0-based for corners and 1-based for cells.
* \param [in,out] i FOUR (4) integer coordinates along x-axis in
* \a based .. \a mx. On input, only the first is used.
Expand Down
14 changes: 8 additions & 6 deletions src/forestclaw3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,18 @@ int fclaw3d_patch_corner_neighbors (fclaw3d_domain_t * domain,
void fclaw3d_patch_corner_swap (int *cornerno, int *rcornerno);

/** Transform a patch coordinate into a neighbor patch's coordinate system.
* This function assumes that the two patches are of the SAME size.
* This function assumes that the two patches are of the SAME size and that the
* patches lie in coordinate systems with the same orientation.
* It is LEGAL to call this function for both local and ghost patches.
* \param [in] ipatch The patch that the input coordinates are relative to.
* \param [in] opatch The patch that the output coordinates are relative to.
* \param [in] icorner Corner number of this patch to transform across.
* This function assumes ocorner == icorner ^ 7, so
* ocorner is the opposite corner of icorner.
* \param [in] is_block_boundary Set to true for a block corner.
* \param [in] mx Number of cells along x direction of patch.
* \param [in] my Number of cells along y direction of patch.
* This function assumes \a mx == \a my.
* \param [in] mz Number of cells along z direction of patch.
* This function assumes \a mx == \a mz.
* \param [in] based Indices are 0-based for corners and 1-based for cells.
* \param [in,out] i Integer coordinate along x-axis in \a based .. \a mx.
* \param [in,out] j Integer coordinate along y-axis in \a based .. \a my.
Expand All @@ -663,17 +664,18 @@ void fclaw3d_patch_transform_corner (fclaw3d_patch_t * ipatch,
int based, int *i, int *j, int *k);

/** Transform a patch coordinate into a neighbor patch's coordinate system.
* This function assumes that the neighbor patch is smaller (HALF size).
* This function assumes that the neighbor patch is smaller (HALF size) and that
* the patches lie in coordinate systems with the same orientation.
* It is LEGAL to call this function for both local and ghost patches.
* \param [in] ipatch The patch that the input coordinates are relative to.
* \param [in] opatch The patch that the output coordinates are relative to.
* \param [in] icorner Corner number of this patch to transform across.
* This function assumes ocorner == icorner ^ 7, so
* ocorner is the opposite corner of icorner.
* \param [in] is_block_boundary Set to true for a block corner.
* \param [in] mx Number of cells along x direction of patch.
* \param [in] my Number of cells along y direction of patch.
* This function assumes \a mx == \a my.
* \param [in] mz Number of cells along z direction of patch.
* This function assumes \a mx == \a mz.
* \param [in] based Indices are 0-based for corners and 1-based for cells.
* \param [in,out] i EIGHT (8) integer coordinates along x-axis in
* \a based .. \a mx. On input, only the first is used.
Expand Down
16 changes: 6 additions & 10 deletions src/patches/clawpatch/fclaw2d_clawpatch_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ FCLAW2D_CLAWPATCH_TRANSFORM_FACE_HALF (const int *i1, const int *j1,
}


/* TODO: Extend this for a block-block corner */
void
FCLAW2D_CLAWPATCH_TRANSFORM_CORNER (const int *i1, const int *j1,
int *i2, int *j2,
Expand All @@ -143,20 +142,18 @@ FCLAW2D_CLAWPATCH_TRANSFORM_CORNER (const int *i1, const int *j1,
}
else
{
/* corner within a block */
/* Corner within a block or a block-block corner. For block-block
* corners, we assume both patches lie in coordinate systems with the
* same orientation. */
FCLAW_ASSERT (tdata->block_iface == -1);
fclaw2d_patch_transform_corner (tdata->this_patch,
tdata->neighbor_patch,
tdata->icorner, tdata->is_block_corner,
clawpatch_opt->mx, clawpatch_opt->my,
tdata->based, i2, j2);
}
/* Done. */
/* TODO: We need to permit that it's a block corner. In this case,
* call fclaw2d_patch_transform_corner with is_block_boundary = 1 */
}

/* TODO: Extend this for a block-block corner */
void
FCLAW2D_CLAWPATCH_TRANSFORM_CORNER_HALF (const int *i1, const int *j1,
int *i2, int *j2,
Expand All @@ -180,15 +177,14 @@ FCLAW2D_CLAWPATCH_TRANSFORM_CORNER_HALF (const int *i1, const int *j1,
}
else
{
/* corner within a block */
/* Corner within a block or a block-block corner. For block-block
* corners, we assume both patches lie in coordinate systems with the
* same orientation. */
FCLAW_ASSERT (tdata->block_iface == -1);
fclaw2d_patch_transform_corner2 (tdata->this_patch,
tdata->neighbor_patch,
tdata->icorner, tdata->is_block_corner,
clawpatch_opt->mx, clawpatch_opt->my,
tdata->based, i2, j2);
}
/* Done */
/* TODO: We need to permit that it's a block corner. In this case,
* call fclaw2d_patch_transform_corner2 with is_block_boundary = 1 */
}

0 comments on commit 5710a11

Please sign in to comment.