MOAB: Mesh Oriented datABase  (version 5.4.1)
CompositeOFAdd.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     [email protected], [email protected], [email protected],
00024     [email protected], [email protected], [email protected]
00025 
00026   ***************************************************************** */
00027 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3
00028 // -*-
00029 
00030 /*! \file CompositeOFAdd.hpp
00031 
00032 Header file for the MBMesquite:: CompositeOFAdd class
00033 
00034   \author Michael Brewer
00035   \date   2002-06-24
00036  */
00037 
00038 #ifndef CompositeOFAdd_hpp
00039 #define CompositeOFAdd_hpp
00040 
00041 #include "Mesquite.hpp"
00042 #include "ObjectiveFunction.hpp"
00043 #include "MsqHessian.hpp"
00044 
00045 namespace MBMesquite
00046 {
00047 /*!\class CompositeOFAdd
00048   \brief Adds two ObjectiveFunction values together.
00049 */
00050 class MsqMeshEntity;
00051 class PatchData;
00052 class MsqError;
00053 class Vector3D;
00054 
00055 class CompositeOFAdd : public ObjectiveFunction
00056 {
00057   public:
00058     MESQUITE_EXPORT
00059     CompositeOFAdd( ObjectiveFunction*, ObjectiveFunction*, bool delete_OFs = false );
00060 
00061     MESQUITE_EXPORT
00062     virtual ~CompositeOFAdd();
00063 
00064     //!\brief Called at start of instruction queue processing
00065     //!
00066     //! Do any preliminary global initialization, consistency checking,
00067     //! etc.
00068     MESQUITE_EXPORT
00069     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00070 
00071     MESQUITE_EXPORT
00072     virtual bool initialize_block_coordinate_descent( MeshDomainAssoc* mesh_and_domain,
00073                                                       const Settings* settings,
00074                                                       PatchSet* user_set,
00075                                                       MsqError& err );
00076 
00077     MESQUITE_EXPORT
00078     virtual bool evaluate( EvalType type, PatchData& pd, double& value_out, bool free, MsqError& err );
00079 
00080     MESQUITE_EXPORT
00081     virtual bool evaluate_with_gradient( EvalType type,
00082                                          PatchData& pd,
00083                                          double& value_out,
00084                                          std::vector< Vector3D >& grad_out,
00085                                          MsqError& err );
00086 
00087     MESQUITE_EXPORT
00088     virtual bool evaluate_with_Hessian_diagonal( EvalType type,
00089                                                  PatchData& pd,
00090                                                  double& value_out,
00091                                                  std::vector< Vector3D >& grad_out,
00092                                                  std::vector< SymMatrix3D >& hess_diag_out,
00093                                                  MsqError& err );
00094 
00095     MESQUITE_EXPORT
00096     virtual bool evaluate_with_Hessian( EvalType type,
00097                                         PatchData& pd,
00098                                         double& value_out,
00099                                         std::vector< Vector3D >& grad_out,
00100                                         MsqHessian& Hessian_out,
00101                                         MsqError& err );
00102 
00103     MESQUITE_EXPORT
00104     virtual ObjectiveFunction* clone() const;
00105 
00106     MESQUITE_EXPORT
00107     virtual void clear();
00108 
00109     MESQUITE_EXPORT
00110     virtual int min_patch_layers() const;
00111 
00112   private:
00113     /** Temporary storage for gradient */
00114     mutable std::vector< Vector3D > mGradient;
00115     /** Temporary storage for hessian diagonal */
00116     mutable std::vector< SymMatrix3D > mDiagonal;
00117     /** Temporary storage for Hessian */
00118     mutable MsqHessian mHessian;
00119 
00120     ObjectiveFunction* objFunc1;
00121     ObjectiveFunction* objFunc2;
00122     bool deleteObjFuncs;
00123 };
00124 }  // namespace MBMesquite
00125 #endif  //  CompositeOFAdd_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines