AbstractLinAlgPack_MA28Solver.cpp

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 #include "Moocho_ConfigDefs.hpp"
00030 
00031 
00032 #ifdef HAVE_MOOCHO_MA28
00033 
00034 
00035 #include "AbstractLinAlgPack_MA28Solver.hpp"
00036 
00037 // Initialize static variables
00038 MA28_Cpp::MA28Solver* MA28_Cpp::MA28Solver::curr_solver_ = 0;
00039 
00040 // Initialize the references to the ma28 common blocks defined in the fortran code.
00041 MA28_Cpp::MA28CommonBlockReferences MA28_Cpp::MA28Solver::ma28_common_blocks_(
00042     MA28_CppDecl::ma28ed_cb,
00043     MA28_CppDecl::ma28fd_cb,
00044     MA28_CppDecl::ma28gd_cb,
00045     MA28_CppDecl::ma28hd_cb,
00046     MA28_CppDecl::ma30ed_cb,
00047     MA28_CppDecl::ma30fd_cb,
00048     MA28_CppDecl::ma30gd_cb,
00049     MA28_CppDecl::ma30hd_cb,
00050     MA28_CppDecl::ma30id_cb,
00051     MA28_CppDecl::mc23bd_cb
00052   );
00053 
00054 // Save the default values of the ma28 common block variables.
00055 // By setting the references to the common block variables first we are guarented that
00056 // references will be bound to the proper memory locations.  The only problem with this is that
00057 // how can I be sure that the initializations for the fortran BLOCK DATA units have
00058 // be performed before these global initializations are carried out.  I need to look into this in
00059 // different platforms to ensure that this will work.  Otherwise I will just have to set the
00060 // default values myself.
00061 MA28_Cpp::MA28CommonBlockStorage MA28_Cpp::MA28Solver::default_common_blocks_(
00062   MA28Solver::ma28_common_blocks_);
00063 
00064 // ///////////////////////////////
00065 // Member functions
00066 
00067 MA28_Cpp::MA28Solver::MA28Solver()
00068   : common_blocks_(default_common_blocks_), changed_(false)
00069 {
00070   mp(0);  // We can't print to standard fortran streams from C++
00071   lp(0);
00072 }
00073 
00074 MA28_Cpp::MA28Solver::MA28Solver(const MA28Solver& s)
00075   : common_blocks_(s.common_blocks_), changed_(false)
00076 {}
00077 
00078 void MA28_Cpp::MA28Solver::set_common_block_data() {
00079   // Copy to the ma28 ma28 common blocks if this is not the current solver.
00080   if( (this != curr_solver_ )|| ( (this == curr_solver_) && changed_ ) )
00081     ma28_common_blocks_ = common_blocks_;
00082   // Make this solver the current solver
00083   curr_solver_ = this;
00084   changed_ = false;
00085 }
00086 
00087 void MA28_Cpp::MA28Solver::get_common_block_data() {
00088   // You must save the common block data back in order to get the return parameters.
00089   // Later I should differentiate what is control and what is return but for
00090   // now this is the easiest thing to do.
00091   common_blocks_ = ma28_common_blocks_;
00092 }
00093 
00094 
00095 #endif // HAVE_MOOCHO_MA28
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Generated on Wed Apr 13 10:09:15 2011 for AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects by  doxygen 1.6.3