MOAB: Mesh Oriented datABase  (version 5.2.1)
FakeTargetCalc Class Reference
+ Inheritance diagram for FakeTargetCalc:
+ Collaboration diagram for FakeTargetCalc:

Public Member Functions

 FakeTargetCalc (bool surface_orient=true)
 ~FakeTargetCalc ()
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.
double get_weight (PatchData &pd, size_t element, Sample sample, MsqError &err)
 Get target metric weight.
bool have_surface_orient () const
 Use 3x2 W for surface elements if true, 2x2 W if false.
unsigned long make_value (Mesh::ElementHandle elem, Sample sample, unsigned idx)

Private Attributes

bool surfOrient

Detailed Description

Definition at line 136 of file TargetReadWriteTest.cpp.


Constructor & Destructor Documentation

FakeTargetCalc::FakeTargetCalc ( bool  surface_orient = true) [inline]

Definition at line 141 of file TargetReadWriteTest.cpp.

: surfOrient( surface_orient ) {}

Definition at line 143 of file TargetReadWriteTest.cpp.

{}

Member Function Documentation

bool FakeTargetCalc::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 185 of file TargetReadWriteTest.cpp.

References CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::element_by_index(), MBMesquite::PatchData::get_element_handles_array(), MBMesquite::MsqMeshEntity::get_element_type(), sample, and u.

Referenced by TargetReadWriteTest::read_write_2D_targets().

{
    CPPUNIT_ASSERT_EQUAL( 2u, TopologyInfo::dimension( pd.element_by_index( elem ).get_element_type() ) );
    for( unsigned i = 0; i < 2; ++i )
        for( unsigned j = 0; j < 2; ++j )
            W_out( i, j ) = make_value( pd.get_element_handles_array()[elem], sample, ( 2 - i ) * ( 2 - j ) );
    return true;
}
bool FakeTargetCalc::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 161 of file TargetReadWriteTest.cpp.

References CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::element_by_index(), MBMesquite::PatchData::get_element_handles_array(), MBMesquite::MsqMeshEntity::get_element_type(), sample, and u.

Referenced by TargetReadWriteTest::read_write_3D_targets().

{
    CPPUNIT_ASSERT_EQUAL( 3u, TopologyInfo::dimension( pd.element_by_index( elem ).get_element_type() ) );
    unsigned i, j;
    for( i = 0; i < 3; ++i )
    {
        for( j = 0; j < i; ++j )
            W_out( i, j ) = 0.0;
        for( j = i; j < 3; ++j )
            W_out( i, j ) = make_value( pd.get_element_handles_array()[elem], sample, 3 * i + j + 1 );
    }
    return true;
}
bool FakeTargetCalc::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 175 of file TargetReadWriteTest.cpp.

References CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::element_by_index(), MBMesquite::PatchData::get_element_handles_array(), MBMesquite::MsqMeshEntity::get_element_type(), sample, and u.

Referenced by TargetReadWriteTest::read_write_surface_targets().

{
    CPPUNIT_ASSERT_EQUAL( 2u, TopologyInfo::dimension( pd.element_by_index( elem ).get_element_type() ) );
    for( unsigned i = 0; i < 3; ++i )
        for( unsigned j = 0; j < 2; ++j )
            W_out( i, j ) = make_value( pd.get_element_handles_array()[elem], sample, 2 * i + j );
    return true;
}
double FakeTargetCalc::get_weight ( PatchData pd,
size_t  element,
Sample  sample,
MsqError err 
) [virtual]

Get target metric weight.

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

Implements MBMesquite::WeightCalculator.

Definition at line 194 of file TargetReadWriteTest.cpp.

References MBMesquite::PatchData::get_element_handles_array(), and sample.

Referenced by TargetReadWriteTest::read_write_weights().

{
    return make_value( pd.get_element_handles_array()[elem], sample, 0 );
}
bool FakeTargetCalc::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 153 of file TargetReadWriteTest.cpp.

    {
        return surfOrient;
    }
unsigned long FakeTargetCalc::make_value ( Mesh::ElementHandle  elem,
Sample  sample,
unsigned  idx 
)

Definition at line 199 of file TargetReadWriteTest.cpp.

References CPPUNIT_ASSERT, MBMesquite::Sample::dimension, MBMesquite::Sample::number, MBMesquite::Sample::SIDE_DIMENSION_BITS, and MBMesquite::Sample::SIDE_NUMBER_BITS.

{
    const unsigned index_bits = 4;
    CPPUNIT_ASSERT( idx < ( 1 << index_bits ) );
    unsigned long result = (unsigned long)elem;
    result               = ( result << Sample::SIDE_DIMENSION_BITS ) | sample.dimension;
    result               = ( result << Sample::SIDE_NUMBER_BITS ) | sample.number;
    result               = ( result << index_bits ) | idx;
    return result;
}

Member Data Documentation

Definition at line 138 of file TargetReadWriteTest.cpp.

List of all members.


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