/** @file AvgExtentForRefrac.cpp @author Brian Magill @datecreated 04/17/2008 $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: Finds average value for exoatmospheric solar extent Note: This is a first cut at this averaging routine. It should be more than just guessing what sample size will work best. */ //---------------------------------------------------------------------- // #include #include #include #include "AvgExtentForRefrac.h" using namespace std; double AvgExtentForRefrac::operator()(valarray const &input) const { string strErr; if (input.size() < sampleSize) { strErr = "Input extent array size is smaller than size of average"; throw runtime_error(strErr); } // slice_array work = input[slice(0,sampleSize, 0)]; valarray work = input[slice(0,sampleSize, 1)]; double result = work.sum()/work.size(); return result; }