MOOCHO (Single Doxygen Collection) Version of the Day
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 //
00042 // These classes are used to encapsulate the copy of ma28 common block data from
00043 // on set to another.
00044 
00045 #ifndef MA28_COMMON_BLOCK_ENCAP_H
00046 #define MA28_COMMON_BLOCK_ENCAP_H
00047 
00048 #include <iostream>
00049 
00050 #include "AbstractLinAlgPack_MA28_CppDecl.hpp"
00051 
00052 namespace MA28_Cpp {
00053 
00054   using MA28_CppDecl::MA28ED_struct;
00055   using MA28_CppDecl::MA28FD_struct;
00056   using MA28_CppDecl::MA28GD_struct;
00057   using MA28_CppDecl::MA28HD_struct;
00058   using MA28_CppDecl::MA30ED_struct;
00059   using MA28_CppDecl::MA30FD_struct;
00060   using MA28_CppDecl::MA30GD_struct;
00061   using MA28_CppDecl::MA30HD_struct;
00062   using MA28_CppDecl::MA30ID_struct;
00063   using MA28_CppDecl::MC23BD_struct;
00064 
00065 class MA28CommonBlockStorage; // forward declaration
00066 
00067 // This is a class for storing the references to MA28 common blocks.
00068 // It is used to simplify copy of common block members.
00069 class MA28CommonBlockReferences {
00070 public:
00071   // Construct with references.
00072   MA28CommonBlockReferences(
00073     MA28ED_struct& ma28ed,
00074     MA28FD_struct& ma28fd,
00075     MA28GD_struct& ma28gd,
00076     MA28HD_struct& ma28hd,
00077     MA30ED_struct& ma30ed,
00078     MA30FD_struct& ma30fd,
00079     MA30GD_struct& ma30gd,
00080     MA30HD_struct& ma30hd,
00081     MA30ID_struct& ma30id,
00082     MC23BD_struct& mc23bd
00083     ) :
00084     ma28ed_(ma28ed),
00085     ma28fd_(ma28fd),
00086     ma28gd_(ma28gd),
00087     ma28hd_(ma28hd),
00088     ma30ed_(ma30ed),
00089     ma30fd_(ma30fd),
00090     ma30gd_(ma30gd),
00091     ma30hd_(ma30hd),
00092     ma30id_(ma30id),
00093     mc23bd_(mc23bd)
00094   {}
00095 
00096   // Use default copy constructor ....
00097 
00098   // public reference members
00099   MA28ED_struct& ma28ed_;
00100   MA28FD_struct& ma28fd_;
00101   MA28GD_struct& ma28gd_;
00102   MA28HD_struct& ma28hd_;
00103   MA30ED_struct& ma30ed_;
00104   MA30FD_struct& ma30fd_;
00105   MA30GD_struct& ma30gd_;
00106   MA30HD_struct& ma30hd_;
00107   MA30ID_struct& ma30id_;
00108   MC23BD_struct& mc23bd_;
00109 
00110   // Assignment operator
00111   MA28CommonBlockReferences& operator=(const MA28CommonBlockStorage& ma28cbs);
00112 
00113   // Use default assignment operator ....
00114 
00115   // Output common block info to a ostream
00116   void dump_values(std::ostream& o);
00117 private:
00118   MA28CommonBlockReferences(); // not defined and not to be called.
00119 };
00120 
00121 // This is a storage class for MA28 common blocks.  It is ment to be
00122 // used by objects that wish to save the state of MA28.  The default
00123 // C++ copy constructor and assignment operator are use since a 
00124 // memberwise copy of member data is exactly what I want.
00125 class MA28CommonBlockStorage {
00126 public:
00127   // Use default constructor ....
00128   // Use default copy constructor .....
00129   
00130   // Copy the values
00131   MA28CommonBlockStorage(const MA28CommonBlockReferences& cb) :
00132     ma28ed_(cb.ma28ed_),
00133     ma28fd_(cb.ma28fd_),
00134     ma28gd_(cb.ma28gd_),
00135     ma28hd_(cb.ma28hd_),
00136     ma30ed_(cb.ma30ed_),
00137     ma30fd_(cb.ma30fd_),
00138     ma30gd_(cb.ma30gd_),
00139     ma30hd_(cb.ma30hd_),
00140     ma30id_(cb.ma30id_),
00141     mc23bd_(cb.mc23bd_)
00142   {}
00143 
00144   // Public storage members
00145   MA28ED_struct ma28ed_;
00146   MA28FD_struct ma28fd_;
00147   MA28GD_struct ma28gd_;
00148   MA28HD_struct ma28hd_;
00149   MA30ED_struct ma30ed_;
00150   MA30FD_struct ma30fd_;
00151   MA30GD_struct ma30gd_;
00152   MA30HD_struct ma30hd_;
00153   MA30ID_struct ma30id_;
00154   MC23BD_struct mc23bd_;
00155 
00156   // Assignment operator
00157   MA28CommonBlockStorage& operator=(const MA28CommonBlockReferences& ma28cbs);
00158 
00159   // Use default assignment operator
00160 
00161   // Output common block info to a ostream
00162   void dump_values(std::ostream& o);
00163 
00164 };
00165 
00166 } // end namespace MA28_Cpp
00167 
00168 #endif // MA28_COMMON_BLOCK_ENCAP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines