MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2009 Sandia National Laboratories. Developed at the 00005 University of Wisconsin--Madison under SNL contract number 00006 624796. The U.S. Government and the University of Wisconsin 00007 retain certain rights to 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 (2009) [email protected] 00024 00025 ***************************************************************** */ 00026 00027 /** \file PaverMinEdgeLengthWrapper.cpp 00028 * \brief 00029 * \author Jason Kraftcheck 00030 */ 00031 00032 #include "Mesquite.hpp" 00033 #include "PaverMinEdgeLengthWrapper.hpp" 00034 00035 #include "TerminationCriterion.hpp" 00036 #include "InstructionQueue.hpp" 00037 #include "QualityAssessor.hpp" 00038 #include "MeshImpl.hpp" 00039 #include "PlanarDomain.hpp" 00040 00041 #include "ElementPMeanP.hpp" 00042 #include "PMeanPTemplate.hpp" 00043 #include "TrustRegion.hpp" 00044 #include "TQualityMetric.hpp" 00045 #include "IdealShapeTarget.hpp" 00046 #include "TShapeSizeB1.hpp" 00047 #include "RefMeshTargetCalculator.hpp" 00048 #include "ReferenceMesh.hpp" 00049 00050 #include "EdgeLengthMetric.hpp" 00051 #include "LambdaConstant.hpp" 00052 00053 #include "MsqFPE.hpp" 00054 #include "MeshUtil.hpp" 00055 #include "SimpleStats.hpp" 00056 00057 namespace MBMesquite 00058 { 00059 00060 void PaverMinEdgeLengthWrapper::run_wrapper( MeshDomainAssoc* mesh_and_domain, 00061 ParallelMesh* pmesh, 00062 Settings* settings, 00063 QualityAssessor* qa, 00064 MsqError& err ) 00065 { 00066 InstructionQueue q; 00067 Mesh* mesh = mesh_and_domain->get_mesh(); 00068 00069 // calculate average lambda for mesh 00070 ReferenceMesh ref_mesh( mesh ); 00071 RefMeshTargetCalculator W_0( &ref_mesh ); 00072 SimpleStats lambda_stats; 00073 MeshUtil tool( mesh, settings ); 00074 tool.lambda_distribution( lambda_stats, err );MSQ_ERRRTN( err ); 00075 double lambda = lambda_stats.average(); 00076 00077 // create objective function 00078 IdealShapeTarget W_i; 00079 LambdaConstant W( lambda, &W_i ); 00080 TShapeSizeB1 tm; 00081 TQualityMetric mu_0( &W, &tm ); 00082 ElementPMeanP mu( 1.0, &mu_0 ); 00083 PMeanPTemplate of( 1.0, &mu ); 00084 00085 // create quality assessor 00086 EdgeLengthMetric len( 0.0 ); 00087 qa->add_quality_assessment( &mu ); 00088 qa->add_quality_assessment( &len ); 00089 q.add_quality_assessor( qa, err ); 00090 00091 // create solver 00092 TrustRegion solver( &of ); 00093 TerminationCriterion tc, ptc; 00094 tc.add_absolute_vertex_movement( maxVtxMovement ); 00095 tc.add_iteration_limit( iterationLimit ); 00096 ptc.add_iteration_limit( pmesh ? parallelIterations : 1 ); 00097 solver.set_inner_termination_criterion( &tc ); 00098 solver.set_outer_termination_criterion( &ptc ); 00099 q.set_master_quality_improver( &solver, err );MSQ_ERRRTN( err ); 00100 q.add_quality_assessor( qa, err ); 00101 00102 // Optimize mesh 00103 q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_CHKERR( err ); 00104 } 00105 00106 } // namespace MBMesquite