32 #include "MsqVertex.hpp"
44 std::map<string,tagStruct>::iterator pos;
45 for(pos = s_to_t.begin(); pos!= s_to_t.end(); ++pos){
46 switch ((pos->second).type){
49 delete ((std::vector<char>*)pos->second.edata);
51 delete ((std::vector<char>*)pos->second.ndata);
56 delete ((std::vector<char>*)pos->second.edata);
58 delete ((std::vector<char>*)pos->second.ndata);
63 delete ((std::vector<char>*)pos->second.edata);
65 delete ((std::vector<char>*)pos->second.ndata);
70 delete ((std::vector<char>*)pos->second.edata);
72 delete ((std::vector<char>*)pos->second.ndata);
77 delete ((std::vector<char>*)pos->second.edata);
79 delete ((std::vector<char>*)pos->second.ndata);
87 std::vector<COM::Connectivity*> conn;
88 _pane->connectivities(conn);
93 for(uint
i=0;
i<conn.size(); ++
i){
95 cout <<
"MOP> Connectivity " <<
i <<
" has name " << conn[
i]->name() << endl;
96 cout <<
"MOP> offset = " << offset << endl;
98 cptr = conn[
i]->pointer();
99 uint
nj = _with_ghost ? (uint)conn[
i]->size_of_elements() :
100 (uint)conn[
i]->size_of_real_elements();
101 for(uint
j = 0;
j<
nj; ++
j){
102 temp = cptr[offset+4*
j];
103 cptr[offset+4*
j] = cptr[offset+4*
j+2];
104 cptr[offset+4*
j+2] = temp;
111 cout <<
"MOP> MesqPane::init" << endl;
112 _dc =
new MAP::Pane_dual_connectivity(_pane, _with_ghost);
114 cout <<
"MOP> Building pb" << endl;
115 MAP::Pane_boundary pb(_pane);
117 cout <<
"MOP> Finished building pb" << endl;
118 std::vector<bool> _is_isolated;
119 _is_isolated.clear();
121 cout <<
"MOP> Determining border nodes" << endl;
123 pb.determine_border_nodes(_is_border, _is_isolated, NULL, 1);
125 pb.determine_border_nodes(_is_border, _is_isolated, NULL, 0);
127 cout <<
"MOP> Finished determining border nodes" << endl;
128 int siz = _is_border.size();
129 for(
int i =0;
i < siz; ++
i){
130 if(_is_border[
i] && _verb >1)
131 cout <<
"MOP> node " <<
i+1 <<
" is on the border" << endl;
132 if(_is_isolated[
i] && _verb >1)
133 cout <<
"MOP> node " <<
i+1 <<
" is isolated" << endl;
134 if(!(_is_border[
i] || _is_isolated[
i]) && _verb >1)
135 cout <<
"MOP> node " << i+1 <<
" is free" << endl;
136 _is_border[
i] = (_is_border[
i] || _is_isolated[
i]);
139 _vertexBytes.resize(_with_ghost ? _pane->size_of_nodes() :
140 _pane->size_of_real_nodes());
142 cout <<
"MOP> size_of_elements = " << _pane->size_of_elements() << endl;
143 cout <<
"MOP> size_of_ghost_elements = " << _pane->size_of_ghost_elements() << endl;
144 cout <<
"MOP> size_of_real_elements = " << _pane->size_of_real_elements() << endl;
145 cout <<
"MOP> size_of_nodes = " << _pane->size_of_nodes() << endl;
146 cout <<
"MOP> size_of_ghost_nodes = " << _pane->size_of_ghost_nodes() << endl;
147 cout <<
"MOP> size_of_real_nodes = " << _pane->size_of_real_nodes() << endl;
150 cout <<
"MOP> MesqPane::init done" << endl;
154 ElementHandle* elem_array,
size_t elem_len,
155 size_t* elem_conn_offsets,
size_t offset_len,
156 size_t* elem_conn_indices,
size_t index_len,
159 cout <<
"MOP> MesqPane::get_all_mesh" << endl;
160 int pane_size = _with_ghost ? _pane->size_of_nodes() :
161 _pane->size_of_real_nodes();
164 "Vert_Len Must Be At Least Number of Nodes");
166 for(
int i = 1;
i <= pane_size; ++
i)
167 vert_array[
i-1] = ((
char*)NULL)+
i;
169 pane_size = _with_ghost ? _pane->size_of_elements() :
170 _pane->size_of_real_elements();
173 "Array_Size Must Be At Least Number of Nodes");
175 elem_conn_offsets[0] = 0;
176 Element_node_enumerator ene(_pane,1);
177 std::vector<int> nodes;
179 for(
int i = 1;
i <= pane_size; ++
i, ene.next()){
181 elem_array[
i-1] = ((
char*)NULL)+
i;
183 elem_conn_offsets[
i] = elem_conn_offsets[
i-1]+ ene.size_of_nodes();
185 ene.get_nodes(nodes);
186 for(
int j=0,
nj=ene.size_of_nodes();
j<
nj; ++
j)
187 elem_conn_indices[elem_conn_offsets[
i-1]+
j] = nodes[
j]-1;
193 cout <<
"MOP> MesqPane::vertex_iterator" << endl;
195 _pane->size_of_real_nodes());
200 cout <<
"MOP> MesqPane::element_iterator" << endl;
202 _pane->size_of_real_elements());
207 cout <<
"MOP> MesqPane::vertex_is_fixed" << endl;
208 uint node_id = (
char*)vertex - (
char*)NULL;
210 "Invalid vertex for MesqPane::vertex_is_fixed()");
211 return _is_border[node_id-1];
213 cout <<
"MOP> MesqPane::vertex_is_fixed finished" << endl;
217 size_t num_vtx, MsqError &err){
219 cout <<
"MOP> MesqPane::vertices_are_on_boundary" << endl;
220 for (
size_t i = 0;
i < num_vtx; ++
i){
221 uint node_id = (((
char*)vert_array[
i]) - (
char*)NULL);
222 if (_is_border[node_id-1]){
225 std::cout <<
"MOP> Node " << node_id <<
" is on the boundary." << endl;
232 cout <<
"MOP> MesqPane::vertices_are_on_boundary finished" << endl;
236 MsqVertex* coordinates,
240 cout <<
"MOP> MesqPane::vertices_get_coordinates" << endl;
241 const double *xptr = _pane->coordinates(), *yptr=NULL, *zptr=NULL;
242 const COM::Attribute *nc = _pane->attribute(
COM::COM_NC);
243 int stride = nc->stride();
245 const COM::Attribute *xc = _pane->attribute(
COM::COM_NC1);
246 const COM::Attribute *yc = _pane->attribute(
COM::COM_NC2);
247 const COM::Attribute *zc = _pane->attribute(
COM::COM_NC3);
248 int stride1 = xc->stride();
249 int stride2 = yc->stride();
250 int stride3 = zc->stride();
251 xptr = _pane->x_coordinates();
252 yptr = _pane->y_coordinates();
253 zptr = _pane->z_coordinates();
254 for (
size_t i = 0;
i < num_vtx; ++
i){
255 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
256 coordinates[
i].set(*(xptr+offset*stride1),
257 *(yptr+offset*stride2),
258 *(zptr+offset*stride3));
262 int nn = _with_ghost ? _pane->size_of_nodes() :
263 _pane->size_of_real_nodes();
264 xptr = _pane->x_coordinates();
265 for (
size_t i = 0;
i < num_vtx; ++
i){
266 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
267 coordinates[
i].set(*(xptr+offset),
269 *(xptr+offset+2*nn));
273 xptr = _pane->x_coordinates();
274 for (
size_t i = 0;
i < num_vtx; ++
i){
275 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
276 coordinates[
i].set(xptr + offset * stride);
278 cout <<
"MOP> Coords of node " << offset+1 <<
" = ["
279 << coordinates[
i][0] <<
","
280 << coordinates[
i][1] <<
","
281 << coordinates[
i][2] <<
"]" << endl;
287 "Invalid stride length for nodal coordinates.");
290 cout <<
"MOP> MesqPane::vertices_get_coordinates finished" << endl;
296 int node_id = ((
char*)vertex-(
char*)NULL);
298 cout <<
"MOP> MesqPane::vertex_set_coordinates, node = " << node_id << endl;
300 double * xptr = _pane->coordinates();
304 cout <<
"MOP> Coordinate: [" << *xptr <<
" , "
305 << *(xptr+1) <<
" , " << *(xptr+2) <<
"], ";
307 coordinates.get_coordinates(xptr);
309 cout <<
"-> [" << *xptr <<
" , "
310 << *(xptr+1) <<
" , " << *(xptr+2) <<
"]" << endl;
314 coordinates.get_coordinates(*(_pane->x_coordinates()+
offset),
315 *(_pane->y_coordinates()+
offset),
316 *(_pane->z_coordinates()+
offset));
319 cout <<
"MOP> MesqPane::vertex_set_coordinates finished" << endl;
323 unsigned char byte, MsqError &err){
325 cout <<
"MOP> MesqPane::vertex_set_byte" << endl;
326 int offset = ((
char*)vertex - (
char*)NULL) - 1;
327 _vertexBytes[
offset] = byte;
329 cout <<
"MOP> MesqPane::vertex_set_byte finished" << endl;
333 unsigned char *byte_array,
334 size_t array_size, MsqError &err){
336 cout <<
"MOP> MesqPane::vertices_set_byte" << endl;
338 for(
size_t i = 0;
i < array_size; ++
i){
339 offset = ((
char*)vert_array[
i] - (
char*)NULL) - 1;
340 _vertexBytes[
offset] = byte_array[
i];
343 cout <<
"MOP> MesqPane::vertices_set_byte" << endl;
347 unsigned char *byte, MsqError &err){
349 cout <<
"MOP> MesqPane::vertex_get_byte" << endl;
350 int offset = ((
char*)vertex - (
char*)NULL) - 1;
351 *byte = _vertexBytes[
offset];
355 unsigned char *byte_array,
356 size_t array_size, MsqError &err){
358 cout <<
"MOP> MesqPane::vertices_get_byte" << endl;
360 for(
size_t i = 0;
i < array_size; ++
i){
361 offset = ((
char*)vertex[
i] - (
char*)NULL) - 1;
362 byte_array[
i] = _vertexBytes[
offset];
365 cout <<
"MOP> MesqPane::vertices_get_byte finished" << endl;
371 cout <<
"MOP> MesqPane::vertex_get_attached_element_count" << endl;
372 int node_id = ((
char*)vertex - (
char*)NULL);
373 std::vector<int> elist;
374 _dc->incident_elements(node_id,elist);
377 cout <<
"MOP> MesqPane::vertex_get_attached_element_count finished" << endl;
381 ElementHandle* elem_array,
382 size_t sizeof_elem_array,
385 cout <<
"MOP> MesqPane::vertex_get_attached_elements" << endl;
386 int node_id = ((
char*)vertex - (
char*)NULL);
387 std::vector<int> elist;
388 _dc->incident_elements(node_id,elist);
389 if(sizeof_elem_array > elist.size())
390 sizeof_elem_array = elist.size();
391 for(uint
i = 0;
i < sizeof_elem_array;
i++){
392 elem_array[
i] = ((
char*)NULL+elist[
i]);
395 cout <<
"MOP> MesqPane::vertex_get_attached_elements finished" << endl;
401 cout <<
"MOP> MesqPane::element_get_attached_vertex_count" << endl;
402 int element_id = ((
char*)elem - (
char*)NULL);
403 const COM::Connectivity *con = _pane->connectivity(element_id);
404 return con->size_of_nodes_pe();
412 cout <<
"MOP> MesqPane::get_vertex_use_count" << endl;
414 for(uint
i=0;
i< num_handles; ++
i){
415 int e_id = ((
char*)handle_array[
i] - (
char*)NULL);
416 Element_node_enumerator ene(_pane,e_id);
417 count += (size_t)ene.size_of_nodes();
424 VertexHandle *vert_handles,
425 size_t &sizeof_vert_handles,
427 size_t &sizeof_csr_data,
431 cout <<
"MOP> MesqPane::elements_get_attached_vertices" << endl;
434 std::map<int,int> itop_map;
435 std::map<int,int>::iterator pos;
440 for (
size_t i = 0;
i < num_elems; ++
i){
441 int elem_id = ((
char*)elem_handles[
i] - (
char*)NULL);
442 std::vector<int> elist;
443 _dc->incident_elements(elem_id,elist);
444 size_t nodes_in_elem = elist.size();
445 csr_offsets[
i+1] = csr_offsets[
i] + nodes_in_elem;
448 "Not enough space in arg. csr_data");
451 for( uint
j = 0 ;
j < nodes_in_elem; ++
j){
452 int node_id = ((
char*)elist[
j] - (
char*)NULL);
453 pos = itop_map.find(node_id);
455 if(pos == itop_map.end()){
456 itop_map.insert(std::map<int,int>::value_type(node_id,num_elems));
457 vert_handles[vert_count] = ((
char*)(NULL)+node_id);
458 csr_data[csr_offsets[
i]+
j] = vert_count;
462 csr_data[csr_offsets[
i] +
j] = pos->second;
466 sizeof_csr_data = csr_offsets[num_elems];
467 sizeof_vert_handles = vert_count;
469 cout <<
"MOP> MesqPane::elements_get_attached_vertices" << endl;
475 cout <<
"MOP> MesqPane::element_get_topology" << endl;
476 int elem_id = ((
char*)entity_handle-(
char*)NULL);
478 const COM::Connectivity *con = _pane->connectivity(elem_id);
480 switch(con->element_type()){
481 case COM::Connectivity::TRI3 :
484 case COM::Connectivity::QUAD4 :
487 case COM::Connectivity::TET4 :
490 case COM::Connectivity::HEX8 :
495 "Element type not supported by Mesquite.");
505 size_t num_elements, MsqError &err){
507 cout <<
"MOP> MesqPane::element_get_topologies" << endl;
508 for (
size_t i = 0;
i < num_elements;
i++){
509 element_topologies[
i] = element_get_topology(element_handle_array[
i],err);
512 cout <<
"MOP> MesqPane::element_get_topologies done" << endl;
528 TagType type,
unsigned length,
529 const void* default_value,
532 std::string tag_name(*(const_cast<std::string *>(&tag_n)));
534 cout <<
"MOP> MesqPane::tag_create" << endl;
536 tagStruct new_tag = {
length, type, NULL,
538 int esize = 1+(_with_ghost ? _pane->size_of_elements() :
539 _pane->size_of_real_elements());
540 int nsize = 1+(_with_ghost ? _pane->size_of_nodes() :
541 _pane->size_of_real_nodes());
545 std::vector<char>* temp =
new std::vector<char>;
546 temp->reserve(length*esize);
547 temp->resize(length*esize);
548 new_tag.edata = (
void *)temp;
550 temp =
new std::vector<char>;
551 temp->reserve(nsize*length);
552 temp->resize(nsize*length);
553 new_tag.ndata = (
void *)temp;
555 for(uint
i=0;
i<length*esize; ++
i)
556 (*
static_cast<std::vector<char>*
>(new_tag.edata))[
i]
557 = ((
char *)default_value)[
i];
558 for(uint
i=0;
i<length*nsize; ++
i)
559 (*((std::vector<char>*)new_tag.ndata))[
i]
560 = ((
char *)default_value)[
i];
565 std::vector<bool>* temp =
new std::vector<bool>;
566 temp->reserve(esize*length);
567 temp->resize(esize*length);
568 new_tag.edata = (
void *) temp;
570 temp =
new std::vector<bool>;
571 temp->reserve(nsize*length);
572 temp->resize(nsize*length);
573 new_tag.ndata = (
void *) temp;
576 (*((std::vector<bool>*)new_tag.edata))[
i]
577 = ((
bool *)default_value)[
i];
579 (*((std::vector<bool>*)new_tag.ndata))[
i]
580 = ((
bool *)default_value)[
i];
585 std::vector<int>* temp =
new std::vector<int>;
586 temp->reserve(esize*length);
587 temp->resize(esize*length);
588 new_tag.edata = (
void *) temp;
590 temp =
new std::vector<int>;
591 temp->reserve(nsize*length);
592 temp->resize(nsize*length);
593 new_tag.ndata = (
void *) temp;
596 (*((std::vector<int>*)new_tag.edata))[
i]
597 = ((
int *)default_value)[
i];
599 (*((std::vector<int>*)new_tag.ndata))[
i]
600 = ((
int *)default_value)[
i];
605 std::vector<double>* temp =
new std::vector<double>;
606 temp->reserve(esize*length);
607 temp->resize(esize*length);
608 new_tag.edata = (
void *) temp;
610 temp =
new std::vector<double>;
611 temp->reserve(nsize*length);
612 temp->resize(nsize*length);
613 new_tag.ndata = (
void *) temp;
616 (*((std::vector<double>*)new_tag.edata))[
i]
617 = ((
double *)default_value)[
i];
619 (*((std::vector<double>*)new_tag.ndata))[
i]
620 = ((
double *)default_value)[
i];
625 std::vector<void*>* temp =
new std::vector<void*>;
626 temp->reserve(esize*length);
627 temp->resize(esize*length);
628 new_tag.edata = (
void *) temp;
630 temp =
new std::vector<void*>;
631 temp->reserve(nsize*length);
632 temp->resize(nsize*length);
633 new_tag.ndata = (
void *) temp;
636 (*((std::vector<void*>*)new_tag.edata))[
i]
637 = ((
void* *)default_value)[
i];
639 (*((std::vector<void*>*)new_tag.ndata))[
i]
640 = ((
void* *)default_value)[
i];
645 "Unrecognized TagType.");
648 s_to_t.insert(std::make_pair<msq_std::string,tagStruct>(tag_name,new_tag));
649 std::map<msq_std::string,tagStruct>::iterator pos;
650 pos = s_to_t.find(tag_name);
652 "Unable to create tag for Mesquite.");
653 return &(pos->second);
662 cout <<
"MOP> MesqPane::tag_delete" << endl;
663 tagStruct* tag = (tagStruct*)handle;
664 switch ( (*tag).type){
666 std::vector<char>*
v = (std::vector<char>*)(*tag).edata;
669 v = (std::vector<char>*)(*tag).ndata;
675 std::vector<bool>*
v = (std::vector<bool>*) (*tag).edata;
678 v = (std::vector<bool>*) (*tag).ndata;
684 std::vector<int>*
v = (std::vector<int>*) (*tag).edata;
687 v = (std::vector<int>*) (*tag).ndata;
693 std::vector<double>*
v = (std::vector<double>*) (*tag).edata;
696 v = (std::vector<double>*) (*tag).ndata;
702 std::vector<void*>*
v = (std::vector<void*>*) (*tag).edata;
705 v = (std::vector<void*>*) (*tag).ndata;
712 "Unrecognized TagType.");
715 const msq_std::string
n= (*tag).name;
716 std::map<msq_std::string,tagStruct>::iterator pos;
717 pos = s_to_t.find(n);
718 assert(pos != s_to_t.end());
734 cout <<
"MOP> MesqPane::tag_get" << endl;
735 std::map<msq_std::string,tagStruct>::iterator pos;
736 pos = s_to_t.find(name);
737 if(pos == s_to_t.end())
752 msq_std::string& name_out,
754 unsigned& length_out,
757 cout <<
"MOP> MesqPane::tag_properties" << endl;
758 tagStruct* tag = (tagStruct*)handle;
759 name_out = (*tag).name;
760 type_out = (*tag).type;
761 length_out = (*tag).size;
776 const ElementHandle* elem_array,
777 const void* tag_data,
780 cout <<
"MOP> MesqPane::tag_set_element_data" << endl;
781 tagStruct* tag = (tagStruct*)handle;
782 int ne = 1 + (_with_ghost ? _pane->size_of_elements() :
783 _pane->size_of_real_elements());
784 switch ((*tag).type){
786 std::vector<char>*
v = (std::vector<char>*)(*tag).edata;
787 uint tsize = ne*(*tag).size;
788 if (v->size() != tsize){
791 "Invalid TagHandle received from Mesquite");
794 for(
int i=0;
i < ne; ++
i){
795 for(uint
j=0;
j< (*tag).size; ++
j)
796 (*v)[
i*(*tag).size+
j]=(*v)[
j];
799 for(uint
i=0;
i<num_elems; ++
i){
800 int eid = ((
char*)elem_array[
i]-(
char*)NULL);
801 for(uint
j=0;
j< (*tag).size; ++
j)
802 (*v)[eid * (*tag).size +
j]=((
char*)tag_data)[
i*(*tag).size+
j];
807 std::vector<bool>*
v = (std::vector<bool>*)(*tag).edata;
808 uint tsize = ne*(*tag).size;
809 if (v->size() != tsize){
812 "Invalid TagHandle received from Mesquite");
815 for(
int i=0;
i < ne; ++
i){
816 for(uint
j=0;
j< (*tag).size; ++
j)
817 (*v)[
i*(*tag).size+
j]=(*v)[
j];
820 for(uint
i=0;
i<num_elems; ++
i){
821 int eid = ((
bool*)elem_array[
i]-(
bool*)NULL);
822 for(uint
j=0;
j< (*tag).size; ++
j)
823 (*v)[eid * (*tag).size +
j]=((
bool*)tag_data)[
i*(*tag).size+
j];
828 std::vector<int>*
v = (std::vector<int>*)(*tag).edata;
829 uint tsize = ne*(*tag).size;
830 if (v->size() != tsize){
833 "Invalid TagHandle received from Mesquite");
836 for(
int i=0;
i < ne; ++
i){
837 for(uint
j=0;
j< (*tag).size; ++
j)
838 (*v)[
i*(*tag).size+
j]=(*v)[
j];
841 for(uint
i=0;
i<num_elems; ++
i){
842 int eid = ((
int*)elem_array[
i]-(
int*)NULL);
843 for(uint
j=0;
j< (*tag).size; ++
j)
844 (*v)[eid * (*tag).size +
j]=((
int*)tag_data)[
i*(*tag).size+
j];
849 std::vector<double>*
v = (std::vector<double>*)(*tag).edata;
850 uint tsize = ne*(*tag).size;
851 if (v->size() != tsize){
854 "Invalid TagHandle received from Mesquite");
857 for(
int i=0;
i < ne; ++
i){
858 for(uint
j=0;
j< (*tag).size; ++
j)
859 (*v)[
i*(*tag).size+
j]=(*v)[
j];
862 for(uint
i=0;
i<num_elems; ++
i){
863 int eid = ((
double*)elem_array[
i]-(
double*)NULL);
864 for(uint
j=0;
j< (*tag).size; ++
j)
865 (*v)[eid * (*tag).size +
j]=((
double*)tag_data)[
i*(*tag).size+
j];
870 std::vector<void*>*
v = (std::vector<void*>*)(*tag).edata;
871 uint tsize = ne*(*tag).size;
872 if (v->size() != tsize){
875 "Invalid TagHandle received from Mesquite");
878 for(
int i=0;
i < ne; ++
i){
879 for(uint
j=0;
j< (*tag).size; ++
j)
880 (*v)[
i*(*tag).size+
j]=(*v)[
j];
883 for(uint
i=0;
i<num_elems; ++
i){
884 int eid = ((
void**)elem_array[
i]-(
void**)NULL);
885 for(uint
j=0;
j< (*tag).size; ++
j)
886 (*v)[eid * (*tag).size +
j]=((
void**)tag_data)[
i*(*tag).size+
j];
892 "TagHandle with unrecgonized TagType received.");
909 const VertexHandle* node_array,
910 const void* tag_data,
913 cout <<
"MOP> MesqPane::tag_set_vertex_data" << endl;
914 tagStruct* tag = (tagStruct*)handle;
915 uint nn = 1 + (_with_ghost ? _pane->size_of_nodes() :
916 _pane->size_of_real_nodes());
917 switch ((*tag).type){
919 std::vector<char>*
v = (std::vector<char>*)(*tag).ndata;
920 uint tsize = (nn)* (*tag).size;
921 if (v->size() != tsize){
924 "Invalid TagHandle received from Mesquite");
927 for(uint
i=0;
i < nn; ++
i){
928 for(uint
j=0;
j< (*tag).size; ++
j)
929 (*v)[
i * (*tag).size +
j]=(*v)[
j];
932 for(uint
i=0;
i<num_elems; ++
i){
933 int eid = ((
char*)node_array[
i]-(
char*)NULL);
934 for(uint
j=0;
j<(*tag).size; ++
j)
935 (*v)[eid * (*tag).size +
j]=((
char*)tag_data)[
i*(*tag).size+
j];
940 std::vector<bool>*
v = (std::vector<bool>*)(*tag).ndata;
941 uint tsize = (nn)* (*tag).size;
942 if (v->size() != tsize){
945 "Invalid TagHandle received from Mesquite");
948 for(uint
i=0;
i < nn; ++
i){
949 for(uint
j=0;
j< (*tag).size; ++
j)
950 (*v)[
i * (*tag).size +
j]=(*v)[
j];
953 for(uint
i=0;
i<num_elems; ++
i){
954 int eid = ((
bool*)node_array[
i]-(
bool*)NULL);
955 for(uint
j=0;
j<(*tag).size; ++
j)
956 (*v)[eid * (*tag).size +
j]=((
bool*)tag_data)[
i*(*tag).size+
j];
961 std::vector<int>*
v = (std::vector<int>*)(*tag).ndata;
962 uint tsize = (nn)* (*tag).size;
963 if (v->size() != tsize){
966 "Invalid TagHandle received from Mesquite");
969 for(uint
i=0;
i < nn; ++
i){
970 for(uint
j=0;
j< (*tag).size; ++
j)
971 (*v)[
i * (*tag).size +
j]=(*v)[
j];
974 for(uint
i=0;
i<num_elems; ++
i){
975 int eid = ((
int*)node_array[
i]-(
int*)NULL);
976 for(uint
j=0;
j<(*tag).size; ++
j)
977 (*v)[eid * (*tag).size +
j]=((
int*)tag_data)[
i*(*tag).size+
j];
982 std::vector<double>*
v = (std::vector<double>*)(*tag).ndata;
983 uint tsize = (nn)* (*tag).size;
984 if (v->size() != tsize){
987 "Invalid TagHandle received from Mesquite");
990 for(uint
i=0;
i < nn; ++
i){
991 for(uint
j=0;
j< (*tag).size; ++
j)
992 (*v)[
i * (*tag).size +
j]=(*v)[
j];
995 for(uint
i=0;
i<num_elems; ++
i){
996 int eid = ((
double*)node_array[
i]-(
double*)NULL);
997 for(uint
j=0;
j<(*tag).size; ++
j)
998 (*v)[eid * (*tag).size +
j]=((
double*)tag_data)[
i*(*tag).size+
j];
1003 std::vector<void*>*
v = (std::vector<void*>*)(*tag).ndata;
1004 uint tsize = (nn)* (*tag).size;
1005 if (v->size() != tsize){
1008 "Invalid TagHandle received from Mesquite");
1011 for(uint
i=0;
i < nn; ++
i){
1012 for(uint
j=0;
j< (*tag).size; ++
j)
1013 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1016 for(uint
i=0;
i<num_elems; ++
i){
1017 int eid = ((
void**)node_array[
i]-(
void**)NULL);
1018 for(uint
j=0;
j<(*tag).size; ++
j)
1019 (*v)[eid * (*tag).size +
j]=((
void**)tag_data)[
i*(*tag).size+
j];
1039 const ElementHandle* elem_array,
1043 cout <<
"MOP> MesqPane::tag_get_element_data" << endl;
1044 tagStruct* tag = (tagStruct*)handle;
1045 switch ((*tag).type){
1047 for(uint
i=0;
i<num_elems; ++
i){
1048 int eid = ((
char*)elem_array[
i]-(
char*)NULL);
1049 for(uint
j=0;
j<(*tag).size; ++
j)
1050 ((
char*)tag_data)[
i * (*tag).size +
j]
1051 = ((
char*)((*tag).edata))[eid*(*tag).size+
j];
1056 for(uint
i=0;
i<num_elems; ++
i){
1057 int eid = ((
bool*)elem_array[
i]-(
bool*)NULL);
1058 for(uint
j=0;
j<(*tag).size; ++
j)
1059 ((
bool*)tag_data)[
i * (*tag).size +
j]
1060 = ((
bool*)((*tag).edata))[eid*(*tag).size+
j];
1065 for(uint
i=0;
i<num_elems; ++
i){
1066 int eid = ((
int*)elem_array[
i]-(
int*)NULL);
1067 for(uint
j=0;
j<(*tag).size; ++
j)
1068 ((
int*)tag_data)[
i * (*tag).size +
j]
1069 = ((
int*)((*tag).edata))[eid*(*tag).size+
j];
1074 for(uint
i=0;
i<num_elems; ++
i){
1075 int eid = ((
double*)elem_array[
i]-(
double*)NULL);
1076 for(uint
j=0;
j<(*tag).size; ++
j)
1077 ((
double*)tag_data)[
i * (*tag).size +
j]
1078 = ((
double*)((*tag).edata))[eid*(*tag).size+
j];
1083 for(uint
i=0;
i<num_elems; ++
i){
1084 int eid = ((
void**)elem_array[
i]-(
void**)NULL);
1085 for(uint
j=0;
j<(*tag).size; ++
j)
1086 ((
void**)tag_data)[
i * (*tag).size +
j]
1087 = ((
void**)((*tag).edata))[eid*(*tag).size+
j];
1106 const VertexHandle* node_array,
1110 cout <<
"MOP> MesqPane::tag_get_vertex_data" << endl;
1111 tagStruct* tag = (tagStruct*)handle;
1112 switch ((*tag).type){
1114 for(uint
i=0;
i<num_elems; ++
i){
1115 int vid = ((
char*)node_array[
i]-(
char*)NULL);
1116 for(uint
j=0;
j<(*tag).size; ++
j)
1117 ((
char*)tag_data)[
i * (*tag).size +
j]
1118 = ((
char*)((*tag).ndata))[vid*(*tag).size+
j];
1123 for(uint
i=0;
i<num_elems; ++
i){
1124 int vid = ((
bool*)node_array[
i]-(
bool*)NULL);
1125 for(uint
j=0;
j<(*tag).size; ++
j)
1126 ((
bool*)tag_data)[
i * (*tag).size +
j]
1127 = ((
bool*)((*tag).ndata))[vid*(*tag).size+
j];
1132 for(uint
i=0;
i<num_elems; ++
i){
1133 int vid = ((
int*)node_array[
i]-(
int*)NULL);
1134 for(uint
j=0;
j<(*tag).size; ++
j)
1135 ((
int*)tag_data)[
i * (*tag).size +
j]
1136 = ((
int*)((*tag).ndata))[vid*(*tag).size+
j];
1141 for(uint
i=0;
i<num_elems; ++
i){
1142 int vid = ((
double*)node_array[
i]-(
double*)NULL);
1143 for(uint
j=0;
j<(*tag).size; ++
j)
1144 ((
double*)tag_data)[
i * (*tag).size +
j]
1145 = ((
double*)((*tag).ndata))[vid*(*tag).size+
j];
1150 for(uint
i=0;
i<num_elems; ++
i){
1151 int vid = ((
void**)node_array[
i]-(
void**)NULL);
1152 for(uint
j=0;
j<(*tag).size; ++
j)
1153 ((
void**)tag_data)[
i * (*tag).size +
j]
1154 = ((
void**)((*tag).ndata))[vid*(*tag).size+
j];
1163 size_t num_handles, MsqError &err){
1166 cout <<
"MOP> MesqPane::release_entity_handles" << endl;
1172 cout <<
"MOP> MesqPane::release()" << endl;
virtual void vertices_get_byte(VertexHandle *vertex, unsigned char *byte_array, size_t array_size, MsqError &err)
Retrieve the byte value for the specified vertices.
void invert()
Invert Tetrahedrons.
virtual ElementIterator * element_iterator(MsqError &err)
Returns a pointer to an element iterator over this Pane.
#define COM_assertion_msg(EX, msg)
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.
virtual void vertices_get_coordinates(VertexHandle vert_array[], Mesquite::MsqVertex *const &coordinates, const size_t &num_vtx, MsqError &err)
Get the location of a vertex.
virtual ~MesqPane()
Destructor.
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.
A class for iterating through a Panes vertices or elements.
virtual void vertices_are_on_boundary(VertexHandle vert_array[], bool on_bnd[], size_t num_vtx, MsqError &err)
Tells whether the vertex is on the boundary.
real *8 function offset(vNorm, x2, y2, z2)
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)
Returns vertices which are part of each element in the "elem_handles" array.
virtual size_t get_vertex_use_count(ElementHandle *handle_array, size_t num_handles, MsqError &err)
EntityIterator ElementIterator
EntityIterator VertexIterator
virtual size_t element_get_attached_vertex_count(ElementHandle elem, MsqError &err) const
Gets the number of vertices in this element.
double length(Vector3D *const v, int n)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
virtual bool vertex_is_fixed(VertexHandle vertex, MsqError &err)
Tells wheter the vertex is allowed to be repositioned.
virtual void tag_delete(TagHandle handle, MsqError &err)
Remove a tag and all corresponding data.
NVec< 3, double > Vector3D
virtual void release()
Release a MesqPane from use.
virtual void elements_get_topologies(ElementHandle *element_handle_array, EntityTopology *element_topologies, size_t num_elements, MsqError &err)
Returns the topologies of the given entities.
virtual void vertices_set_byte(VertexHandle *vert_array, unsigned char *byte_array, size_t array_size, MsqError &err)
Set mutliple vertex flags.
virtual TagHandle tag_create(const msq_std::string &tag_name, TagType type, unsigned length, const void *default_value, MsqError &err)
Create a tag.
virtual size_t vertex_get_attached_element_count(VertexHandle vertex, MsqError &err) const
Gets the number of elements attached to this vertex.
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.
virtual void tag_properties(TagHandle handle, msq_std::string &name_out, TagType &type_out, unsigned &length_out, MsqError &err)
Get properites of tag.
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.
virtual TagHandle tag_get(const msq_std::string &name, MsqError &err)
Get handle for existing tag, by name.
virtual void release_entity_handles(EntityHandle *handle_array, size_t num_handles, MsqError &err)
Tells the mesh that the client is finished with a given entity handle.
virtual VertexIterator * vertex_iterator(MsqError &err)
Returns a pointer to a vertex iterator over this Pane.
void * TagHandle
Type used to refer to a tag defintion.
virtual void vertex_get_attached_elements(VertexHandle vertex, ElementHandle *elem_array, size_t sizeof_elem_array, MsqError &err)
Gets the elements attached to this vertex.
virtual void vertex_get_byte(VertexHandle vertex, unsigned char *byte, MsqError &err)
Retrieve the byte value for the specified vertex.
virtual void vertex_set_byte(VertexHandle vertex, unsigned char byte, MsqError &err)
Set a vertex flag.
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.
virtual EntityTopology element_get_topology(ElementHandle entity_handle, MsqError &err) const
Returns the topology of the given entity.
virtual void vertex_set_coordinates(VertexHandle vertex, const Vector3D &coordinates, MsqError &err)
Set the Location of a vertex.
void init()
Initialize the MesqPane.