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

Scale a target matrix by the size of another. More...

#include <LambdaTarget.hpp>

+ Inheritance diagram for MBMesquite::LambdaTarget:
+ Collaboration diagram for MBMesquite::LambdaTarget:

Public Member Functions

 LambdaTarget (TargetCalculator *lambda_source, TargetCalculator *composite_source)
 ~LambdaTarget ()
bool get_3D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 3 > &W_out, MsqError &err)
 Get a target matrix.
bool get_2D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 2, 2 > &W_out, MsqError &err)
 Get a target matrix.
bool get_surface_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 2 > &W_out, MsqError &err)
 Get a target matrix.
bool have_surface_orient () const
 Use 3x2 W for surface elements if true, 2x2 W if false.

Private Attributes

TargetCalculatorlambdaSource
TargetCalculatorcompositeSource

Detailed Description

Scale a target matrix by the size of another.

Combine two target matrices by extracting a scalar representation of the size (lambda) of one and use that value to scale the other. The expected use of this target calculator is to preserve the size of a reference mesh while targeting ideal elements for shape.

Definition at line 48 of file LambdaTarget.hpp.


Constructor & Destructor Documentation

MBMesquite::LambdaTarget::LambdaTarget ( TargetCalculator lambda_source,
TargetCalculator composite_source 
)
Parameters:
lambda_sourceTarget calculator from which to extract scaling factor (lambda).
composite_sourceTarget calcualtor from which to obtain a target that will be scaled by lambda.

Definition at line 40 of file LambdaTarget.cpp.

    : lambdaSource( lambda_source ), compositeSource( composite_source )
{
}

Definition at line 45 of file LambdaTarget.cpp.

{}

Member Function Documentation

bool MBMesquite::LambdaTarget::get_2D_target ( PatchData pd,
size_t  element,
Sample  sample,
MsqMatrix< 2, 2 > &  W_out,
MsqError err 
) [virtual]

Get a target matrix.

Parameters:
pdThe current PatchData
elementThe index an element within the patch data.
sampleThe sample point in the element.
W_outThe resulting target matrix.

Implements MBMesquite::TargetCalculator.

Definition at line 67 of file LambdaTarget.cpp.

References compositeSource, MBMesquite::det(), MBMesquite::TargetCalculator::get_2D_target(), lambdaSource, and MSQ_CHKERR.

{
    bool valid = lambdaSource->get_2D_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    double det1 = det( W_out );

    valid = compositeSource->get_2D_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    double det2 = det( W_out );

    if( det2 < 1e-15 ) return false;

    W_out *= sqrt( det1 / det2 );
    return true;
}
bool MBMesquite::LambdaTarget::get_3D_target ( PatchData pd,
size_t  element,
Sample  sample,
MsqMatrix< 3, 3 > &  W_out,
MsqError err 
) [virtual]

Get a target matrix.

Parameters:
pdThe current PatchData
elementThe index an element within the patch data.
sampleThe sample point in the element.
W_outThe resulting target matrix.

Implements MBMesquite::TargetCalculator.

Definition at line 47 of file LambdaTarget.cpp.

References MBMesquite::cbrt(), compositeSource, MBMesquite::det(), MBMesquite::TargetCalculator::get_3D_target(), lambdaSource, and MSQ_CHKERR.

{
    bool valid = lambdaSource->get_3D_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    double det1 = det( W_out );

    valid = compositeSource->get_3D_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    double det2 = det( W_out );

    if( det2 < 1e-15 ) return false;

    W_out *= MBMesquite::cbrt( fabs( det1 / det2 ) );
    return true;
}
bool MBMesquite::LambdaTarget::get_surface_target ( PatchData pd,
size_t  element,
Sample  sample,
MsqMatrix< 3, 2 > &  W_out,
MsqError err 
) [virtual]

Get a target matrix.

Parameters:
pdThe current PatchData
elementThe index an element within the patch data.
sampleThe sample point in the element.
W_outThe resulting target matrix.

Implements MBMesquite::TargetCalculator.

Definition at line 87 of file LambdaTarget.cpp.

References MBMesquite::MsqMatrix< R, C >::column(), compositeSource, moab::cross(), MBMesquite::TargetCalculator::get_surface_target(), lambdaSource, and MSQ_CHKERR.

{
    bool valid = lambdaSource->get_surface_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    MsqVector< 3 > cross = W_out.column( 0 ) * W_out.column( 1 );
    double det1          = cross % cross;  // length squared

    valid = compositeSource->get_surface_target( pd, element, sample, W_out, err );
    if( MSQ_CHKERR( err ) && !valid ) return false;
    cross       = W_out.column( 0 ) * W_out.column( 1 );
    double det2 = cross % cross;  // length squared

    if( det2 < 1e-15 ) return false;

    W_out *= sqrt( sqrt( det1 / det2 ) );
    return true;
}
bool MBMesquite::LambdaTarget::have_surface_orient ( ) const [inline, virtual]

Use 3x2 W for surface elements if true, 2x2 W if false.

If true, then the targets for surface elements attempt some control of orientation and therefore get_surface_target must be used to get the targets. If false, then the target contains no orientation data and is therefore the same as the corresponding 2D target for surface elements. In this case, get_2D_target should be used.

Implements MBMesquite::TargetCalculator.

Definition at line 67 of file LambdaTarget.hpp.

References compositeSource, and MBMesquite::TargetCalculator::have_surface_orient().


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