AbstractLinAlgPack_MA28CommonBlockEncap.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) 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 Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 //
00029 // These classes are used to encapsulate the copy of ma28 common block data from
00030 // on set to another.
00031 
00032 #ifndef MA28_COMMON_BLOCK_ENCAP_H
00033 #define MA28_COMMON_BLOCK_ENCAP_H
00034 
00035 #include <iostream>
00036 
00037 #include "AbstractLinAlgPack_MA28_CppDecl.hpp"
00038 
00039 namespace MA28_Cpp {
00040 
00041   using MA28_CppDecl::MA28ED_struct;
00042   using MA28_CppDecl::MA28FD_struct;
00043   using MA28_CppDecl::MA28GD_struct;
00044   using MA28_CppDecl::MA28HD_struct;
00045   using MA28_CppDecl::MA30ED_struct;
00046   using MA28_CppDecl::MA30FD_struct;
00047   using MA28_CppDecl::MA30GD_struct;
00048   using MA28_CppDecl::MA30HD_struct;
00049   using MA28_CppDecl::MA30ID_struct;
00050   using MA28_CppDecl::MC23BD_struct;
00051 
00052 class MA28CommonBlockStorage; // forward declaration
00053 
00054 // This is a class for storing the references to MA28 common blocks.
00055 // It is used to simplify copy of common block members.
00056 class MA28CommonBlockReferences {
00057 public:
00058   // Construct with references.
00059   MA28CommonBlockReferences(
00060     MA28ED_struct& ma28ed,
00061     MA28FD_struct& ma28fd,
00062     MA28GD_struct& ma28gd,
00063     MA28HD_struct& ma28hd,
00064     MA30ED_struct& ma30ed,
00065     MA30FD_struct& ma30fd,
00066     MA30GD_struct& ma30gd,
00067     MA30HD_struct& ma30hd,
00068     MA30ID_struct& ma30id,
00069     MC23BD_struct& mc23bd
00070     ) :
00071     ma28ed_(ma28ed),
00072     ma28fd_(ma28fd),
00073     ma28gd_(ma28gd),
00074     ma28hd_(ma28hd),
00075     ma30ed_(ma30ed),
00076     ma30fd_(ma30fd),
00077     ma30gd_(ma30gd),
00078     ma30hd_(ma30hd),
00079     ma30id_(ma30id),
00080     mc23bd_(mc23bd)
00081   {}
00082 
00083   // Use default copy constructor ....
00084 
00085   // public reference members
00086   MA28ED_struct& ma28ed_;
00087   MA28FD_struct& ma28fd_;
00088   MA28GD_struct& ma28gd_;
00089   MA28HD_struct& ma28hd_;
00090   MA30ED_struct& ma30ed_;
00091   MA30FD_struct& ma30fd_;
00092   MA30GD_struct& ma30gd_;
00093   MA30HD_struct& ma30hd_;
00094   MA30ID_struct& ma30id_;
00095   MC23BD_struct& mc23bd_;
00096 
00097   // Assignment operator
00098   MA28CommonBlockReferences& operator=(const MA28CommonBlockStorage& ma28cbs);
00099 
00100   // Use default assignment operator ....
00101 
00102   // Output common block info to a ostream
00103   void dump_values(std::ostream& o);
00104 private:
00105   MA28CommonBlockReferences(); // not defined and not to be called.
00106 };
00107 
00108 // This is a storage class for MA28 common blocks.  It is ment to be
00109 // used by objects that wish to save the state of MA28.  The default
00110 // C++ copy constructor and assignment operator are use since a 
00111 // memberwise copy of member data is exactly what I want.
00112 class MA28CommonBlockStorage {
00113 public:
00114   // Use default constructor ....
00115   // Use default copy constructor .....
00116   
00117   // Copy the values
00118   MA28CommonBlockStorage(const MA28CommonBlockReferences& cb) :
00119     ma28ed_(cb.ma28ed_),
00120     ma28fd_(cb.ma28fd_),
00121     ma28gd_(cb.ma28gd_),
00122     ma28hd_(cb.ma28hd_),
00123     ma30ed_(cb.ma30ed_),
00124     ma30fd_(cb.ma30fd_),
00125     ma30gd_(cb.ma30gd_),
00126     ma30hd_(cb.ma30hd_),
00127     ma30id_(cb.ma30id_),
00128     mc23bd_(cb.mc23bd_)
00129   {}
00130 
00131   // Public storage members
00132   MA28ED_struct ma28ed_;
00133   MA28FD_struct ma28fd_;
00134   MA28GD_struct ma28gd_;
00135   MA28HD_struct ma28hd_;
00136   MA30ED_struct ma30ed_;
00137   MA30FD_struct ma30fd_;
00138   MA30GD_struct ma30gd_;
00139   MA30HD_struct ma30hd_;
00140   MA30ID_struct ma30id_;
00141   MC23BD_struct mc23bd_;
00142 
00143   // Assignment operator
00144   MA28CommonBlockStorage& operator=(const MA28CommonBlockReferences& ma28cbs);
00145 
00146   // Use default assignment operator
00147 
00148   // Output common block info to a ostream
00149   void dump_values(std::ostream& o);
00150 
00151 };
00152 
00153 } // end namespace MA28_Cpp
00154 
00155 #endif // MA28_COMMON_BLOCK_ENCAP_H

Generated on Thu Sep 18 12:35:11 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1