MOAB: Mesh Oriented datABase  (version 5.3.1)
SizeAdaptShapeWrapper.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 SizeAdaptShapeWrapper.cpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #include "Mesquite.hpp"
00033 #include "SizeAdaptShapeWrapper.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 "PMeanPTemplate.hpp"
00042 #include "ElementPMeanP.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 #include "TagVertexMesh.hpp"
00050 #include "LambdaTarget.hpp"
00051 #include "EdgeLengthMetric.hpp"
00052 
00053 namespace MBMesquite
00054 {
00055 
00056 void SizeAdaptShapeWrapper::run_wrapper( MeshDomainAssoc* mesh_and_domain, ParallelMesh* pmesh, Settings* settings,
00057                                          QualityAssessor* qa, MsqError& err )
00058 {
00059     InstructionQueue q;
00060     Mesh* mesh = mesh_and_domain->get_mesh();
00061 
00062     // calculate average lambda for mesh
00063     TagVertexMesh init_mesh( err, mesh );MSQ_ERRRTN( err );
00064     ReferenceMesh ref_mesh( &init_mesh );
00065     RefMeshTargetCalculator W_0( &ref_mesh );
00066     q.add_tag_vertex_mesh( &init_mesh, err );MSQ_ERRRTN( err );
00067 
00068     // create objective function
00069     IdealShapeTarget W_i;
00070     LambdaTarget W( &W_0, &W_i );
00071     TShapeSizeB1 tm;
00072     TQualityMetric mu_0( &W, &tm );
00073     ElementPMeanP mu( 1.0, &mu_0 );
00074     PMeanPTemplate of( 1.0, &mu );
00075 
00076     // create quality assessor
00077     EdgeLengthMetric len( 0.0 );
00078     qa->add_quality_assessment( &mu );
00079     qa->add_quality_assessment( &len );
00080     q.add_quality_assessor( qa, err );
00081 
00082     // create solver
00083     TrustRegion solver( &of );
00084     TerminationCriterion tc, ptc;
00085     tc.add_absolute_vertex_movement( maxVtxMovement );
00086     tc.add_iteration_limit( iterationLimit );
00087     ptc.add_iteration_limit( pmesh ? parallelIterations : 1 );
00088     solver.set_inner_termination_criterion( &tc );
00089     solver.set_outer_termination_criterion( &ptc );
00090     q.set_master_quality_improver( &solver, err );MSQ_ERRRTN( err );
00091     q.add_quality_assessor( qa, err );
00092 
00093     // Optimize mesh
00094     q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_CHKERR( err );
00095 }
00096 
00097 }  // namespace MBMesquite
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines