MOAB: Mesh Oriented datABase  (version 5.3.1)
PaverMinEdgeLengthWrapper.cpp
Go to the documentation of this file.
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) kraftche@cae.wisc.edu
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, ParallelMesh* pmesh, Settings* settings,
00061                                              QualityAssessor* qa, MsqError& err )
00062 {
00063     InstructionQueue q;
00064     Mesh* mesh = mesh_and_domain->get_mesh();
00065 
00066     // calculate average lambda for mesh
00067     ReferenceMesh ref_mesh( mesh );
00068     RefMeshTargetCalculator W_0( &ref_mesh );
00069     SimpleStats lambda_stats;
00070     MeshUtil tool( mesh, settings );
00071     tool.lambda_distribution( lambda_stats, err );MSQ_ERRRTN( err );
00072     double lambda = lambda_stats.average();
00073 
00074     // create objective function
00075     IdealShapeTarget W_i;
00076     LambdaConstant W( lambda, &W_i );
00077     TShapeSizeB1 tm;
00078     TQualityMetric mu_0( &W, &tm );
00079     ElementPMeanP mu( 1.0, &mu_0 );
00080     PMeanPTemplate of( 1.0, &mu );
00081 
00082     // create quality assessor
00083     EdgeLengthMetric len( 0.0 );
00084     qa->add_quality_assessment( &mu );
00085     qa->add_quality_assessment( &len );
00086     q.add_quality_assessor( qa, err );
00087 
00088     // create solver
00089     TrustRegion solver( &of );
00090     TerminationCriterion tc, ptc;
00091     tc.add_absolute_vertex_movement( maxVtxMovement );
00092     tc.add_iteration_limit( iterationLimit );
00093     ptc.add_iteration_limit( pmesh ? parallelIterations : 1 );
00094     solver.set_inner_termination_criterion( &tc );
00095     solver.set_outer_termination_criterion( &ptc );
00096     q.set_master_quality_improver( &solver, err );MSQ_ERRRTN( err );
00097     q.add_quality_assessor( qa, err );
00098 
00099     // Optimize mesh
00100     q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_CHKERR( err );
00101 }
00102 
00103 }  // namespace MBMesquite
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines