Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshTSTTImpl Class Reference

Implementation of MeshTSTT. More...

Inheritance diagram for MeshTSTTImpl:
Collaboration diagram for MeshTSTTImpl:

Public Member Functions

 MeshTSTTImpl (TSTTM::Mesh &tstt_mesh, MsqError &err)
 
virtual ~MeshTSTTImpl ()
 
virtual void set_active_set (void *element_set, MsqError &)
 set mesh to be smoothed. More...
 
virtual int get_geometric_dimension (Mesquite::MsqError &)
 Get dimension of vertex coordinates (2D vs. More...
 
virtual void get_all_sizes (size_t &vertex_count, size_t &element_count, size_t &vertex_use_count, MsqError &err)
 get sizes for calling get_all_mesh More...
 
virtual void get_all_mesh (VertexHandle *vert_array, size_t vert_len, ElementHandle *elem_array, size_t elem_len, size_t *elem_conn_offsets, size_t offset_len, size_t *elem_conn_indices, size_t index_len, MsqError &err)
 Get entities and connectivity. More...
 
virtual VertexIteratorvertex_iterator (MsqError &err)
 Create iterator for vertices in active set. More...
 
virtual ElementIteratorelement_iterator (MsqError &err)
 Create iterator for elements in active set. More...
 
virtual bool vertex_is_fixed (VertexHandle vertex, MsqError &err)
 Query "fixed" flag for a vertex. More...
 
virtual void vertices_are_on_boundary (VertexHandle vert_array[], bool on_bnd[], size_t num_vtx, MsqError &err)
 Query "boundary" flag for an array of vertices. More...
 
virtual void vertices_get_coordinates (const VertexHandle vert_array[], MsqVertex *coordinates, size_t num_vtx, MsqError &err)
 Get vertex coordinates. More...
 
virtual void vertex_set_coordinates (VertexHandle vertex, const Vector3D &coordinates, MsqError &err)
 Set vertex coordinates. More...
 
virtual void vertex_set_byte (VertexHandle vertex, unsigned char byte, MsqError &err)
 Set vertex mark. More...
 
virtual void vertices_set_byte (VertexHandle *vert_array, unsigned char *byte_array, size_t array_size, MsqError &err)
 Set vertex mark. More...
 
virtual void vertex_get_byte (VertexHandle vertex, unsigned char *byte, MsqError &err)
 Get vertex mark. More...
 
virtual void vertices_get_byte (VertexHandle *vert_array, unsigned char *byte_array, size_t array_size, MsqError &err)
 Get vertex mark. More...
 
virtual size_t vertex_get_attached_element_count (VertexHandle vertex, MsqError &err)
 Get vertex adjacencies. More...
 
virtual void vertex_get_attached_elements (VertexHandle vertex, ElementHandle *elem_array, size_t sizeof_elem_array, MsqError &err)
 Get vertex adjacencies. More...
 
virtual size_t element_get_attached_vertex_count (ElementHandle elem, MsqError &err)
 Get length of connectivity list More...
 
virtual size_t get_vertex_use_count (ElementHandle *array, size_t length, MsqError &err)
 
virtual void elements_get_attached_vertices (ElementHandle *elem_handles, size_t num_elems, VertexHandle *vert_handles, size_t &sizeof_vert_handles, size_t *csr_data, size_t &sizeof_csr_data, size_t *csr_offsets, MsqError &err)
 Get element connectivity in overly-complex CSR rep. More...
 
virtual EntityTopology element_get_topology (ElementHandle entity_handle, MsqError &err)
 Return topology type enum for specified element. More...
 
virtual void elements_get_topologies (ElementHandle *element_handle_array, EntityTopology *element_topologies, size_t num_elements, MsqError &err)
 Return topology type enum for an array of elements. More...
 
virtual void release_entity_handles (EntityHandle *handle_array, size_t num_handles, MsqError &err)
 no-op More...
 
virtual void release ()
 Instead of deleting a Mesh when you think you are done, call release(). More...
 
virtual TagHandle tag_create (const msq_std::string &tag_name, TagType type, unsigned length, const void *default_value, MsqError &err)
 Create a tag. More...
 
virtual void tag_delete (TagHandle handle, MsqError &err)
 Remove a tag and all corresponding data. More...
 
virtual TagHandle tag_get (const msq_std::string &name, MsqError &err)
 Get handle for existing tag, by name. More...
 
virtual void tag_properties (TagHandle handle, msq_std::string &name_out, TagType &type_out, unsigned &length_out, MsqError &err)
 Get properites of tag. More...
 
virtual void tag_set_element_data (TagHandle handle, size_t num_elems, const ElementHandle *elem_array, const void *tag_data, MsqError &err)
 Set tag values on elements. More...
 
virtual void tag_set_vertex_data (TagHandle handle, size_t num_elems, const VertexHandle *node_array, const void *tag_data, MsqError &err)
 Set tag values on vertices. More...
 
virtual void tag_get_element_data (TagHandle handle, size_t num_elems, const ElementHandle *elem_array, void *tag_data, MsqError &err)
 Get tag values on elements. More...
 
virtual void tag_get_vertex_data (TagHandle handle, size_t num_elems, const VertexHandle *node_array, void *tag_data, MsqError &err)
 Get tag values on vertices. More...
 
- Public Member Functions inherited from MeshTSTT
virtual ~MeshTSTT ()
 
virtual ~MeshTSTT ()
 

Protected Member Functions

void set_int_tag (void *tag, void *meshset, int value, MsqError &err)
 
void popupate_input_elements () throw ( TSTTB::Error )
 Populate inputElements from elemetnSet. More...
 
- Protected Member Functions inherited from Mesh
virtual ~Mesh ()
 Don't allow a Mesh to be deleted directly. More...
 

Private Member Functions

void tag_set_data (TagHandle handle, size_t num_elems, const EntityHandle *handle_array, const void *tag_data, MsqError &err)
 Set tag values. More...
 
void tag_get_data (TagHandle handle, size_t num_elems, const EntityHandle *handle_array, void *tag_data, MsqError &err)
 Get tag values. More...
 
void cache_adjacent_elements (void *vertex_handle, MsqError &err)
 Get elements adjacent to vertex and store in vertexAdjElements. More...
 

Private Attributes

TSTTM::Mesh meshIFace
 TSTT basic mesh interface instance. More...
 
TSTTM::Entity entIFace
 TSTT interface for per-entity queries. More...
 
TSTTB::EntTag tagIFace
 
TSTTM::Arr arrIFace
 TSTT interface for multi-entity (array) queries. More...
 
TSTTB::ArrTag arrTagIFace
 
TSTTM::Modify modIFace
 TSTT interface for modifying mesh. More...
 
TSTTB::EntSet setIFace
 TSTT interface for entity set operations. More...
 
bool haveMesh
 Have mesh. More...
 
void * elementSet
 TSTTM entity set handle for elements to improve. More...
 
void * nodeSet
 TSTTM entity set handle for nodes to move. More...
 
msq_std::set< void * > inputElements
 std::set containing elements in elementSet, used to constrain vertex->element adjaceny queries to only those elements that are in the input element set. More...
 
TSTTM::EntityType inputSetType
 The type of elements contained in the input element set. More...
 
TagHandle byteTag
 Handle for tag used to hold vertex byte. More...
 
bool createdByteTag
 Tag was created in constructor. More...
 
TagHandle fixedTag
 Handle for tag used to hold vertex-fixed flag. More...
 
bool createdFixedTag
 Fixed tag was created in constructor. More...
 
EntityTopology topologyMap [TSTTM::EntityTopology_ALL_TOPOLOGIES+1]
 Handle for the tag used internally to remove duplicates from lists. More...
 
sidl::array< void * > vertexAdjElements
 Cached result for vertex->element query. More...
 
int vertexAdjElementSize
 Number of valid entries vertexAdjElements. More...
 
void * cachedAdjVertex
 Vertex for which vertexAdjElements is cached. More...
 

Additional Inherited Members

- Public Types inherited from Mesh
enum  TagType {
  BYTE, BOOL, INT, DOUBLE,
  HANDLE
}
 The type of a tag. More...
 
typedef void * EntityHandle
 Opaque EntityHandle type and tag type. More...
 
typedef EntityHandle VertexHandle
 
typedef EntityHandle ElementHandle
 
- Static Public Member Functions inherited from MeshTSTT
static MeshTSTTcreate (TSTTM::Mesh &mesh, void *meshset, MsqError &err)
 factory method More...
 
static MeshTSTTcreate (TSTTM::Mesh &mesh, MsqError &err)
 factory method More...
 
static MeshTSTTcreate (TSTTM::Mesh &mesh, void *meshset, MsqError &err)
 factory method More...
 
static MeshTSTTcreate (TSTTM::Mesh &mesh, MsqError &err)
 factory method More...
 

Detailed Description

Implementation of MeshTSTT.

Definition at line 307 of file MeshTSTT.cpp.

Constructor & Destructor Documentation

MeshTSTTImpl ( TSTTM::Mesh &  tstt_mesh,
Mesquite::MsqError err 
)

Definition at line 714 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, MeshTSTTImpl::arrTagIFace, MeshTSTTImpl::byteTag, MeshTSTTImpl::createdByteTag, MeshTSTTImpl::createdFixedTag, MeshTSTTImpl::entIFace, MeshTSTTImpl::fixedTag, Mesquite::HEXAHEDRON, i, MsqError::INTERNAL_ERROR, MsqError::INVALID_STATE, Mesquite::MIXED, MeshTSTTImpl::modIFace, MSQ_SETERR, MeshTSTTImpl::nodeSet, Mesquite::PRISM, Mesquite::process_tstt_error(), Mesquite::PYRAMID, Mesquite::QUADRILATERAL, MeshTSTTImpl::set_int_tag(), MeshTSTTImpl::setIFace, MeshTSTTImpl::tagIFace, Mesquite::TETRAHEDRON, MeshTSTTImpl::topologyMap, Mesquite::TRIANGLE, Mesquite::VERTEX_BYTE_TAG_NAME, and Mesquite::VERTEX_FIXED_TAG_NAME.

715  : meshIFace(tstt_mesh),
716  elementSet(0), nodeSet(0),
717  inputSetType( TSTTM::EntityType_ALL_TYPES ),
718  byteTag(0), createdByteTag(false),
719  fixedTag(0), createdFixedTag(false),
721 // ,vertexIndexTag(0), createdVertexIndexTag(false)
722 {
723  // Initialize topology map
724 
725  const size_t mapsize = sizeof(topologyMap) / sizeof(Mesquite::EntityTopology);
726  if (mapsize < TSTTM::EntityTopology_ALL_TOPOLOGIES)
727  {
728  MSQ_SETERR(err)("MeshTSTT needs to be updated for new TSTT element topologies.",
730  return;
731  }
732 
733  for (size_t i = 0; i <= TSTTM::EntityTopology_ALL_TOPOLOGIES; ++i)
735 
736  topologyMap[TSTTM::EntityTopology_TRIANGLE ] = Mesquite::TRIANGLE;
737  topologyMap[TSTTM::EntityTopology_QUADRILATERAL] = Mesquite::QUADRILATERAL;
738  topologyMap[TSTTM::EntityTopology_TETRAHEDRON ] = Mesquite::TETRAHEDRON;
739  topologyMap[TSTTM::EntityTopology_HEXAHEDRON ] = Mesquite::HEXAHEDRON;
740  topologyMap[TSTTM::EntityTopology_PRISM ] = Mesquite::PRISM;
741  topologyMap[TSTTM::EntityTopology_PYRAMID ] = Mesquite::PYRAMID;
742 
743  try {
744  // Attempt to cast to single-entity query interface
745  entIFace = tstt_mesh;
746  if (!entIFace)
747  {
748  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTM::EntTag",
750  return;
751  }
752  // Attempt cast to multi-entity query interface
753  arrIFace = tstt_mesh;
754  if (!arrIFace)
755  {
756  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTM::ArrTag",
758  return;
759  }
760  // Attempt cast to modify interface
761  modIFace = tstt_mesh;
762  if (!arrIFace)
763  {
764  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTM::Modify",
766  return;
767  }
768  // Attempt cast to entity set interface
769  setIFace = tstt_mesh;
770  if (!arrIFace)
771  {
772  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTM::EntSet",
774  return;
775  }
776  // Get tag interface
777  tagIFace = tstt_mesh;
778  if (!tagIFace)
779  {
780  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTB::EntTag",
782  return;
783  }
784  // Get tag interface
785  arrTagIFace = tstt_mesh;
786  if (!arrTagIFace)
787  {
788  MSQ_SETERR(err)( "TSTTM::Mesh does not implement TSTTB::ArrTag",
790  return;
791  }
792 
793  // Get tag for fixed flag
794  try {
795  fixedTag = tagIFace.getTagHandle( VERTEX_FIXED_TAG_NAME );
796 
797  // Double-check types incase tag already existed
798  if (tagIFace.getTagSize(fixedTag) != sizeof(int) ||
799  tagIFace.getTagType(fixedTag) != TSTTB::TagValueType_INTEGER)
800  {
802  "Tag \"%s\" exists with invalid type/size",
804  return;
805  }
806  } catch (...) {
807  fixedTag = 0;
808  }
809 
810  // Get/create tag for vertex byte
811  try {
812  byteTag = tagIFace.getTagHandle( VERTEX_BYTE_TAG_NAME );
813  } catch (...) {}
814 
815  if (!byteTag) {
816  tagIFace.createTag( VERTEX_BYTE_TAG_NAME, sizeof(int), TSTTB::TagValueType_INTEGER, byteTag );
817  createdByteTag = true;
818  }
819  // Double-check types incase tag already existed
820  if (tagIFace.getTagSize(byteTag) != sizeof(int) ||
821  tagIFace.getTagType(byteTag) != TSTTB::TagValueType_INTEGER)
822  {
824  "Tag \"%s\" exists with invalid type/size",
826  return;
827  }
828 
829  // Clear vertex byte tag
830  set_int_tag( byteTag, nodeSet, 0, err );
831  if (err)
832  return;
833 
834  // Get/create tag for vertex index
835 /*
836  //try {
837  // vertexIndexTag = tagIFace.getTagHandle( VERTEX_INDEX_TAG_NAME );
838  //} catch (...) {}
839 
840  if (!vertexIndexTag) {
841  tagIFace.createTag( VERTEX_INDEX_TAG_NAME, sizeof(int), TSTTB::TagValueType_INTEGER, byteTag );
842  createdVertexIndexTag = true;
843  }
844  // Double-check types incase tag already existed
845  if (tagIFace.getTagSize(vertexIndexTag) != sizeof(int) ||
846  tagIFace.getTagType(vertexIndexTag) != TSTTB::TagValueType_INTEGER)
847  {
848  MSQ_SETERR(err)( MsqError::INVALID_STATE,
849  "Tag \"%s\" exists with invalid type/size",
850  VERTEX_INDEX_TAG_NAME );
851  return;
852  }
853 */
854  }
855  catch (TSTTB::Error &tstt_err) {
857  try {
858  if (createdFixedTag)
859  tagIFace.destroyTag( fixedTag, false );
860  if (createdByteTag)
861  tagIFace.destroyTag( byteTag, false );
862 // if (createdVertexIndexTag)
863 // tagIFace.destroyTag( vertexIndexTag, false );
864  }
865  catch (...) {}
866  }
867  catch(...) {
868  MSQ_SETERR(err)("Uknown exception",MsqError::INTERNAL_ERROR);
869  }
870 }
bool createdByteTag
Tag was created in constructor.
Definition: MeshTSTT.cpp:656
int vertexAdjElementSize
Number of valid entries vertexAdjElements.
Definition: MeshTSTT.cpp:672
EntityTopology
Definition: Mesquite.hpp:92
void * nodeSet
TSTTM entity set handle for nodes to move.
Definition: MeshTSTT.cpp:638
TagHandle fixedTag
Handle for tag used to hold vertex-fixed flag.
Definition: MeshTSTT.cpp:658
bool createdFixedTag
Fixed tag was created in constructor.
Definition: MeshTSTT.cpp:660
TSTTM::Modify modIFace
TSTT interface for modifying mesh.
Definition: MeshTSTT.cpp:629
const char *const VERTEX_BYTE_TAG_NAME
The name of the tag (integer) that Mesquite will use to store internal data.
TSTTM::EntityType inputSetType
The type of elements contained in the input element set.
Definition: MeshTSTT.cpp:651
void set_int_tag(void *tag, void *meshset, int value, MsqError &err)
Definition: MeshTSTT.cpp:894
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
TSTTM::Mesh meshIFace
TSTT basic mesh interface instance.
Definition: MeshTSTT.cpp:621
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
void * cachedAdjVertex
Vertex for which vertexAdjElements is cached.
Definition: MeshTSTT.cpp:674
const char *const VERTEX_FIXED_TAG_NAME
The name of the tag (integer) Mesquite expects to be non-zero for vertices which are not to be moved ...
object is in an invalid state
TSTTB::EntSet setIFace
TSTT interface for entity set operations.
Definition: MeshTSTT.cpp:631
EntityTopology topologyMap[TSTTM::EntityTopology_ALL_TOPOLOGIES+1]
Handle for the tag used internally to remove duplicates from lists.
Definition: MeshTSTT.cpp:667
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
TSTTM::Entity entIFace
TSTT interface for per-entity queries.
Definition: MeshTSTT.cpp:623
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

~MeshTSTTImpl ( )
virtual

Definition at line 872 of file MeshTSTT.cpp.

References Mesquite::process_tstt_error().

873 {
874  try {
875  if (elementSet)
876  setIFace.destroyEntSet( elementSet );
877  if (nodeSet)
878  setIFace.destroyEntSet( nodeSet );
879 
880  if (createdFixedTag)
881  tagIFace.destroyTag( fixedTag, false );
882  if (createdByteTag)
883  tagIFace.destroyTag( byteTag, false );
884 // if (createdVertexIndexTag)
885 // tagIFace.destroyTag( vertexIndexTag, false );
886  }
887  catch (TSTTB::Error& tstt_err ) {
888  process_tstt_error(tstt_err);
889  throw;
890  }
891 }
bool createdByteTag
Tag was created in constructor.
Definition: MeshTSTT.cpp:656
void * nodeSet
TSTTM entity set handle for nodes to move.
Definition: MeshTSTT.cpp:638
TagHandle fixedTag
Handle for tag used to hold vertex-fixed flag.
Definition: MeshTSTT.cpp:658
bool createdFixedTag
Fixed tag was created in constructor.
Definition: MeshTSTT.cpp:660
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
TSTTB::EntSet setIFace
TSTT interface for entity set operations.
Definition: MeshTSTT.cpp:631
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Member Function Documentation

void cache_adjacent_elements ( void *  vertex_handle,
MsqError err 
)
private

Get elements adjacent to vertex and store in vertexAdjElements.

Definition at line 1362 of file MeshTSTT.cpp.

References MeshTSTTImpl::cachedAdjVertex, Mesquite::convert_from_sidl_vector(), MeshTSTTImpl::entIFace, MeshTSTTImpl::inputElements, MeshTSTTImpl::inputSetType, MsqError::INTERNAL_ERROR, MSQ_SETERR, MeshTSTTImpl::popupate_input_elements(), Mesquite::process_tstt_error(), MeshTSTTImpl::vertexAdjElements, and MeshTSTTImpl::vertexAdjElementSize.

Referenced by MeshTSTTImpl::vertex_get_attached_element_count(), and MeshTSTTImpl::vertex_get_attached_elements().

1363 {
1364  // If already have data cached for this vertex, just return
1365  if (vtx == cachedAdjVertex)
1366  return;
1367 
1368  // make sure to clear this so that if we fail in the middle,
1369  // we don't end up with invlaid cache data for the prev vertex.
1370  cachedAdjVertex = 0;
1372 
1373  try {
1374  // First try using current array size
1375  bool success;
1376  try {
1378  success = true;
1379  }
1380  catch( ... ) {
1381  success = false;
1382  }
1383 
1384  // If failed, try again and let implementation allocate storage
1385  if (!success) {
1386  vertexAdjElements = sidl::array<void*>();
1388  }
1389 
1390  // Store which vertex we have cached adj data for
1391  cachedAdjVertex = vtx;
1392 
1393  // We need to use inputElements. Fill it if it hasn't
1394  // been filled yet.
1395  if (inputElements.empty())
1397  }
1398  catch(::TSTTB::Error &tstt_err) {
1400  return;
1401  }
1402 
1403  // Remove from list any elements not in the input set
1404  void** write_ptr = convert_from_sidl_vector( vertexAdjElements );
1405  void** const end_ptr = write_ptr + vertexAdjElementSize;
1406  for (void** read_ptr = write_ptr; read_ptr != end_ptr; ++read_ptr)
1407  {
1408  if (inputElements.find( *read_ptr ) != inputElements.end())
1409  {
1410  *write_ptr = *read_ptr;
1411  ++write_ptr;
1412  }
1413  }
1414 
1415  vertexAdjElementSize = write_ptr - convert_from_sidl_vector( vertexAdjElements );
1416 }
int vertexAdjElementSize
Number of valid entries vertexAdjElements.
Definition: MeshTSTT.cpp:672
TSTTM::EntityType inputSetType
The type of elements contained in the input element set.
Definition: MeshTSTT.cpp:651
static T * convert_from_sidl_vector(sidl::array< T > &array)
sidl::array< void * > vertexAdjElements
Cached result for vertex-&gt;element query.
Definition: MeshTSTT.cpp:670
void popupate_input_elements()
Populate inputElements from elemetnSet.
Definition: MeshTSTT.cpp:1037
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void * cachedAdjVertex
Vertex for which vertexAdjElements is cached.
Definition: MeshTSTT.cpp:674
msq_std::set< void * > inputElements
std::set containing elements in elementSet, used to constrain vertex-&gt;element adjaceny queries to onl...
Definition: MeshTSTT.cpp:643
TSTTM::Entity entIFace
TSTT interface for per-entity queries.
Definition: MeshTSTT.cpp:623
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Here is the caller graph for this function:

size_t element_get_attached_vertex_count ( ElementHandle  elem,
MsqError err 
)
virtual

Get length of connectivity list

Implements Mesh.

Definition at line 1453 of file MeshTSTT.cpp.

References MeshTSTTImpl::entIFace, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1456 {
1457  try {
1458  sidl::array<void*> junk;
1459  int result = 0;
1460  entIFace.getEntAdj( elem, TSTTM::EntityType_VERTEX, junk, result );
1461  return result;
1462  }
1463  catch(::TSTTB::Error &tstt_err) {
1465  return 0;
1466  }
1467 }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Entity entIFace
TSTT interface for per-entity queries.
Definition: MeshTSTT.cpp:623
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

EntityTopology element_get_topology ( ElementHandle  entity_handle,
MsqError err 
)
virtual

Return topology type enum for specified element.

Implements Mesh.

Definition at line 1668 of file MeshTSTT.cpp.

References MeshTSTTImpl::entIFace, MsqError::INTERNAL_ERROR, Mesquite::MIXED, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::topologyMap.

1670 {
1671  try {
1672  TSTTM::EntityTopology topo = entIFace.getEntTopo( element );
1673  return topologyMap[topo];
1674  }
1675  catch(::TSTTB::Error &tstt_err) {
1677  return MIXED;
1678  }
1679 }
EntityTopology
Definition: Mesquite.hpp:92
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
EntityTopology topologyMap[TSTTM::EntityTopology_ALL_TOPOLOGIES+1]
Handle for the tag used internally to remove duplicates from lists.
Definition: MeshTSTT.cpp:667
TSTTM::Entity entIFace
TSTT interface for per-entity queries.
Definition: MeshTSTT.cpp:623
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

ElementIterator * element_iterator ( MsqError err)
virtual

Create iterator for elements in active set.

Implements Mesh.

Definition at line 1108 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, MeshTSTTImpl::elementSet, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1109 {
1110  try {
1111  return new TSTTArrIter( arrIFace,
1112  elementSet,
1113  TSTTM::EntityType_ALL_TYPES,
1114  TSTTM::EntityTopology_ALL_TOPOLOGIES );
1115  }
1116  catch (TSTTB::Error &tstt_err) {
1118  return 0;
1119  }
1120 }
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void elements_get_attached_vertices ( ElementHandle elements,
size_t  num_elems,
VertexHandle vertices,
size_t &  vert_len,
size_t *  indices,
size_t &  indices_len,
size_t *  offsets,
Mesquite::MsqError err 
)
virtual

Get element connectivity in overly-complex CSR rep.

Get connectivity.

Returns the vertices that are part of the topological definition of each element in the "elem_handles" array. When this function is called, the following must be true: a) "elem_handles" points at an array of "num_elems" element handles. b) "vert_handles" points at an array of size "sizeof_vert_handles" c) "csr_data" points at an array of size "sizeof_csr_data" d) "csr_offsets" points at an array of size "num_elems+1"

When this function returns, adjacency information will be stored in csr format: a) "vert_handles" stores handles to all vertices found in one or more of the elements. Each vertex appears only once in "vert_handles", even if it is in multiple elements. b) "sizeof_vert_handles" is set to the number of vertex handles placed into "vert_handles". c) "sizeof_csr_data" is set to the total number of vertex uses (for example, sizeof_csr_data = 6 in the case of 2 TRIANGLES, even if the two triangles share some vertices). c) "csr_offsets" is filled such that csr_offset[i] indicates the location of entity i's first adjacency in "csr_data". The number of vertices in element i is equal to csr_offsets[i+1] - csr_offsets[i]. For this reason, csr_offsets[num_elems] is set to the new value of "sizeof_csr_data". d) "csr_data" stores integer offsets which give the location of each adjacency in the "vert_handles" array.

As an example of how to use this data, you can get the handle of the first vertex in element #3 like this: VertexHandle vh = vert_handles[ csr_data[ csr_offsets[3] ] ]

and the second vertex of element #3 like this: VertexHandle vh = vert_handles[ csr_data[ csr_offsets[3]+1 ] ]

Parameters
elements- Array of length num_elems containing elements handles of elements for which connectivity is to be queried.
vertices- Array of vertex handles in connectivity list.
offsets- Indices into indices array, one per element.
indices- Indices into vertex_handles

