Rythmos - Transient Integration for Differential Equations Version of the Day
Rythmos_DataStore_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., 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_DATA_STORE_DECL_H
00030 #define Rythmos_DATA_STORE_DECL_H
00031 
00032 #include "Rythmos_Types.hpp"
00033 #include "Thyra_VectorBase.hpp"
00034 #include "Teuchos_Describable.hpp"
00035 
00036 namespace Rythmos {
00037 
00038 template<class Scalar>
00039 class DataStore : virtual public Teuchos::Describable
00040 {
00041 
00042   public:
00043 
00044     typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00045 
00047     ~DataStore() {};
00048 
00050     DataStore();
00051 
00053     // This is a shallow copy constructor, use clone for a deep copy
00054     DataStore(Scalar& time_
00055       ,const Teuchos::RCP<const Thyra::VectorBase<Scalar> >& x_
00056       ,const Teuchos::RCP<const Thyra::VectorBase<Scalar> >& xdot_
00057       ,ScalarMag& accuracy_);
00058 
00060     // This is a shallow copy constructor, use clone for a deep copy
00061     DataStore(const DataStore<Scalar>& ds_in);
00062     
00064     // This is a deep clone and copies the underlying vectors
00065     RCP<DataStore<Scalar> > clone() const;
00066 
00068     Scalar time;
00069 
00071     Teuchos::RCP<const Thyra::VectorBase<Scalar> > x;
00072 
00074     Teuchos::RCP<const Thyra::VectorBase<Scalar> > xdot;
00075 
00077     ScalarMag accuracy;
00078 
00080     bool operator< (const DataStore<Scalar>& ds) const;
00081 
00083     bool operator<= (const DataStore<Scalar>& ds) const;
00084 
00086     bool operator< (const Scalar& t) const;
00087 
00089     bool operator<= (const Scalar& t) const;
00090 
00092     bool operator> (const DataStore<Scalar>& ds) const;
00093 
00095     bool operator>= (const DataStore<Scalar>& ds) const;
00096 
00098     bool operator> (const Scalar& t) const;
00099 
00101     bool operator>= (const Scalar& t) const;
00102 
00104     bool operator== (const DataStore<Scalar>& ds) const;
00105 
00107     bool operator== (const Scalar& t) const;
00108 
00110     typedef Array<DataStore<Scalar> > DataStoreVector_t;
00111 
00113     typedef Array<const DataStore<Scalar> > constDataStoreVector_t;
00114 
00116     typedef std::list<DataStore<Scalar> > DataStoreList_t;
00117 
00119     typedef std::list<const DataStore<Scalar> > constDataStoreList_t;
00120 
00122 
00123     std::string description() const;
00124 
00127     void describe(
00128       Teuchos::FancyOStream       &out
00129       ,const Teuchos::EVerbosityLevel      verbLevel
00130       ) const;
00131 };
00132 
00133 
00134 // This is a helper function to convert a vector of DataStore objects to vectors of t,x,xdot,accuracy
00135 template<class Scalar>
00136 void dataStoreVectorToVector(
00137       const typename DataStore<Scalar>::DataStoreVector_t &ds
00138       ,Array<Scalar> *time_vec
00139       ,Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > *x_vec
00140       ,Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > *xdot_vec
00141       ,Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> *accuracy_vec);
00142 
00143 // This is a helper function to convert vectors of t,x,xdot,accuracy to a vector of DataStore objects
00144 template<class Scalar>
00145 void vectorToDataStoreVector(
00146       const Array<Scalar> &time_vec
00147       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &x_vec
00148       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &xdot_vec
00149       ,const Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &accuracy_vec
00150       ,typename DataStore<Scalar>::DataStoreVector_t *ds);
00151 
00152 // This is a helper function to convert vectors of t,x,xdot,[accuracy] to a list of DataStore objects
00153 template<class Scalar>
00154 void vectorToDataStoreList(
00155       const Array<Scalar> &time_vec
00156       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &x_vec
00157       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &xdot_vec
00158       ,const Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &accuracy_vec
00159       ,typename DataStore<Scalar>::DataStoreList_t *ds);
00160 
00161 template<class Scalar>
00162 void vectorToDataStoreList(
00163       const Array<Scalar> &time_vec
00164       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &x_vec
00165       ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > &xdot_vec
00166       ,typename DataStore<Scalar>::DataStoreList_t *ds);
00167 
00168 } // namespace Rythmos
00169 
00170 #endif // Rythmos_DATA_STORE_DECL_H
00171 
 All Classes Functions Variables Typedefs Friends