MOAB: Mesh Oriented datABase  (version 5.4.1)
UnOptimizer Class Reference
+ Inheritance diagram for UnOptimizer:
+ Collaboration diagram for UnOptimizer:

Public Member Functions

 UnOptimizer (ObjectiveFunction *of)
virtual ~UnOptimizer ()
virtual std::string get_name () const
 Get string name for use in diagnostic and status output.
virtual PatchSetget_patch_set ()

Protected Member Functions

virtual void initialize (PatchData &pd, MsqError &err)
virtual void optimize_vertex_positions (PatchData &pd, MsqError &err)
virtual void initialize_mesh_iteration (PatchData &pd, MsqError &err)
virtual void terminate_mesh_iteration (PatchData &pd, MsqError &err)
virtual void cleanup ()

Private Attributes

std::vector< size_t > adjVtxList
VertexPatches patchSet
ObjectiveFunctionobjectiveFunction

Detailed Description

Definition at line 29 of file randomize.cpp.


Constructor & Destructor Documentation

Definition at line 32 of file randomize.cpp.

: objectiveFunction( of ) {}
virtual UnOptimizer::~UnOptimizer ( ) [inline, virtual]

Definition at line 34 of file randomize.cpp.

{}

Member Function Documentation

void UnOptimizer::cleanup ( ) [protected, virtual]

Implements MBMesquite::VertexMover.

Definition at line 68 of file randomize.cpp.

{}
std::string UnOptimizer::get_name ( ) const [virtual]

Get string name for use in diagnostic and status output.

Implements MBMesquite::Instruction.

Definition at line 57 of file randomize.cpp.

{
    return "UnOptimize";
}

Implements MBMesquite::QualityImprover.

Definition at line 61 of file randomize.cpp.

{
    return &patchSet;
}
void UnOptimizer::initialize ( PatchData pd,
MsqError err 
) [protected, virtual]

Implements MBMesquite::VertexMover.

Definition at line 65 of file randomize.cpp.

{}
void UnOptimizer::initialize_mesh_iteration ( PatchData pd,
MsqError err 
) [protected, virtual]

Implements MBMesquite::VertexMover.

Definition at line 66 of file randomize.cpp.

{}
void UnOptimizer::optimize_vertex_positions ( PatchData pd,
MsqError err 
) [protected, virtual]

Implements MBMesquite::VertexMover.

Definition at line 70 of file randomize.cpp.

References MBMesquite::arrptr(), MBMesquite::ObjectiveFunction::CALCULATE, MBMesquite::PatchData::create_vertices_memento(), MBMesquite::PatchData::get_minmax_edge_length(), MBMesquite::grad(), MBMesquite::MsqError::INVALID_MESH, MBMesquite::MsqVertex::is_free_vertex(), MSQ_ERRRTN, MSQ_SETERR, MBMesquite::PatchData::num_free_vertices(), MBMesquite::PatchData::set_free_vertices_constrained(), MBMesquite::PatchData::set_to_vertices_memento(), and MBMesquite::PatchData::vertex_by_index().

{
    assert( pd.num_free_vertices() == 1 && pd.vertex_by_index( 0 ).is_free_vertex() );
    std::vector< Vector3D > grad( 1 );
    double val, junk, coeff;
    bool state;

    state = objectiveFunction->evaluate_with_gradient( ObjectiveFunction::CALCULATE, pd, val, grad, err );MSQ_ERRRTN( err );
    if( !state )
    {
        MSQ_SETERR( err )( MsqError::INVALID_MESH );
        return;
    }
    grad[0] /= grad[0].length();

    PatchDataVerticesMemento* memento = pd.create_vertices_memento( err );MSQ_ERRRTN( err );
    std::unique_ptr< PatchDataVerticesMemento > deleter( memento );
    pd.get_minmax_edge_length( junk, coeff );

    for( int i = 0; i < 100; ++i )
    {
        pd.set_free_vertices_constrained( memento, arrptr( grad ), 1, coeff, err );MSQ_ERRRTN( err );
        state = objectiveFunction->evaluate( ObjectiveFunction::CALCULATE, pd, val, true, err );MSQ_ERRRTN( err );
        if( state ) break;
        coeff *= 0.5;
    }
    if( !state )
    {
        pd.set_to_vertices_memento( memento, err );
    }
}
void UnOptimizer::terminate_mesh_iteration ( PatchData pd,
MsqError err 
) [protected, virtual]

Implements MBMesquite::VertexMover.

Definition at line 67 of file randomize.cpp.

{}

Member Data Documentation

std::vector< size_t > UnOptimizer::adjVtxList [private]

Definition at line 52 of file randomize.cpp.

Definition at line 54 of file randomize.cpp.

Definition at line 53 of file randomize.cpp.

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines