-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ghost interface #1278
base: main
Are you sure you want to change the base?
Ghost interface #1278
Conversation
src/t8_forest/t8_forest_general.h
Outdated
T8_GHOST_FACES, /**< Consider all face (codimension 1) neighbors. */ | ||
T8_GHOST_EDGES, /**< Consider all edge (codimension 2) and face neighbors. */ | ||
T8_GHOST_VERTICES, /**< Consider all vertex (codimension 3) and edge and face neighbors. */ | ||
T8_GHOST_USERDEFINED /** If the user define by his self a step_1 or step_2 function*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T8_GHOST_USERDEFINED /** If the user define by his self a step_1 or step_2 function*/ | |
T8_GHOST_USER_DEFINED /** If the user define by his self a step_1 or step_2 function*/ |
src/t8_forest/t8_forest.cxx
Outdated
forest->ghost_type = ghost_type; | ||
forest->ghost_algorithm = ghost_version; | ||
t8_forest_ghost_definition_c *ghost_definition = t8_forest_ghost_definition_face_new (ghost_version); | ||
t8_forest_set_ghost_ext_new (forest, do_ghost, ghost_definition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ext_new
is not a good function name, can we just overwrite the t8_forest_set_ghost_ext
function instead?
src/t8_forest/t8_forest_ghost.cxx
Outdated
const t8_gloidx_t global_num_elements = t8_forest_get_global_num_elements (forest); | ||
const t8_linearidx_t lin_id | ||
= eclass_scheme->t8_element_get_linear_id (element, eclass_scheme->t8_element_level (element)); | ||
|
||
const t8_linearidx_t b_0 = global_num_elements / forest->mpisize; | ||
const t8_linearidx_t r = global_num_elements % forest->mpisize; | ||
|
||
const int p_guess = lin_id / b_0; | ||
if (p_guess < 2 || r == 0) { | ||
return p_guess; | ||
} | ||
const int x = (p_guess * r) / forest->mpisize; | ||
|
||
const int owner = (lin_id - x) / b_0; | ||
|
||
return owner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments would be nice
/** | ||
* Satisfy the C interface of forest | ||
* Create a new ghost_definition of type face with given version | ||
*/ | ||
t8_forest_ghost_definition_c * | ||
t8_forest_ghost_definition_face_new (const int version); | ||
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Create a new ghost_definition of type stencil | ||
*/ | ||
t8_forest_ghost_definition_c * | ||
t8_forest_ghost_definition_stencil_new (); | ||
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Return for a ghost_definition of Type FACE the ghost_algorithm / ghost_version (1, 2 or 3) | ||
* \param [in] ghost_definition Pointer to object of class t8_forest_ghost_face | ||
*/ | ||
int | ||
t8_forest_ghost_definition_face_version (t8_forest_ghost_definition_c *ghost_definition); | ||
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Return the type of a ghost_definition | ||
* \param [in] ghost_definition Pointer to object of class t8_forest_ghost_definition or a derivet class | ||
*/ | ||
t8_ghost_type_t | ||
t8_forest_ghost_definition_get_type (const t8_forest_ghost_definition_c *ghost_definition); | ||
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Do a ref on the ghost_definition | ||
* Needed in t8_forest_commit | ||
*/ | ||
void | ||
t8_forest_ghost_definition_ref (t8_forest_ghost_definition_c *ghost_definition); | ||
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Do a unref on the ghost_definition | ||
* Needed in t8_forest_commit and t8_forest_set_ghost_ext_new | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please user proper docstrings
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Co-authored-by: Sandro Elsweijer <[email protected]>
Describe your changes here:
Design and implementation of the feature Ghost Interface.
Creating a class design for a Ghost interface with abstract base class and derived classes for specific ghost-types (Definitions of neighborhoods).
The type of ghost-algorithm (befor only face-neighborhoods supported), was stored in the forest struct until yet.
Now the forest struct stores a pointer to a Ghost-Interface class.
Not finished yet
All these boxes must be checked by the reviewers before merging the pull request:
As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.
General
The reviewer executed the new code features at least once and checked the results manually
The code follows the t8code coding guidelines
New source/header files are properly added to the Makefiles
The code is well documented
All function declarations, structs/classes and their members have a proper doxygen documentation
All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue)
Tests
Github action
The code compiles without warning in debugging and release mode, with and without MPI (this should be executed automatically in a github action)
All tests pass (in various configurations, this should be executed automatically in a github action)
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scp
to check the indentation of these files.License
doc/
(or already has one)