Implements Mesh.

Definition at line 1495 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, Mesquite::convert_to_sidl_vector(), Mesquite::copy_from_sidl(), MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

Referenced by MeshTSTTImpl::get_all_mesh().

1504 {
1505  if (num_elems == 0)
1506  return;
1507 
1508  try {
1509  // Constuct arguments to TSTT
1510  int vert_count, off_count;
1511  sidl::array<void*> elem_arr( convert_to_sidl_vector( elements, num_elems ) );
1512  sidl::array<void*> vert_arr( convert_to_sidl_vector( (void**)indices, indices_len ) );
1513  sidl::array<int> off_arr;
1514  if (sizeof(size_t) == sizeof(int))
1515  off_arr = convert_to_sidl_vector( (int*)offsets, num_elems + 1 );
1516  else
1517  off_arr = alloc_sidl_vector<int>( num_elems + 1 );
1518 
1519  // Query TSTT for element connectivity
1520  arrIFace.getEntArrAdj( elem_arr, num_elems,
1521  TSTTM::EntityType_VERTEX,
1522  vert_arr, vert_count,
1523  off_arr, off_count );
1524 
1525  indices_len = vert_count;
1526  // If couldn't do array borrow, copy offsets into output array
1527  if (sizeof(size_t) != sizeof(int))
1528  copy_from_sidl( off_arr, offsets );
1529 
1530  // Mesquite expects index array length as last value in offset array.
1531  // If TSTT mesh doesn't return it, then add it.
1532  if ((unsigned)off_count == num_elems)
1533  offsets[num_elems] = vert_count;
1534  else
1535  assert( (unsigned)off_count == num_elems+1 );
1536  }
1537  catch(::TSTTB::Error &tstt_err) {
1539  return;
1540  }
1541 
1542  // Construct unique list of vertex handles
1543  vert_len = 0;
1544  msq_std::map<VertexHandle,size_t> index_map;
1545  const size_t* end = indices + indices_len;
1546  /*
1547  for (size_t* iter = indices; iter != end; ++iter)
1548  {
1549  VertexHandle vertex = *(VertexHandle*)iter;
1550  msq_std::map<VertexHandle,size_t>::iterator pos = index_map.find( vertex );
1551  size_t index;
1552  if (pos == index_map.end())
1553  index_map[vertex] = index = vert_len++;
1554  else
1555  index = pos->second;
1556 
1557  vertices[index] = vertex;
1558  *iter = index;
1559  }
1560  */
1561  // Rather than the above simple code, do the following more complicated
1562  // code so the resulting list of vertices are sorted (easier to debug)
1563  for (size_t* iter = indices; iter != end; ++iter)
1564  {
1565  VertexHandle vertex = *(VertexHandle*)iter;
1566  msq_std::map<VertexHandle,size_t>::iterator pos = index_map.find( vertex );
1567  if (pos == index_map.end())
1568  index_map[vertex] = 0;
1569  }
1570  for (msq_std::map<VertexHandle,size_t>::iterator m_iter = index_map.begin();
1571  m_iter != index_map.end(); ++m_iter)
1572  {
1573  vertices[vert_len] = m_iter->first;
1574  m_iter->second = vert_len++;
1575  }
1576  for (size_t* iter = indices; iter != end; ++iter)
1577  {
1578  VertexHandle vertex = *(VertexHandle*)iter;
1579  msq_std::map<VertexHandle,size_t>::iterator pos = index_map.find( vertex );
1580  *iter = pos->second;
1581  }
1582 
1583 
1584 }
EntityHandle VertexHandle
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
static void copy_from_sidl(sidl::array< S > &source, T *target)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Here is the caller graph for this function:

