Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#391 closed defect (fixed)

Bug in GriddedSubsetSurface's distance X calculation

Reported by: Kevin Milner Owned by:
Priority: critical Milestone: OpenSHA 1.3
Component: sha Version:
Keywords: Cc:

Description

I noticed an apparent bug in the caching for GriddedSubsetSurface? while investigating #390. DistanceX uses a different cache but the getDistanceX method was being called with the regular cached location, siteLocForDistCalcs, instead of siteLocForDistXCalc. This means that our distance X calculations have potentially been off any time that distance X is calculated before any of the other distance metrics for a given site. Any results since the new surface implementation was added where values for multiple sites were calculated could be affected by this bug.

public synchronized double getDistanceX(Location siteLoc){
	if(!siteLocForDistXCalc.equals(siteLoc)) {
		siteLocForDistXCalc = siteLoc;
		distanceX = GriddedSurfaceUtils.getDistanceX(getEvenlyDiscritizedUpperEdge(), siteLocForDistCalcs);
	}
	return distanceX;
}

Change History (2)

comment:1 Changed 12 years ago by Kevin Milner

Resolution: fixed
Status: newclosed

fixed in [8866].

comment:2 Changed 12 years ago by Peter Powers

I need to take a look at this. This very thing raised a red flag when I was working on this class many weeks ago. I started to make a change but then realized the implementation was ok, for some reason that I can't remember. That's not to say it doesn't suffer from the multithreading issues in #390

Note: See TracTickets for help on using tickets.