1 /* ***************************************************************** 2 MESQUITE -- The Mesh Quality Improvement Toolkit 3 4 Copyright 2006 Sandia National Laboratories. Developed at the 5 University of Wisconsin--Madison under SNL contract number 6 624796. The U.S. Government and the University of Wisconsin 7 retain certain rights to this software. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2.1 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 (lgpl.txt) along with this library; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 (2006) kraftche@cae.wisc.edu 24 25 ***************************************************************** */ 26 27 28 /** \file ObjectiveFunctionTemplate.hpp 29 * \brief 30 * \author Jason Kraftcheck 31 */ 32 33 #ifndef MSQ_OBJECTIVE_FUNCTION_TEMPLATE_HPP 34 #define MSQ_OBJECTIVE_FUNCTION_TEMPLATE_HPP 35 36 #include "Mesquite.hpp" 37 #include "ObjectiveFunction.hpp" 38 39 namespace MBMesquite { 40 41 /**\brief Base for most concrete objective functions 42 * 43 * Base class for objective functions which are a function 44 * of a quality metric. 45 */ 46 class MESQUITE_EXPORT ObjectiveFunctionTemplate : public ObjectiveFunction 47 { 48 public: 49 ObjectiveFunctionTemplate(QualityMetric * qm=0)50 ObjectiveFunctionTemplate( QualityMetric* qm = 0 ) : qualityMetric(qm) {} 51 52 virtual ~ObjectiveFunctionTemplate(); 53 get_quality_metric() const54 QualityMetric* get_quality_metric() const { return qualityMetric; } 55 set_quality_metric(QualityMetric * metric)56 void set_quality_metric( QualityMetric* metric ) { qualityMetric = metric; } 57 58 virtual bool initialize_block_coordinate_descent( MeshDomainAssoc* mesh_and_domain, 59 const Settings* settings, 60 PatchSet* user_set, 61 MsqError& err ); 62 63 virtual int min_patch_layers() const; 64 65 //!\brief Called at start of instruction queue processing 66 //! 67 //! Do any preliminary global initialization, consistency checking, 68 //! etc. Default implementation does nothing. 69 virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, 70 const Settings* settings, 71 MsqError& err ); 72 73 private: 74 75 QualityMetric* qualityMetric; 76 }; 77 78 } // namespace MBMesquite 79 80 #endif 81