Rythmos_SmartInterpolationBufferAppender.hpp

00001 //@HEADER
00002 // ***********************************************************************
00003 //
00004 //                     Rythmos Package
00005 //                 Copyright (2006) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 
00029 #ifndef RYTHMOS_SMART_INTERPOLATION_BUFFER_APPENDER_HPP
00030 #define RYTHMOS_SMART_INTERPOLATION_BUFFER_APPENDER_HPP
00031 
00032 #include "Rythmos_InterpolationBufferAppenderBase.hpp"
00033 
00034 
00035 namespace Rythmos {
00036 
00037 
00039 template<class Scalar>
00040 class SmartInterpolationBufferAppender
00041   : virtual public InterpolationBufferAppenderBase<Scalar>
00042 {
00043   public:
00048     void append(
00049         const InterpolationBufferBase<Scalar>& interpBuffSource, 
00050         const TimeRange<Scalar>& range,
00051         const Ptr<InterpolationBufferBase<Scalar> > &interpBuffSink 
00052         );
00053 };
00054 
00055 
00056 //
00057 // Implementations
00058 //
00059 
00060 
00061 template<class Scalar>
00062 void SmartInterpolationBufferAppender<Scalar>::append(
00063   const InterpolationBufferBase<Scalar>& interpBuffSource, 
00064   const TimeRange<Scalar>& range,
00065   const Ptr<InterpolationBufferBase<Scalar> > &interpBuffSink
00066     ) 
00067 {
00068   TEST_FOR_EXCEPTION(
00069     true, std::logic_error,
00070     "This class has never been tested before and should not be used\n"
00071     "until it is"
00072     );
00073   // 2007/12/05: rabartl: This code has not been tested so don't use this
00074   // until a test has been writen for this!
00075 #ifdef TEUCHOS_DEBUG
00076   this->assertAppendPreconditions(interpBuffSource,range,*interpBuffSink);
00077 #endif // TEUCHOS_DEBUG
00078   if (interpBuffSink->getOrder() >= interpBuffSource.getOrder()) {
00079     // The incoming interpolation buffer's order of interpolation is lower than
00080     // the base interpolation buffer's order of interpolation.  In this case,
00081     // we just copy the data over.
00082     PointwiseInterpolationBufferAppender<Scalar> defaultAppender;
00083     defaultAppender.append(interpBuffSink,interpBuffSource,range);
00084   } else {
00085     // In this case, the incoming interpolation buffer's order of interpolation
00086     // is higher than the base interpolation buffer's, so we'll ask it to
00087     // interpolate points before inserting into the base interpolation buffer.
00088     TEST_FOR_EXCEPTION(
00089         true,std::logic_error,
00090         "Error, the smart interpolation buffer appender is not implemented\n"
00091         "for appending interpolation buffers with higher order interpolation\n"
00092         "into interpolation buffers with a lower order of interpolation yet!"
00093         );
00094     // 08/09/07 tscoffe:  Note:  you can't use selectPointsInTimeRange
00095     // immediately because you may need to interpolate points before the first
00096     // node inside the range.  I.e. interpBuffSource.getNodes = [... , range.lower(), ... , range.upper(), ... ]
00097   }
00098 }
00099 
00100 
00101 } // namespace Rythmos
00102 
00103 
00104 #endif //RYTHMOS_SMART_INTERPOLATION_BUFFER_APPENDER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends

Generated on Tue Oct 20 10:24:09 2009 for Rythmos - Transient Integration for Differential Equations by  doxygen 1.6.1