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

An interface for a mapping function of the form \(\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\), where \(\vec{x_i}\) is a point in \(\mathbf{R}^3\) (i.e. \(x_i,y_i,z_i\)), \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\) for surface elements and \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\) for volume elements. More...

#include <MappingFunction.hpp>

+ Inheritance diagram for MBMesquite::MappingFunction:

Public Member Functions

virtual ~MappingFunction ()
virtual EntityTopology element_topology () const =0
 Get MBMesquite::EntityTopology handled by this mapping function.
virtual int num_nodes () const =0
 Get number of nodes in the element type.
virtual NodeSet sample_points (NodeSet higher_order_nodes) const
 Get sample points at which to evaluate mapping function.
virtual void coefficients (Sample location, NodeSet nodeset, double *coeff_out, size_t *indices_out, size_t &num_coeff_out, MsqError &err) const =0
 Mapping Function Coefficients.
void convert_connectivity_indices (int num_nodes_in_output_element_type, size_t *index_list, unsigned num_indices, MsqError &err) const

Static Public Member Functions

static void convert_connectivity_indices (EntityTopology topology, int num_nodes_in_input_elem_type, int num_nodes_in_output_elem_type, size_t *index_list, unsigned num_indices, MsqError &err)

Static Private Member Functions

static void convert_connectivity_indices_impl (EntityTopology topology, int num_nodes_in_input_elem_type, int num_nodes_in_output_elem_type, size_t *index_list, unsigned num_indices, MsqError &err)

Detailed Description

An interface for a mapping function of the form \(\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\), where \(\vec{x_i}\) is a point in \(\mathbf{R}^3\) (i.e. \(x_i,y_i,z_i\)), \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\) for surface elements and \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\) for volume elements.

This is an interface for describing a mapping function for a single element topology. A mapping function is assumed to be of the following form: \(\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\) where \(n\) is the number of nodes in the element, \(\vec{x_i}\) is a point in \(\mathbf{R}^3\) (i.e. \(x_i,y_i,z_i\)), and \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\) for surface elements and \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\) for volume elements. For example, for a linear quadrilateral element, the mapping function will be of the form: \(\vec{x}(\xi,\eta)=N_1(\xi,\eta)\vec{x_1} +N_2(\xi,\eta)\vec{x_2} +N_3(\xi,\eta)\vec{x_3} +N_4(\xi,\eta)\vec{x_4}\)

A single implementation of this interface may support multiple types of elements of the same topology. Element types within a topology may vary by the presences or lack there of of mid-edge, mid-face, and mid-element nodes.

Definition at line 79 of file MappingFunction.hpp.


Constructor & Destructor Documentation

virtual MBMesquite::MappingFunction::~MappingFunction ( ) [inline, virtual]

Definition at line 82 of file MappingFunction.hpp.

{}

Member Function Documentation

virtual void MBMesquite::MappingFunction::coefficients ( Sample  location,
NodeSet  nodeset,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff_out,
MsqError err 
) const [pure virtual]

Mapping Function Coefficients.

