/** @class RhoCalc.cpp @author Brian Magill @datecreated 07/04/2006 $Date:$ $Revision:$ @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief: Calculates Refraction angle at (t - tau) in the past */ //---------------------------------------------------------------------- // #include #include "RhoFunction.h" #include "VectorLinInterp.hpp" using namespace std; double RhoFunction::Calculate(double currentTime) { double rho_0; VectorLinInterp linInterp; double tm = currentTime - tauPtr->operator( )(currentTime); if (time.size() < 1) { rho_0 = 0.0; } else if( tm < *time.begin() ) { rho_0 = 0.0; } else if ( tm > *(time.end() - 1) ) { cerr << "Warning, time is out of range!"; cerr << " currentTime = " << currentTime; cerr << ", tm = " << tm << ", *time.end() = " << *(time.end() - 1) << endl; rho_0 = -999.99; } else { rho_0 = linInterp.Interpol(rho, time, tm); } return rho_0; } void RhoFunction::dump() { // cout << "tau = " << tau << endl<< endl; cout << "time " << "\t " << "refraction angle"; cout << "\t tau" << endl; for(unsigned long j = 0; j < time.size(); j++) { cout << time[j] << "\t "; cout << rho[j] << "\t"; cout << tauPtr->operator( )(time[j]) << endl; } cout << endl; }