-
Notifications
You must be signed in to change notification settings - Fork 53
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.cxx
Outdated
SC_CHECK_ABORT (do_ghost != 0, "do_ghost == 0 in set_ghost_ext_new.\n"); | ||
SC_CHECK_ABORT (ghost_interface != NULL, "invalides ghost interface in set_ghost_ext_new\n"); |
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.
This negates the possibility to deactivate ghost. One could want to call
t8_forest_set_ghost_ext_new (forest, false, NULL)
to deactivate ghost during a specific part of the simulation.
IMHO
T8_ASSERT (!(do_ghost == 1 && ghost_interface == NULL);
would be a better check
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.
I see your point. But a little question, why should we use T8_ASSERT
instead of SC_CHECK_ABORT
?
If someone sets the combination 1 and NULL, this can not work.
In the function t8_forest_set_ghost_ext
we also use SC_CHECK_ABORT
, that was the reason for me to do the same.
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.
I see your point. But a little question, why should we use
T8_ASSERT
instead ofSC_CHECK_ABORT
? If someone sets the combination 1 and NULL, this can not work.In the function
t8_forest_set_ghost_ext
we also useSC_CHECK_ABORT
, that was the reason for me to do the same.
We want to use T8_ASSERT
as often as possible, because it does not affect the performance in release mode. In this case a SC_CHECK_ABORT
is also okay, because this function is not called that often
src/t8_forest/t8_forest_balance.cxx
Outdated
if (forest->set_from->ghosts == NULL) { | ||
forest->set_from->ghost_type = T8_GHOST_FACES; | ||
// forest->set_from->ghost_type = T8_GHOST_FACES; | ||
if (forest->set_from->ghost_interface == NULL) { | ||
forest->set_from->ghost_interface = t8_forest_ghost_interface_face_new (3); | ||
create_ghost_interface = 1; | ||
} | ||
t8_forest_ghost_create_topdown (forest->set_from); | ||
if (create_ghost_interface) { | ||
t8_forest_ghost_interface_unref (&(forest->set_from->ghost_interface)); | ||
forest->set_from->ghost_interface = NULL; | ||
} |
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
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.
step1 and step2 were renamed
t8_forest_ghost_interface_unref (&(forest->ghost_interface)); | ||
} | ||
forest->do_ghost = do_ghost; | ||
forest->ghost_interface = ghost_interface; |
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.
Maybe we can find a more suitable name. Yes, this is an interface, but in this case the class defines what the ghost algorithm actually does. Maybe ghost_strategy
or ghost_recipe
?
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.
Maybe ghost_creator
or ghost_builder
is a good name. Because the class contains all what is necessary to build the ghost layer and the only function, that you can call from outside is do_ghost
.
If we want to take multiple ghost_algorithms on one forest, the forest will save the handler for them and not longer the ghost_interface class.
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.
I see where you are going there, but these names suggest that the class builds another object like the t8_scheme_builder
.
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.
maybe ghost_definition
// t8_ghost_type_t ghost_type; /**< If a ghost layer will be created, the type of neighbors that count as ghost. */ | ||
// int ghost_algorithm; /**< Controls the algorithm used for ghost. 1 = balanced only. 2 = also unbalanced | ||
// 3 = top-down search and unbalanced. */ |
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.
Is this still needed?
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.
No, this is no longer necessary. The ghost_type and the ghost_algorithm are part of the class.
Please also create an author file for your work under |
edd08d5
to
b8c3a67
Compare
src/t8_forest/t8_forest_ghost.cxx
Outdated
#ifdef T8_ENABLE_DEBUG | ||
#endif |
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.
Probably there once was something between this, but it got removed and somebody forgot to remove this
t8_forest_ghost_interface_unref (&(forest->ghost_interface)); | ||
} | ||
forest->do_ghost = do_ghost; | ||
forest->ghost_interface = ghost_interface; |
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.
maybe ghost_definition
|
||
/** | ||
* Satisfy the C interface of forest | ||
* Return for a ghost_interface of Type FACE the ghost_algorithm / ghost_version (1, 2 or 3) |
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.
Yes you can use \note
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)