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

Calculate Jacobian matrices given vertex coordinates and MappingFunction. More...

#include <JacobianCalculator.hpp>

+ Collaboration diagram for MBMesquite::JacobianCalculator:

Public Member Functions

void get_Jacobian_2D (const MappingFunction2D *mf, NodeSet ho_bits, Sample location, const Vector3D *vertex_coords, size_t num_vertex, MsqMatrix< 3, 2 > &J_out, MsqError &err)
 Calculate Jacobian for surface element.
void get_Jacobian_3D (const MappingFunction3D *mf, NodeSet ho_bits, Sample location, const Vector3D *vertex_coords, size_t num_vertex, MsqMatrix< 3, 3 > &J_out, MsqError &err)
 Calculate Jacobian for volume element.

Private Types

enum  { MAX_ELEM_NODES = 27 }

Private Attributes

size_t mIndices [MAX_ELEM_NODES]
MsqVector< 3 > mDerivs3D [MAX_ELEM_NODES]
MsqVector< 2 > mDerivs2D [MAX_ELEM_NODES]

Detailed Description

Calculate Jacobian matrices given vertex coordinates and MappingFunction.

Definition at line 50 of file JacobianCalculator.hpp.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
MAX_ELEM_NODES 

Definition at line 78 of file JacobianCalculator.hpp.

    {
        MAX_ELEM_NODES = 27
    };

Member Function Documentation

void MBMesquite::JacobianCalculator::get_Jacobian_2D ( const MappingFunction2D mf,
NodeSet  ho_bits,
Sample  location,
const Vector3D vertex_coords,
size_t  num_vertex,
MsqMatrix< 3, 2 > &  J_out,
MsqError err 
)

Calculate Jacobian for surface element.

Calculate the Jacobian matrix at a specified location in a surface element.

Parameters:
mfThe mapping function
ho_bitsbit mask indicating which higher-order nodes are present in the element (zero for a linear element)
locationLogical position within element at which to evaluate Jacobian
J_outThe resulting Jacobian matrix.

Definition at line 41 of file JacobianCalculator.cpp.

References MBMesquite::MappingFunction::convert_connectivity_indices(), MBMesquite::MappingFunction2D::derivatives(), mDerivs2D, mIndices, MSQ_ERRRTN, and MBMesquite::MsqMatrix< R, C >::set_column().

Referenced by LinearMappingFunctionTest::do_ideal_test(), TriLagrangeShapeTest::test_ideal_jacobian(), and QuadLagrangeShapeTest::test_ideal_jacobian().

{
    size_t num_vtx = 0;
    mf->derivatives( location, ho_bits, mIndices, mDerivs2D, num_vtx, err );MSQ_ERRRTN( err );
    mf->convert_connectivity_indices( num_type_vert, mIndices, num_vtx, err );MSQ_ERRRTN( err );
    const MsqVector< 2 >* d = mDerivs2D;
    const size_t* const e   = mIndices + num_vtx;
    Vector3D c[2]           = { Vector3D( 0, 0, 0 ), Vector3D( 0, 0, 0 ) };
    for( const size_t* i = mIndices; i != e; ++i, ++d )
    {
        c[0] += ( *d )[0] * verts[*i];
        c[1] += ( *d )[1] * verts[*i];
    }
    J_out.set_column( 0, MsqMatrix< 3, 1 >( c[0].to_array() ) );
    J_out.set_column( 1, MsqMatrix< 3, 1 >( c[1].to_array() ) );
}
void MBMesquite::JacobianCalculator::get_Jacobian_3D ( const MappingFunction3D mf,
NodeSet  ho_bits,
Sample  location,
const Vector3D vertex_coords,
size_t  num_vertex,
MsqMatrix< 3, 3 > &  J_out,
MsqError err 
)

Calculate Jacobian for volume element.

Calculate the Jacobian matrix at a specified location in a volume element.

Parameters:
mfThe mapping function
ho_bitsbit mask indicating which higher-order nodes are present in the element (zero for a linear element)
locationLogical position within element at which to evaluate Jacobian
J_outThe resulting Jacobian matrix.

Definition at line 60 of file JacobianCalculator.cpp.

References MBMesquite::MappingFunction::convert_connectivity_indices(), MBMesquite::MappingFunction3D::derivatives(), mDerivs3D, mIndices, MSQ_ERRRTN, and MBMesquite::MsqMatrix< R, C >::set_column().

Referenced by LinearMappingFunctionTest::do_ideal_test(), and TetLagrangeShapeTest::test_ideal_jacobian().

{
    size_t num_vtx = 0;
    mf->derivatives( location, ho_bits, mIndices, mDerivs3D, num_vtx, err );MSQ_ERRRTN( err );
    mf->convert_connectivity_indices( num_type_vert, mIndices, num_vtx, err );MSQ_ERRRTN( err );
    const MsqVector< 3 >* d = mDerivs3D;
    const size_t* const e   = mIndices + num_vtx;
    Vector3D c[3]           = { Vector3D( 0, 0, 0 ), Vector3D( 0, 0, 0 ), Vector3D( 0, 0, 0 ) };
    for( const size_t* i = mIndices; i != e; ++i, ++d )
    {
        c[0] += ( *d )[0] * verts[*i];
        ;
        c[1] += ( *d )[1] * verts[*i];
        ;
        c[2] += ( *d )[2] * verts[*i];
        ;
    }
    J_out.set_column( 0, MsqMatrix< 3, 1 >( c[0].to_array() ) );
    J_out.set_column( 1, MsqMatrix< 3, 1 >( c[1].to_array() ) );
    J_out.set_column( 2, MsqMatrix< 3, 1 >( c[2].to_array() ) );
}

Member Data Documentation

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