-
Notifications
You must be signed in to change notification settings - Fork 4
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
filtering/reconnecting #18
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4cb2094
filtering/reconnecting WIP
brauliorivas df53119
basic filtering for MC particle function
brauliorivas 8cd129d
refactor toggle functionality + fix reconnect child/parent
brauliorivas 0ec7955
filtering/reconnecting WIP
brauliorivas 4e5f1a1
basic filtering for MC particle function
brauliorivas ccaeeca
refactor toggle functionality + fix reconnect child/parent
brauliorivas 022dece
incorporate advanced filtering for Monte Carlo Particles
brauliorivas b8fd996
remove accidently added node_modules
brauliorivas 35ce882
fix merge conflict
brauliorivas 209d98a
[FEAT] filters using checkbox based on Simulator Status field
brauliorivas 01183ee
remove filter.js file from menu folder, relocate
brauliorivas 975cbc5
Merge branch 'main' into feat-filtering
tmadlener f19980f
fix filtering function, now works together toogle with ranges
brauliorivas 4a7629f
Merge branch 'feat-filtering' of github.com:brauliorivas/dmx into fea…
brauliorivas 5e221d6
Merge branch 'main' into feat-filtering
brauliorivas 849cfcf
[WIP] add testing for filtering functions
brauliorivas 89aabf9
initial test suite for MC particles filtering
brauliorivas 490b773
add .js for file extension import
brauliorivas 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Link } from "./objects.js"; | ||
|
||
export function reconnect( | ||
criteriaFunction, | ||
parentLinks, | ||
childrenLinks, | ||
particles | ||
) { | ||
const filteredParticles = []; | ||
const newParentLinks = []; | ||
const newChildrenLinks = []; | ||
|
||
for (const particle of particles) { | ||
if (!criteriaFunction(particle)) { | ||
const parentParticles = []; | ||
const childrenParticles = []; | ||
|
||
for (const parent of particle.parents) { | ||
if (criteriaFunction(particles[parent])) { | ||
parentParticles.push(parent); | ||
} | ||
} | ||
|
||
for (const child of particle.children) { | ||
if (criteriaFunction(particles[child])) { | ||
childrenParticles.push(child); | ||
} | ||
} | ||
|
||
for (const parent of parentParticles) { | ||
for (const child of childrenParticles) { | ||
const link = new Link(newParentLinks.length, parent, child); | ||
newParentLinks.push(link); | ||
} | ||
} | ||
} else { | ||
filteredParticles.push(particle); | ||
|
||
for (const parentLinkId of particle.parentLinks) { | ||
const parentLink = parentLinks[parentLinkId]; | ||
const parent = particles[parentLink.from]; | ||
if (criteriaFunction(parent)) { | ||
newParentLinks.push( | ||
new Link(newParentLinks.length, parentLink.from, parentLink.to) | ||
); | ||
} | ||
} | ||
|
||
for (const childrenLinkId of particle.childrenLinks) { | ||
const childrenLink = childrenLinks[childrenLinkId]; | ||
const child = particles[childrenLink.to]; | ||
if (criteriaFunction(child)) { | ||
newChildrenLinks.push( | ||
new Link( | ||
newChildrenLinks.length, | ||
childrenLink.from, | ||
childrenLink.to | ||
) | ||
); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return [filteredParticles, newParentLinks, newChildrenLinks]; | ||
} |
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
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.
Stupid question from my side, where do these inputs come from?
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.
Don't worry, these inputs come from main.js.