Skip to content

Commit

Permalink
Merge develop into feature-ci-io-test-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-griesbach committed Feb 7, 2025
2 parents 691f888 + 5024034 commit 8546e09
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 67 deletions.
2 changes: 1 addition & 1 deletion doc/coding_standards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ library tries to adhere to.
relative/path/to/configure --enable-mpi --enable-debug CC=mpicxx \
CFLAGS="-Wall -Wextra -Wno-unused-parameter -O0 -g"

and run `make -j V=0`. Modify accordingly for production builds.
and run `make -j`. Modify accordingly for production builds.

## Boolean variables

Expand Down
12 changes: 6 additions & 6 deletions doc/doxygen/installation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
*
* \subsubsection complile_software 4. Compile the software
*
* > `make -j V=0`
* > `make -j`
*
* The environment variable `V=0` suppresses most of `make`'s console output.
* Adding the environment variable `V=1` would re-enable much `make` output.
*
* \subsubsection install_software 5. Install the software (optional)
*
* > `make install V=0`
* > `make install`
*
* The software is installed by default into the prefix `./local`.
* This can be changed by setting `configure --prefix=<PATH>`.
Expand Down Expand Up @@ -148,16 +148,16 @@
*
* After configuration, the next step is the compilation of \c p4est:
*
* > `make -j V=0`
* > `make -j`
*
* > `make install -j V=0`
* > `make install -j`
*
* \subsubsection verification 5. Verification Step
*
* It's recommended to execute the \c p4est test programs post-installation
* to ensure everything is in order:
*
* > `make -j4 check V=0`
* > `make -j4 check`
*
* Where the `-j` option limits parallel make to at most four targets at the same time.
*
Expand Down
2 changes: 1 addition & 1 deletion doc/p4est-build-wdeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd p4est && \
mkdir build && \
cd build && \
../configure $CONFIG --with-sc="$PREFIX/libsc" --prefix="$PREFIX/p4est" && \
make -j install V=0 && \
make -j install && \
cd ../../ && \
rm -rf p4est/.git && \
rm -r p4est || bdie "p4est"
10 changes: 5 additions & 5 deletions doc/webpage/tutorial-build.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ <h3>Configure, make, install</h3>
in your own programs. Omit the debug option only if you really must have the
fastest running code.
</li>
<li>Call <code>make -j8 V=0</code> to build the software.
<li>Call <code>make -j8</code> to build the software.
The <code>-j</code> switch allows for parallel make processes, speeding up the
build noticeably, and <code>V=0</code> disables echoing the compile command
lines.</li>
<li>If you're curious, call <code>make -j2 check V=0</code>.
build noticeably, and <code>V=1</code> would enable echoing the compile
command lines for added information.</li>
<li>If you're curious, call <code>make -j2 check</code>.
This will compile and execute our complimentary test programs.</li>
<li>If you have specified an installation prefix, you can run
<code>make -j10 install V=0</code>.
<code>make -j10 install</code>.
This call will neatly arrange all exported header files, library files,
example binaries, some configuration files and documentation in mostly
standard-conforming directories.</li>
Expand Down
146 changes: 130 additions & 16 deletions src/p4est_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,13 @@ p4est_quadrant_child_id (const p4est_quadrant_t * q)
int
p4est_coordinates_is_inside_root (const p4est_qcoord_t coord[])
{
P4EST_ASSERT (coord != NULL);

/* *INDENT-OFF* */
return (coord[0] >= 0 && coord[0] < P4EST_ROOT_LEN) &&
(coord[1] >= 0 && coord[1] < P4EST_ROOT_LEN) &&
return (coord[0] >= 0 && coord[0] <= P4EST_ROOT_LEN) &&
(coord[1] >= 0 && coord[1] <= P4EST_ROOT_LEN) &&
#ifdef P4_TO_P8
(coord[2] >= 0 && coord[2] < P4EST_ROOT_LEN) &&
(coord[2] >= 0 && coord[2] <= P4EST_ROOT_LEN) &&
#endif
/* *INDENT-ON* */
1;
Expand All @@ -672,15 +674,16 @@ p4est_coordinates_is_inside_root (const p4est_qcoord_t coord[])
int
p4est_quadrant_is_inside_root (const p4est_quadrant_t * q)
{
p4est_qcoord_t coord[P4EST_DIM];
P4EST_ASSERT (q != NULL);

coord[0] = q->x;
coord[1] = q->y;
/* *INDENT-OFF* */
return (q->x >= 0 && q->x < P4EST_ROOT_LEN) &&
(q->y >= 0 && q->y < P4EST_ROOT_LEN) &&
#ifdef P4_TO_P8
coord[2] = q->z;
(q->z >= 0 && q->z < P4EST_ROOT_LEN) &&
#endif

return p4est_coordinates_is_inside_root (coord);
/* *INDENT-ON* */
1;
}

int
Expand Down Expand Up @@ -752,8 +755,10 @@ p4est_quadrant_is_node (const p4est_quadrant_t * q, int inside)
int
p4est_coordinates_is_valid (const p4est_qcoord_t coord[], int level)
{
P4EST_ASSERT (coord != NULL);

return
(level >= 0 && level <= P4EST_QMAXLEVEL) &&
(level >= 0 && level <= P4EST_MAXLEVEL) &&
((coord[0] & (P4EST_QUADRANT_LEN (level) - 1)) == 0) &&
((coord[1] & (P4EST_QUADRANT_LEN (level) - 1)) == 0) &&
#ifdef P4_TO_P8
Expand All @@ -765,15 +770,16 @@ p4est_coordinates_is_valid (const p4est_qcoord_t coord[], int level)
int
p4est_quadrant_is_valid (const p4est_quadrant_t * q)
{
p4est_qcoord_t coord[P4EST_DIM];
P4EST_ASSERT (q != NULL);

coord[0] = q->x;
coord[1] = q->y;
return
(q->level >= 0 && q->level <= P4EST_QMAXLEVEL) &&
((q->x & (P4EST_QUADRANT_LEN (q->level) - 1)) == 0) &&
((q->y & (P4EST_QUADRANT_LEN (q->level) - 1)) == 0) &&
#ifdef P4_TO_P8
coord[2] = q->z;
((q->z & (P4EST_QUADRANT_LEN (q->level) - 1)) == 0) &&
#endif

return p4est_coordinates_is_valid (coord, q->level);
p4est_quadrant_is_inside_root (q);
}

int
Expand Down Expand Up @@ -1215,6 +1221,21 @@ p4est_quadrant_enlarge_last (const p4est_quadrant_t * a, p4est_quadrant_t * q)
#endif
}

void
p4est_quadrant_root (p4est_quadrant_t *root)
{
P4EST_ASSERT (root != NULL);

root->x = 0;
root->y = 0;
#ifdef P4_TO_P8
root->z = 0;
#endif
root->level = 0;

P4EST_ASSERT (p4est_quadrant_is_valid (root));
}

void
p4est_quadrant_ancestor (const p4est_quadrant_t * q,
int level, p4est_quadrant_t * r)
Expand Down Expand Up @@ -1289,6 +1310,25 @@ p4est_quadrant_child (const p4est_quadrant_t * q, p4est_quadrant_t * r,
P4EST_ASSERT (p4est_quadrant_is_parent (q, r));
}

void
p4est_quadrant_volume_coordinates (const p4est_quadrant_t * q,
p4est_qcoord_t coords[])
{
/* compute half length of qudrant: legal even when at P4EST_QMAXLEVEL */
const p4est_qcoord_t qhh = P4EST_QUADRANT_LEN (q->level + 1);

/* we require a quadrant in the unit tree, not outside of it */
P4EST_ASSERT (p4est_quadrant_is_valid (q));

/* for any coordinate axis shift by half the quadrant length */
coords[0] = q->x + qhh;
coords[1] = q->y + qhh;
#ifdef P4_TO_P8
coords[2] = q->z + qhh;
#endif
P4EST_ASSERT (p4est_coordinates_is_valid (coords, q->level + 1));
}

void
p4est_quadrant_face_neighbor (const p4est_quadrant_t * q,
int face, p4est_quadrant_t * r)
Expand Down Expand Up @@ -1447,6 +1487,31 @@ p4est_quadrant_all_face_neighbors (const p4est_quadrant_t * q,
}
}

