27 #ifndef MSQ_CORNER_TAG_HPP
28 #define MSQ_CORNER_TAG_HPP
30 #ifdef MSQ_USE_OLD_STD_HEADERS
128 inline void clear( );
146 template <
typename T>
155 template <
typename T>
161 template <
typename T>
164 for (
typename msq_std::vector<T*>::iterator
i = tagData.begin();
i != tagData.end(); ++
i)
169 template <
typename T>
174 if (tagData.size() <= (unsigned)elem_index)
175 tagData.resize( elem_index+1, 0 );
177 int num_corners = tagHandles.num_corners( pd, elem_index );
178 if (!tagData[elem_index]) {
179 tagData[elem_index] =
new T[num_corners];
180 tagHandles.save_load_tags(
true, pd, elem_index, tagData[elem_index],
sizeof(T), err );
184 return tagData[elem_index];
187 template <
typename T>
193 if (tagData.size() <= (unsigned)elem_index)
194 tagData.resize( elem_index+1, 0 );
196 int num_corners = tagHandles.num_corners( pd, elem_index );
197 if (!tagData[elem_index])
198 tagData[elem_index] =
new T[num_corners];
199 memcpy( tagData[elem_index], data, num_corners *
sizeof(T) );
201 tagHandles.save_load_tags(
false, pd, elem_index, (
void*)data,
sizeof(T), err );
CornerTag(const char *name, Mesh::TagType type=Mesh::BYTE)
Initialize.
CornerTagHandles(const char *tag_name, Mesh::TagType type, unsigned tag_len)
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
static size_t size(Mesh::TagType type)
static Mesh * get_current_mesh(PatchData *pd)
Used to hold the error state and return it to the application.
TagType
The type of a tag.
This file contains the Mesquite mesh interface. Many users will want to implement a concrete class de...
void set_element_corner_tags(PatchData *pd, int elem_idx, const T *data, MsqError &err)
Utility class to manage tag handles for corner tags.
msq_std::vector< T * > tagData
#define MSQ_CHKERR(err)
Mesquite's Error Checking macro.
const T * get_element_corner_tags(PatchData *pd, int elem_idx, MsqError &err)
Get a pointer to the array of all corner tag values for a given element.
CornerTagHandles tagHandles
static int num_corners(PatchData *pd, int elem_index)
const msq_std::string tagName
const Mesh::TagType tagType
A Mesquite::Mesh is a collection of mesh elements which are composed of mesh vertices. Intermediate objects are not accessible through this interface (where intermediate objects include things like the faces of a hex, or an element's edges).
A class for caching and managing Tags on element corners.
void save_load_tags(bool load, PatchData *pd, size_t elem_index, void *data, size_t tag_byes, MsqError &err)
void * TagHandle
Type used to refer to a tag defintion.
void clear()
Clear cached data.
TagHandle get_handle(Mesh *mesh, unsigned num_corners, MsqError &err)
Get the tag handle for storing this tag type with the specified number of values (corners).
msq_std::vector< TagHandle > cornerHandles