MOAB: Mesh Oriented datABase  (version 5.3.0)
ConjugateGradient.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
00024     pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
00025 
00026   ***************************************************************** */
00027 /*!
00028   \file   ConjugateGradient.hpp
00029   \brief
00030 
00031   Conjugate Gradient minimization method ...
00032 
00033   \author Michael Brewer
00034   \date   2002-06/19
00035 */
00036 
00037 #ifndef Mesquite_ConjugateGradient_hpp
00038 #define Mesquite_ConjugateGradient_hpp
00039 #include "Mesquite.hpp"
00040 #include "VertexMover.hpp"
00041 #include "PatchData.hpp"
00042 #include "PatchSetUser.hpp"
00043 
00044 namespace MBMesquite
00045 {
00046 class ObjectiveFunction;
00047 
00048 /*! \class ConjugateGradient
00049   \brief Optimizes the objective function using the Polack-Ribiere scheme.
00050  */
00051 class ConjugateGradient : public VertexMover, public PatchSetUser
00052 {
00053   public:
00054     MESQUITE_EXPORT ConjugateGradient( ObjectiveFunction* objective );
00055     MESQUITE_EXPORT ConjugateGradient( ObjectiveFunction* objective, MsqError& err );
00056 
00057     MESQUITE_EXPORT virtual ~ConjugateGradient();
00058 
00059     MESQUITE_EXPORT virtual std::string get_name() const;
00060 
00061     virtual PatchSet* get_patch_set();
00062 
00063     //! Just for debugging purposes or for obtaining more data
00064     //! during the optimization process.
00065     MESQUITE_EXPORT void set_debugging_level( int new_lev )
00066     {
00067         conjGradDebug = new_lev;
00068     }
00069 
00070   protected:
00071     //! Initialize data for smoothing process
00072     virtual void initialize( PatchData& pd, MsqError& err );
00073 
00074     virtual void optimize_vertex_positions( PatchData& pd, MsqError& err );
00075 
00076     virtual void initialize_mesh_iteration( PatchData& pd, MsqError& err );
00077 
00078     virtual void terminate_mesh_iteration( PatchData& pd, MsqError& err );
00079 
00080     //! Delete arrays initially created in initialize().
00081     virtual void cleanup();
00082 
00083     //! Returns the step distance to take in the search direction.
00084     double get_step( PatchData& pd, double f0, int& j, MsqError& err );
00085 
00086     //! Culls the vertex list free_vertex_list.
00087     // void cull_list(PatchData &pd, double beta, MsqError &err);
00088 
00089   private:
00090     std::vector< Vector3D > fGrad, pGrad, fNewGrad;
00091     PatchDataVerticesMemento* pMemento;
00092     // just for debugging
00093     int conjGradDebug;
00094 };
00095 
00096 }  // namespace MBMesquite
00097 
00098 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines