MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::MsqIRel Class Reference

#include <MsqIRel.hpp>

+ Inheritance diagram for MBMesquite::MsqIRel:
+ Collaboration diagram for MBMesquite::MsqIRel:

Public Member Functions

 MsqIRel (iGeom_Instance geom, iRel_Instance irel_iface, iRel_PairHandle irel_instance)
virtual ~MsqIRel ()
void snap_to (Mesh::VertexHandle entity_handle, Vector3D &coordinat) const
void vertex_normal_at (Mesh::VertexHandle entity_handle, Vector3D &coordinate) const
void element_normal_at (Mesh::ElementHandle entity_handle, Vector3D &coordinate) const
void vertex_normal_at (const Mesh::VertexHandle *handles, Vector3D coordinates[], unsigned count, MsqError &err) const
 evaluate surface normals
void closest_point (Mesh::VertexHandle handle, const Vector3D &position, Vector3D &closest, Vector3D &normal, MsqError &err) const
 evaluate closest point and normal
void domain_DoF (const Mesh::VertexHandle *handle_array, unsigned short *dof_array, size_t num_vertices, MsqError &err) const

Protected Member Functions

int geom_from_mesh (Mesh::EntityHandle mesh_handle_in, iBase_EntityHandle &geom_handle_out, int &geom_dimension_out) const
int geom_from_mesh (Mesh::EntityHandle const *mesh_handles_in, iBase_EntityHandle *geom_handles_out, unsigned short *geom_dimensions_out, size_t count) const

Private Attributes

iRel_Instance relateIface
iRel_PairHandle relateInstance
std::vector< iBase_EntityHandlegeomHandles

Detailed Description

Definition at line 44 of file MsqIRel.hpp.


Constructor & Destructor Documentation

MBMesquite::MsqIRel::MsqIRel ( iGeom_Instance  geom,
iRel_Instance  irel_iface,
iRel_PairHandle  irel_instance 
)

Definition at line 47 of file MsqIRel.cpp.

    : MsqCommonIGeom( geom ), relateIface( relate_iface ), relateInstance( relate_instance )
{
}

Definition at line 52 of file MsqIRel.cpp.

{}

Member Function Documentation

void MBMesquite::MsqIRel::closest_point ( Mesh::VertexHandle  handle,
const Vector3D position,
Vector3D closest,
Vector3D normal,
MsqError err 
) const [virtual]

evaluate closest point and normal

Given a position in space, return the closest position in the domain and the domain normal at that point.

Parameters:
entity_handleEvaluate the subset of the domain contianing this entity
positionInput position for which to evaluate
closestClosest position in the domain.
normalDomain normal at the location of 'closest'

Implements MBMesquite::MeshDomain.

Definition at line 153 of file MsqIRel.cpp.

References MBMesquite::MsqCommonIGeom::closest_and_normal(), dim, geom, geom_from_mesh(), iBase_SUCCESS, ierr, INTERNAL_ERROR, MBMesquite::MsqError::INVALID_ARG, MSQ_SETERR, and MBMesquite::process_itaps_error().

{
    int ierr, dim;
    iBase_EntityHandle geom;

    ierr = geom_from_mesh( handle, geom, dim );
    if( iBase_SUCCESS != ierr )
    {
        MSQ_SETERR( err )( process_itaps_error( ierr ), MsqError::INTERNAL_ERROR );
        return;
    }

    if( dim != 2 )
    {
        MSQ_SETERR( err )( "Cannot get normal for non-surface geometry", MsqError::INVALID_ARG );
        return;
    }

    ierr = closest_and_normal( geom, position, closest, p_normal );
    if( iBase_SUCCESS != ierr )
    {
        MSQ_SETERR( err )( process_itaps_error( ierr ), MsqError::INTERNAL_ERROR );
        return;
    }
}
void MBMesquite::MsqIRel::domain_DoF ( const Mesh::VertexHandle handle_array,
unsigned short *  dof_array,
size_t  num_vertices,
MsqError err 
) const

Definition at line 139 of file MsqIRel.cpp.

References MBMesquite::arrptr(), geom_from_mesh(), geomHandles, iBase_SUCCESS, ierr, INTERNAL_ERROR, MSQ_SETERR, and MBMesquite::process_itaps_error().

