30 #include "MsqVertex.hpp"
43 std::map<string,tagStruct>::iterator pos;
44 for(pos = s_to_t.begin(); pos!= s_to_t.end(); ++pos){
45 switch ((pos->second).type){
48 delete ((std::vector<char>*)pos->second.edata);
50 delete ((std::vector<char>*)pos->second.ndata);
55 delete ((std::vector<char>*)pos->second.edata);
57 delete ((std::vector<char>*)pos->second.ndata);
62 delete ((std::vector<char>*)pos->second.edata);
64 delete ((std::vector<char>*)pos->second.ndata);
69 delete ((std::vector<char>*)pos->second.edata);
71 delete ((std::vector<char>*)pos->second.ndata);
76 delete ((std::vector<char>*)pos->second.edata);
78 delete ((std::vector<char>*)pos->second.ndata);
86 std::vector<COM::Connectivity*> conn;
87 _pane->connectivities(conn);
92 for(uint
i=0;
i<conn.size(); ++
i){
93 if(conn[
i]->element_type() == conn_type &&
94 conn_type == COM::Connectivity::TET4){
95 cptr = conn[
i]->pointer();
96 uint
nj = _with_ghost ? (uint)conn[
i]->size_of_elements() :
97 (uint)conn[
i]->size_of_real_elements();
98 for(uint
j = 0;
j<
nj; ++
j){
99 temp = cptr[offset+4*
j];
100 cptr[offset+4*
j] = cptr[offset+4*
j+2];
101 cptr[offset+4*
j+2] = temp;
104 else if(conn[
i]->element_type() == conn_type &&
105 conn_type == COM::Connectivity::HEX8){
106 cptr = conn[
i]->pointer();
107 uint
nj = _with_ghost ? (uint)conn[
i]->size_of_elements() :
108 (uint)conn[
i]->size_of_real_elements();
109 for(uint
j = 0;
j<
nj; ++
j){
110 temp = cptr[offset+8*
j+5];
111 cptr[offset+8*
j+5] = cptr[offset+8*
j+7];
112 cptr[offset+8*
j+7] = temp;
113 temp = cptr[offset+8*
j+1];
114 cptr[offset+8*
j+1] = cptr[offset+8*
j+3];
115 cptr[offset+8*
j+3] = temp;
123 cout <<
"MOP> MesqPane::init" << endl;
124 _dc =
new MAP::Pane_dual_connectivity(_pane, _with_ghost);
126 cout <<
"MOP> Building pb" << endl;
127 MAP::Pane_boundary pb(_pane);
129 cout <<
"MOP> Finished building pb" << endl;
130 std::vector<bool> _is_isolated;
131 _is_isolated.clear();
133 cout <<
"MOP> Determining border nodes" << endl;
135 pb.determine_border_nodes(_is_border, _is_isolated, NULL, 1);
137 pb.determine_border_nodes(_is_border, _is_isolated, NULL, 0);
139 cout <<
"MOP> Finished determining border nodes" << endl;
140 int siz = _is_border.size();
141 for(
int i =0;
i < siz; ++
i){
142 if(_is_border[
i] && _verb >1)
143 cout <<
"MOP> node " <<
i+1 <<
" is on the border" << endl;
144 if(_is_isolated[
i] && _verb >1)
145 cout <<
"MOP> node " <<
i+1 <<
" is isolated" << endl;
146 if(!(_is_border[
i] || _is_isolated[
i]) && _verb >1)
147 cout <<
"MOP> node " << i+1 <<
" is free" << endl;
148 _is_border[
i] = (_is_border[
i] || _is_isolated[
i]);
151 _vertexBytes.resize(_with_ghost ? _pane->size_of_nodes() :
152 _pane->size_of_real_nodes());
154 cout <<
"MOP> size_of_elements = " << _pane->size_of_elements() << endl;
155 cout <<
"MOP> size_of_ghost_elements = " << _pane->size_of_ghost_elements() << endl;
156 cout <<
"MOP> size_of_real_elements = " << _pane->size_of_real_elements() << endl;
157 cout <<
"MOP> size_of_nodes = " << _pane->size_of_nodes() << endl;
158 cout <<
"MOP> size_of_ghost_nodes = " << _pane->size_of_ghost_nodes() << endl;
159 cout <<
"MOP> size_of_real_nodes = " << _pane->size_of_real_nodes() << endl;
162 cout <<
"MOP> MesqPane::init done" << endl;
169 int e_size = _with_ghost ? _pane->size_of_elements() :
170 _pane->size_of_real_elements();
171 elements.resize(e_size);
172 for(
int i=1;
i<= e_size; ++
i){
173 elements[
i-1] = ((
char*)NULL)+
i;
181 int v_size = _with_ghost ? _pane->size_of_nodes() :
182 _pane->size_of_real_nodes();
183 vertices.resize(v_size);
184 for(
int i=1;
i<= v_size; ++
i){
185 vertices[
i-1] = ((
char*)NULL)+
i;
192 size_t* elem_conn_offsets,
size_t offset_len,
193 size_t* elem_conn_indices,
size_t index_len,
196 cout <<
"MOP> MesqPane::get_all_mesh" << endl;
197 int pane_size = _with_ghost ? _pane->size_of_nodes() :
198 _pane->size_of_real_nodes();
201 "Vert_Len Must Be At Least Number of Nodes");
203 for(
int i = 1;
i <= pane_size; ++
i)
204 vert_array[
i-1] = ((
char*)NULL)+
i;
206 pane_size = _with_ghost ? _pane->size_of_elements() :
207 _pane->size_of_real_elements();
210 "Array_Size Must Be At Least Number of Nodes");
212 elem_conn_offsets[0] = 0;
213 Element_node_enumerator ene(_pane,1);
214 std::vector<int> nodes;
216 for(
int i = 1;
i <= pane_size; ++
i, ene.next()){
218 elem_array[
i-1] = ((
char*)NULL)+
i;
220 elem_conn_offsets[
i] = elem_conn_offsets[
i-1]+ ene.size_of_nodes();
222 ene.get_nodes(nodes);
223 for(
int j=0,
nj=ene.size_of_nodes();
j<
nj; ++
j)
224 elem_conn_indices[elem_conn_offsets[
i-1]+
j] = nodes[
j]-1;
230 cout <<
"MOP> MesqPane::vertex_iterator" << endl;
232 _pane->size_of_real_nodes());
237 cout <<
"MOP> MesqPane::element_iterator" << endl;
239 _pane->size_of_real_elements());
243 bool fixed_flag_array[],
246 for(
size_t i =0;
i< num_vtx; ++
i){
247 uint node_id = (
char*)vert_array[
i] - (
char*)NULL;
248 fixed_flag_array[
i] = _is_border[node_id-1];
254 cout <<
"MOP> MesqPane::vertex_is_fixed" << endl;
255 uint node_id = (
char*)vertex - (
char*)NULL;
257 "Invalid vertex for MesqPane::vertex_is_fixed()");
258 return _is_border[node_id-1];
260 cout <<
"MOP> MesqPane::vertex_is_fixed finished" << endl;
264 size_t num_vtx, MsqError &err){
266 cout <<
"MOP> MesqPane::vertices_are_on_boundary" << endl;
267 for (
size_t i = 0;
i < num_vtx; ++
i){
268 uint node_id = (((
char*)vert_array[
i]) - (
char*)NULL);
269 if (_is_border[node_id-1]){
272 std::cout <<
"MOP> Node " << node_id <<
" is on the boundary." << endl;
279 cout <<
"MOP> MesqPane::vertices_are_on_boundary finished" << endl;
283 MsqVertex* coordinates,
287 cout <<
"MOP> MesqPane::vertices_get_coordinates" << endl;
288 const double *xptr = _pane->coordinates(), *yptr=NULL, *zptr=NULL;
289 const COM::Attribute *nc = _pane->attribute(
COM::COM_NC);
290 int stride = nc->stride();
292 const COM::Attribute *xc = _pane->attribute(
COM::COM_NC1);
293 const COM::Attribute *yc = _pane->attribute(
COM::COM_NC2);
294 const COM::Attribute *zc = _pane->attribute(
COM::COM_NC3);
295 int stride1 = xc->stride();
296 int stride2 = yc->stride();
297 int stride3 = zc->stride();
298 xptr = _pane->x_coordinates();
299 yptr = _pane->y_coordinates();
300 zptr = _pane->z_coordinates();
301 for (
size_t i = 0;
i < num_vtx; ++
i){
302 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
303 coordinates[
i].set(*(xptr+offset*stride1),
304 *(yptr+offset*stride2),
305 *(zptr+offset*stride3));
309 int nn = _with_ghost ? _pane->size_of_nodes() :
310 _pane->size_of_real_nodes();
311 xptr = _pane->x_coordinates();
312 for (
size_t i = 0;
i < num_vtx; ++
i){
313 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
314 coordinates[
i].set(*(xptr+offset),
316 *(xptr+offset+2*nn));
320 xptr = _pane->x_coordinates();
321 for (
size_t i = 0;
i < num_vtx; ++
i){
322 int offset = (
char*)vert_array[
i]-(
char*)NULL -1;
323 coordinates[
i].set(xptr + offset * stride);
325 cout <<
"MOP> Coords of node " << offset+1 <<
" = ["
326 << coordinates[
i][0] <<
","
327 << coordinates[
i][1] <<
","
328 << coordinates[
i][2] <<
"]" << endl;
334 "Invalid stride length for nodal coordinates.");
337 cout <<
"MOP> MesqPane::vertices_get_coordinates finished" << endl;
343 int node_id = ((
char*)vertex-(
char*)NULL);
345 cout <<
"MOP> MesqPane::vertex_set_coordinates, node = " << node_id << endl;
347 double * xptr = _pane->coordinates();
351 cout <<
"MOP> Coordinate: [" << *xptr <<
" , "
352 << *(xptr+1) <<
" , " << *(xptr+2) <<
"], ";
354 coordinates.get_coordinates(xptr);
356 cout <<
"-> [" << *xptr <<
" , "
357 << *(xptr+1) <<
" , " << *(xptr+2) <<
"]" << endl;
361 coordinates.get_coordinates(*(_pane->x_coordinates()+
offset),
362 *(_pane->y_coordinates()+
offset),
363 *(_pane->z_coordinates()+
offset));
366 cout <<
"MOP> MesqPane::vertex_set_coordinates finished" << endl;
370 unsigned char byte, MsqError &err){
372 cout <<
"MOP> MesqPane::vertex_set_byte" << endl;
373 int offset = ((
char*)vertex - (
char*)NULL) - 1;
374 _vertexBytes[
offset] = byte;
376 cout <<
"MOP> MesqPane::vertex_set_byte finished" << endl;
380 unsigned char *byte_array,
381 size_t array_size, MsqError &err){
383 cout <<
"MOP> MesqPane::vertices_set_byte" << endl;
385 for(
size_t i = 0;
i < array_size; ++
i){
386 offset = ((
char*)vert_array[
i] - (
char*)NULL) - 1;
387 _vertexBytes[
offset] = byte_array[
i];
390 cout <<
"MOP> MesqPane::vertices_set_byte" << endl;
395 const unsigned char *byte_array,
399 for(
size_t i = 0;
i < array_size; ++
i){
400 offset = ((
char*)vert_array[
i] - (
char*)NULL) - 1;
401 _vertexBytes[
offset] = byte_array[
i];
406 unsigned char *byte, MsqError &err){
408 cout <<
"MOP> MesqPane::vertex_get_byte" << endl;
409 int offset = ((
char*)vertex - (
char*)NULL) - 1;
410 *byte = _vertexBytes[
offset];
414 unsigned char *byte_array,
415 size_t array_size, MsqError &err){
417 cout <<
"MOP> MesqPane::vertices_get_byte" << endl;
419 for(
size_t i = 0;
i < array_size; ++
i){
420 offset = ((
char*)vertex[
i] - (
char*)NULL) - 1;
421 byte_array[
i] = _vertexBytes[
offset];
424 cout <<
"MOP> MesqPane::vertices_get_byte finished" << endl;
430 cout <<
"MOP> MesqPane::vertex_get_attached_element_count" << endl;
431 int node_id = ((
char*)vertex - (
char*)NULL);
432 std::vector<int> elist;
433 _dc->incident_elements(node_id,elist);
436 cout <<
"MOP> MesqPane::vertex_get_attached_element_count finished" << endl;
441 size_t sizeof_elem_array,
444 cout <<
"MOP> MesqPane::vertex_get_attached_elements" << endl;
445 int node_id = ((
char*)vertex - (
char*)NULL);
446 std::vector<int> elist;
447 _dc->incident_elements(node_id,elist);
448 if(sizeof_elem_array > elist.size())
449 elist.resize(sizeof_elem_array);
450 for(uint
i = 0;
i < sizeof_elem_array;
i++){
451 elem_array[
i] = ((
char*)NULL+elist[
i]);
454 cout <<
"MOP> MesqPane::vertex_get_attached_elements finished" << endl;
460 msq_std::vector<ElementHandle>& elements,
461 msq_std::vector<size_t>& offsets,
466 elements.reserve(6*num_vertex);
467 offsets.resize(num_vertex+1);
470 std::vector<int> elist;
473 for(
size_t i=0;
i<num_vertex; ++
i){
474 offsets[
i] += elist.size();
475 offsets[
i+1] = offsets[
i];
476 int node_id = ((
char*)vertex_array[
i] - (
char*)NULL);
477 _dc->incident_elements(node_id,elist);
478 for(uint
i=0,
ni=elist.size();
i<
ni; ++
i)
479 elements.push_back((
char*)NULL + elist[
i]);
481 offsets[num_vertex] = offsets[num_vertex-1] + elist.size();
484 vector<ElementHandle>(elements).
swap(elements);
490 cout <<
"MOP> MesqPane::element_get_attached_vertex_count" << endl;
491 int element_id = ((
char*)elem - (
char*)NULL);
492 const COM::Connectivity *con = _pane->connectivity(element_id);
493 return con->size_of_nodes_pe();
501 cout <<
"MOP> MesqPane::get_vertex_use_count" << endl;
503 for(uint
i=0;
i< num_handles; ++
i){
504 int e_id = ((
char*)handle_array[
i] - (
char*)NULL);
505 Element_node_enumerator ene(_pane,e_id);
506 count += (size_t)ene.size_of_nodes();
513 msq_std::vector<VertexHandle>& vert_handles,
514 msq_std::vector<size_t>& offsets,
520 vert_handles.clear();
521 offsets.resize(num_elems+1);
523 std::vector<int> nodes;
527 vert_handles.reserve(4*num_elems);
531 for(
size_t i=0;
i< num_elems; ++
i){
532 offsets[
i] += nodes.size();
533 offsets[
i+1] = offsets[
i];
536 int elem_id = ((
char*)elem_handles[
i] - (
char*)NULL);
537 Element_node_enumerator ene(_pane,elem_id);
538 ene.get_nodes(nodes);
540 for(uint
j=0,
nj= nodes.size();
j<
nj; ++
j){
541 vert_handles.push_back((
char*)NULL + nodes[
j]);
546 offsets[num_elems] += nodes.size();
547 msq_std::vector<VertexHandle>(vert_handles).
swap(vert_handles);
549 for(uint
i=0;
i < offsets.size(); ++
i){
559 size_t &sizeof_vert_handles,
561 size_t &sizeof_csr_data,
565 cout <<
"MOP> MesqPane::elements_get_attached_vertices" << endl;
568 std::map<int,int> itop_map;
569 std::map<int,int>::iterator pos;
574 for (
size_t i = 0;
i < num_elems; ++
i){
575 int elem_id = ((
char*)elem_handles[
i] - (
char*)NULL);
576 std::vector<int> elist;
577 _dc->incident_elements(elem_id,elist);
578 size_t nodes_in_elem = elist.size();
579 csr_offsets[
i+1] = csr_offsets[
i] + nodes_in_elem;
582 "Not enough space in arg. csr_data");
585 for( uint
j = 0 ;
j < nodes_in_elem; ++
j){
586 int node_id = ((
char*)elist[
j] - (
char*)NULL);
587 pos = itop_map.find(node_id);
589 if(pos == itop_map.end()){
590 itop_map.insert(std::map<int,int>::value_type(node_id,num_elems));
591 vert_handles[vert_count] = ((
char*)(NULL)+node_id);
592 csr_data[csr_offsets[
i]+
j] = vert_count;
596 csr_data[csr_offsets[
i] +
j] = pos->second;
600 sizeof_csr_data = csr_offsets[num_elems];
601 sizeof_vert_handles = vert_count;
603 cout <<
"MOP> MesqPane::elements_get_attached_vertices" << endl;
609 cout <<
"MOP> MesqPane::element_get_topology" << endl;
610 int elem_id = ((
char*)entity_handle-(
char*)NULL);
612 const COM::Connectivity *con = _pane->connectivity(elem_id);
614 switch(con->element_type()){
615 case COM::Connectivity::TRI3 :
618 case COM::Connectivity::QUAD4 :
621 case COM::Connectivity::TET4 :
624 case COM::Connectivity::HEX8 :
627 case COM::Connectivity::PYRIMID5 :
630 case COM::Connectivity::PRISM6 :
635 "Element type not supported by Mesquite.");
645 size_t num_elements, MsqError &err){
647 cout <<
"MOP> MesqPane::element_get_topologies" << endl;
648 for (
size_t i = 0;
i < num_elements;
i++){
649 element_topologies[
i] = element_get_topology(element_handle_array[
i],err);
652 cout <<
"MOP> MesqPane::element_get_topologies done" << endl;
657 size_t num_elements, MsqError &err){
659 cout <<
"MOP> MesqPane::element_get_topologies" << endl;
660 for (
size_t i = 0;
i < num_elements;
i++){
661 element_topologies[
i] = element_get_topology(element_handle_array[
i],err);
664 cout <<
"MOP> MesqPane::element_get_topologies done" << endl;
681 const void* default_value,
684 std::string tag_name(*(const_cast<std::string *>(&tag_n)));
686 cout <<
"MOP> MesqPane::tag_create" << endl;
690 int esize = 1+(_with_ghost ? _pane->size_of_elements() :
691 _pane->size_of_real_elements());
692 int nsize = 1+(_with_ghost ? _pane->size_of_nodes() :
693 _pane->size_of_real_nodes());
697 std::vector<char>* temp =
new std::vector<char>;
698 temp->reserve(length*esize);
699 temp->resize(length*esize);
700 new_tag.
edata = (
void *)temp;
702 temp =
new std::vector<char>;
703 temp->reserve(nsize*length);
704 temp->resize(nsize*length);
705 new_tag.
ndata = (
void *)temp;
707 for(uint
i=0;
i<length*esize; ++
i)
708 (*
static_cast<std::vector<char>*
>(new_tag.
edata))[
i]
709 = ((
char *)default_value)[
i];
710 for(uint
i=0;
i<length*nsize; ++
i)
711 (*((std::vector<char>*)new_tag.
ndata))[
i]
712 = ((
char *)default_value)[
i];
717 std::vector<bool>* temp =
new std::vector<bool>;
718 temp->reserve(esize*length);
719 temp->resize(esize*length);
720 new_tag.
edata = (
void *) temp;
722 temp =
new std::vector<bool>;
723 temp->reserve(nsize*length);
724 temp->resize(nsize*length);
725 new_tag.
ndata = (
void *) temp;
728 (*((std::vector<bool>*)new_tag.
edata))[
i]
729 = ((
bool *)default_value)[
i];
731 (*((std::vector<bool>*)new_tag.
ndata))[
i]
732 = ((
bool *)default_value)[
i];
737 std::vector<int>* temp =
new std::vector<int>;
738 temp->reserve(esize*length);
739 temp->resize(esize*length);
740 new_tag.
edata = (
void *) temp;
742 temp =
new std::vector<int>;
743 temp->reserve(nsize*length);
744 temp->resize(nsize*length);
745 new_tag.
ndata = (
void *) temp;
748 (*((std::vector<int>*)new_tag.
edata))[
i]
749 = ((
int *)default_value)[
i];
751 (*((std::vector<int>*)new_tag.
ndata))[
i]
752 = ((
int *)default_value)[
i];
757 std::vector<double>* temp =
new std::vector<double>;
758 temp->reserve(esize*length);
759 temp->resize(esize*length);
760 new_tag.
edata = (
void *) temp;
762 temp =
new std::vector<double>;
763 temp->reserve(nsize*length);
764 temp->resize(nsize*length);
765 new_tag.
ndata = (
void *) temp;
768 (*((std::vector<double>*)new_tag.
edata))[
i]
769 = ((
double *)default_value)[
i];
771 (*((std::vector<double>*)new_tag.
ndata))[
i]
772 = ((
double *)default_value)[
i];
777 std::vector<void*>* temp =
new std::vector<void*>;
778 temp->reserve(esize*length);
779 temp->resize(esize*length);
780 new_tag.
edata = (
void *) temp;
782 temp =
new std::vector<void*>;
783 temp->reserve(nsize*length);
784 temp->resize(nsize*length);
785 new_tag.
ndata = (
void *) temp;
788 (*((std::vector<void*>*)new_tag.
edata))[
i]
789 = ((
void* *)default_value)[
i];
791 (*((std::vector<void*>*)new_tag.
ndata))[
i]
792 = ((
void* *)default_value)[
i];
797 "Unrecognized TagType.");
800 s_to_t.insert(std::make_pair<msq_std::string,tagStruct>(tag_name,new_tag));
801 std::map<msq_std::string,tagStruct>::iterator pos;
802 pos = s_to_t.find(tag_name);
804 "Unable to create tag for Mesquite.");
805 return &(pos->second);
814 cout <<
"MOP> MesqPane::tag_delete" << endl;
816 switch ( (*tag).type){
818 std::vector<char>*
v = (std::vector<char>*)(*tag).edata;
821 v = (std::vector<char>*)(*tag).ndata;
827 std::vector<bool>*
v = (std::vector<bool>*) (*tag).edata;
830 v = (std::vector<bool>*) (*tag).ndata;
836 std::vector<int>*
v = (std::vector<int>*) (*tag).edata;
839 v = (std::vector<int>*) (*tag).ndata;
845 std::vector<double>*
v = (std::vector<double>*) (*tag).edata;
848 v = (std::vector<double>*) (*tag).ndata;
854 std::vector<void*>*
v = (std::vector<void*>*) (*tag).edata;
857 v = (std::vector<void*>*) (*tag).ndata;
864 "Unrecognized TagType.");
867 const msq_std::string
n= (*tag).name;
868 std::map<msq_std::string,tagStruct>::iterator pos;
869 pos = s_to_t.find(n);
870 assert(pos != s_to_t.end());
886 cout <<
"MOP> MesqPane::tag_get" << endl;
887 std::map<msq_std::string,tagStruct>::iterator pos;
888 pos = s_to_t.find(name);
889 if(pos == s_to_t.end())
904 msq_std::string& name_out,
906 unsigned& length_out,
909 cout <<
"MOP> MesqPane::tag_properties" << endl;
911 name_out = (*tag).name;
912 type_out = (*tag).type;
913 length_out = (*tag).
size;
929 const void* tag_data,
932 cout <<
"MOP> MesqPane::tag_set_element_data" << endl;
934 int ne = 1 + (_with_ghost ? _pane->size_of_elements() :
935 _pane->size_of_real_elements());
936 switch ((*tag).type){
938 std::vector<char>*
v = (std::vector<char>*)(*tag).edata;
939 uint tsize = ne*(*tag).size;
940 if (v->size() != tsize){
943 "Invalid TagHandle received from Mesquite");
946 for(
int i=0;
i < ne; ++
i){
947 for(uint
j=0;
j< (*tag).size; ++
j)
948 (*v)[
i*(*tag).size+
j]=(*v)[
j];
951 for(uint
i=0;
i<num_elems; ++
i){
952 int eid = ((
char*)elem_array[
i]-(
char*)NULL);
953 for(uint
j=0;
j< (*tag).size; ++
j)
954 (*v)[eid * (*tag).size +
j]=((
char*)tag_data)[
i*(*tag).size+
j];
959 std::vector<bool>*
v = (std::vector<bool>*)(*tag).edata;
960 uint tsize = ne*(*tag).size;
961 if (v->size() != tsize){
964 "Invalid TagHandle received from Mesquite");
967 for(
int i=0;
i < ne; ++
i){
968 for(uint
j=0;
j< (*tag).size; ++
j)
969 (*v)[
i*(*tag).size+
j]=(*v)[
j];
972 for(uint
i=0;
i<num_elems; ++
i){
973 int eid = ((
bool*)elem_array[
i]-(
bool*)NULL);
974 for(uint
j=0;
j< (*tag).size; ++
j)
975 (*v)[eid * (*tag).size +
j]=((
bool*)tag_data)[
i*(*tag).size+
j];
980 std::vector<int>*
v = (std::vector<int>*)(*tag).edata;
981 uint tsize = ne*(*tag).size;
982 if (v->size() != tsize){
985 "Invalid TagHandle received from Mesquite");
988 for(
int i=0;
i < ne; ++
i){
989 for(uint
j=0;
j< (*tag).size; ++
j)
990 (*v)[
i*(*tag).size+
j]=(*v)[
j];
993 for(uint
i=0;
i<num_elems; ++
i){
994 int eid = ((
int*)elem_array[
i]-(
int*)NULL);
995 for(uint
j=0;
j< (*tag).size; ++
j)
996 (*v)[eid * (*tag).size +
j]=((
int*)tag_data)[
i*(*tag).size+
j];
1001 std::vector<double>*
v = (std::vector<double>*)(*tag).edata;
1002 uint tsize = ne*(*tag).size;
1003 if (v->size() != tsize){
1006 "Invalid TagHandle received from Mesquite");
1009 for(
int i=0;
i < ne; ++
i){
1010 for(uint
j=0;
j< (*tag).size; ++
j)
1011 (*v)[
i*(*tag).size+
j]=(*v)[
j];
1014 for(uint
i=0;
i<num_elems; ++
i){
1015 int eid = ((
double*)elem_array[
i]-(
double*)NULL);
1016 for(uint
j=0;
j< (*tag).size; ++
j)
1017 (*v)[eid * (*tag).size +
j]=((
double*)tag_data)[
i*(*tag).size+
j];
1022 std::vector<void*>*
v = (std::vector<void*>*)(*tag).edata;
1023 uint tsize = ne*(*tag).size;
1024 if (v->size() != tsize){
1027 "Invalid TagHandle received from Mesquite");
1030 for(
int i=0;
i < ne; ++
i){
1031 for(uint
j=0;
j< (*tag).size; ++
j)
1032 (*v)[
i*(*tag).size+
j]=(*v)[
j];
1035 for(uint
i=0;
i<num_elems; ++
i){
1036 int eid = ((
void**)elem_array[
i]-(
void**)NULL);
1037 for(uint
j=0;
j< (*tag).size; ++
j)
1038 (*v)[eid * (*tag).size +
j]=((
void**)tag_data)[
i*(*tag).size+
j];
1044 "TagHandle with unrecgonized TagType received.");
1062 const void* tag_data,
1065 cout <<
"MOP> MesqPane::tag_set_vertex_data" << endl;
1067 uint nn = 1 + (_with_ghost ? _pane->size_of_nodes() :
1068 _pane->size_of_real_nodes());
1069 switch ((*tag).type){
1071 std::vector<char>*
v = (std::vector<char>*)(*tag).ndata;
1072 uint tsize = (nn)* (*tag).size;
1073 if (v->size() != tsize){
1076 "Invalid TagHandle received from Mesquite");
1079 for(uint
i=0;
i < nn; ++
i){
1080 for(uint
j=0;
j< (*tag).size; ++
j)
1081 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1084 for(uint
i=0;
i<num_elems; ++
i){
1085 int eid = ((
char*)node_array[
i]-(
char*)NULL);
1086 for(uint
j=0;
j<(*tag).size; ++
j)
1087 (*v)[eid * (*tag).size +
j]=((
char*)tag_data)[
i*(*tag).size+
j];
1092 std::vector<bool>*
v = (std::vector<bool>*)(*tag).ndata;
1093 uint tsize = (nn)* (*tag).size;
1094 if (v->size() != tsize){
1097 "Invalid TagHandle received from Mesquite");
1100 for(uint
i=0;
i < nn; ++
i){
1101 for(uint
j=0;
j< (*tag).size; ++
j)
1102 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1105 for(uint
i=0;
i<num_elems; ++
i){
1106 int eid = ((
bool*)node_array[
i]-(
bool*)NULL);
1107 for(uint
j=0;
j<(*tag).size; ++
j)
1108 (*v)[eid * (*tag).size +
j]=((
bool*)tag_data)[
i*(*tag).size+
j];
1113 std::vector<int>*
v = (std::vector<int>*)(*tag).ndata;
1114 uint tsize = (nn)* (*tag).size;
1115 if (v->size() != tsize){
1118 "Invalid TagHandle received from Mesquite");
1121 for(uint
i=0;
i < nn; ++
i){
1122 for(uint
j=0;
j< (*tag).size; ++
j)
1123 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1126 for(uint
i=0;
i<num_elems; ++
i){
1127 int eid = ((
int*)node_array[
i]-(
int*)NULL);
1128 for(uint
j=0;
j<(*tag).size; ++
j)
1129 (*v)[eid * (*tag).size +
j]=((
int*)tag_data)[
i*(*tag).size+
j];
1134 std::vector<double>*
v = (std::vector<double>*)(*tag).ndata;
1135 uint tsize = (nn)* (*tag).size;
1136 if (v->size() != tsize){
1139 "Invalid TagHandle received from Mesquite");
1142 for(uint
i=0;
i < nn; ++
i){
1143 for(uint
j=0;
j< (*tag).size; ++
j)
1144 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1147 for(uint
i=0;
i<num_elems; ++
i){
1148 int eid = ((
double*)node_array[
i]-(
double*)NULL);
1149 for(uint
j=0;
j<(*tag).size; ++
j)
1150 (*v)[eid * (*tag).size +
j]=((
double*)tag_data)[
i*(*tag).size+
j];
1155 std::vector<void*>*
v = (std::vector<void*>*)(*tag).ndata;
1156 uint tsize = (nn)* (*tag).size;
1157 if (v->size() != tsize){
1160 "Invalid TagHandle received from Mesquite");
1163 for(uint
i=0;
i < nn; ++
i){
1164 for(uint
j=0;
j< (*tag).size; ++
j)
1165 (*v)[
i * (*tag).size +
j]=(*v)[
j];
1168 for(uint
i=0;
i<num_elems; ++
i){
1169 int eid = ((
void**)node_array[
i]-(
void**)NULL);
1170 for(uint
j=0;
j<(*tag).size; ++
j)
1171 (*v)[eid * (*tag).size +
j]=((
void**)tag_data)[
i*(*tag).size+
j];
1195 cout <<
"MOP> MesqPane::tag_get_element_data" << endl;
1197 switch ((*tag).type){
1199 for(uint
i=0;
i<num_elems; ++
i){
1200 int eid = ((
char*)elem_array[
i]-(
char*)NULL);
1201 for(uint
j=0;
j<(*tag).size; ++
j)
1202 ((
char*)tag_data)[
i * (*tag).size +
j]
1203 = ((
char*)((*tag).edata))[eid*(*tag).size+
j];
1208 for(uint
i=0;
i<num_elems; ++
i){
1209 int eid = ((
bool*)elem_array[
i]-(
bool*)NULL);
1210 for(uint
j=0;
j<(*tag).size; ++
j)
1211 ((
bool*)tag_data)[
i * (*tag).size +
j]
1212 = ((
bool*)((*tag).edata))[eid*(*tag).size+
j];
1217 for(uint
i=0;
i<num_elems; ++
i){
1218 int eid = ((
int*)elem_array[
i]-(
int*)NULL);
1219 for(uint
j=0;
j<(*tag).size; ++
j)
1220 ((
int*)tag_data)[
i * (*tag).size +
j]
1221 = ((
int*)((*tag).edata))[eid*(*tag).size+
j];
1226 for(uint
i=0;
i<num_elems; ++
i){
1227 int eid = ((
double*)elem_array[
i]-(
double*)NULL);
1228 for(uint
j=0;
j<(*tag).size; ++
j)
1229 ((
double*)tag_data)[
i * (*tag).size +
j]
1230 = ((
double*)((*tag).edata))[eid*(*tag).size+
j];
1235 for(uint
i=0;
i<num_elems; ++
i){
1236 int eid = ((
void**)elem_array[
i]-(
void**)NULL);
1237 for(uint
j=0;
j<(*tag).size; ++
j)
1238 ((
void**)tag_data)[
i * (*tag).size +
j]
1239 = ((
void**)((*tag).edata))[eid*(*tag).size+
j];
1262 cout <<
"MOP> MesqPane::tag_get_vertex_data" << endl;
1264 switch ((*tag).type){
1266 for(uint
i=0;
i<num_elems; ++
i){
1267 int vid = ((
char*)node_array[
i]-(
char*)NULL);
1268 for(uint
j=0;
j<(*tag).size; ++
j)
1269 ((
char*)tag_data)[
i * (*tag).size +
j]
1270 = ((
char*)((*tag).ndata))[vid*(*tag).size+
j];
1275 for(uint
i=0;
i<num_elems; ++
i){
1276 int vid = ((
bool*)node_array[
i]-(
bool*)NULL);
1277 for(uint
j=0;
j<(*tag).size; ++
j)
1278 ((
bool*)tag_data)[
i * (*tag).size +
j]
1279 = ((
bool*)((*tag).ndata))[vid*(*tag).size+
j];
1284 for(uint
i=0;
i<num_elems; ++
i){
1285 int vid = ((
int*)node_array[
i]-(
int*)NULL);
1286 for(uint
j=0;
j<(*tag).size; ++
j)
1287 ((
int*)tag_data)[
i * (*tag).size +
j]
1288 = ((
int*)((*tag).ndata))[vid*(*tag).size+
j];
1293 for(uint
i=0;
i<num_elems; ++
i){
1294 int vid = ((
double*)node_array[
i]-(
double*)NULL);
1295 for(uint
j=0;
j<(*tag).size; ++
j)
1296 ((
double*)tag_data)[
i * (*tag).size +
j]
1297 = ((
double*)((*tag).ndata))[vid*(*tag).size+
j];
1302 for(uint
i=0;
i<num_elems; ++
i){
1303 int vid = ((
void**)node_array[
i]-(
void**)NULL);
1304 for(uint
j=0;
j<(*tag).size; ++
j)
1305 ((
void**)tag_data)[
i * (*tag).size +
j]
1306 = ((
void**)((*tag).ndata))[vid*(*tag).size+
j];
1315 size_t num_handles, MsqError &err){
1318 cout <<
"MOP> MesqPane::release_entity_handles" << endl;
1322 size_t num_handles, MsqError &err){
1325 cout <<
"MOP> MesqPane::release_entity_handles" << endl;
1331 cout <<
"MOP> MesqPane::release()" << endl;
virtual void vertices_get_fixed_flag(const VertexHandle vert_array[], bool fixed_flag_array[], size_t num_vtx, MsqError &err)
Returns true or false, indicating whether the vertex is allowed to be repositioned.
void swap(int &a, int &b)
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.
virtual void vertices_get_attached_elements(const VertexHandle *vertex_array, size_t num_vertex, msq_std::vector< ElementHandle > &elements, msq_std::vector< size_t > &offsets, MsqError &err)
get elements adjacent to vertices
void invert()
Invert Tetrahedrons.
virtual ElementIterator * element_iterator(MsqError &err)
Returns a pointer to an element iterator over this Pane.
A tag structure required by Mesquite.
TagType
The type of a tag.
#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.
EntityHandle VertexHandle
EntityHandle ElementHandle
virtual void get_all_elements(ElementHandle *elem_array, size_t array_size, MsqError &err)
Fills array with handles to all elements in the mesh.
void * EntityHandle
Opaque EntityHandle type and tag type.
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.
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.
void int int REAL REAL REAL *z blockDim dim * ni
virtual void vertex_get_byte(VertexHandle vertex, unsigned char *byte, MsqError &err)
Retrieve the byte value for the specified vertex.
virtual void get_all_vertices(VertexHandle *vert_array, size_t array_size, MsqError &err)
Fills array with handles to all vertices.
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.