DLR-AMR / t8code

Parallel algorithms and data structures for tree-based adaptive mesh refinement (AMR) with arbitrary element shapes.

Home Page:https://dlr-amr.github.io/t8code/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clean-up: Proper C/C++ interface for `t8_cmesh_set_join_by_vertices `

jmark opened this issue · comments

The signature of t8_cmesh_set_join_by_vertices is like the following which is not clean and useful for users:

/** Sets the face connectivity information of an un-committed \cmesh based on a list of tree vertices.
 * \param[in,out]   cmesh         Pointer to a t8code cmesh object. If set to NULL this argument is ignored.
 * \param[in]       ntrees        Number of coarse mesh elements resp. trees.
 * \param[in]       vertices      List of per element vertices with dimensions [ntrees,T8_ECLASS_MAX_CORNERS,T8_ECLASS_MAX_DIM].
 * \param[in]       eclasses      List of element classes of length [ntrees].
 * \param[in,out]   connectivity  If connectivity is not NULL the variable is filled with a pointer to an allocated
                                  face connectivity array. The ownership of this
                                  array goes to the caller. This argument is mainly used for debugging and
                                  testing purposes. The dimension of \a connectivity are [ntrees,T8_ECLASS_MAX_FACES,3].
                                  For each element and each face the following is stored:
                                      neighbor_tree_id, neighbor_dual_face_id, orientation
 * \param[in]       do_both_directions Compute the connectivity from both neighboring sides. Takes much longer to compute.
  \warning This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator.
  \note This routine does not detect periodic boundaries.
 */
void
t8_cmesh_set_join_by_vertices (t8_cmesh_t cmesh, const int ntrees, const t8_eclass_t *eclasses, const double *vertices,
                               int **connectivity, const int do_both_directions);

The optiondo_both_directions is for debugging and testing purposes. It is used in the GoogleTests. However, changing this now would mean a breaking release. This routine created a life on its own and creeped into several interfaces/codes already even though it was originally envisaged as an internal helper function. When we switch to proper C++/C interfaces we should clean this up and provide
a proper interface.