void elements_get_topologies ( ElementHandle element_handle_array,
EntityTopology element_topologies,
size_t  num_elements,
MsqError err 
)
virtual

Return topology type enum for an array of elements.

Implements Mesh.

Definition at line 1683 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::topologyMap.

1687 {
1688  try {
1689 
1690  sidl::array<TSTTM::EntityTopology> topologies( alloc_sidl_vector<TSTTM::EntityTopology>( num_elements ) );
1691  sidl::array<void*> handles( convert_to_sidl_vector( element_handle_array, num_elements ) );
1692  int topo_len_out;
1693  arrIFace.getEntArrTopo( handles, num_elements, topologies, topo_len_out );
1694  if ((size_t)topo_len_out != num_elements) {
1696  return;
1697  }
1698 
1699  for (unsigned i = 0; i < num_elements; ++i)
1700  element_topologies[i] = topologyMap[topologies.get(i)];
1701  }
1702  catch(::TSTTB::Error &tstt_err) {
1704  }
1705 }
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
EntityTopology topologyMap[TSTTM::EntityTopology_ALL_TOPOLOGIES+1]
Handle for the tag used internally to remove duplicates from lists.
Definition: MeshTSTT.cpp:667
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void get_all_mesh ( VertexHandle vert_array,
size_t  vert_len,
ElementHandle elem_array,
size_t  elem_len,
size_t *  elem_conn_offsets,
size_t  offset_len,
size_t *  elem_conn_indices,
size_t  index_len,
MsqError err 
)
virtual

Get entities and connectivity.

Get vertex handles, element handles, and connectivty for active mesh. Use get_all_sizes to determine required array sizes.

Parameters
vert_arrayArray to store vertex handles in
vert_lenLength of vert_array
elem_arrayArray to store element handles in
elem_lenLength of elem_array
elem_conn_offsetsOffsets into elem_conn_indices at which the connectivity data for each element begins.
offset_lenLength of elem_conn_offsets. Should be elem_len + 1.
elem_conn_indicesIndices into vert_array
index_lenLength of elem_conn_indices.

Implements Mesh.

Definition at line 1629 of file MeshTSTT.cpp.

References Mesquite::convert_to_sidl_vector(), MeshTSTTImpl::elements_get_attached_vertices(), MeshTSTTImpl::elementSet, MsqError::INTERNAL_ERROR, MeshTSTTImpl::meshIFace, MSQ_SETERR, MsqError::OUT_OF_MEMORY, and Mesquite::process_tstt_error().

1634 {
1635  int num_elem;
1636  try {
1637  sidl::array<void*> elements( convert_to_sidl_vector( elem_array, elem_len ) );
1638  meshIFace.getEntities( elementSet,
1639  TSTTM::EntityType_ALL_TYPES,
1640  TSTTM::EntityTopology_ALL_TOPOLOGIES,
1641  elements,
1642  num_elem );
1643  if ((unsigned)num_elem > elem_len)
1644  {
1645  MSQ_SETERR(err)("Insufficient space in array", MsqError::OUT_OF_MEMORY);
1646  return;
1647  }
1648  }
1649  catch(::TSTTB::Error &tstt_err) {
1651  return;
1652  }
1653 
1654  if (offset_len <= (unsigned)num_elem)
1655  {
1656  MSQ_SETERR(err)("Insufficient space in array", MsqError::OUT_OF_MEMORY);
1657  return;
1658  }
1659 
1660  elements_get_attached_vertices( elem_array, num_elem,
1661  vert_array, vert_len,
1662  conn_array, conn_len,
1663  offset_array, err );
1664 }
unable to allocate the necessary memory
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Mesh meshIFace
TSTT basic mesh interface instance.
Definition: MeshTSTT.cpp:621
virtual void elements_get_attached_vertices(ElementHandle *elem_handles, size_t num_elems, VertexHandle *vert_handles, size_t &sizeof_vert_handles, size_t *csr_data, size_t &sizeof_csr_data, size_t *csr_offsets, MsqError &err)
Get element connectivity in overly-complex CSR rep.
Definition: MeshTSTT.cpp:1495
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void get_all_sizes ( size_t &  vertex_count,
size_t &  element_count,
size_t &  vertex_use_count,
MsqError err 
)
virtual

get sizes for calling get_all_mesh

Get counts of entities in mesh.

Parameters
vertex_count- Number of vertices connected to active mesh
element_count- Number of elements in active mesh
vertex_use_count- Number of vertex uses (sum of the length of the connectivity list for all elements in active.)

Implements Mesh.

Definition at line 1586 of file MeshTSTT.cpp.

References MeshTSTTImpl::elementSet, MsqError::INTERNAL_ERROR, MeshTSTTImpl::meshIFace, MSQ_SETERR, MeshTSTTImpl::nodeSet, and Mesquite::process_tstt_error().

1590 {
1591  try {
1592 
1593  // Get number of vertices
1594  vertex_count = meshIFace.getNumOfType( nodeSet, TSTTM::EntityType_VERTEX );
1595 
1596  // Get number of elements
1597  element_count = meshIFace.getNumOfType( elementSet, TSTTM::EntityType_FACE );
1598  element_count += meshIFace.getNumOfType( elementSet, TSTTM::EntityType_REGION );
1599 
1600  // Get number of vertex uses
1601  sidl::array<void*> handles1, handles2;
1602  sidl::array<int> offsets1, offsets2;
1603  sidl::array<int> flags1, flags2;
1604  int num_handles, num_offsets, num_flags;
1605  // Face elements
1606  meshIFace.getAdjEntities( elementSet,
1607  TSTTM::EntityType_FACE,
1608  TSTTM::EntityTopology_ALL_TOPOLOGIES,
1609  TSTTM::EntityType_VERTEX,
1610  handles1, num_handles,
1611  offsets1, num_offsets,
1612  flags1 , num_flags );
1613  vertex_use_count = num_handles;
1614  // Region elements
1615  meshIFace.getAdjEntities( elementSet,
1616  TSTTM::EntityType_REGION,
1617  TSTTM::EntityTopology_ALL_TOPOLOGIES,
1618  TSTTM::EntityType_VERTEX,
1619  handles2, num_handles,
1620  offsets2, num_offsets,
1621  flags2 , num_flags );
1622  vertex_use_count += num_handles;
1623  }
1624  catch(::TSTTB::Error &tstt_err) {
1626  }
1627 }
void * nodeSet
TSTTM entity set handle for nodes to move.
Definition: MeshTSTT.cpp:638
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Mesh meshIFace
TSTT basic mesh interface instance.
Definition: MeshTSTT.cpp:621
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

int get_geometric_dimension ( Mesquite::MsqError err)
virtual

Get dimension of vertex coordinates (2D vs.

3D).

Implements Mesh.

Definition at line 1072 of file MeshTSTT.cpp.

References MsqError::INTERNAL_ERROR, MeshTSTTImpl::meshIFace, MSQ_SETERR, and Mesquite::process_tstt_error().

1073 {
1074  try {
1075  return meshIFace.getGeometricDim();
1076  }
1077  catch (TSTTB::Error &tstt_err) {
1079  return 0;
1080  }
1081 }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Mesh meshIFace
TSTT basic mesh interface instance.
Definition: MeshTSTT.cpp:621
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

size_t get_vertex_use_count ( ElementHandle array,
size_t  length,
MsqError err 
)
virtual

Implements Mesh.

Definition at line 1469 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, Mesquite::convert_to_sidl_vector(), MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1472 {
1473  try {
1474  sidl::array<void*> handles( convert_to_sidl_vector( array, length ) );
1475  sidl::array<void*> adj;
1476  sidl::array<int> offsets;
1477  int32_t adj_size, off_size;
1478  arrIFace.getEntArrAdj( handles, length, TSTTM::EntityType_VERTEX, adj, adj_size, offsets, off_size );
1479  return adj_size;
1480  }
1481  catch(::TSTTB::Error &tstt_err) {
1483  return 0;
1484  }
1485 }
double length(Vector3D *const v, int n)
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void popupate_input_elements ( )
throw (TSTTB::Error
)
protected

Populate inputElements from elemetnSet.

Definition at line 1037 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, Mesquite::convert_to_sidl_vector(), MeshTSTTImpl::elementSet, MeshTSTTImpl::inputElements, and MeshTSTTImpl::setIFace.

Referenced by MeshTSTTImpl::cache_adjacent_elements().

1038 {
1039  const int ELEM_BUFFER_SIZE = 1024;
1040  void* handle_array[ELEM_BUFFER_SIZE];
1041  sidl::array<void*> handles = convert_to_sidl_vector( handle_array, ELEM_BUFFER_SIZE );
1042  void* iter;
1043 
1044  inputElements.clear();
1045 
1046  arrIFace.initEntArrIter( elementSet,
1047  TSTTM::EntityType_ALL_TYPES,
1048  TSTTM::EntityTopology_ALL_TOPOLOGIES,
1049  ELEM_BUFFER_SIZE,
1050  iter );
1051 
1052  int count = 0;
1053  bool more = false;
1054  do {
1055  // Add elements to element set
1056  more = arrIFace.getEntArrNextIter( iter, handles, count );
1057  if (!count) break;
1058  setIFace.addEntArrToSet( handles, count, elementSet );
1059 
1060  void** const end_ptr = handle_array + count;
1061  for (void** ptr = handle_array; ptr != end_ptr; ++ptr)
1062  inputElements.insert( *ptr );
1063 
1064  } while (more);
1065 
1066  arrIFace.endEntArrIter( iter );
1067 }
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
msq_std::set< void * > inputElements
std::set containing elements in elementSet, used to constrain vertex-&gt;element adjaceny queries to onl...
Definition: MeshTSTT.cpp:643
TSTTB::EntSet setIFace
TSTT interface for entity set operations.
Definition: MeshTSTT.cpp:631
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626

Here is the call graph for this function:

Here is the caller graph for this function:

void release ( )
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 Mesh.

Definition at line 1722 of file MeshTSTT.cpp.

1723 {
1724 }
void release_entity_handles ( EntityHandle handle_array,
size_t  num_handles,
MsqError err 
)
virtual

no-op

Implements Mesh.

Definition at line 1710 of file MeshTSTT.cpp.

1713 {
1714  // Do nothing
1715 }
void set_active_set ( void *  element_set,
MsqError err 
)
virtual

set mesh to be smoothed.

Set the mesh which Mesquite is to smooth. Optionally specify fixed vertices. NOTE: If an active set is not specified, the default is to use the global set (the ENTIRE mesh.)

Parameters
element_setTSTT entity set handle for set containing mesh elements and vertices for which quality is to be improved.

Implements MeshTSTT.

Definition at line 931 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, MeshTSTTImpl::cachedAdjVertex, MeshTSTTImpl::elementSet, i, MeshTSTTImpl::inputElements, MeshTSTTImpl::inputSetType, MsqError::INTERNAL_ERROR, MSQ_SETERR, MeshTSTTImpl::nodeSet, num_nodes, Mesquite::process_tstt_error(), MeshTSTTImpl::setIFace, and MeshTSTTImpl::vertexAdjElementSize.

932 {
933  const int ELEM_BUFFER_SIZE = 1024;
934  const int NODE_BUFFER_SIZE = 27 * ELEM_BUFFER_SIZE;
935  sidl::array<void*> elements( alloc_sidl_vector<void*>( ELEM_BUFFER_SIZE ) );
936  sidl::array<void*> nodes( alloc_sidl_vector<void*>( NODE_BUFFER_SIZE ) );
937  sidl::array<int> offsets( alloc_sidl_vector<int >( ELEM_BUFFER_SIZE ) );
938  void* iter = 0;
939 
940  try {
941 
942  // Create new sets for nodes and elements
943  if (elementSet)
944  {
945  setIFace.destroyEntSet( elementSet );
946  elementSet = 0;
947  }
948  if (nodeSet)
949  {
950  setIFace.destroyEntSet( nodeSet );
951  nodeSet = 0;
952  }
953  setIFace.createEntSet( false, elementSet );
954  setIFace.createEntSet( false, nodeSet );
955 
956  // Iterate over set twice, once for FACEs and once for REGIONs
957  bool have_faces = false, have_regions = false;
958  for (int i = 0; i < 2; ++i)
959  {
960  TSTTM::EntityType type = i ? TSTTM::EntityType_REGION :
961  TSTTM::EntityType_FACE;
962  bool& have_some = i ? have_regions : have_faces;
963 
964  arrIFace.initEntArrIter( elem_set,
965  type,
966  TSTTM::EntityTopology_ALL_TOPOLOGIES,
967  ELEM_BUFFER_SIZE,
968  iter );
969 
970  int count = 0;
971  bool more = false;
972  do {
973  // Add elements to element set
974  more = arrIFace.getEntArrNextIter( iter, elements, count );
975  if (!count) break;
976  setIFace.addEntArrToSet( elements, count, elementSet );
977 
978  // Add nodes to node set
979  int num_nodes, num_offsets;
980  arrIFace.getEntArrAdj( elements, count, TSTTM::EntityType_VERTEX,
981  nodes, num_nodes, offsets, num_offsets );
982  setIFace.addEntArrToSet( nodes, num_nodes, nodeSet );
983 
984  have_some = true;
985  } while (more);
986 
987  arrIFace.endEntArrIter( iter );
988  iter = 0;
989 
990  } // for (type)
991 
992  if (!have_faces)
993  inputSetType = TSTTM::EntityType_REGION;
994  else if (!have_regions)
995  inputSetType = TSTTM::EntityType_FACE;
996  else
997  inputSetType = TSTTM::EntityType_ALL_TYPES;
998 
999  //set_fixed_tag( nodeSet, false, err ); MSQ_ERRRTN(err);
1000  }
1001  catch (TSTTB::Error &tstt_err) {
1002  // If an error occured, try to clean up anything created above
1003 
1004  try {
1005  if (iter) {
1006  arrIFace.endEntArrIter( iter );
1007  iter = 0;
1008  }
1009  }
1010  catch( ... ) {}
1011 
1012  try {
1013  if (elementSet) {
1014  setIFace.destroyEntSet( elementSet );
1015  elementSet = 0;
1016  }
1017  }
1018  catch( ... ) {}
1019 
1020  try {
1021  if (nodeSet) {
1022  setIFace.destroyEntSet( nodeSet );
1023  nodeSet = 0;
1024  }
1025  }
1026  catch( ... ) {}
1027 
1029  }
1030 
1031  // clear cached data
1032  inputElements.clear();
1034  cachedAdjVertex = 0;
1035 }
int vertexAdjElementSize
Number of valid entries vertexAdjElements.
Definition: MeshTSTT.cpp:672
void * nodeSet
TSTTM entity set handle for nodes to move.
Definition: MeshTSTT.cpp:638
TSTTM::EntityType inputSetType
The type of elements contained in the input element set.
Definition: MeshTSTT.cpp:651
void * elementSet
TSTTM entity set handle for elements to improve.
Definition: MeshTSTT.cpp:636
const int num_nodes
Definition: ex1.C:96
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
void * cachedAdjVertex
Vertex for which vertexAdjElements is cached.
Definition: MeshTSTT.cpp:674
msq_std::set< void * > inputElements
std::set containing elements in elementSet, used to constrain vertex-&gt;element adjaceny queries to onl...
Definition: MeshTSTT.cpp:643
TSTTB::EntSet setIFace
TSTT interface for entity set operations.
Definition: MeshTSTT.cpp:631
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void set_int_tag ( void *  tag,
void *  meshset,
int  value,
MsqError err 
)
protected

Definition at line 894 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, MeshTSTTImpl::arrTagIFace, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

Referenced by MeshTSTTImpl::MeshTSTTImpl().

898 {
899  const unsigned BUFFER_COUNT = 1024;
900 
901  sidl::array<int> value_array( alloc_sidl_vector<int>( BUFFER_COUNT, value ) );
902 
903  sidl::array<void*> handle_array( alloc_sidl_vector<void*>( BUFFER_COUNT ) );
904  int count = BUFFER_COUNT;
905  void* iter = 0;
906  bool more;
907 
908  try {
909 
910  arrIFace.initEntArrIter( elem_set,
911  TSTTM::EntityType_VERTEX,
912  TSTTM::EntityTopology_POINT,
913  BUFFER_COUNT, iter );
914 
915  do {
916  more = arrIFace.getEntArrNextIter( iter, handle_array, count );
917  if (count > 0)
918  arrTagIFace.setIntArrData( handle_array, count, tag, value_array, count );
919  } while (more);
920 
921  arrIFace.endEntArrIter( iter );
922  }
923 
924  catch (TSTTB::Error &tstt_err) {
925  if( iter ) try { arrIFace.endEntArrIter( iter ); } catch (...) {}
927  }
928 }
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Here is the caller graph for this function:

TagHandle tag_create ( const msq_std::string &  tag_name,
TagType  type,
unsigned  length,
const void *  default_value,
MsqError err 
)
virtual

Create a tag.

Create a user-defined data type that can be attached to any element or vertex in the mesh. For an opaque or undefined type, use type=BYTE and length=sizeof(..).

Parameters
tag_nameA unique name for the data object
typeThe type of the data
lengthNumber of values per entity (1->scalar, >1 ->vector)
default_valueDefault value to assign to all entities - may be NULL
Returns
- Handle for tag definition

Implements Mesh.

Definition at line 1727 of file MeshTSTT.cpp.

References Mesh::BYTE, Mesh::DOUBLE, Mesh::HANDLE, Mesh::INT, MsqError::INTERNAL_ERROR, MsqError::INVALID_ARG, Mesquite::length(), MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1731 {
1732  TSTTB::TagValueType tstt_type;
1733  size_t size = 0;
1734  switch (type) {
1735  case Mesquite::Mesh::BYTE: size = sizeof(char ); tstt_type = TSTTB::TagValueType_OPAQUE; break;
1736  case Mesquite::Mesh::INT: size = sizeof(int ); tstt_type = TSTTB::TagValueType_INTEGER; break;
1737  case Mesquite::Mesh::DOUBLE: size = sizeof(double); tstt_type = TSTTB::TagValueType_DOUBLE; break;
1738  case Mesquite::Mesh::HANDLE: size = sizeof(void* ); tstt_type = TSTTB::TagValueType_ENTITY_HANDLE; break;
1739  default:
1740  MSQ_SETERR(err)("Invalid tag type", MsqError::INVALID_ARG );
1741  return 0;
1742  }
1743  size *= length;
1744 
1745  try {
1746  void* handle = 0;
1747  tagIFace.createTag( name, size, tstt_type, handle );
1748  return handle;
1749  }
1750  catch(::TSTTB::Error &tstt_err) {
1752  return 0;
1753  }
1754 }
double length(Vector3D *const v, int n)
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void tag_delete ( TagHandle  handle,
MsqError err 
)
virtual

Remove a tag and all corresponding data.

Delete a tag.

Implements Mesh.

Definition at line 1756 of file MeshTSTT.cpp.

References MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1757 {
1758  try {
1759  tagIFace.destroyTag( handle, true );
1760  }
1761  catch(::TSTTB::Error &tstt_err) {
1763  }
1764 }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

TagHandle tag_get ( const msq_std::string &  name,
MsqError err 
)
virtual

Get handle for existing tag, by name.

Implements Mesh.

Definition at line 1766 of file MeshTSTT.cpp.

References MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1767 {
1768  try {
1769  return tagIFace.getTagHandle( name );
1770  }
1771  catch(::TSTTB::Error &tstt_err) {
1772  if (tstt_err.getErrorType() != TSTTB::ErrorType_TAG_NOT_FOUND) {
1774  }
1775  return 0;
1776  }
1777 }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void tag_get_data ( TagHandle  handle,
size_t  num_elems,
const EntityHandle handle_array,
void *  tag_data,
MsqError err 
)
private

Get tag values.

Definition at line 1922 of file MeshTSTT.cpp.

References Mesquite::alloc_sidl_vector(), MeshTSTTImpl::arrTagIFace, Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

Referenced by MeshTSTTImpl::tag_get_element_data(), and MeshTSTTImpl::tag_get_vertex_data().

1927 {
1928  try {
1929  size_t len, size = tagIFace.getTagSize( tag );
1930  int32_t lower = 0, upper = num_elems - 1, stride = 1, count = num_elems;
1931  sidl::array<void*> handles;
1932  handles.borrow( const_cast<void**>(array), 1, &lower, &upper, &stride );
1933  switch (tagIFace.getTagType( tag ))
1934  {
1935  case TSTTB::TagValueType_ENTITY_HANDLE:
1936  {
1937  len = size / sizeof(void*);
1938  sidl::array<void*> sdata( convert_to_sidl_vector( (void**)data, len*num_elems ));
1939  arrTagIFace.getEHArrData( handles, num_elems, tag, sdata, count );
1940  }
1941  break;
1942 
1943  case TSTTB::TagValueType_DOUBLE:
1944  {
1945  len = size / sizeof(double);
1946  sidl::array<double> sdata( convert_to_sidl_vector( (double*)data, len*num_elems ));
1947  arrTagIFace.getDblArrData( handles, num_elems, tag, sdata, count );
1948  }
1949  break;
1950 
1951  case TSTTB::TagValueType_INTEGER:
1952  {
1953  len = size / sizeof(int);
1954  sidl::array<int> sdata( convert_to_sidl_vector( (int*)data, len*num_elems ));
1955  arrTagIFace.getIntArrData( handles, num_elems, tag, sdata, count );
1956  }
1957  break;
1958 
1959  default:
1960  {
1961 #if TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_OPAQUE_PACKED
1962  len = num_elems / sizeof(void*);
1963  if (num_elems % sizeof(void*))
1964  ++len;
1965  sidl::array<void*> sdata( convert_to_sidl_vector( (void**)data, len ) );
1966 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_OPAQUE_PADDED
1967  assert( size <= sizeof(void*) );
1968  sidl::array<void*> sdata( alloc_sidl_vector<void*>(num_elems) );
1969 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_CHAR
1970  len = size * num_elems;
1971  sidl::array<char> sdata( convert_to_sidl_vector( (char*)data, len ) );
1972 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_UCHAR \
1973  || TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_BYTE
1974  len = size * num_elems;
1975  sidl::array<unsigned char> sdata( alloc_sidl_vector( (unsigned char*)data, len ) );
1976 #else
1977 #error
1978 #endif
1979  int32_t junk;
1980  arrTagIFace.getArrData( handles, num_elems, tag, sdata, count, junk );
1981 
1982 #if TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_OPAQUE_PADDED
1983  const char* ptr = reinterpret_cast<const char*>(data);
1984  for (size_t i = 0; i < num_elems; ++i)
1985  sdata.set( i, reinterpret_cast<void*>(*(ptr + i*size)) );
1986 #endif
1987  }
1988  }
1989  }
1990  catch(::TSTTB::Error &tstt_err) {
1992  }
1993 }
static sidl::array< T > alloc_sidl_vector(size_t size)
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Here is the caller graph for this function:

void tag_get_element_data ( TagHandle  handle,
size_t  num_elems,
const ElementHandle elem_array,
void *  tag_data,
MsqError err 
)
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 Mesh.

Definition at line 1904 of file MeshTSTT.cpp.

References MeshTSTTImpl::tag_get_data().

1909 {
1910  tag_get_data( tag, num_elems, array, data, err );
1911 }
void tag_get_data(TagHandle handle, size_t num_elems, const EntityHandle *handle_array, void *tag_data, MsqError &err)
Get tag values.
Definition: MeshTSTT.cpp:1922

Here is the call graph for this function:

void tag_get_vertex_data ( TagHandle  handle,
size_t  num_elems,
const VertexHandle node_array,
void *  tag_data,
MsqError err 
)
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 Mesh.

Definition at line 1913 of file MeshTSTT.cpp.

References MeshTSTTImpl::tag_get_data().

1918 {
1919  tag_get_data( tag, num_elems, array, data, err );
1920 }
void tag_get_data(TagHandle handle, size_t num_elems, const EntityHandle *handle_array, void *tag_data, MsqError &err)
Get tag values.
Definition: MeshTSTT.cpp:1922

Here is the call graph for this function:

void tag_properties ( TagHandle  handle,
msq_std::string &  name_out,
TagType type_out,
unsigned &  length_out,
MsqError err 
)
virtual

Get properites of tag.

Get data type and number of values per entity for tag.

Parameters
handleTag to get properties of.
name_outPassed back tag name.
type_outPassed back tag type.
length_outPassed back number of values per entity.

Implements Mesh.

Definition at line 1779 of file MeshTSTT.cpp.

References Mesh::BYTE, Mesh::DOUBLE, Mesh::HANDLE, Mesh::INT, MsqError::INTERNAL_ERROR, MSQ_SETERR, MsqError::NOT_IMPLEMENTED, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1784 {
1785  size_t size;
1786  TSTTB::TagValueType type;
1787  try {
1788  name = tagIFace.getTagName( handle );
1789  size = tagIFace.getTagSize( handle );
1790  type = tagIFace.getTagType( handle );
1791  }
1792  catch(::TSTTB::Error &tstt_err) {
1794  return;
1795  }
1796 
1797  size_t tsize;
1798  switch (type) {
1799  case TSTTB::TagValueType_OPAQUE : tsize = sizeof(char ); type_out = Mesquite::Mesh::BYTE ; break;
1800  case TSTTB::TagValueType_INTEGER : tsize = sizeof(int ); type_out = Mesquite::Mesh::INT ; break;
1801  case TSTTB::TagValueType_DOUBLE : tsize = sizeof(double); type_out = Mesquite::Mesh::DOUBLE; break;
1802  case TSTTB::TagValueType_ENTITY_HANDLE: tsize = sizeof(void* ); type_out = Mesquite::Mesh::HANDLE; break;
1803  default:
1804  MSQ_SETERR(err)("Unsupported TSTT tag type", MsqError::NOT_IMPLEMENTED );
1805  return;
1806  }
1807 
1808  if (size % tsize != 0)
1809  {
1810  MSQ_SETERR(err)("Invalid TSTT tag size", MsqError::INTERNAL_ERROR );
1811  return;
1812  }
1813 
1814  length_out = size / tsize;
1815 }
requested functionality is not (yet) implemented
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void tag_set_data ( TagHandle  handle,
size_t  num_elems,
const EntityHandle handle_array,
const void *  tag_data,
MsqError err 
)
private

Set tag values.

Definition at line 1835 of file MeshTSTT.cpp.

References Mesquite::alloc_sidl_vector(), MeshTSTTImpl::arrTagIFace, Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

Referenced by MeshTSTTImpl::tag_set_element_data(), and MeshTSTTImpl::tag_set_vertex_data().

