-
Notifications
You must be signed in to change notification settings - Fork 9
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
BUG: Fixes to several filters as reported by users #699
Closed
imikejackson
wants to merge
4
commits into
BlueQuartzSoftware:develop
from
imikejackson:feature/udri_misc_fixes
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
734fc82
STLFileReader: Fix crash when all points are on a single plane.
imikejackson 4bc1369
SampleSurfaceMesh: Sped up the computation, but the output is still w…
imikejackson d4d00f1
Adjust Parameter Order.
imikejackson 5e43278
WriteSTLFile: Ensure output path is created when executing filter.
imikejackson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -105,6 +105,8 @@ class SampleSurfaceMeshImplByPoints | |||||||||||||||||||
|
||||||||||||||||||||
void checkPoints(usize start, usize end) const | ||||||||||||||||||||
{ | ||||||||||||||||||||
auto startTime = std::chrono::steady_clock::now(); | ||||||||||||||||||||
|
||||||||||||||||||||
usize iter = m_FeatureId; | ||||||||||||||||||||
|
||||||||||||||||||||
// find bounding box for current feature | ||||||||||||||||||||
|
@@ -115,6 +117,15 @@ class SampleSurfaceMeshImplByPoints | |||||||||||||||||||
// check points in vertex array to see if they are in the bounding box of the feature | ||||||||||||||||||||
for(usize i = start; i < end; i++) | ||||||||||||||||||||
{ | ||||||||||||||||||||
auto now = std::chrono::steady_clock::now(); | ||||||||||||||||||||
// Only send updates every 1 second | ||||||||||||||||||||
if(std::chrono::duration_cast<std::chrono::milliseconds>(now - startTime).count() > 1000) | ||||||||||||||||||||
{ | ||||||||||||||||||||
std::string message = fmt::format("{}", i); | ||||||||||||||||||||
m_Filter->sendThreadSafeProgressMessage(i, i - start, m_Points.size()); | ||||||||||||||||||||
startTime = std::chrono::steady_clock::now(); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
Point3Df point = m_Points[i]; | ||||||||||||||||||||
if(m_PolyIds[i] == 0) | ||||||||||||||||||||
{ | ||||||||||||||||||||
|
@@ -126,11 +137,6 @@ class SampleSurfaceMeshImplByPoints | |||||||||||||||||||
} | ||||||||||||||||||||
pointsVisited++; | ||||||||||||||||||||
|
||||||||||||||||||||
// Send some feedback | ||||||||||||||||||||
if(pointsVisited % 1000 == 0) | ||||||||||||||||||||
{ | ||||||||||||||||||||
m_Filter->sendThreadSafeProgressMessage(m_FeatureId, 1000, m_Points.size()); | ||||||||||||||||||||
} | ||||||||||||||||||||
// Check for the filter being cancelled. | ||||||||||||||||||||
if(m_ShouldCancel) | ||||||||||||||||||||
{ | ||||||||||||||||||||
|
@@ -288,8 +294,11 @@ Result<> SampleSurfaceMesh::execute(SampleSurfaceMeshInputValues& inputValues) | |||||||||||||||||||
{ | ||||||||||||||||||||
for(int32 featureId = 0; featureId < numFeatures; featureId++) | ||||||||||||||||||||
{ | ||||||||||||||||||||
updateProgress(fmt::format("Sampling FeatureID: {} ", featureId)); | ||||||||||||||||||||
|
||||||||||||||||||||
ParallelDataAlgorithm dataAlg; | ||||||||||||||||||||
dataAlg.setRange(0, points.size()); | ||||||||||||||||||||
dataAlg.setParallelizationEnabled(true); | ||||||||||||||||||||
dataAlg.execute(SampleSurfaceMeshImplByPoints(this, triangleGeom, faceLists[featureId], faceBBs, points, featureId, polyIds, m_ShouldCancel)); | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
@@ -306,21 +315,20 @@ void SampleSurfaceMesh::sendThreadSafeProgressMessage(usize featureId, usize num | |||||||||||||||||||
|
||||||||||||||||||||
m_ProgressCounter += numCompleted; | ||||||||||||||||||||
auto now = std::chrono::steady_clock::now(); | ||||||||||||||||||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(m_InitialTime - now).count(); | ||||||||||||||||||||
if(diff > 1000) | ||||||||||||||||||||
if(std::chrono::duration_cast<std::chrono::milliseconds>(now - m_LastUpdateTime).count() > 1000) | ||||||||||||||||||||
{ | ||||||||||||||||||||
std::string progMessage = fmt::format("Feature {} | Points Completed: {} of {}", featureId, m_ProgressCounter, totalFeatures); | ||||||||||||||||||||
float inverseRate = static_cast<float>(diff) / static_cast<float>(m_ProgressCounter - m_LastProgressInt); | ||||||||||||||||||||
auto remainMillis = std::chrono::milliseconds(static_cast<int64>(inverseRate * (totalFeatures - m_ProgressCounter))); | ||||||||||||||||||||
auto secs = std::chrono::duration_cast<std::chrono::seconds>(remainMillis); | ||||||||||||||||||||
remainMillis -= std::chrono::duration_cast<std::chrono::milliseconds>(secs); | ||||||||||||||||||||
auto mins = std::chrono::duration_cast<std::chrono::minutes>(secs); | ||||||||||||||||||||
secs -= std::chrono::duration_cast<std::chrono::seconds>(mins); | ||||||||||||||||||||
auto hour = std::chrono::duration_cast<std::chrono::hours>(mins); | ||||||||||||||||||||
mins -= std::chrono::duration_cast<std::chrono::minutes>(hour); | ||||||||||||||||||||
progMessage += fmt::format(" || Est. Time Remain: {} hours {} minutes {} seconds", hour.count(), mins.count(), secs.count()); | ||||||||||||||||||||
std::string progMessage = fmt::format("{}", m_ProgressCounter); | ||||||||||||||||||||
// float inverseRate = static_cast<float>(diff) / static_cast<float>(m_ProgressCounter - m_LastProgressInt); | ||||||||||||||||||||
// auto remainMillis = std::chrono::milliseconds(static_cast<int64>(inverseRate * (totalFeatures - m_ProgressCounter))); | ||||||||||||||||||||
// auto secs = std::chrono::duration_cast<std::chrono::seconds>(remainMillis); | ||||||||||||||||||||
// remainMillis -= std::chrono::duration_cast<std::chrono::milliseconds>(secs); | ||||||||||||||||||||
// auto mins = std::chrono::duration_cast<std::chrono::minutes>(secs); | ||||||||||||||||||||
// secs -= std::chrono::duration_cast<std::chrono::seconds>(mins); | ||||||||||||||||||||
// auto hour = std::chrono::duration_cast<std::chrono::hours>(mins); | ||||||||||||||||||||
// mins -= std::chrono::duration_cast<std::chrono::minutes>(hour); | ||||||||||||||||||||
// progMessage += fmt::format(" || Est. Time Remain: {} hours {} minutes {} seconds", hour.count(), mins.count(), secs.count()); | ||||||||||||||||||||
Comment on lines
+321
to
+329
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
m_MessageHandler({IFilter::Message::Type::Info, progMessage}); | ||||||||||||||||||||
m_InitialTime = std::chrono::steady_clock::now(); | ||||||||||||||||||||
m_LastProgressInt = m_ProgressCounter; | ||||||||||||||||||||
m_LastUpdateTime = std::chrono::steady_clock::now(); | ||||||||||||||||||||
// m_LastProgressInt = m_ProgressCounter; | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
} | ||||||||||||||||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.