Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/behavior/24062-tb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Change in TrapezoidMapTriFinder, triangulation interpolation, and refinement output due to change in shuffle.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

would solve the failing doc build (if I got the length right...).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you're having trouble aligning the underline, then that's a sign the title is probably too long. I would leave out all of the details and just say "Change in triangulation output ..." Also, no trailing period in titles.

With std::random_shuffle removed from C++17, TrapezouidMapTriFinder, triangular interpolation, and refinement now use std::shuffle with a new random generator leading to a different output.
Comment thread
tybeller marked this conversation as resolved.
Outdated
20 changes: 4 additions & 16 deletions src/tri/_tri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <algorithm>
#include <set>
#include <random>


TriEdge::TriEdge()
Expand Down Expand Up @@ -1465,8 +1466,8 @@ TrapezoidMapTriFinder::initialize()
_tree->assert_valid(false);

// Randomly shuffle all edges other than first 2.
RandomNumberGenerator rng(1234);
std::random_shuffle(_edges.begin()+2, _edges.end(), rng);
std::mt19937 rng(1234);
std::shuffle(_edges.begin()+2, _edges.end(), rng);

// Add edges, one at a time, to tree.
size_t nedges = _edges.size();
Expand Down Expand Up @@ -2055,17 +2056,4 @@ TrapezoidMapTriFinder::Trapezoid::set_upper_right(Trapezoid* upper_right_)
upper_right = upper_right_;
if (upper_right != 0)
upper_right->upper_left = this;
}



RandomNumberGenerator::RandomNumberGenerator(unsigned long seed)
: _m(21870), _a(1291), _c(4621), _seed(seed % _m)
{}

unsigned long
RandomNumberGenerator::operator()(unsigned long max_value)
{
_seed = (_seed*_a + _c) % _m;
return (_seed*max_value) / _m;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please end the file with an empty line. That will fix the pre-commit issue. (The pyside6 issue is fixed in #24158.)