MOAB: Mesh Oriented datABase  (version 5.2.1)
laplacian_polygon_test.cpp File Reference
#include <iostream>
#include <cstdlib>
#include "TestUtil.hpp"
#include "Mesquite.hpp"
#include "MsqError.hpp"
#include "MeshImpl.hpp"
#include "Vector3D.hpp"
#include "InstructionQueue.hpp"
#include "PatchData.hpp"
#include "TerminationCriterion.hpp"
#include "QualityAssessor.hpp"
#include "PlanarDomain.hpp"
#include "MsqTimer.hpp"
#include "ConditionNumberQualityMetric.hpp"
#include "LInfTemplate.hpp"
#include "SteepestDescent.hpp"
#include "LaplacianSmoother.hpp"
#include "EdgeLengthQualityMetric.hpp"
+ Include dependency graph for laplacian_polygon_test.cpp:

Go to the source code of this file.

Functions

void help (const char *argv0)
int main (int argc, char *argv[])

Variables

std::string DEFAULT_INPUT = "/2D/vtk/N-Polygonal/poly1.vtk"

Function Documentation

void help ( const char *  argv0)

Definition at line 74 of file laplacian_polygon_test.cpp.

References DEFAULT_INPUT.

{
    std::cerr << "Usage: " << argv0 << " [<input_file>] [<output_file>]" << std::endl
              << "  default input file is: " << DEFAULT_INPUT << std::endl
              << "  defualt is no output file" << std::endl;
    exit( 1 );
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 82 of file laplacian_polygon_test.cpp.

References MBMesquite::TerminationCriterion::add_iteration_limit(), MBMesquite::QualityAssessor::add_quality_assessment(), DEFAULT_INPUT, help(), input_file, mesh, MBMesquite::MeshImpl::read_vtk(), MBMesquite::QualityMetric::RMS, MBMesquite::IQInterface::run_instructions(), MBMesquite::AveragingQM::set_averaging_method(), MBMesquite::InstructionQueue::set_master_quality_improver(), MBMesquite::QualityImprover::set_outer_termination_criterion(), MBMesquite::Timer::since_birth(), t, and MBMesquite::MeshImpl::write_vtk().

{
    const char* input_file  = DEFAULT_INPUT.c_str();
    const char* output_file = NULL;
    switch( argc )
    {
        default:
            help( argv[0] );
        case 3:
            if( !strcmp( argv[2], "-h" ) ) help( argv[0] );
            output_file = argv[2];
        case 2:
            if( !strcmp( argv[1], "-h" ) ) help( argv[0] );
            input_file = argv[1];
        case 1:;
    }

    /* Read a VTK Mesh file */
    MsqPrintError err( cout );
    MBMesquite::MeshImpl mesh;
    mesh.read_vtk( input_file, err );
    if( err ) return 1;

    // creates an intruction queue
    InstructionQueue queue1;

    // creates a mean ratio quality metric ...
    ConditionNumberQualityMetric shape_metric;
    EdgeLengthQualityMetric lapl_met;
    lapl_met.set_averaging_method( QualityMetric::RMS );

    // creates the laplacian smoother  procedures
    LaplacianSmoother lapl1;
    QualityAssessor stop_qa = QualityAssessor( &shape_metric );
    stop_qa.add_quality_assessment( &lapl_met );

    //**************Set stopping criterion****************
    TerminationCriterion sc2;
    sc2.add_iteration_limit( 10 );
    if( err ) return 1;
    lapl1.set_outer_termination_criterion( &sc2 );

    // adds 1 pass of pass1 to mesh_set1
    //  queue1.add_quality_assessor(&stop_qa,err);
    if( err ) return 1;
    queue1.set_master_quality_improver( &lapl1, err );
    if( err ) return 1;
    //  queue1.add_quality_assessor(&stop_qa,err);
    if( err ) return 1;

    PlanarDomain plane( Vector3D( 0, 0, 1 ), Vector3D( 0, 0, 0 ) );

    // launches optimization on mesh_set1
    MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, &plane );
    Timer t;
    queue1.run_instructions( &mesh_and_domain, err );
    if( err ) return 1;
    double secs = t.since_birth();
    std::cout << "Optimization completed in " << secs << " seconds" << std::endl;

    if( output_file )
    {
        mesh.write_vtk( output_file, err );
        if( err ) return 1;
        std::cout << "Wrote file: " << output_file << std::endl;
    }

    return 0;
}

Variable Documentation

std::string DEFAULT_INPUT = "/2D/vtk/N-Polygonal/poly1.vtk"

Definition at line 72 of file laplacian_polygon_test.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines