MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::SmartLaplacianSmoother Class Reference

#include <SmartLaplacianSmoother.hpp>

+ Inheritance diagram for MBMesquite::SmartLaplacianSmoother:
+ Collaboration diagram for MBMesquite::SmartLaplacianSmoother:

Public Member Functions

MESQUITE_EXPORT SmartLaplacianSmoother (ObjectiveFunction *OF=NULL)
MESQUITE_EXPORT ~SmartLaplacianSmoother ()
virtual MESQUITE_EXPORT std::string get_name () const
 Get string name for use in diagnostic and status output.

Static Public Member Functions

static MESQUITE_EXPORT size_t num_inverted (PatchData &pd, MsqError &err)

Protected Member Functions

virtual MESQUITE_EXPORT void optimize_vertex_positions (PatchData &pd, MsqError &err)

Private Attributes

std::vector< size_t > adjVtxList

Detailed Description

Definition at line 13 of file SmartLaplacianSmoother.hpp.


Constructor & Destructor Documentation

Parameters:
OFObjectiveFunction used by some termination criteria

Definition at line 20 of file SmartLaplacianSmoother.hpp.

: RelaxationSmoother( OF ) {}

Member Function Documentation

std::string MBMesquite::SmartLaplacianSmoother::get_name ( ) const [virtual]

Get string name for use in diagnostic and status output.

Implements MBMesquite::Instruction.

Definition at line 22 of file SmartLaplacianSmoother.cpp.

{
    return "SmartLaplacianSmoother";
}

Definition at line 9 of file SmartLaplacianSmoother.cpp.

References MBMesquite::MsqMeshEntity::check_element_orientation(), MBMesquite::PatchData::element_by_index(), MSQ_ERRZERO, and MBMesquite::PatchData::num_elements().

Referenced by optimize_vertex_positions().

{
    size_t result = 0;
    int inverted, junk;
    for( size_t i = 0; i < pd.num_elements(); ++i )
    {
        pd.element_by_index( i ).check_element_orientation( pd, inverted, junk, err );
        MSQ_ERRZERO( err );
        if( inverted ) ++result;
    }
    return result;
}
void MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions ( PatchData pd,
MsqError err 
) [protected, virtual]

Implements MBMesquite::RelaxationSmoother.

Definition at line 29 of file SmartLaplacianSmoother.cpp.

References adjVtxList, MBMesquite::PatchData::get_adjacent_vertex_indices(), MBMesquite::PatchData::get_vertex_array(), MSQ_ERRRTN, n, MBMesquite::PatchData::num_free_vertices(), num_inverted(), MBMesquite::PatchData::set_vertex_coordinates(), and MBMesquite::PatchData::snap_vertex_to_domain().

{
    assert( pd.num_free_vertices() == 1 );
    const size_t center_vtx_index = 0;
    const size_t init_inverted    = num_inverted( pd, err );MSQ_ERRRTN( err );

    adjVtxList.clear();
    pd.get_adjacent_vertex_indices( center_vtx_index, adjVtxList, err );MSQ_ERRRTN( err );

    if( adjVtxList.empty() ) return;

    const MsqVertex* verts = pd.get_vertex_array( err );
    const size_t n         = adjVtxList.size();

    const Vector3D orig_pos = verts[center_vtx_index];
    Vector3D new_pos        = verts[adjVtxList[0]];
    for( size_t i = 1; i < n; ++i )
        new_pos += verts[adjVtxList[i]];
    new_pos *= 1.0 / n;
    pd.set_vertex_coordinates( new_pos, center_vtx_index, err );
    pd.snap_vertex_to_domain( center_vtx_index, err );MSQ_ERRRTN( err );
    const size_t new_inverted = num_inverted( pd, err );MSQ_ERRRTN( err );
    if( new_inverted > init_inverted ) pd.set_vertex_coordinates( orig_pos, center_vtx_index, err );
}

Member Data Documentation

std::vector< size_t > MBMesquite::SmartLaplacianSmoother::adjVtxList [private]

Definition at line 36 of file SmartLaplacianSmoother.hpp.

Referenced by optimize_vertex_positions().

List of all members.


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