Rythmos - Transient Integration for Differential Equations Version of the Day
Rythmos_InterpolationBuffer_decl.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., 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_INTERPOLATION_BUFFER_DECL_H
00030 #define Rythmos_INTERPOLATION_BUFFER_DECL_H
00031 
00032 #include "Rythmos_InterpolationBufferBase.hpp"
00033 #include "Rythmos_Types.hpp"
00034 #include "Rythmos_DataStore.hpp"
00035 #include "Rythmos_InterpolatorAcceptingObjectBase.hpp"
00036 
00037 
00038 
00039 namespace Rythmos {
00040 
00041 enum IBPolicy {
00042   BUFFER_POLICY_INVALID = 0,
00043   BUFFER_POLICY_STATIC = 1,
00044   BUFFER_POLICY_KEEP_NEWEST = 2
00045 };
00046 
00047 
00049 template<class Scalar>
00050 class InterpolationBuffer :
00051   virtual public InterpolationBufferBase<Scalar>,
00052   virtual public InterpolatorAcceptingObjectBase<Scalar>
00053 {
00054 public:
00055 
00056   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00057 
00059 
00060   RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
00061 
00063   InterpolationBuffer();
00064 
00066   void initialize( const RCP<InterpolatorBase<Scalar> >& interpolator, int storage );
00067 
00070 
00072   void setInterpolator(const RCP<InterpolatorBase<Scalar> >& interpolator);
00073 
00075   RCP<InterpolatorBase<Scalar> >
00076     getNonconstInterpolator();
00077 
00079   RCP<const InterpolatorBase<Scalar> >
00080     getInterpolator() const;
00081 
00083   RCP<InterpolatorBase<Scalar> > unSetInterpolator();
00084 
00086 
00088   void setStorage( int storage );
00089 
00091   int getStorage() const;
00092 
00094   IBPolicy getIBPolicy();
00095 
00097   ~InterpolationBuffer() {};
00098 
00100   void addPoints(
00101     const Array<Scalar>& time_vec
00102     ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& x_vec
00103     ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec);
00104 
00106   void getPoints(
00107     const Array<Scalar>& time_vec
00108     ,Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec
00109     ,Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec
00110     ,Array<ScalarMag>* accuracy_vec
00111     ) const;
00112 
00114   TimeRange<Scalar> getTimeRange() const;
00115 
00117   void getNodes(Array<Scalar>* time_vec) const;
00118 
00120   int getOrder() const;
00121 
00123   void removeNodes(Array<Scalar>& time_vec);
00124 
00126 
00127   std::string description() const;
00128 
00130   void describe(
00131     Teuchos::FancyOStream       &out
00132     ,const Teuchos::EVerbosityLevel      verbLevel
00133     ) const;
00134 
00136 
00137   void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
00138 
00140   RCP<Teuchos::ParameterList> getNonconstParameterList();
00141 
00143   RCP<Teuchos::ParameterList> unsetParameterList();
00144 
00145   RCP<const Teuchos::ParameterList> getValidParameters() const;
00146 
00147 private:
00148 
00149   RCP<InterpolatorBase<Scalar> > interpolator_;
00150   int storage_limit_;
00151   RCP<typename DataStore<Scalar>::DataStoreVector_t> data_vec_;
00152 
00153   RCP<Teuchos::ParameterList> paramList_;
00154 
00155   IBPolicy policy_;
00156 
00157 
00158   // Private member functions:
00159   void defaultInitializeAll_();
00160 
00161 };
00162 
00163 
00168 template<class Scalar>
00169 RCP<InterpolationBuffer<Scalar> > interpolationBuffer(
00170   const RCP<InterpolatorBase<Scalar> >& interpolator = Teuchos::null,
00171   int storage = 0
00172   )
00173 {
00174   RCP<InterpolationBuffer<Scalar> > ib = rcp(new InterpolationBuffer<Scalar>());
00175   ib->initialize(interpolator, storage);
00176   return ib;
00177 }
00178 
00179 
00180 } // namespace Rythmos
00181 
00182 
00183 #endif // Rythmos_INTERPOLATION_BUFFER_DECL_H
 All Classes Functions Variables Typedefs Friends