include/deal.II/lac/swappable_vector.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: swappable_vector.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //---------------------------------------------------------------------------
00012 #ifndef __deal2__swappable_vector_h
00013 #define __deal2__swappable_vector_h
00014 
00015 
00016 #include <deal.II/base/config.h>
00017 #include <deal.II/base/thread_management.h>
00018 #include <deal.II/lac/vector.h>
00019 #include <string>
00020 
00021 DEAL_II_NAMESPACE_OPEN
00022 
00051 template <typename number>
00052 class SwappableVector : public Vector<number>
00053 {
00054   public:
00061     SwappableVector ();
00062 
00075     SwappableVector (const SwappableVector &v);
00076 
00083     virtual ~SwappableVector ();
00084 
00092     SwappableVector & operator = (const SwappableVector &);
00093 
00116     void swap_out (const std::string &filename);
00117 
00134     void reload ();
00135 
00169     void alert ();
00170 
00171 
00187     void kill_file ();
00188 
00199     const std::string & get_filename () const;
00200 
00206     std::size_t memory_consumption () const;
00207 
00213     DeclException0 (ExcSizeZero);
00217     DeclException0 (ExcSizeNonzero);
00221     DeclException1 (ExcInvalidFilename,
00222                     std::string,
00223                     << "The filename <" << arg1
00224                     << "> is not a valid one here.");
00228     DeclException0 (ExcInvalidCopyOperation);
00230   private:
00241     std::string filename;
00242 
00256     Threads::ThreadMutex lock;
00257 
00265     bool data_is_preloaded;
00266 
00284     void reload_vector (const bool set_flag);
00285 };
00286 
00288 /*----------------------------   swappable_vector.h     ---------------------------*/
00289 /* end of #ifndef __deal2__swappable_vector_h */
00290 DEAL_II_NAMESPACE_CLOSE
00291 
00292 #endif
00293 /*----------------------------   swappable_vector.h     ---------------------------*/
00294 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Wed May 23 2012 12:03:29 by doxygen 1.7.3