Skip to content
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

Add C++ Implementation of precice-aste-join #156

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

kursatyurt
Copy link
Collaborator

@kursatyurt kursatyurt commented Nov 3, 2022

Main changes of this PR

Add an C++ implementation of precice-aste-join

Due to many loops and copy operations, Python implementation is considerably slow for large meshes. This C++ implementation provides 4-8 times faster merge operations than the Python version.

What is missing?

  • The logger system is not set yet.
  • Shall we add a unit or integration test?

Author's checklist

  • I used the pre-commit hook and used pre-commit run --all to apply all available hooks.
  • I added a test to cover the proposed changes in our test suite.
  • I updated the documentation in docs/README.md.
  • I updated potential breaking changes in the tutorial precice/tutorials/aste-turbine.

@kursatyurt kursatyurt self-assigned this Nov 3, 2022
Copy link
Member

@davidscn davidscn left a comment

Choose a reason for hiding this comment

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

We definitely need tests. A rather simple solution would be to perform the merging in the integration tests twice, one with the python version, one with the cpp version. We also need to update the website docs accordingly.

po::store(parse_command_line(argc, argv, desc), vm);

if (vm.count("help")) {
std::cout << desc << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

As you already mentioned in your comment, we should probably include the ASTE logger here. Should be easy to use anyway.

src/precice-aste-join.cpp Outdated Show resolved Hide resolved
Comment on lines +46 to +48
} catch (nlohmann::detail::type_error &) {
std::cerr << "Error while parsing recovery file \"size\" is missing";
std::exit(EXIT_FAILURE);
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is an unintentional duplication of the catch above?

Comment on lines +56 to +58
} catch (nlohmann::detail::type_error &) {
std::cerr << "Error while parsing recovery file \"cell_types\" is missing";
std::exit(EXIT_FAILURE);
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is an unintentional duplication of the catch above?

src/precice-aste-join.cpp Outdated Show resolved Hide resolved
Comment on lines +33 to +38
/**
* @brief Count the number of partitioned mesh files for given prefix
*
* @param prefix
* @return size_t
*/
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, I won't comment all the comments

src/precice-aste-join.hpp Outdated Show resolved Hide resolved
return joinedMesh;
}

auto recoveryMerge(const std::string &prefix, std::size_t numparts, int size, const std::vector<int> &cellTypes, const std::vector<std::vector<int>> &cells) -> vtkSmartPointer<vtkUnstructuredGrid>
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there is quite a lot of duplication between the partitionwiseMerge and the recoveryMerge. I would expect that the one is a subroutine of the other.
I would propose to first add tests and afterwards refactor here.

src/precice-aste-join.cpp Outdated Show resolved Hide resolved
src/precice-aste-join.cpp Outdated Show resolved Hide resolved
@kursatyurt kursatyurt marked this pull request as draft March 6, 2023 01:21
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.

2 participants