MCPcopy Create free account
hub / github.com/DOI-USGS/ISIS3 / LoadCache

Method LoadCache

isis/src/base/objs/SpicePosition/SpicePosition.cpp:297–338  ·  view source on GitHub ↗

Cache J2000 position over a time range. * * This method will load an internal cache with coordinates over a time * range. This prevents * the NAIF kernels from being read over-and-over again and slowing a * application down due to I/O performance. Once the * cache has been loaded then the kernels can be unloaded from the NAIF * system. * * @param startTime Starting e

Source from the content-addressed store, hash-verified

295 *
296 */
297 void SpicePosition::LoadCache(double startTime, double endTime, int size) {
298 // Make sure cache isn't already loaded
299 if(p_source == Memcache || p_source == HermiteCache) {
300 QString msg = "A SpicePosition cache has already been created";
301 throw IException(IException::Programmer, msg, _FILEINFO_);
302 }
303
304 if(startTime > endTime) {
305 QString msg = "Argument startTime must be less than or equal to endTime";
306 throw IException(IException::Programmer, msg, _FILEINFO_);
307 }
308
309 if((startTime != endTime) && (size == 1)) {
310 QString msg = "Cache size must be more than 1 if startTime endTime differ";
311 throw IException(IException::Programmer, msg, _FILEINFO_);
312 }
313
314 // Save full cache parameters
315 p_fullCacheStartTime = startTime;
316 p_fullCacheEndTime = endTime;
317 p_fullCacheSize = size;
318 LoadTimeCache();
319
320 // Loop and load the cache
321 std::vector<ale::State> stateCache;
322 for(int i = 0; i < size; i++) {
323 double et = p_cacheTime[i];
324 SetEphemerisTime(et);
325 ale::State currentState = ale::State(ale::Vec3d(p_coordinate));
326 if (p_hasVelocity) {
327 currentState.velocity = ale::Vec3d(p_velocity);
328 }
329 stateCache.push_back(currentState);
330 }
331
332 if (m_state != NULL) {
333 delete m_state;
334 }
335
336 m_state = new ale::States(p_cacheTime, stateCache);
337 p_source = Memcache;
338 }
339
340
341 /** Cache J2000 position for a time.

Callers 4

mainFunction · 0.45
isdInitMethod · 0.45
initMethod · 0.45
createCacheMethod · 0.45

Calls 12

atMethod · 0.80
RecordsMethod · 0.80
FieldsMethod · 0.80
IExceptionClass · 0.50
toDoubleFunction · 0.50
push_backMethod · 0.45
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
hasKeywordMethod · 0.45
findKeywordMethod · 0.45
NameMethod · 0.45

Tested by 1

mainFunction · 0.36