void
p4est_quadrant_face_coordinates (const p4est_quadrant_t * q, int face,
p4est_qcoord_t coords[])
{
/* compute half length of qudrant: legal even when at P4EST_QMAXLEVEL */
const p4est_qcoord_t qh = P4EST_QUADRANT_LEN (q->level);
const p4est_qcoord_t qhh = qh >> 1;

/* store the coordinate axis normal to the face */
const int faceh = face >> 1;

P4EST_ASSERT (0 <= face && face < P4EST_FACES);
P4EST_ASSERT (0 <= faceh && faceh < P4EST_DIM);
P4EST_ASSERT (p4est_quadrant_is_valid (q));

/* for the coordinate axis normal to the face, choose shift of 0 or qh */
/* for a coordinate axis parallel to the face, shift by half */
coords[0] = q->x + ((faceh == 0) ? ((face & 1) ? qh : 0) : qhh);
coords[1] = q->y + ((faceh == 1) ? ((face & 1) ? qh : 0) : qhh);
#ifdef P4_TO_P8
coords[2] = q->z + ((faceh == 2) ? ((face & 1) ? qh : 0) : qhh);
#endif
P4EST_ASSERT (p4est_coordinates_is_valid (coords, q->level + 1));
}

void
p4est_quadrant_corner_neighbor (const p4est_quadrant_t * q,
int corner, p4est_quadrant_t * r)
Expand Down Expand Up @@ -1664,6 +1729,23 @@ p4est_quadrant_corner_node (const p4est_quadrant_t * q,
P4EST_ASSERT (p4est_quadrant_is_node (r, 0));
}