1840 {
1841  try {
1842  size_t len, size = tagIFace.getTagSize( tag );
1843  int count;
1844  sidl::array<void*> handles( convert_to_sidl_vector( (void**)array, num_elems ) );
1845  switch (tagIFace.getTagType( tag ))
1846  {
1847  case TSTTB::TagValueType_ENTITY_HANDLE:
1848  {
1849  len = size / sizeof(void*);
1850  sidl::array<void*> sdata( convert_to_sidl_vector( (void**)data, len*num_elems ));
1851  arrTagIFace.setEHArrData( handles, num_elems, tag, sdata, count );
1852  }
1853  break;
1854 
1855  case TSTTB::TagValueType_DOUBLE:
1856  {
1857  len = size / sizeof(double);
1858  sidl::array<double> sdata( convert_to_sidl_vector( (double*)data, len*num_elems ));
1859  arrTagIFace.setDblArrData( handles, num_elems, tag, sdata, count );
1860  }
1861  break;
1862 
1863  case TSTTB::TagValueType_INTEGER:
1864  {
1865  len = size / sizeof(int);
1866  sidl::array<int> sdata( convert_to_sidl_vector( (int*)data, len*num_elems ));
1867  arrTagIFace.setIntArrData( handles, num_elems, tag, sdata, count );
1868  }
1869  break;
1870 
1871  default:
1872  {
1873 #if TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_OPAQUE_PACKED
1874  len = num_elems / sizeof(void*);
1875  if (num_elems % sizeof(void*))
1876  ++len;
1877  sidl::array<void*> sdata( convert_to_sidl_vector( (void**)data, len ) );
1878 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_OPAQUE_PADDED
1879  assert( size <= sizeof(void*) );
1880  sidl::array<void*> sdata( alloc_sidl_vector<void*>(num_elems) );
1881  const char* ptr = reinterpret_cast<const char*>(data);
1882  for (size_t i = 0; i < num_elems; ++i)
1883  sdata.set( i, reinterpret_cast<void*>(*(ptr + i*size)) );
1884 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_CHAR
1885  len = size * num_elems;
1886  sidl::array<char> sdata( convert_to_sidl_vector( (char*)data, len ) );
1887 #elif TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_UCHAR \
1888  || TSTT_OPAQUE_TAG_TYPE == OPAQUE_TYPE_BYTE
1889  len = size * num_elems;
1890  sidl::array<unsigned char> sdata( alloc_sidl_vector( (unsigned char*)data, len ) );
1891 #else
1892 #error
1893 #endif
1894  arrTagIFace.setArrData( handles, num_elems, tag, sdata, count, size );
1895  }
1896  }
1897  }
1898  catch(::TSTTB::Error &tstt_err) {
1900  }
1901 }
static sidl::array< T > alloc_sidl_vector(size_t size)
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Here is the caller graph for this function:

void tag_set_element_data ( TagHandle  handle,
size_t  num_elems,
const ElementHandle elem_array,
const void *  tag_data,
MsqError err 
)
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 Mesh.

Definition at line 1817 of file MeshTSTT.cpp.

References MeshTSTTImpl::tag_set_data().

1822 {
1823  tag_set_data( tag, num_elems, array, data, err );
1824 }
void tag_set_data(TagHandle handle, size_t num_elems, const EntityHandle *handle_array, const void *tag_data, MsqError &err)
Set tag values.
Definition: MeshTSTT.cpp:1835

Here is the call graph for this function:

void tag_set_vertex_data ( TagHandle  handle,
size_t  num_elems,
const VertexHandle node_array,
const void *  tag_data,
MsqError err 
)
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 Mesh.

Definition at line 1826 of file MeshTSTT.cpp.

References MeshTSTTImpl::tag_set_data().

1831 {
1832  tag_set_data( tag, num_elems, array, data, err );
1833 }
void tag_set_data(TagHandle handle, size_t num_elems, const EntityHandle *handle_array, const void *tag_data, MsqError &err)
Set tag values.
Definition: MeshTSTT.cpp:1835

Here is the call graph for this function:

size_t vertex_get_attached_element_count ( VertexHandle  vertex,
MsqError err 
)
virtual

Get vertex adjacencies.

Implements Mesh.

Definition at line 1424 of file MeshTSTT.cpp.

References MeshTSTTImpl::cache_adjacent_elements(), MSQ_ERRZERO, and MeshTSTTImpl::vertexAdjElementSize.

1426 {
1427  cache_adjacent_elements( vertex, err ); MSQ_ERRZERO(err);
1428  return vertexAdjElementSize;
1429 }
void cache_adjacent_elements(void *vertex_handle, MsqError &err)
Get elements adjacent to vertex and store in vertexAdjElements.
Definition: MeshTSTT.cpp:1362
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
int vertexAdjElementSize
Number of valid entries vertexAdjElements.
Definition: MeshTSTT.cpp:672

Here is the call graph for this function:

void vertex_get_attached_elements ( VertexHandle  vertex,
ElementHandle elem_array,
size_t  sizeof_elem_array,
MsqError err 
)
virtual

Get vertex adjacencies.

Implements Mesh.

Definition at line 1432 of file MeshTSTT.cpp.

References MeshTSTTImpl::cache_adjacent_elements(), Mesquite::convert_from_sidl_vector(), MsqError::INVALID_ARG, MSQ_ERRRTN, MSQ_SETERR, MeshTSTTImpl::vertexAdjElements, and MeshTSTTImpl::vertexAdjElementSize.

1436 {
1437  cache_adjacent_elements( vertex, err ); MSQ_ERRRTN(err);
1438  if (sizeof_elem_array < (unsigned)vertexAdjElementSize) {
1439  MSQ_SETERR(err)("Insufficient space in array.", MsqError::INVALID_ARG);
1440  return;
1441  }
1442 
1443  assert( sizeof(ElementHandle) == sizeof(void*) );
1444  void** array = convert_from_sidl_vector( vertexAdjElements );
1445  memcpy( elem_array, array, vertexAdjElementSize * sizeof(void*) );
1446 }
void cache_adjacent_elements(void *vertex_handle, MsqError &err)
Get elements adjacent to vertex and store in vertexAdjElements.
Definition: MeshTSTT.cpp:1362
int vertexAdjElementSize
Number of valid entries vertexAdjElements.
Definition: MeshTSTT.cpp:672
EntityHandle ElementHandle
static T * convert_from_sidl_vector(sidl::array< T > &array)
sidl::array< void * > vertexAdjElements
Cached result for vertex-&gt;element query.
Definition: MeshTSTT.cpp:670
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

void vertex_get_byte ( VertexHandle  vertex,
unsigned char *  byte,
MsqError err 
)
virtual

Get vertex mark.

Implements Mesh.

Definition at line 1323 of file MeshTSTT.cpp.

References MeshTSTTImpl::byteTag, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1326 {
1327  try {
1328  *byte = (unsigned char)tagIFace.getIntData( vertex, byteTag );
1329  }
1330  catch(::TSTTB::Error &tstt_err) {
1332  }
1333 }
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

bool vertex_is_fixed ( VertexHandle  vertex,
MsqError err 
)
virtual

Query "fixed" flag for a vertex.

Implements Mesh.

Definition at line 1128 of file MeshTSTT.cpp.

References MeshTSTTImpl::fixedTag, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1129 {
1130  // If mesh does not contain a fixed tag, assume no vertices are fixed
1131  if (!fixedTag)
1132  return false;
1133 
1134  try {
1135  return (bool)tagIFace.getIntData( vertex, fixedTag );
1136  }
1137  catch( TSTTB::Error& tstt_err ) {
1139  return true;
1140  }
1141 }
TagHandle fixedTag
Handle for tag used to hold vertex-fixed flag.
Definition: MeshTSTT.cpp:658
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

VertexIterator * vertex_iterator ( MsqError err)
virtual

Create iterator for vertices in active set.

Implements Mesh.

Definition at line 1089 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrIFace, MsqError::INTERNAL_ERROR, MSQ_SETERR, MeshTSTTImpl::nodeSet, and Mesquite::process_tstt_error().

1090 {
1091  try {
1092  return new TSTTArrIter( arrIFace,
1093  nodeSet,
1094  TSTTM::EntityType_ALL_TYPES,
1095  TSTTM::EntityTopology_ALL_TOPOLOGIES );
1096  }
1097  catch (TSTTB::Error &tstt_err) {
1099  return 0;
1100  }
1101 }
void * nodeSet
TSTTM entity set handle for nodes to move.
Definition: MeshTSTT.cpp:638
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTM::Arr arrIFace
TSTT interface for multi-entity (array) queries.
Definition: MeshTSTT.cpp:626
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertex_set_byte ( VertexHandle  vertex,
unsigned char  byte,
MsqError err 
)
virtual

Set vertex mark.

Implements Mesh.

Definition at line 1285 of file MeshTSTT.cpp.

References MeshTSTTImpl::byteTag, MsqError::INTERNAL_ERROR, MSQ_SETERR, Mesquite::process_tstt_error(), and MeshTSTTImpl::tagIFace.

1288 {
1289  try {
1290  int value = byte;
1291  tagIFace.setIntData( vertex, byteTag, value );
1292  }
1293  catch(::TSTTB::Error &tstt_err) {
1295  }
1296 }
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
TSTTB::EntTag tagIFace
Definition: MeshTSTT.cpp:624
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertex_set_coordinates ( VertexHandle  vertex,
const Vector3D coordinates,
MsqError err 
)
virtual

Set vertex coordinates.

Implements Mesh.

Definition at line 1267 of file MeshTSTT.cpp.

References Mesquite::convert_to_sidl_vector(), MsqError::INTERNAL_ERROR, MeshTSTTImpl::modIFace, MSQ_SETERR, Mesquite::process_tstt_error(), and Vector3D::to_array().

1270 {
1271  try {
1272  sidl::array<double> coords(
1273  convert_to_sidl_vector( const_cast<double*>(coordinates.to_array()), 3 ) );
1274  modIFace.setVtxCoords( vertex, coords, 1 );
1275  }
1276  catch(::TSTTB::Error &tstt_err) {
1278  }
1279 }
TSTTM::Modify modIFace
TSTT interface for modifying mesh.
Definition: MeshTSTT.cpp:629
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertices_are_on_boundary ( VertexHandle  vert_array[],
bool  on_bnd[],
size_t  num_vtx,
MsqError err 
)
virtual

Query "boundary" flag for an array of vertices.

Implements Mesh.

