#include "walkingsearch.h"#include "Metric.h"#include "logging.h"#include <petsc.h>#include <stdbool.h>#include <math.h>Go to the source code of this file.
Macros | |
| #define | MAX_TRAVERSAL 1000 |
| #define | DISTANCE_THRESHOLD 1e-11 |
| #define | REPEAT_COUNT_THRESHOLD 5 |
| #define | BLOCKED_WALK_GUARD_CELLS 3.0 |
| #define | REFLECTION_CAP 4 |
| #define | PICURV_NODE(i, j, k) coor[(((k) - gzs) * gym + ((j) - gys)) * gxm + ((i) - gxs)] |
Functions | |
| PetscErrorCode | GetCellCharacteristicSize (const Cell *cell, PetscReal *cellSize) |
| Implementation of GetCellCharacteristicSize(). | |
| static PetscReal | FacePlaneDistance (const FacePlane *plane, const Cmpnts p, const PetscReal threshold) |
Signed distance from p to a face plane, positive on the cell side, zeroed below threshold. | |
| PetscErrorCode | CalculateDistancesToCellFacePlanes (const Cmpnts p, const CellFacePlanes *planes, PetscReal *d, const PetscReal threshold, Cmpnts *normals) |
| Implementation of CalculateDistancesToCellFacePlanes(). | |
| PetscErrorCode | CalculateDistancesToCellFaces (const Cmpnts p, const Cell *cell, PetscReal *d, const PetscReal threshold, Cmpnts *normals) |
| Implementation of CalculateDistancesToCellFaces(). | |
| PetscErrorCode | DeterminePointPosition (PetscReal *d, PetscInt *result) |
| Implementation of DeterminePointPosition(). | |
| PetscErrorCode | InitializeTraversalParameters (UserCtx *user, Particle *particle, PetscInt *idx, PetscInt *idy, PetscInt *idz, PetscInt *traversal_steps) |
| Implementation of InitializeTraversalParameters(). | |
| PetscErrorCode | CheckCellWithinLocalGrid (UserCtx *user, PetscInt idx, PetscInt idy, PetscInt idz, PetscBool *is_within) |
| Implementation of CheckCellWithinLocalGrid(). | |
| PetscErrorCode | RetrieveCurrentCell (UserCtx *user, PetscInt idx, PetscInt idy, PetscInt idz, Cell *cell) |
| Implementation of RetrieveCurrentCell(). | |
| PetscErrorCode | EvaluateParticlePositionInPlanes (const CellFacePlanes *planes, PetscReal *d, const Cmpnts p, PetscInt *position, const PetscReal threshold) |
| Implementation of EvaluateParticlePositionInPlanes(). | |
| PetscErrorCode | UpdateCellIndicesBasedOnDistances (PetscReal d[NUM_FACES], PetscInt *idx, PetscInt *idy, PetscInt *idz) |
| Implementation of UpdateCellIndicesBasedOnDistances(). | |
| PetscErrorCode | FindOwnerOfCell (UserCtx *user, PetscInt i, PetscInt j, PetscInt k, PetscMPIInt *owner_rank) |
| Implementation of FindOwnerOfCell(). | |
| PetscErrorCode | ReflectParticleAcrossCellFace (const CellFacePlanes *planes, PetscInt face, Cmpnts *p) |
| Implementation of ReflectParticleAcrossCellFace(). | |
| PetscErrorCode | PlaceParticleInsideCell (const Cell *cell, Cmpnts *p, PetscBool *placed) |
| Implementation of PlaceParticleInsideCell(). | |
| static void | ResetStuckDetection (PetscInt *repeated, PetscInt *prev_i, PetscInt *prev_j, PetscInt *prev_k) |
| Forget the cell the stuck-walk detector compared against, after the particle moved without the walk stepping (a wrap, a reflection or the reflection fallback). | |
| PetscErrorCode | LocateParticleOrFindMigrationTarget (UserCtx *user, const FacePlaneArrays *planes, Particle *particle, ParticleLocationStatus *status_out) |
| Implementation of LocateParticleOrFindMigrationTarget(). | |
Variables | |
| static const BCFace | kCellFaceDomainFace [NUM_FACES] |
| #define MAX_TRAVERSAL 1000 |
Definition at line 11 of file walkingsearch.c.
| #define DISTANCE_THRESHOLD 1e-11 |
Definition at line 12 of file walkingsearch.c.
| #define REPEAT_COUNT_THRESHOLD 5 |
Definition at line 13 of file walkingsearch.c.
| #define BLOCKED_WALK_GUARD_CELLS 3.0 |
Definition at line 16 of file walkingsearch.c.
| #define REFLECTION_CAP 4 |
Definition at line 18 of file walkingsearch.c.
| #define PICURV_NODE | ( | i, | |
| j, | |||
| k | |||
| ) | coor[(((k) - gzs) * gym + ((j) - gys)) * gxm + ((i) - gxs)] |
| PetscErrorCode GetCellCharacteristicSize | ( | const Cell * | cell, |
| PetscReal * | cellSize | ||
| ) |
Implementation of GetCellCharacteristicSize().
Estimates a characteristic length of the cell for threshold scaling.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 30 of file walkingsearch.c.
|
inlinestatic |
Signed distance from p to a face plane, positive on the cell side, zeroed below threshold.
Definition at line 73 of file walkingsearch.c.
| PetscErrorCode CalculateDistancesToCellFacePlanes | ( | const Cmpnts | p, |
| const CellFacePlanes * | planes, | ||
| PetscReal * | d, | ||
| const PetscReal | threshold, | ||
| Cmpnts * | normals | ||
| ) |
Implementation of CalculateDistancesToCellFacePlanes().
Signed distances from a point to precomputed cell face planes.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 88 of file walkingsearch.c.
| PetscErrorCode CalculateDistancesToCellFaces | ( | const Cmpnts | p, |
| const Cell * | cell, | ||
| PetscReal * | d, | ||
| const PetscReal | threshold, | ||
| Cmpnts * | normals | ||
| ) |
Implementation of CalculateDistancesToCellFaces().
Computes the signed distances from a point to each face of a cubic cell.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 113 of file walkingsearch.c.
| PetscErrorCode DeterminePointPosition | ( | PetscReal * | d, |
| PetscInt * | result | ||
| ) |
Implementation of DeterminePointPosition().
Classifies a point based on precomputed face distances.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 154 of file walkingsearch.c.
| PetscErrorCode InitializeTraversalParameters | ( | UserCtx * | user, |
| Particle * | particle, | ||
| PetscInt * | idx, | ||
| PetscInt * | idy, | ||
| PetscInt * | idz, | ||
| PetscInt * | traversal_steps | ||
| ) |
Implementation of InitializeTraversalParameters().
Initializes traversal parameters for locating a particle.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 214 of file walkingsearch.c.
| PetscErrorCode CheckCellWithinLocalGrid | ( | UserCtx * | user, |
| PetscInt | idx, | ||
| PetscInt | idy, | ||
| PetscInt | idz, | ||
| PetscBool * | is_within | ||
| ) |
Implementation of CheckCellWithinLocalGrid().
Checks if the current cell indices are within the local grid boundaries.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 346 of file walkingsearch.c.
| PetscErrorCode RetrieveCurrentCell | ( | UserCtx * | user, |
| PetscInt | idx, | ||
| PetscInt | idy, | ||
| PetscInt | idz, | ||
| Cell * | cell | ||
| ) |
Implementation of RetrieveCurrentCell().
Retrieves the coordinates of the eight vertices of the current cell.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 404 of file walkingsearch.c.
| PetscErrorCode EvaluateParticlePositionInPlanes | ( | const CellFacePlanes * | planes, |
| PetscReal * | d, | ||
| const Cmpnts | p, | ||
| PetscInt * | position, | ||
| const PetscReal | threshold | ||
| ) |
Implementation of EvaluateParticlePositionInPlanes().
Classifies a point against a cell's precomputed face planes.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 453 of file walkingsearch.c.
| PetscErrorCode UpdateCellIndicesBasedOnDistances | ( | PetscReal | d[NUM_FACES], |
| PetscInt * | idx, | ||
| PetscInt * | idy, | ||
| PetscInt * | idz | ||
| ) |
Implementation of UpdateCellIndicesBasedOnDistances().
Updates the cell indices based on the signed distances to each face.
Definition at line 472 of file walkingsearch.c.
| PetscErrorCode FindOwnerOfCell | ( | UserCtx * | user, |
| PetscInt | i, | ||
| PetscInt | j, | ||
| PetscInt | k, | ||
| PetscMPIInt * | owner_rank | ||
| ) |
Implementation of FindOwnerOfCell().
Finds the MPI rank that owns a given global cell index.
Definition at line 538 of file walkingsearch.c.
| PetscErrorCode ReflectParticleAcrossCellFace | ( | const CellFacePlanes * | planes, |
| PetscInt | face, | ||
| Cmpnts * | p | ||
| ) |
Implementation of ReflectParticleAcrossCellFace().
Mirrors a point about the plane of one face of a cell.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 589 of file walkingsearch.c.
Implementation of PlaceParticleInsideCell().
Moves a point to just inside a cell along the segment toward the cell centroid.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 617 of file walkingsearch.c.
|
inlinestatic |
Forget the cell the stuck-walk detector compared against, after the particle moved without the walk stepping (a wrap, a reflection or the reflection fallback).
Definition at line 663 of file walkingsearch.c.
| PetscErrorCode LocateParticleOrFindMigrationTarget | ( | UserCtx * | user, |
| const FacePlaneArrays * | planes, | ||
| Particle * | particle, | ||
| ParticleLocationStatus * | status_out | ||
| ) |
Implementation of LocateParticleOrFindMigrationTarget().
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/walkingsearch.h.
Definition at line 675 of file walkingsearch.c.
Definition at line 21 of file walkingsearch.c.