void
p4est_quadrant_corner_coordinates (const p4est_quadrant_t * q, int corner,
p4est_qcoord_t coords[])
{
const p4est_qcoord_t qh = P4EST_QUADRANT_LEN (q->level);

P4EST_ASSERT (0 <= corner && corner < P4EST_CHILDREN);
P4EST_ASSERT (p4est_quadrant_is_valid (q));

coords[0] = q->x + ((corner & 1) ? qh : 0);
coords[1] = q->y + ((corner & 2) ? qh : 0);
#ifdef P4_TO_P8
coords[2] = q->z + ((corner & 4) ? qh : 0);
#endif
P4EST_ASSERT (p4est_coordinates_is_valid (coords, q->level));
}

void
p4est_quadrant_children (const p4est_quadrant_t * q,
p4est_quadrant_t * c0, p4est_quadrant_t * c1,
Expand Down Expand Up @@ -2123,6 +2205,38 @@ p4est_quadrant_touches_corner (const p4est_quadrant_t * q,
return incount == P4EST_DIM;
}

void
p4est_coordinates_transform_corner (p4est_qcoord_t coords[], int corner)
{
p4est_qcoord_t shift[2];
#ifdef P4EST_ENABLE_DEBUG
p4est_qcoord_t rcoords[P4EST_DIM];
p4est_quadrant_t root;
#endif

P4EST_ASSERT (coords != NULL);
P4EST_ASSERT (0 <= corner && corner < P4EST_CHILDREN);

shift[0] = 0;
shift[1] = P4EST_ROOT_LEN;

coords[0] = shift[corner & 1];
coords[1] = shift[(corner >> 1) & 1];
#ifdef P4_TO_P8
coords[2] = shift[corner >> 2];
#endif

#ifdef P4EST_ENABLE_DEBUG
p4est_quadrant_root (&root);
p4est_quadrant_corner_coordinates (&root, corner, rcoords);
P4EST_ASSERT (rcoords[0] == coords[0]);
P4EST_ASSERT (rcoords[1] == coords[1]);
#ifdef P4_TO_P8
P4EST_ASSERT (rcoords[2] == coords[2]);
#endif
#endif
}

void
p4est_quadrant_transform_corner (p4est_quadrant_t * q, int corner, int inside)
{
Expand Down
Loading

0 comments on commit 8546e09

Please sign in to comment.