From: Wolfgang Bangerth Date: Tue, 28 Dec 2021 05:07:04 +0000 (-0700) Subject: Add a bunch of dummy functions for TriaAccessor<0,1,spacedim>. X-Git-Tag: v9.4.0-rc1~691^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa3fadc0512389e5447747f554c0eeaa30e7549c;p=dealii.git Add a bunch of dummy functions for TriaAccessor<0,1,spacedim>. --- diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index 8e5641cbbc..a095c8f36b 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -2570,12 +2570,207 @@ public: * Return the manifold indicator of this object. * * @see - * @ref GlossManifoldIndicator "Glossary entry on manifold indicators" + * @ref GlossManifoldIndicator "Glossary entry on manifold indicators". */ types::manifold_id manifold_id() const; + /** + * @name User data + */ + /** + * @{ + */ + /** + * Read the user flag. See + * @ref GlossUserFlags + * for more information. + */ + bool + user_flag_set() const; + + /** + * Set the user flag. See + * @ref GlossUserFlags + * for more information. + */ + void + set_user_flag() const; + + /** + * Clear the user flag. See + * @ref GlossUserFlags + * for more information. + */ + void + clear_user_flag() const; + + /** + * Set the user flag for this and all descendants. See + * @ref GlossUserFlags + * for more information. + */ + void + recursively_set_user_flag() const; + + /** + * Clear the user flag for this and all descendants. See + * @ref GlossUserFlags + * for more information. + */ + void + recursively_clear_user_flag() const; + + /** + * Reset the user data to zero, independent if pointer or index. See + * @ref GlossUserData + * for more information. + */ + void + clear_user_data() const; + + /** + * Set the user pointer to @p p. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. + * + * See + * @ref GlossUserData + * for more information. + */ + void + set_user_pointer(void *p) const; + + /** + * Reset the user pointer to a @p nullptr pointer. See + * @ref GlossUserData + * for more information. + */ + void + clear_user_pointer() const; + + /** + * Access the value of the user pointer. It is in the responsibility of the + * user to make sure that the pointer points to something useful. You should + * use the new style cast operator to maintain a minimum of type safety, + * e.g. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. A + * *a=static_cast(cell->user_pointer());. + * + * See + * @ref GlossUserData + * for more information. + */ + void * + user_pointer() const; + + /** + * Set the user pointer of this object and all its children to the given + * value. This is useful for example if all cells of a certain subdomain, or + * all faces of a certain part of the boundary should have user pointers + * pointing to objects describing this part of the domain or boundary. + * + * Note that the user pointer is not inherited under mesh refinement, so + * after mesh refinement there might be cells or faces that don't have user + * pointers pointing to the describing object. In this case, simply loop + * over all the elements of the coarsest level that has this information, + * and use this function to recursively set the user pointer of all finer + * levels of the triangulation. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. + * + * See + * @ref GlossUserData + * for more information. + */ + void + recursively_set_user_pointer(void *p) const; + + /** + * Clear the user pointer of this object and all of its descendants. The + * same holds as said for the recursively_set_user_pointer() function. See + * @ref GlossUserData + * for more information. + */ + void + recursively_clear_user_pointer() const; + + /** + * Set the user index to @p p. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. See + * @ref GlossUserData + * for more information. + */ + void + set_user_index(const unsigned int p) const; + + /** + * Reset the user index to 0. See + * @ref GlossUserData + * for more information. + */ + void + clear_user_index() const; + + /** + * Access the value of the user index. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. + * + * See + * @ref GlossUserData + * for more information. + */ + unsigned int + user_index() const; + + /** + * Set the user index of this object and all its children. + * + * Note that the user index is not inherited under mesh refinement, so after + * mesh refinement there might be cells or faces that don't have the + * expected user indices. In this case, simply loop over all the elements of + * the coarsest level that has this information, and use this function to + * recursively set the user index of all finer levels of the triangulation. + * + * @note User pointers and user indices are mutually exclusive. Therefore, + * you can only use one of them, unless you call + * Triangulation::clear_user_data() in between. + * + * See + * @ref GlossUserData + * for more information. + */ + void + recursively_set_user_index(const unsigned int p) const; + + /** + * Clear the user index of this object and all of its descendants. The same + * holds as said for the recursively_set_user_index() function. + * + * See + * @ref GlossUserData + * for more information. + */ + void + recursively_clear_user_index() const; + /** + * @} + */ + /** * @name Orientation of sub-objects */ diff --git a/source/grid/tria_accessor.cc b/source/grid/tria_accessor.cc index a9a8655462..823105c8e9 100644 --- a/source/grid/tria_accessor.cc +++ b/source/grid/tria_accessor.cc @@ -1798,6 +1798,190 @@ TriaAccessor::center( } +/*---------------- Functions: TriaAccessor<0,1,spacedim> -------------------*/ + + +template +bool +TriaAccessor<0, 1, spacedim>::user_flag_set() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); + return true; +} + + + +template +void +TriaAccessor<0, 1, spacedim>::set_user_flag() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::clear_user_flag() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_set_user_flag() const +{ + set_user_flag(); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_set_user_flag(); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_clear_user_flag() const +{ + clear_user_flag(); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_clear_user_flag(); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::clear_user_data() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::set_user_pointer(void *) const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::clear_user_pointer() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void * +TriaAccessor<0, 1, spacedim>::user_pointer() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); + return nullptr; +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_set_user_pointer(void *p) const +{ + set_user_pointer(p); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_set_user_pointer(p); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_clear_user_pointer() const +{ + clear_user_pointer(); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_clear_user_pointer(); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::set_user_index(const unsigned int) const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::clear_user_index() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); +} + + + +template +unsigned int +TriaAccessor<0, 1, spacedim>::user_index() const +{ + Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert(false, ExcNotImplemented()); + return 0; +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_set_user_index(unsigned int p) const +{ + set_user_index(p); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_set_user_index(p); +} + + + +template +void +TriaAccessor<0, 1, spacedim>::recursively_clear_user_index() const +{ + clear_user_index(); + + if (this->has_children()) + for (unsigned int c = 0; c < this->n_children(); ++c) + this->child(c)->recursively_clear_user_index(); +} + + + /*------------------------ Functions: CellAccessor<1> -----------------------*/