AbstractLinAlgPack_MA28Solver.cpp

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

Generated on Wed May 12 21:52:26 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7