-
Notifications
You must be signed in to change notification settings - Fork 124
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
Compact Triangulation Integration #674
Conversation
hi @guoxiliu thanks a lot for your PR. it seems that the CI identified a couple of issues with this PR. could you please make sure:
Thanks! |
Thanks, @julien-tierny. I will continue to work on these issues.
|
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 have started a review. It is not finished at the moment.
I will resume it asap.
Update the reference in vtk header and xml file
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.
hi @guoxiliu
sorry for the late reply but here's my review for this PR.
if you could fix the few remarks I added in there, that would be wonderful.
maybe @pierre-guillou, you could also review the PR if you have time.
once the above remarks are addressed, I'll go ahead and run experiments with the code.
thanks!
core/vtk/ttkCompactTriangulationPreconditioning/ttkCompactTriangulationPreconditioning.cpp
Outdated
Show resolved
Hide resolved
core/vtk/ttkCompactTriangulationPreconditioning/ttkCompactTriangulationPreconditioning.cpp
Outdated
Show resolved
Hide resolved
core/vtk/ttkCompactTriangulationPreconditioning/ttkCompactTriangulationPreconditioning.cpp
Outdated
Show resolved
Hide resolved
core/vtk/ttkCompactTriangulationPreconditioning/ttkCompactTriangulationPreconditioning.cpp
Outdated
Show resolved
Hide resolved
Move Octree to the base folder Remove debug message prefix in vtk file
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.
hi @guoxiliu
thanks a lot for your quick fix.
I have found yet a few occurrences of dynamic allocation.
could you also address these and let me know when you're done?
thanks!
ok, thanks @guoxiliu |
as a side note, I switched the |
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.
Hi @guoxiliu!
I've looked at this PR and written a few comments on minor points. I hope I'm not too picky...
core/base/octree/Octree.h
Outdated
using namespace ttk; | ||
using namespace std; |
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'm a bit concerned with these using namespace
directives inside a header file since, through preprocessor inclusion, this can have non-local effects on other parts of the TTK codebase. Would it be possible to remove those and use instead fully qualified types (with ttk::
and std::
prefixes)? (using namespace
in .cpp source files is fine though)
core/base/octree/Octree.h
Outdated
class OctreeNode { | ||
public: | ||
OctreeNode() { | ||
OctreeNode(0); |
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 creates a temporary object that is never used. Did you intend OctreeNode() : OctreeNode(0) {}
instead? It is flagged by clang-tidy in the check_code
CI workflow, first lint_code
job, Use clang-tidy to lint code
step as bugprone-undelegated-constructor
core/base/octree/Octree.cpp
Outdated
using namespace ttk; | ||
|
||
Octree::Octree(const AbstractTriangulation *t) { | ||
Octree(t, 1000); |
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 creates a temporary object. Did you intend to call Octree::Octree(const AbstractTriangulation *t):Octree(t, 1000) {}
instead?
core/base/octree/Octree.cpp
Outdated
uint32_t location; | ||
float ncenter[3] = {0.0}, nsize[3] = {0.0}; | ||
for(int i = 0; i < dim; i++) { | ||
SimplexId vertexId; |
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.
Due to the internals of getCellVertex
, this variable needs to be initialized (otherwise, a garbage value might be propagated). A simple SimplexId vertexId{};
with two braces should suffice to zero-initialize the variable. This is flagged by the clang static analyzer (check_code
CI workflow, second lint_code
job, Use Clang static analyzer
step).
core/base/octree/Octree.h
Outdated
*/ | ||
uint32_t | ||
getChildLocation(uint32_t parLoc, SimplexId vertexId, float centerArr[3]) { | ||
float xval, yval, zval; |
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.
Those values should also be zero-initialized: float xval{}, yval{}, zval{};
/** | ||
* Reorder the input cells. | ||
*/ | ||
int reorderCells(const std::vector<SimplexId> &vertexMap, |
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.
inline
or move to .cpp?
#include <vtkCharArray.h> | ||
#include <vtkDataArray.h> | ||
#include <vtkDataSet.h> | ||
#include <vtkDataSetAlgorithm.h> | ||
#include <vtkDoubleArray.h> | ||
#include <vtkFiltersCoreModule.h> | ||
#include <vtkFloatArray.h> | ||
#include <vtkInformation.h> | ||
#include <vtkIntArray.h> | ||
#include <vtkObjectFactory.h> | ||
#include <vtkPointData.h> | ||
#include <vtkSmartPointer.h> | ||
#include <vtkUnstructuredGrid.h> |
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.
A lot of those includes
can be moved to the .cpp
core/base/octree/Octree.h
Outdated
float center[3]; | ||
float size[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.
Maybe use std::array<float, 3>
instead of C-array? std::array
are zero-initialized and have additional methods (begin()
, end()
, ...) that make them compatible with std::vector
. To get a C-array like pointer, use the data()
method.
std::vector<std::string>::iterator iter = scalarFields.begin(); | ||
while(iter != scalarFields.end()) { |
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.
A range-based for loop (for(const auto &s : scalarFields)
) should be more readable here
iter = scalarFields.begin(); | ||
while(iter != scalarFields.end()) { |
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.
A range-based for loop might be preferred here too
@pierre-guillou |
Hi @guoxiliu, Thanks for taking my remarks into account. 0001-Reduce-variables-scope.txt Also, I noticed several times some weird memory issue that filled the 64GB of RAM of my computer and makes it swap. To trigger them, I load the noisyTerrain.vtu dataset in ParaView, apply Thanks, |
@guoxiliu: also, it seems that the memory issue @pierre-guillou mentioned seems to be the last obstacle to the merge of this PR. thanks for your feedback. |
Thank you, @julien-tierny and @pierre-guillou. I am working on merging the patch and the memory issue. I will update the repo when I fix it. Best, |
Thanks @guoxiliu! The memory issue seems to be gone with your last commit! |
Alright, looks good to me. |
Now @guoxiliu |
Thank you, @julien-tierny!
I will follow the guideline in the link you mentioned and prepare the example. |
Thanks for contributing to TTK!
Before submitting your pull request, please:
Review our Contributor Guidelines, in particular regarding code formatting (with clang-format) and continuous integration.
Please provide a quick description of your contributions below:
This PR adds a compact triangulation data structure and also a preconditioning plugin for it.