void test_lapl_geo_sphere() { Mesquite::MeshImpl mesh; Mesquite::MsqPrintError err(cout); mesh.read_vtk(MESH_FILES_DIR "2D/vtk/tris/untangled/Mesquite_geo_10242.vtk", err); //create geometry sphere: ratius 1, centered at (0,0,0) Vector3D center(0,0,0); Mesquite::SphericalDomain msq_geom(center, 1.0); // creates an intruction queue InstructionQueue queue1; // creates an edge length metric ... EdgeLengthQualityMetric edg_len; //create the laplacian smoother LaplacianSmoother lapl; //Make sure no errors CPPUNIT_ASSERT(!err); //create a quality assessor QualityAssessor qa=QualityAssessor( &edg_len ); //*******Set stopping criterion 10 iterates *********** //StoppingCriterion sc10(StoppingCriterion::NUMBER_OF_PASSES,10); //lapl->set_stopping_criterion(&sc10); TerminationCriterion sc10; sc10.add_iteration_limit( 10 ); lapl.set_outer_termination_criterion(&sc10); //qa, qi, qa queue1.set_master_quality_improver(&lapl, err); //Make sure no errors CPPUNIT_ASSERT(!err); // launches optimization on mesh_set1 MeshDomainAssoc mesh_and_domain = MeshDomainAssoc(&mesh, &msq_geom); double orig_qa_val=qa.loop_over_mesh(&mesh_and_domain, 0, err); //Make sure no errors CPPUNIT_ASSERT(!err); queue1.run_instructions(&mesh_and_domain, err); CPPUNIT_ASSERT(!err); //Make sure no errors CPPUNIT_ASSERT(!err); double fin_qa_val=qa.loop_over_mesh(&mesh_and_domain, 0, err); //Make sure no errors CPPUNIT_ASSERT(!err); //make sure 'quality' improved CPPUNIT_ASSERT( fin_qa_val <= orig_qa_val ); }
//! Constructor sets the instructions in the queue. LaplacianIQ() { MsqError err; // creates a mean ratio quality metric ... inverseMeanRatio = new IdealWeightInverseMeanRatio(err); // creates the laplacian smoother procedures lapl1 = new LaplacianSmoother(err); mQA = new QualityAssessor(inverseMeanRatio,QualityAssessor::MAXIMUM, err); //**************Set stopping criterion**************** mTerm = new TerminationCriterion(); mTerm->add_criterion_type_with_int(TerminationCriterion::NUMBER_OF_ITERATES,10,err); lapl1->set_outer_termination_criterion(mTerm); // sets a culling method on the first QualityImprover lapl1->add_culling_method(PatchData::NO_BOUNDARY_VTX); // adds 1 pass of pass1 this->add_quality_assessor(mQA,err); MSQ_CHKERR(err); this->set_master_quality_improver(lapl1, err); MSQ_CHKERR(err); this->add_quality_assessor(mQA,err); MSQ_CHKERR(err); }