MOAB: Mesh Oriented datABase
(version 5.4.1)
|
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 VertexMover.hpp 00029 \brief 00030 00031 The VertexMover Class is the base class for all the smoothing and 00032 optimizing algorythms 00033 00034 \author Thomas Leurent 00035 \date 2002-01-17 00036 */ 00037 00038 #ifndef Mesquite_VertexMover_hpp 00039 #define Mesquite_VertexMover_hpp 00040 00041 #include "Mesquite.hpp" 00042 #include "QualityImprover.hpp" 00043 #include "OFEvaluator.hpp" 00044 #include "MeshInterface.hpp" 00045 00046 namespace MBMesquite 00047 { 00048 class ObjectiveFunction; 00049 class PatchData; 00050 class ParallelMesh; 00051 00052 /*! \class VertexMover 00053 Base class for all Vertex Movers. 00054 */ 00055 class MESQUITE_EXPORT VertexMover : public QualityImprover 00056 { 00057 protected: 00058 VertexMover( ObjectiveFunction* OF = NULL ); 00059 00060 public: 00061 // virtual destructor ensures use of polymorphism during destruction 00062 virtual ~VertexMover(); 00063 00064 virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err ); 00065 00066 virtual double loop_over_mesh( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err ); 00067 00068 virtual double loop_over_mesh( ParallelMesh* mesh, MeshDomain* domain, const Settings* settings, MsqError& err ); 00069 00070 /**\brief Do Nash-game type optimization 00071 * 00072 * Default, opposite of \c do_block_coordinate_descent(). 00073 */ 00074 inline void do_nash_game_optimization() 00075 { 00076 objFuncEval.do_nash_game(); 00077 } 00078 00079 /**\brief Check if optmizer will do Nash-game type optimization 00080 * 00081 * Default, opposite of \c is_block_coordinate_descent_optimization(). 00082 */ 00083 inline bool is_nash_game_optimization() const 00084 { 00085 return objFuncEval.is_nash_game(); 00086 } 00087 00088 /**\brief Do block coordinate descent optimization 00089 * 00090 * Opposite of \c do_nash_game(). 00091 */ 00092 inline void do_block_coordinate_descent_optimization() 00093 { 00094 objFuncEval.do_block_coordinate_descent(); 00095 } 00096 00097 /**\brief Check if optmizer will do block coordinate descent type optimization 00098 * 00099 * Default, opposite of \c is_nash_game_optimization(). 00100 */ 00101 inline bool is_block_coordinate_descent_optimization() const 00102 { 00103 return objFuncEval.is_block_coordinate_descent(); 00104 } 00105 00106 /**\brief Use Jacobi iteration for optimization 00107 * 00108 * Opposite of \c do_gauss_optimization() 00109 */ 00110 inline void do_jacobi_optimization() 00111 { 00112 jacobiOpt = true; 00113 } 00114 00115 /**\brief Check if optimization will use Jacobi iteration 00116 * 00117 * Opposite of \c is_gauss_optimization() 00118 */ 00119 inline bool is_jacobi_optimization() const 00120 { 00121 return jacobiOpt; 00122 } 00123 00124 /**\brief Use Gauss-Seidel iteration for optimization 00125 * 00126 * Default, opposite of \c do_jacobi_optimization() 00127 */ 00128 inline void do_gauss_optimization() 00129 { 00130 jacobiOpt = false; 00131 } 00132 00133 /**\brief Check if optimization will use Gauss-Seidel iteration 00134 * 00135 * Default, opposite of \c is_jacobi_optimization() 00136 */ 00137 inline bool is_gauss_optimization() const 00138 { 00139 return !jacobiOpt; 00140 } 00141 00142 protected: 00143 virtual void initialize( PatchData& pd, MsqError& err ) = 0; 00144 virtual void cleanup() = 0; 00145 virtual void optimize_vertex_positions( PatchData& pd, 00146 MsqError& err ) = 0; // modifies the PatchData object 00147 00148 virtual void initialize_mesh_iteration( PatchData& pd, MsqError& err ) = 0; 00149 virtual void terminate_mesh_iteration( PatchData&, MsqError& err ) = 0; 00150 00151 OFEvaluator& get_objective_function_evaluator() 00152 { 00153 return objFuncEval; 00154 } 00155 00156 static TagHandle get_jacobi_coord_tag( Mesh* mesh, MsqError& err ); 00157 static void commit_jacobi_coords( TagHandle tag, Mesh* mesh, MsqError& err ); 00158 00159 private: 00160 OFEvaluator objFuncEval; 00161 bool jacobiOpt; 00162 }; 00163 00164 } // namespace MBMesquite 00165 #endif // Mesquite_VertexMover_hpp