This function returns the list of scalar values ( \(N_i\)'s) resulting from the evaluation of the mapping function coefficient terms \(N_1(\vec{\xi}), N_2(\vec{\xi}), \ldots, N_n(\vec{\xi})\) for a given \(\vec{\xi}\).

Parameters:
locationWhere within the element at which to evaluate the coefficients.
nodesetList of which nodes are present in the element.
coefficients_outThe coefficients ( \(N_i(\vec{\xi})\)) for each vertex in the element.
indices_outThe index ($i$ in $N_i$) for each term in 'coeffs_out'. The assumption is that mapping function implementations will not return zero coefficients. This is not required, but for element types with large numbers of nodes it may have a significant impact on performance.

Implemented in CenterMF3D, CenterMF2D, MBMesquite::HexLagrangeShape, MBMesquite::TetLagrangeShape, MBMesquite::LinearPyramid, MBMesquite::QuadLagrangeShape, MBMesquite::TriLagrangeShape, MBMesquite::LinearHexahedron, MBMesquite::LinearPrism, MBMesquite::LinearQuadrilateral, MBMesquite::LinearTetrahedron, and MBMesquite::LinearTriangle.

Referenced by LinearMappingFunctionTest::do_coeff_test(), MBMesquite::PatchData::get_sample_location(), LinearMappingFunctionTest::test_coeff_fail(), and MBMesquite::PatchData::update_slave_node_coordinates().

void MBMesquite::MappingFunction::convert_connectivity_indices ( EntityTopology  topology,
int  num_nodes_in_input_elem_type,
int  num_nodes_in_output_elem_type,
size_t *  index_list,
unsigned  num_indices,
MsqError err 
) [inline, static]

Definition at line 514 of file MappingFunction.hpp.

References convert_connectivity_indices_impl(), and corners.

Referenced by MBMesquite::JacobianCalculator::get_Jacobian_2D(), MBMesquite::JacobianCalculator::get_Jacobian_3D(), MBMesquite::PatchData::get_sample_location(), MBMesquite::MappingFunction2D::jacobian(), MBMesquite::MappingFunction3D::jacobian(), and MBMesquite::PatchData::update_slave_node_coordinates().

{
    // If the types are the same or either type has only corner
    // vertices, then no conversion is necessary.
    const int num_corners = TopologyInfo::corners( topo );
    if( input_type != output_type && input_type != num_corners && output_type != num_corners )
        convert_connectivity_indices_impl( topo, input_type, output_type, index_list, num_indices, err );
}
void MBMesquite::MappingFunction::convert_connectivity_indices ( int  num_nodes_in_output_element_type,
size_t *  index_list,
unsigned  num_indices,
MsqError err 
) const [inline]

Definition at line 151 of file MappingFunction.hpp.

    {
        convert_connectivity_indices( element_topology(), num_nodes(), num_nodes_in_output_element_type, index_list,
                                      num_indices, err );
    }
void MBMesquite::MappingFunction::convert_connectivity_indices_impl ( EntityTopology  topology,
int  num_nodes_in_input_elem_type,
int  num_nodes_in_output_elem_type,
size_t *  index_list,
unsigned  num_indices,
MsqError err 
) [static, private]

Definition at line 48 of file MappingFunction.cpp.

References corners, MBMesquite::edges, MBMesquite::faces, MSQ_ERRRTN, MSQ_SETERR, and MBMesquite::MsqError::UNSUPPORTED_ELEMENT.

Referenced by convert_connectivity_indices().

{
    bool in_edges, in_faces, in_region, out_edges, out_faces, out_region;
    TopologyInfo::higher_order( topo, input_type, in_edges, in_faces, in_region, err );MSQ_ERRRTN( err );
    TopologyInfo::higher_order( topo, output_type, out_edges, out_faces, out_region, err );MSQ_ERRRTN( err );

    // We could probably use TopologyInfo to do this more forward-compatible,
    // but for efficiency assume the current ITAPS node ordering, where
    // all mid-edge nodes occur before mid-face nodes and the mid-region
    // node is always last.

    // If both have mid-region nodes and they don't have the same stuff
    // preceeding the mid-region node, then we need to change that index.
    bool region_diff = in_region && out_region && ( in_faces != out_faces || in_edges != out_edges );
    // If both have mid-face nodes and one has mid-edge nodes and the other
    // does not, then we need to change the face indices.
    bool face_diff = in_faces && out_faces && in_edges != out_edges;
    // if nothing to change, return
    if( !face_diff && !region_diff ) return;

    const unsigned corners         = TopologyInfo::corners( topo );
    const unsigned edges           = TopologyInfo::edges( topo );
    const unsigned faces           = TopologyInfo::faces( topo );
    const unsigned in_face_offset  = in_edges ? corners + edges : corners;
    const unsigned in_regn_offset  = in_faces ? in_face_offset + faces : in_face_offset;
    const unsigned out_face_offset = out_edges ? corners + edges : corners;
    const unsigned out_regn_offset = out_faces ? out_face_offset + faces : out_face_offset;

    // In the code below, assertions are used to validate the input
    // connectivity data as we assume it is an internal mesquite coding
    // error for it to be inconsistent.  True error checking is used
    // if the elements are incompatible (the index list for the input
    // type contains indices for which there is no correpsonding logical
    // node location in the connectivity list of the output element type)
    // because that indicates an invalid setup (the combination of element
    // type and slave nodes does not result in a reduced element that is
    // compatible with the mapping function.)  The latter should probably
    // have been caught by the mapping function, but to be safe we check
    // again here.

    for( size_t i = 0; i < num_indices; ++i )
    {
        if( index_list[i] < in_face_offset )
        {  // corner or mid-edge node
            // nothing to change for these, but check that if it is a mid-edge
            // node that the other type also has edges
            if( index_list[i] >= corners && !out_edges )
            {
                MSQ_SETERR( err )( "Incompatible nodes present.", MsqError::UNSUPPORTED_ELEMENT );
                return;
            }
        }
        else if( index_list[i] < in_regn_offset )
        {  // mid-face node
            assert( TopologyInfo::dimension( topo ) == 3 || index_list[i] == (unsigned)input_type - 1 );
            if( !out_faces )
            {
                MSQ_SETERR( err )( "Incompatible nodes present.", MsqError::UNSUPPORTED_ELEMENT );
                return;
            }
            // working with unsigned type (size_t), so make sure we express this
            // such that there are no intermediate negative values.
            index_list[i] = index_list[i] + out_face_offset - in_face_offset;
        }
        else
        {  // region
            assert( in_region );
            assert( TopologyInfo::dimension( topo ) == 3 && index_list[i] == (unsigned)input_type - 1 );
            if( !out_region )
            {
                MSQ_SETERR( err )( "Incompatible nodes present.", MsqError::UNSUPPORTED_ELEMENT );
                return;
            }
            // working with unsigned type (size_t), so make sure we express this
            // such that there are no intermediate negative values.
            index_list[i] = index_list[i] + out_regn_offset - in_regn_offset;
        }
    }
}
virtual int MBMesquite::MappingFunction::num_nodes ( ) const [pure virtual]

Get number of nodes in the element type.

Get the number of nodes in the element type that the mapping function implements. It is assumed that the result of this function, in combination with the element topology, is sufficient to determine the element type.

Implemented in CenterMF3D, CenterMF2D, MBMesquite::HexLagrangeShape, MBMesquite::TetLagrangeShape, MBMesquite::LinearPyramid, MBMesquite::QuadLagrangeShape, MBMesquite::TriLagrangeShape, MBMesquite::LinearHexahedron, MBMesquite::LinearPrism, MBMesquite::LinearQuadrilateral, MBMesquite::LinearTetrahedron, and MBMesquite::LinearTriangle.

NodeSet MBMesquite::MappingFunction::sample_points ( NodeSet  higher_order_nodes) const [virtual]

Get sample points at which to evaluate mapping function.

Get the points within the element at which TMP quality metrics that are a function of the mapping function Jacobian should be evaluated. The default (which may be overridden by individual mapping functions) is to evaluate at all nodes.

Reimplemented in CenterMF3D, CenterMF2D, MBMesquite::TetLagrangeShape, MBMesquite::LinearPyramid, MBMesquite::TriLagrangeShape, MBMesquite::LinearTetrahedron, and MBMesquite::LinearTriangle.

Definition at line 42 of file MappingFunction.cpp.

References element_topology(), and MBMesquite::NodeSet::set_all_corner_nodes().

Referenced by MBMesquite::MsqMeshEntity::check_element_orientation(), and MBMesquite::PatchData::get_samples().

{
    higher_order.set_all_corner_nodes( element_topology() );
    return higher_order;
}

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