Skip to content

Conversation

@LenaRadmer
Copy link
Collaborator

@LenaRadmer LenaRadmer commented Jan 14, 2026

Describe your changes here:

Changing t8_cad to t8_cad_handle for a more explicit CAD shape management. The cmesh now owns the CAD handle and uses a reference counter to manage it.
Also, the t8_geom prefix was removed for everything related to CAD shape management for cleanup. The mesh reader and geometry implementations were updated to support this new handle system.

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

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 CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation. Make sure to add a file documentation for each file!
  • 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

  • The code is covered in an existing or new test case using Google Test.
  • The code coverage of the project (reported in the CI) should not decrease. If coverage is decreased, make sure that this is reasonable and acceptable.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@LenaRadmer LenaRadmer marked this pull request as ready for review January 19, 2026 08:11
@LenaRadmer LenaRadmer marked this pull request as draft January 19, 2026 09:12
@LenaRadmer LenaRadmer changed the title Improvement: Rename t8_cad to t8_cad_handle Improvement: Move CAD management to t8_cad_handle with cmesh ownership Jan 19, 2026
@LenaRadmer LenaRadmer marked this pull request as ready for review January 19, 2026 12:19

#include <t8.h>
#include <t8_cad/t8_cad.hxx>
#include <t8_cad_handle/t8_cad_handle.hxx>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The folder should still be called t8_cad. It is the t8code module about cad. t8_cad_handle is just one part of it

{
/* Map the new cad shape. */
t8_cad_handle::map_cad_shape (new_cad_shape);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is probably a way to achieve the same thing with less functions. What we definitely need are:
constructor from file
constructor from shape
destructor
load from file
load from shape

public:
/**
* Constructor of the cad shape.
* Constructor of the cad shape handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Constructor of the cad shape handler.
* Constructor of the cad shape handle.

* \param [in] fileprefix Prefix of a .brep file from which to extract cad geometry.
* \return The loaded cad shape.
*/
static TopoDS_Shape
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A static member function means something different than a static function

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what you probably want to use is private

unref ()
{
if (t8_refcount_unref (&rc)) {
t8_debugf ("Deleting the cad_handler.\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t8_debugf ("Deleting the cad_handler.\n");
t8_debugf ("Deleting the cad_handle.\n");

}

/**
* Decrease the reference count of the cad handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Decrease the reference count of the cad handler.
* Decrease the reference count of the cad handle.

is_surface_closed (int geometry_index, int parameter) const;

/**
* Increase the reference count of the cad handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Increase the reference count of the cad handler.
* Increase the reference count of the cad handle.

t8_cad_handle ();

/**
* Destructor of the cad shape handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Destructor of the cad shape handler.
* Destructor of the cad shape handle.


/**
* Decrease the reference count of the cad handler.
* If the reference count reaches zero, the cad handler is deleted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If the reference count reaches zero, the cad handler is deleted.
* If the reference count reaches zero, the cad handle is deleted.

cad_shape_vertex2edge_map; /**< Maps all TopoDS_Vertex of shape to all its connected TopoDS_Edge */
TopTools_IndexedDataMapOfShapeListOfShape
cad_shape_edge2face_map; /**< Maps all TopoDS_Edge of shape to all its connected TopoDS_Face */
/** The reference count of the cad handler. TODO: Replace by shared_ptr when cmesh becomes a class. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** The reference count of the cad handler. TODO: Replace by shared_ptr when cmesh becomes a class. */
/** The reference count of the cad handle. TODO: Replace by shared_ptr when cmesh becomes a class. */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants