MOAB: Mesh Oriented datABase  (version 5.4.1)
FakeMesh Class Reference
+ Inheritance diagram for FakeMesh:
+ Collaboration diagram for FakeMesh:

Public Member Functions

 FakeMesh (size_t num_verts)
 ~FakeMesh ()
void should_fail (bool yesno)
void get_all_elements (vector< ElementHandle > &elems, MsqError &err)
void get_all_vertices (vector< VertexHandle > &verts, MsqError &err)
void vertices_get_fixed_flag (const VertexHandle *verts, std::vector< bool > &fixed, size_t n, MsqError &err)
void vertices_get_slaved_flag (const VertexHandle *verts, std::vector< bool > &fixed, size_t n, MsqError &err)
void vertices_get_attached_elements (const VertexHandle *array, size_t len, vector< ElementHandle > &elems, vector< size_t > &offsets, MsqError &err)
int get_geometric_dimension (MsqError &err)
 Returns whether this mesh lies in a 2D or 3D coordinate system.
VertexIteratorvertex_iterator (MsqError &err)
ElementIteratorelement_iterator (MsqError &err)
void vertices_get_coordinates (const VertexHandle *, MsqVertex *, size_t, MsqError &err)
void vertex_set_coordinates (VertexHandle, const Vector3D &, MsqError &err)
void vertex_set_byte (VertexHandle h, unsigned char b, MsqError &err)
void vertices_set_byte (const VertexHandle *, const unsigned char *, size_t, MsqError &err)
void vertex_get_byte (const VertexHandle h, unsigned char *b, MsqError &err)
void vertices_get_byte (const VertexHandle *, unsigned char *, size_t, MsqError &err)
void elements_get_attached_vertices (const ElementHandle *, size_t, vector< VertexHandle > &, vector< size_t > &, MsqError &err)
void elements_get_topologies (const ElementHandle *, EntityTopology *, size_t, MsqError &err)
TagHandle tag_create (const string &, TagType, unsigned, const void *, MsqError &err)
void tag_delete (TagHandle, MsqError &err)
 Remove a tag and all corresponding data.
TagHandle tag_get (const string &, MsqError &err)
void tag_properties (TagHandle, string &, TagType &, unsigned &, MsqError &err)
void tag_set_element_data (TagHandle, size_t, const ElementHandle *, const void *, MsqError &err)
 Set tag values on elements.
void tag_set_vertex_data (TagHandle, size_t, const VertexHandle *, const void *, MsqError &err)
 Set tag values on vertices.
void tag_get_element_data (TagHandle, size_t, const ElementHandle *, void *, MsqError &err)
 Get tag values on elements.
void tag_get_vertex_data (TagHandle, size_t, const VertexHandle *, void *, MsqError &err)
 Get tag values on vertices.
void release_entity_handles (const EntityHandle *, size_t, MsqError &err)
void release ()

Private Attributes

std::vector< VertexHandlevertHandles
std::vector< ElementHandleelemHandles
std::vector< size_t > vertOffsets
std::vector< bool > fixedFlags
std::vector< unsigned char > vertexBytes
bool doError

Detailed Description

Definition at line 52 of file PatchSetTest.cpp.


Constructor & Destructor Documentation

FakeMesh::FakeMesh ( size_t  num_verts)

Definition at line 173 of file PatchSetTest.cpp.

References elemHandles, fixedFlags, vertexBytes, vertHandles, and vertOffsets.

                                   : doError( false )
{
    vertHandles.resize( num_vtx );
    vertOffsets.resize( num_vtx + 1 );
    fixedFlags.resize( num_vtx );
    elemHandles.clear();
    for( size_t i = 0; i < num_vtx; ++i )
    {
        vertHandles[i] = (Mesh::VertexHandle)i;
        vertOffsets[i] = elemHandles.size();
        for( size_t j = 0; j < ( num_vtx % 5 ); ++j )
            elemHandles.push_back( ( Mesh::ElementHandle )( i * num_vtx + j ) );
        fixedFlags[i] = !( i % 2 );
    }
    vertOffsets[vertOffsets.size() - 1] = elemHandles.size();
    vertexBytes.resize( num_vtx, 0 );
}

Definition at line 191 of file PatchSetTest.cpp.

{}

Member Function Documentation

Definition at line 88 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
        return 0;
    }
void FakeMesh::elements_get_attached_vertices ( const ElementHandle ,
size_t  ,
vector< VertexHandle > &  ,
vector< size_t > &  ,
MsqError err 
) [inline]

Definition at line 112 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::elements_get_topologies ( const ElementHandle element_handle_array,
EntityTopology element_topologies,
size_t  num_elements,
MsqError err 
) [inline, virtual]

Returns the topologies of the given entities. The "entity_topologies" array must be at least "num_elements" in size.

Implements MBMesquite::Mesh.

Definition at line 120 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::get_all_elements ( vector< ElementHandle > &  elems,
MsqError err 
)

Definition at line 193 of file PatchSetTest.cpp.

References doError, elemHandles, and MSQ_SETERR.

Referenced by PatchSetTest::test_global_patch().

{
    if( doError )
    {
        MSQ_SETERR( err )( MsqError::UNKNOWN_ERROR, "Expected error" );
        return;
    }

    elems = elemHandles;
}
void FakeMesh::get_all_vertices ( vector< VertexHandle > &  verts,
MsqError err 
)

Definition at line 204 of file PatchSetTest.cpp.

References doError, MSQ_SETERR, and vertHandles.

Referenced by PatchSetTest::test_global_patch(), and PatchSetTest::test_vertex_patches().

{
    if( doError )
    {
        MSQ_SETERR( err )( MsqError::UNKNOWN_ERROR, "Expected error" );
        return;
    }

    verts = vertHandles;
}
int FakeMesh::get_geometric_dimension ( MsqError err) [inline, virtual]

Returns whether this mesh lies in a 2D or 3D coordinate system.

Implements MBMesquite::Mesh.

Definition at line 78 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
        return 3;
    }
void FakeMesh::release ( ) [inline, virtual]

Instead of deleting a Mesh when you think you are done, call release(). In simple cases, the implementation could just call the destructor. More sophisticated implementations may want to keep the Mesh object to live longer than Mesquite is using it.

Implements MBMesquite::Mesh.

Definition at line 162 of file PatchSetTest.cpp.

{}
void FakeMesh::release_entity_handles ( const EntityHandle handle_array,
size_t  num_handles,
MsqError err 
) [inline, virtual]

Tells the mesh that the client is finished with a given entity handle.

Implements MBMesquite::Mesh.

Definition at line 158 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::should_fail ( bool  yesno) [inline]
TagHandle FakeMesh::tag_create ( const string &  ,
TagType  ,
unsigned  ,
const void *  ,
MsqError err 
) [inline]

Definition at line 124 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
        return 0;
    }
void FakeMesh::tag_delete ( TagHandle  handle,
MsqError err 
) [inline, virtual]

Remove a tag and all corresponding data.

Delete a tag.

Implements MBMesquite::Mesh.

Definition at line 129 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
TagHandle FakeMesh::tag_get ( const string &  ,
MsqError err 
) [inline]

Definition at line 133 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
        return 0;
    }
void FakeMesh::tag_get_element_data ( TagHandle  handle,
size_t  num_elems,
const ElementHandle elem_array,
void *  tag_data,
MsqError err 
) [inline, virtual]

Get tag values on elements.

Get the value of a tag for a list of mesh elements.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of elements for which to get the tag value.
tag_dataReturn buffer in which to copy tag data, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes.

Implements MBMesquite::Mesh.

Definition at line 150 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::tag_get_vertex_data ( TagHandle  handle,
size_t  num_elems,
const VertexHandle node_array,
void *  tag_data,
MsqError err 
) [inline, virtual]

Get tag values on vertices.

Get the value of a tag for a list of mesh vertices.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of vertices for which to get the tag value.
tag_dataReturn buffer in which to copy tag data, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes.

Implements MBMesquite::Mesh.

Definition at line 154 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::tag_properties ( TagHandle  ,
string &  ,
TagType ,
unsigned &  ,
MsqError err 
) [inline]

Definition at line 138 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::tag_set_element_data ( TagHandle  handle,
size_t  num_elems,
const ElementHandle elem_array,
const void *  tag_data,
MsqError err 
) [inline, virtual]

Set tag values on elements.

Set the value of a tag for a list of mesh elements.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of elements for which to set the tag value.
tag_dataTag data for each element, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes.

Implements MBMesquite::Mesh.

Definition at line 142 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::tag_set_vertex_data ( TagHandle  handle,
size_t  num_elems,
const VertexHandle node_array,
const void *  tag_data,
MsqError err 
) [inline, virtual]

Set tag values on vertices.

Set the value of a tag for a list of mesh vertices.

Parameters:
handleThe tag
num_elemsLength of node_array
node_arrayArray of vertices for which to set the tag value.
tag_dataTag data for each element, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes.

Implements MBMesquite::Mesh.

Definition at line 146 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::vertex_get_byte ( const VertexHandle  vertex,
unsigned char *  byte,
MsqError err 
) [inline, virtual]

Retrieve the byte value for the specified vertex or vertices. The byte value is 0 if it has not yet been set via one of the _set_byte() functions.

Implements MBMesquite::Mesh.

Definition at line 106 of file PatchSetTest.cpp.

    {
        vertices_get_byte( &h, b, 1, err );
    }

Definition at line 83 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
        return 0;
    }
void FakeMesh::vertex_set_byte ( VertexHandle  vertex,
unsigned char  byte,
MsqError err 
) [inline, virtual]

Each vertex has a byte-sized flag that can be used to store flags. This byte's value is neither set nor used by the mesh implementation. It is intended to be used by Mesquite algorithms. Until a vertex's byte has been explicitly set, its value is 0.

Implements MBMesquite::Mesh.

Definition at line 101 of file PatchSetTest.cpp.

    {
        vertices_get_byte( &h, &b, 1, err );
    }
void FakeMesh::vertex_set_coordinates ( VertexHandle  ,
const Vector3D ,
MsqError err 
) [inline, virtual]

Implements MBMesquite::Mesh.

Definition at line 97 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::vertices_get_attached_elements ( const VertexHandle array,
size_t  len,
vector< ElementHandle > &  elems,
vector< size_t > &  offsets,
MsqError err 
)

Definition at line 247 of file PatchSetTest.cpp.

References doError, elemHandles, MSQ_SETERR, n, vertHandles, and vertOffsets.

Referenced by PatchSetTest::test_vertex_patches().

{
    if( doError )
    {
        MSQ_SETERR( err )( MsqError::UNKNOWN_ERROR, "Expected error" );
        return;
    }

    if( !verts )
    {
        MSQ_SETERR( err )( MsqError::INVALID_STATE, "NULL array pointer" );
        return;
    }

    elems.clear();
    offsets.clear();
    for( size_t i = 0; i < n; ++i )
    {
        size_t vert = (size_t)verts[i];
        if( vert >= vertHandles.size() )
        {
            MSQ_SETERR( err )( MsqError::INVALID_STATE, "Vertex handle out of range" );
            return;
        }
        offsets.push_back( elems.size() );
        size_t s = vertOffsets[vert];
        size_t e = vertOffsets[vert + 1];
        for( size_t j = s; j < e; ++j )
            elems.push_back( elemHandles[j] );
    }
    offsets.push_back( elems.size() );
}
void FakeMesh::vertices_get_byte ( const VertexHandle handles,
unsigned char *  bytes,
size_t  count,
MsqError err 
) [virtual]

Implements MBMesquite::Mesh.

Definition at line 284 of file PatchSetTest.cpp.

References MSQ_SETERR, vertexBytes, and vertHandles.

{
    for( size_t i = 0; i < count; ++i )
    {
        size_t vert = (size_t)handles[i];
        if( vert >= vertHandles.size() )
        {
            MSQ_SETERR( err )( MsqError::INVALID_STATE, "Vertex handle out of range" );
            return;
        }
        bytes[i] = vertexBytes[vert];
    }
}
void FakeMesh::vertices_get_coordinates ( const VertexHandle ,
MsqVertex ,
size_t  ,
MsqError err 
) [inline]

Definition at line 93 of file PatchSetTest.cpp.

References NI.

    {
        NI( err );
    }
void FakeMesh::vertices_get_fixed_flag ( const VertexHandle verts,
std::vector< bool > &  fixed,
size_t  n,
MsqError err 
)

Definition at line 215 of file PatchSetTest.cpp.

References doError, fixedFlags, MSQ_SETERR, n, and vertHandles.

Referenced by PatchSetTest::test_vertex_patches().

{
    if( doError )
    {
        MSQ_SETERR( err )( MsqError::UNKNOWN_ERROR, "Expected error" );
        return;
    }

    if( !verts )
    {
        MSQ_SETERR( err )( MsqError::INVALID_STATE, "NULL array pointer" );
        return;
    }

    fixed.resize( n );
    for( size_t i = 0; i < n; ++i )
    {
        size_t vert = (size_t)verts[i];
        if( vert >= vertHandles.size() )
        {
            MSQ_SETERR( err )( MsqError::INVALID_STATE, "Vertex handle out of range" );
            return;
        }
        fixed[i] = fixedFlags[vert];
    }
}
void FakeMesh::vertices_get_slaved_flag ( const VertexHandle verts,
std::vector< bool > &  fixed,
size_t  n,
MsqError err 
)

Definition at line 242 of file PatchSetTest.cpp.

References CPPUNIT_ASSERT.

{
    CPPUNIT_ASSERT( false );
}
void FakeMesh::vertices_set_byte ( const VertexHandle handles,
const unsigned char *  bytes,
size_t  count,
MsqError err 
) [virtual]

Implements MBMesquite::Mesh.

Definition at line 298 of file PatchSetTest.cpp.

References MSQ_SETERR, vertexBytes, and vertHandles.

{
    for( size_t i = 0; i < count; ++i )
    {
        size_t vert = (size_t)handles[i];
        if( vert >= vertHandles.size() )
        {
            MSQ_SETERR( err )( MsqError::INVALID_STATE, "Vertex handle out of range" );
            return;
        }
        vertexBytes[vert] = bytes[i];
    }
}

Member Data Documentation

std::vector< ElementHandle > FakeMesh::elemHandles [private]

Definition at line 166 of file PatchSetTest.cpp.

Referenced by FakeMesh(), get_all_elements(), and vertices_get_attached_elements().

std::vector< bool > FakeMesh::fixedFlags [private]

Definition at line 168 of file PatchSetTest.cpp.

Referenced by FakeMesh(), and vertices_get_fixed_flag().

std::vector< unsigned char > FakeMesh::vertexBytes [private]

Definition at line 169 of file PatchSetTest.cpp.

Referenced by FakeMesh(), vertices_get_byte(), and vertices_set_byte().

std::vector< size_t > FakeMesh::vertOffsets [private]

Definition at line 167 of file PatchSetTest.cpp.

Referenced by FakeMesh(), and vertices_get_attached_elements().

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