|
Rythmos - Transient Integration for Differential Equations
Version of the Day
|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp" 00034 00035 00036 namespace Rythmos { 00037 00038 00040 template<class Scalar> 00041 class SmartInterpolationBufferAppender 00042 : virtual public InterpolationBufferAppenderBase<Scalar>, 00043 virtual public Teuchos::ParameterListAcceptorDefaultBase 00044 { 00045 public: 00050 void append( 00051 const InterpolationBufferBase<Scalar>& interpBuffSource, 00052 const TimeRange<Scalar>& range, 00053 const Ptr<InterpolationBufferBase<Scalar> > &interpBuffSink 00054 ); 00055 00058 00060 void setParameterList(RCP<Teuchos::ParameterList> const& paramList); 00061 00063 RCP<const Teuchos::ParameterList> getValidParameters() const; 00064 00066 }; 00067 00068 00069 // 00070 // Implementations 00071 // 00072 00073 00074 template<class Scalar> 00075 void SmartInterpolationBufferAppender<Scalar>::append( 00076 const InterpolationBufferBase<Scalar>& interpBuffSource, 00077 const TimeRange<Scalar>& range, 00078 const Ptr<InterpolationBufferBase<Scalar> > &interpBuffSink 00079 ) 00080 { 00081 TEUCHOS_TEST_FOR_EXCEPTION( 00082 true, std::logic_error, 00083 "This class has never been tested before and should not be used\n" 00084 "until it is" 00085 ); 00086 // 2007/12/05: rabartl: This code has not been tested so don't use this 00087 // until a test has been writen for this! 00088 #ifdef HAVE_RYTHMOS_DEBUG 00089 this->assertAppendPreconditions(interpBuffSource,range,*interpBuffSink); 00090 #endif // HAVE_RYTHMOS_DEBUG 00091 if (interpBuffSink->getOrder() >= interpBuffSource.getOrder()) { 00092 // The incoming interpolation buffer's order of interpolation is lower than 00093 // the base interpolation buffer's order of interpolation. In this case, 00094 // we just copy the data over. 00095 PointwiseInterpolationBufferAppender<Scalar> defaultAppender; 00096 defaultAppender.append(interpBuffSink,interpBuffSource,range); 00097 } else { 00098 // In this case, the incoming interpolation buffer's order of interpolation 00099 // is higher than the base interpolation buffer's, so we'll ask it to 00100 // interpolate points before inserting into the base interpolation buffer. 00101 TEUCHOS_TEST_FOR_EXCEPTION( 00102 true,std::logic_error, 00103 "Error, the smart interpolation buffer appender is not implemented\n" 00104 "for appending interpolation buffers with higher order interpolation\n" 00105 "into interpolation buffers with a lower order of interpolation yet!" 00106 ); 00107 // 08/09/07 tscoffe: Note: you can't use selectPointsInTimeRange 00108 // immediately because you may need to interpolate points before the first 00109 // node inside the range. I.e. interpBuffSource.getNodes = [... , range.lower(), ... , range.upper(), ... ] 00110 } 00111 } 00112 00113 template<class Scalar> 00114 void SmartInterpolationBufferAppender<Scalar>::setParameterList(RCP<Teuchos::ParameterList> const& paramList) 00115 { 00116 TEUCHOS_TEST_FOR_EXCEPT( is_null(paramList) ); 00117 paramList->validateParameters(*this->getValidParameters()); 00118 setMyParamList(paramList); 00119 Teuchos::readVerboseObjectSublist(&*paramList,this); 00120 } 00121 00122 template<class Scalar> 00123 RCP<const Teuchos::ParameterList> SmartInterpolationBufferAppender<Scalar>::getValidParameters() const 00124 { 00125 static RCP<Teuchos::ParameterList> validPL; 00126 if (is_null(validPL)) { 00127 RCP<Teuchos::ParameterList> pl = Teuchos::parameterList(); 00128 Teuchos::setupVerboseObjectSublist(&*pl); 00129 validPL = pl; 00130 } 00131 return (validPL); 00132 } 00133 00134 } // namespace Rythmos 00135 00136 00137 #endif //RYTHMOS_SMART_INTERPOLATION_BUFFER_APPENDER_HPP
1.7.6.1