Rythmos - Transient Integration for Differential Equations Version of the Day
Loading...
Searching...
No Matches
Rythmos_InterpolationBuffer_decl.hpp
1//@HEADER
2// ***********************************************************************
3//
4// Rythmos Package
5// Copyright (2006) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25//
26// ***********************************************************************
27//@HEADER
28
29#ifndef Rythmos_INTERPOLATION_BUFFER_DECL_H
30#define Rythmos_INTERPOLATION_BUFFER_DECL_H
31
32#include "Rythmos_InterpolationBufferBase.hpp"
33#include "Rythmos_Types.hpp"
34#include "Rythmos_DataStore.hpp"
35#include "Rythmos_InterpolatorAcceptingObjectBase.hpp"
36
37
38
39namespace Rythmos {
40
41enum IBPolicy {
42 BUFFER_POLICY_INVALID = 0,
43 BUFFER_POLICY_STATIC = 1,
44 BUFFER_POLICY_KEEP_NEWEST = 2
45};
46
47
49template<class Scalar>
51 virtual public InterpolationBufferBase<Scalar>,
52 virtual public InterpolatorAcceptingObjectBase<Scalar>
53{
54public:
55
56 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
57
59
60 RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
61
64
66 void initialize( const RCP<InterpolatorBase<Scalar> >& interpolator, int storage );
67
70
72 void setInterpolator(const RCP<InterpolatorBase<Scalar> >& interpolator);
73
75 RCP<InterpolatorBase<Scalar> >
77
79 RCP<const InterpolatorBase<Scalar> >
80 getInterpolator() const;
81
83 RCP<InterpolatorBase<Scalar> > unSetInterpolator();
84
86
88 void setStorage( int storage );
89
91 int getStorage() const;
92
94 IBPolicy getIBPolicy();
95
98
100 void addPoints(
101 const Array<Scalar>& time_vec
102 ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& x_vec
103 ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec);
104
106 void getPoints(
107 const Array<Scalar>& time_vec
108 ,Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec
109 ,Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec
110 ,Array<ScalarMag>* accuracy_vec
111 ) const;
112
115
117 void getNodes(Array<Scalar>* time_vec) const;
118
120 int getOrder() const;
121
123 void removeNodes(Array<Scalar>& time_vec);
124
126
127 std::string description() const;
128
130 void describe(
131 Teuchos::FancyOStream &out
132 ,const Teuchos::EVerbosityLevel verbLevel
133 ) const;
134
136
137 void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
138
140 RCP<Teuchos::ParameterList> getNonconstParameterList();
141
143 RCP<Teuchos::ParameterList> unsetParameterList();
144
145 RCP<const Teuchos::ParameterList> getValidParameters() const;
146
147private:
148
149 RCP<InterpolatorBase<Scalar> > interpolator_;
150 int storage_limit_;
151 RCP<typename DataStore<Scalar>::DataStoreVector_t> data_vec_;
152
153 RCP<Teuchos::ParameterList> paramList_;
154
155 IBPolicy policy_;
156
157
158 // Private member functions:
159 void defaultInitializeAll_();
160
161};
162
163
168template<class Scalar>
169RCP<InterpolationBuffer<Scalar> > interpolationBuffer(
170 const RCP<InterpolatorBase<Scalar> >& interpolator = Teuchos::null,
171 int storage = 0
172 )
173{
174 RCP<InterpolationBuffer<Scalar> > ib = rcp(new InterpolationBuffer<Scalar>());
175 ib->initialize(interpolator, storage);
176 return ib;
177}
178
179
180} // namespace Rythmos
181
182
183#endif // Rythmos_INTERPOLATION_BUFFER_DECL_H
Base class for an interpolation buffer.
concrete class for interpolation buffer functionality.
RCP< Teuchos::ParameterList > getNonconstParameterList()
int getOrder() const
Get order of interpolation.
void addPoints(const Array< Scalar > &time_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &x_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &xdot_vec)
Add point to buffer.
void removeNodes(Array< Scalar > &time_vec)
Remove interpolation nodes.
void initialize(const RCP< InterpolatorBase< Scalar > > &interpolator, int storage)
Initialize the buffer:
RCP< InterpolationBuffer< Scalar > > interpolationBuffer(const RCP< InterpolatorBase< Scalar > > &interpolator=Teuchos::null, int storage=0)
Nonmember constructor.
RCP< InterpolatorBase< Scalar > > getNonconstInterpolator()
RCP< InterpolatorBase< Scalar > > unSetInterpolator()
Unset the interpolator for this buffer.
void setStorage(int storage)
Set the maximum storage of this buffer.
void getPoints(const Array< Scalar > &time_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *x_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *xdot_vec, Array< ScalarMag > *accuracy_vec) const
Get value from buffer.
void setInterpolator(const RCP< InterpolatorBase< Scalar > > &interpolator)
Redefined from Rythmos::InterpolatorAcceptingObjectBase.
std::string description() const
Redefined from Teuchos::Describable.
int getStorage() const
Get the maximum storage of this buffer.
RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Redefined from Rythmos::InterpolationBufferBase.
void setParameterList(RCP< Teuchos::ParameterList > const &paramList)
Redefined from Teuchos::ParameterListAcceptor.
RCP< const InterpolatorBase< Scalar > > getInterpolator() const
void getNodes(Array< Scalar > *time_vec) const
Get interpolation nodes.
RCP< Teuchos::ParameterList > unsetParameterList()
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Mix-in interface for objects that accept an interpolator object.
Base strategy class for interpolation functionality.
Represent a time range.