{
    int ierr;

    geomHandles.resize( count );
    ierr = geom_from_mesh( handle_array, arrptr( geomHandles ), dof_array, count );
    if( iBase_SUCCESS != ierr )
    {
        MSQ_SETERR( err )( process_itaps_error( ierr ), MsqError::INTERNAL_ERROR );
        return;
    }
}
void MBMesquite::MsqIRel::element_normal_at ( Mesh::ElementHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Implements MBMesquite::MeshDomain.

Definition at line 104 of file MsqIRel.cpp.

References vertex_normal_at().

{
    MsqIRel::vertex_normal_at( handle, coordinate );
}
int MBMesquite::MsqIRel::geom_from_mesh ( Mesh::EntityHandle  mesh_handle_in,
iBase_EntityHandle geom_handle_out,
int &  geom_dimension_out 
) const [protected]

Get geometric entity owning a mesh entity

Definition at line 180 of file MsqIRel.cpp.

References MBMesquite::MsqCommonIGeom::geomIFace, iBase_SUCCESS, ierr, iRel_getEntEntRelation, relateIface, and relateInstance.

Referenced by closest_point(), domain_DoF(), geom_from_mesh(), snap_to(), and vertex_normal_at().

{
    // get geometric entity
    int ierr;
    iRel_getEntEntRelation( relateIface, relateInstance, (iBase_EntityHandle)mesh_ent_handle, true, &geom_handle,
                            &ierr );
    if( iBase_SUCCESS != ierr ) return ierr;

    // get dimension of geometric entities
    int one = 1, one_too = 1, *type_ptr = &geom_dim;
    iGeom_getArrType( geomIFace, &geom_handle, 1, &type_ptr, &one, &one_too, &ierr );
    if( iBase_SUCCESS != ierr ) return ierr;

    return iBase_SUCCESS;
}
int MBMesquite::MsqIRel::geom_from_mesh ( Mesh::EntityHandle const *  mesh_handles_in,
iBase_EntityHandle geom_handles_out,
unsigned short *  geom_dimensions_out,
size_t  count 
) const [protected]

Definition at line 196 of file MsqIRel.cpp.

References dim, geom_from_mesh(), iBase_SUCCESS, and ierr.

{
    int ierr, dim;
    for( size_t i = 0; i < count; ++i )
    {
        ierr = geom_from_mesh( handles[i], geom_handles[i], dim );
        if( iBase_SUCCESS != ierr ) return ierr;
        dims[i] = dim;
    }

    return iBase_SUCCESS;
}
void MBMesquite::MsqIRel::snap_to ( Mesh::VertexHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Modifies "coordinate" so that it lies on the domain to which "entity_handle" is constrained. The handle determines the domain. The coordinate is the proposed new position on that domain.

Implements MBMesquite::MeshDomain.

Definition at line 54 of file MsqIRel.cpp.

References dim, geom, geom_from_mesh(), iBase_SUCCESS, ierr, MBMesquite::MsqCommonIGeom::move_to(), and MBMesquite::process_itaps_error().

{
    int ierr, dim;
    iBase_EntityHandle geom;

    ierr = geom_from_mesh( handle, geom, dim );
    if( iBase_SUCCESS != ierr )
    {
        process_itaps_error( ierr );
        return;
    }

    if( dim < 3 )
    {
        ierr = move_to( geom, coordinate );
        if( iBase_SUCCESS != ierr )
        {
            process_itaps_error( ierr );
            return;
        }
    }
}
void MBMesquite::MsqIRel::vertex_normal_at ( Mesh::VertexHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Returns the normal of the domain to which "entity_handle" is constrained. For non-planar surfaces, the normal is calculated at the point on the domain that is closest to the passed in value of "coordinate". If the domain does not have a normal, or the normal cannot be determined, "coordinate" is set to (0,0,0). Otherwise, "coordinate" is set to the domain's normal at the appropriate point. In summary, the handle determines the domain. The coordinate determines the point of interest on that domain.

User should see also PatchData::get_domain_normal_at_vertex and PatchData::get_domain_normal_at_element .

Implements MBMesquite::MeshDomain.

Definition at line 77 of file MsqIRel.cpp.

References dim, geom, geom_from_mesh(), iBase_SUCCESS, ierr, MBMesquite::MsqCommonIGeom::normal(), and MBMesquite::process_itaps_error().

Referenced by element_normal_at().

{
    int ierr, dim;
    iBase_EntityHandle geom;

    ierr = geom_from_mesh( handle, geom, dim );
    if( iBase_SUCCESS != ierr )
    {
        process_itaps_error( ierr );
        return;
    }

    if( dim == 2 )
    {
        ierr = normal( geom, coordinate );
        if( iBase_SUCCESS != ierr )
        {
            process_itaps_error( ierr );
            return;
        }
    }
    else
    {
        assert( 0 );
    }
}
void MBMesquite::MsqIRel::vertex_normal_at ( const Mesh::VertexHandle handles,
Vector3D  coordinates[],
unsigned  count,
MsqError err 
) const [virtual]

evaluate surface normals

Returns normals for a domain.

Parameters:
handlesThe domain evaluated is the one in which this mesh entity is constrained.
coordinatesAs input, a list of positions at which to evaluate the domain. As output, the resulting domain normals.
countThe length of the coordinates array.

Implements MBMesquite::MeshDomain.

Definition at line 109 of file MsqIRel.cpp.

References dim, geom, geom_from_mesh(), iBase_SUCCESS, ierr, MBMesquite::MsqError::INVALID_ARG, MSQ_SETERR, MBMesquite::MsqCommonIGeom::normal(), and MBMesquite::process_itaps_error().

{
    int ierr, dim;
    iBase_EntityHandle geom;
    for( unsigned i = 0; i < count; ++i )
    {
        ierr = geom_from_mesh( handle[i], geom, dim );
        if( iBase_SUCCESS != ierr )
        {
            process_itaps_error( ierr );
            return;
        }

        if( dim != 2 )
        {
            MSQ_SETERR( err )
            ( "Cannot get normal for non-surface geometry", MsqError::INVALID_ARG );
            return;
        }

        ierr = normal( geom, coordinates[i] );
        if( iBase_SUCCESS != ierr )
        {
            process_itaps_error( ierr );
            return;
        }
    }
}

Member Data Documentation

std::vector< iBase_EntityHandle > MBMesquite::MsqIRel::geomHandles [mutable, private]

temporary storage of geometry entity handles

Reimplemented from MBMesquite::MsqCommonIGeom.

Definition at line 80 of file MsqIRel.hpp.

Referenced by domain_DoF().

ITAPS interface implementation for mesh->geometry association

Definition at line 76 of file MsqIRel.hpp.

Referenced by geom_from_mesh().

Definition at line 77 of file MsqIRel.hpp.

Referenced by geom_from_mesh().

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