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

[scfinder] processing input origins #38

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

FMassin
Copy link
Member

@FMassin FMassin commented Sep 12, 2023

Adds origin input to scfinder.
Default delay warning threshold changed from 3s to 5s.

@FMassin FMassin added the enhancement New feature or request label Sep 12, 2023
@FMassin FMassin force-pushed the scfinder-origin-input branch from e60cf8f to 0c66882 Compare November 30, 2023 10:08
long event_id = (long)time(NULL);

// make constructor take a Coordinate designated by *cit...it will increment Nfinder
_finderList.push_back(new Finder(Coordinate(org->latitude().value(),
Copy link
Member Author

Choose a reason for hiding this comment

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

Use my own separate local FinDer() object directly with .process() (it's a pointer)

int neppgas = 0;
for ( int i=-1*_nPtsPGA;i<(_nPtsPGA+1);i++ ) {
for ( int j=-1*_nPtsPGA;j<(_nPtsPGA+1);j++ ) {
_latestMaxPGAs.push_back(
Copy link
Member Author

@FMassin FMassin Jun 17, 2024

Choose a reason for hiding this comment

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

Try to make a separate local .copy() and append to this one instead (make sure it's a deep copy).

bool _processOrigins;
double _defaultEpPGA;
int _nPtsPGA;
bool _finderScanProcOrg;
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove

@FMassin FMassin force-pushed the scfinder-origin-input branch from 174a205 to 9070d21 Compare June 20, 2024 12:46
Core::Time(pga.get_timestamp()).iso().c_str(),
pga.get_value());
}

Copy link
Member Author

Choose a reason for hiding this comment

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

@jenrandrews: is this the best way to copy the _latestMaxPGAs data ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Fred, since PGA_Data_List objects are just vectors containing objects of PGA_Data class, I believe you can just do A = B, and A will be a deep copy of B. This may (or may not) be more efficient than your explicit copy loop, since it may not involve vector resizing. However, there is no copy constructor defined for the PGA_Data class, so something may go awry. My suggestion would be to do a quick test: try the originBasedLatestMaxPGAs = _latestMaxPGAs method, change something in one of the PGA_Data objects, and see if it shows up in the other list. If it doesn't, you're golden, otherwise keep what you have.

}
SEISCOMP_DEBUG("sendFinder(originBasedFinder)...");
sendFinder(originBasedFinder);
SEISCOMP_DEBUG("sendFinder(originBasedFinder) is Done");
Copy link
Member Author

@FMassin FMassin Aug 14, 2024

Choose a reason for hiding this comment

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

@jenrandrews @ sceylan : is it correct that originBasedFinder and originBasedLatestMaxPGAs will be destroyed once this method exits?

Copy link
Contributor

Choose a reason for hiding this comment

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

I took a look at the full file and I think originBasedLatestMaxPGAs is truly locally scoped and will be destroyed. For originBasedFinder you are creating it with a "new" which means you should also call "delete" when done. So just add the line "delete originBasedFinder;" whenever in the function/code you are finished with the object (looks like line 647). The object looks locally scoped though, so you could also just create it with "Finder originBasedFinder = Finder(...);" and switch to "originBasedFinder.process()" and "sendFinder(&originBasedFinder)". Either approach should work =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants