/** @class PointingCutoff.cpp @author Brian Magill @creation date 1/1/2007 $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 cuts off the pointing correction at particular time. */ #include #include #include "PointingCutoff.h" #include //#define DEBUG using namespace std; valarray PointingCutoff::operator()(valarray const &time, valarray const &inModel, long &cutoffIndex) { long indx; double value; assert(time.size() == inModel.size()); valarray outModel(inModel.size() ); if (cutoffTime < time.min() || cutoffTime > time.max()) throw runtime_error("PointingCutoff:: cutoff time out of range"); if (mode) for(indx = 0; indx < time.size(); indx++) { if (time[indx] <= cutoffTime) { value = inModel[indx]; cutoffIndex = indx; } outModel[indx] = value; } else for(indx = time.size() - 1; indx >= 0 ; indx--) { if (time[indx] >= cutoffTime) { value = inModel[indx]; cutoffIndex = indx; } outModel[indx] = value; } #ifdef DEBUG cout << "Cutoff Time: " << cutoffTime << endl << endl; cout << "Pointing Model Values: " << endl; cout << "Indx\tTime\tModel Value" << endl; for(unsigned long i = 0; i < outModel.size(); i++) cout << i << ",\t" << time[i] << ",\t" << outModel[i] << endl; #endif return outModel; } void PointingCutoff::operator()(valarray const &time, valarray const &inModel, valarray & outModel, long &cutoffIndex) { outModel.resize(inModel.size() ); outModel = this->operator()(time, inModel, cutoffIndex); }