Definition at line 1149 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrTagIFace, Mesquite::convert_to_sidl_vector(), MeshTSTTImpl::fixedTag, i, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1153 {
1154  // If mesh does not contain a fixed tag, assume no vertices are fixed
1155  if (!fixedTag) {
1156  memset( bool_array, 0, num_vtx * sizeof(bool) );
1157  return;
1158  }
1159 
1160  // Get per-vertex flags from fixedTag
1161  try {
1162  sidl::array<void*> vert_wrapper( convert_to_sidl_vector( vert_array, num_vtx ) );
1163  sidl::array<int> bools = alloc_sidl_vector<int>(num_vtx);
1164 
1165  int num_bools = num_vtx;
1166  arrTagIFace.getIntArrData( vert_wrapper, num_vtx, fixedTag, bools, num_bools );
1167  if (num_vtx != (unsigned)num_bools)
1169 
1170  for (size_t i = 0; i < num_vtx; ++i)
1171  bool_array[i] = bools.get(i);
1172  }
1173  catch(::TSTTB::Error &tstt_err) {
1175  }
1176 }
TagHandle fixedTag
Handle for tag used to hold vertex-fixed flag.
Definition: MeshTSTT.cpp:658
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertices_get_byte ( VertexHandle vert_array,
unsigned char *  byte_array,
size_t  array_size,
MsqError err 
)
virtual

Get vertex mark.

Implements Mesh.

Definition at line 1335 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrTagIFace, MeshTSTTImpl::byteTag, Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1339 {
1340  // TSTT implementations seem to be inconsistant with
1341  // regard to setting opaque tags. Set one at a time
1342  // to be safe. This would be much easier if Mesquite
1343  // used a TSTT-defined type for the data, rather than
1344  // a single byte.
1345  try {
1346  sidl::array<void*> handles( convert_to_sidl_vector( vert_array, array_size ));
1347  sidl::array<int> data( alloc_sidl_vector<int>(array_size) );
1348  int32_t junk;
1349  arrTagIFace.getIntArrData( handles, array_size, byteTag, data, junk );
1350 
1351  for (size_t i = 0; i< array_size; ++i )
1352  byte_array[i] = (unsigned char)data.get(i);
1353  }
1354  catch(::TSTTB::Error &tstt_err) {
1356  }
1357 }
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertices_get_coordinates ( const VertexHandle  vert_array[],
MsqVertex coordinates,
size_t  num_vtx,
MsqError err 
)
virtual

Get vertex coordinates.

Implements Mesh.

Definition at line 1179 of file MeshTSTT.cpp.

References Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MsqError::INVALID_STATE, MeshTSTTImpl::meshIFace, MSQ_SETERR, Mesquite::process_tstt_error(), Vector3D::set(), Vector3D::x(), Vector3D::y(), and Vector3D::z().

1184 {
1185  double* dbl_array = 0;
1186 
1187  try {
1188  int dim = meshIFace.getGeometricDim();
1189  int dbl_len = dim * num_vtx;
1190 
1191  sidl::array<void*> vertex_wrapper(
1192  convert_to_sidl_vector( const_cast<void**>(vert_array), num_vtx ) );
1193  dbl_array = new double[dbl_len];
1194  sidl::array<double> dbl_wrapper( convert_to_sidl_vector( dbl_array, dbl_len ));
1195 
1196  TSTTM::StorageOrder order = TSTTM::StorageOrder_UNDETERMINED;
1197  meshIFace.getVtxArrCoords( vertex_wrapper, num_vtx, order, dbl_wrapper, dbl_len );
1198  if ((unsigned)dbl_len != dim*num_vtx) {
1200  delete [] dbl_array;
1201  return;
1202  }
1203 
1204  if (dim == 2)
1205  {
1206  if (order == TSTTM::StorageOrder_INTERLEAVED)
1207  {
1208  double* iter = dbl_array;
1209  for (size_t i = 0; i < num_vtx; ++i)
1210  {
1211  coordinates[i].x(*iter); ++iter;
1212  coordinates[i].y(*iter); ++iter;
1213  coordinates[i].z(0);
1214  }
1215  }
1216  else
1217  {
1218  double *xiter = dbl_array;
1219  double *yiter = dbl_array + num_vtx;
1220  for (size_t i = 0; i < num_vtx; ++i)
1221  {
1222  coordinates[i].x(*xiter); ++xiter;
1223  coordinates[i].y(*yiter); ++yiter;
1224  coordinates[i].z(0);
1225  }
1226  }
1227  }
1228  else if(dim == 3)
1229  {
1230  if (order == TSTTM::StorageOrder_INTERLEAVED)
1231  {
1232  double* iter = dbl_array;
1233  for (size_t i = 0; i < num_vtx; ++i)
1234  {
1235  coordinates[i].set(iter);
1236  iter += 3;
1237  }
1238  }
1239  else
1240  {
1241  double *xiter = dbl_array;
1242  double *yiter = dbl_array + num_vtx;
1243  double *ziter = dbl_array + 2*num_vtx;
1244  for (size_t i = 0; i < num_vtx; ++i)
1245  {
1246  coordinates[i].x(*xiter); ++xiter;
1247  coordinates[i].y(*yiter); ++yiter;
1248  coordinates[i].z(*ziter); ++ziter;
1249  }
1250  }
1251  }
1252  else
1253  {
1254  MSQ_SETERR(err)(MsqError::INVALID_STATE, "TSTTB database dimension = %d", dim);
1255  delete [] dbl_array;
1256  return;
1257  }
1258 
1259  }
1260  catch(::TSTTB::Error &tstt_err) {
1262  }
1263 
1264  delete [] dbl_array;
1265 }
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
TSTTM::Mesh meshIFace
TSTT basic mesh interface instance.
Definition: MeshTSTT.cpp:621
object is in an invalid state
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

void vertices_set_byte ( VertexHandle vert_array,
unsigned char *  byte_array,
size_t  array_size,
MsqError err 
)
virtual

Set vertex mark.

Implements Mesh.

Definition at line 1298 of file MeshTSTT.cpp.

References MeshTSTTImpl::arrTagIFace, MeshTSTTImpl::byteTag, Mesquite::convert_to_sidl_vector(), i, MsqError::INTERNAL_ERROR, MSQ_SETERR, and Mesquite::process_tstt_error().

1302 {
1303  // TSTT implementations seem to be inconsistant with
1304  // regard to setting opaque tags. Set one at a time
1305  // to be safe. This would be much easier if Mesquite
1306  // used a TSTT-defined type for the data, rather than
1307  // a single byte.
1308  try {
1309  sidl::array<void*> handles( convert_to_sidl_vector( vert_array, array_size ));
1310  sidl::array<int> data(alloc_sidl_vector<int>(array_size));
1311  for (size_t i = 0; i < array_size; ++i)
1312  data.set( i, byte_array[i] );
1313  arrTagIFace.setIntArrData( handles, array_size, byteTag, data, array_size );
1314  }
1315  catch(::TSTTB::Error &tstt_err) {
1317  }
1318 }
static sidl::array< T > convert_to_sidl_vector(T *array, size_t size)
TSTTB::ArrTag arrTagIFace
Definition: MeshTSTT.cpp:627
TagHandle byteTag
Handle for tag used to hold vertex byte.
Definition: MeshTSTT.cpp:654
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
static msq_std::string process_tstt_error(TSTTB::Error &tstt_err)

Here is the call graph for this function:

Member Data Documentation

void* cachedAdjVertex
private

Vertex for which vertexAdjElements is cached.

Definition at line 674 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::cache_adjacent_elements(), and MeshTSTTImpl::set_active_set().

bool createdByteTag
private

Tag was created in constructor.

Definition at line 656 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl().

bool createdFixedTag
private

Fixed tag was created in constructor.

Definition at line 660 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl().

void* elementSet
private
TSTTM::Entity entIFace
private
TagHandle fixedTag
private

Handle for tag used to hold vertex-fixed flag.

Definition at line 658 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl(), MeshTSTTImpl::vertex_is_fixed(), and MeshTSTTImpl::vertices_are_on_boundary().

bool haveMesh
private

Have mesh.

Definition at line 634 of file MeshTSTT.cpp.

msq_std::set<void*> inputElements
private

std::set containing elements in elementSet, used to constrain vertex->element adjaceny queries to only those elements that are in the input element set.

Definition at line 643 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::cache_adjacent_elements(), MeshTSTTImpl::popupate_input_elements(), and MeshTSTTImpl::set_active_set().

TSTTM::EntityType inputSetType
private

The type of elements contained in the input element set.

Should be one of:

  • TSTTM::EntityType_REGION - volume elements
  • TSTTM::EntityType_FACE - face/2d elements
  • TSTTM::EntityType_ALL_TYPES - mixed volume and face elements

Definition at line 651 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::cache_adjacent_elements(), and MeshTSTTImpl::set_active_set().

TSTTM::Mesh meshIFace
private
TSTTM::Modify modIFace
private

TSTT interface for modifying mesh.

Definition at line 629 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl(), and MeshTSTTImpl::vertex_set_coordinates().

void* nodeSet
private

TSTTM entity set handle for nodes to move.

Definition at line 638 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::get_all_sizes(), MeshTSTTImpl::MeshTSTTImpl(), MeshTSTTImpl::set_active_set(), and MeshTSTTImpl::vertex_iterator().

TSTTB::EntSet setIFace
private

TSTT interface for entity set operations.

Definition at line 631 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::MeshTSTTImpl(), MeshTSTTImpl::popupate_input_elements(), and MeshTSTTImpl::set_active_set().

EntityTopology topologyMap[TSTTM::EntityTopology_ALL_TOPOLOGIES+1]
private

Handle for the tag used internally to remove duplicates from lists.

vertexIndexTag was created in constructor Map TSTTM::EntityTopology to Mesquite::EntityTopology

Definition at line 667 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::element_get_topology(), MeshTSTTImpl::elements_get_topologies(), and MeshTSTTImpl::MeshTSTTImpl().

sidl::array<void*> vertexAdjElements
private

Cached result for vertex->element query.

Definition at line 670 of file MeshTSTT.cpp.

Referenced by MeshTSTTImpl::cache_adjacent_elements(), and MeshTSTTImpl::vertex_get_attached_elements().


The documentation for this class was generated from the following file: