Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MesqPane_1_1.C
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 /* ****
24  MesqPane.C
25  *** */
26 
27 #ifndef MESQPANE_C
28 #define MESQPANE_C
29 
30 #include "MsqVertex.hpp"
31 #include "MesqPane_1_1.h"
32 #include "Element_accessors.h"
33 
34 using namespace MOP;
35 using namespace std;
36 namespace Mesquite{
37 
39  _pane = NULL;
40  if(_dc)
41  delete _dc;
42  _dc = NULL;
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){
46  case BYTE : {
47  if(pos->second.edata)
48  delete ((std::vector<char>*)pos->second.edata);
49  if(pos->second.ndata)
50  delete ((std::vector<char>*)pos->second.ndata);
51  break;
52  }
53  case BOOL :{
54  if(pos->second.edata)
55  delete ((std::vector<char>*)pos->second.edata);
56  if(pos->second.ndata)
57  delete ((std::vector<char>*)pos->second.ndata);
58  break;
59  }
60  case INT :{
61  if(pos->second.edata)
62  delete ((std::vector<char>*)pos->second.edata);
63  if(pos->second.ndata)
64  delete ((std::vector<char>*)pos->second.ndata);
65  break;
66  }
67  case DOUBLE :{
68  if(pos->second.edata)
69  delete ((std::vector<char>*)pos->second.edata);
70  if(pos->second.ndata)
71  delete ((std::vector<char>*)pos->second.ndata);
72  break;
73  }
74  case HANDLE : {
75  if(pos->second.edata)
76  delete ((std::vector<char>*)pos->second.edata);
77  if(pos->second.ndata)
78  delete ((std::vector<char>*)pos->second.ndata);
79  break;
80  }
81  }
82  }
83  }
84 
85  void MesqPane::invert(int conn_type){
86  std::vector<COM::Connectivity*> conn;
87  _pane->connectivities(conn);
88 
89  int temp = 0;
90  int *cptr = NULL;
91  uint offset = 0;
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;
102  }
103  }
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;
116  }
117  }
118  }
119  }
120 
121  void MesqPane::init(){
122  if(_verb)
123  cout << "MOP> MesqPane::init" << endl;
124  _dc = new MAP::Pane_dual_connectivity(_pane, _with_ghost);
125  if(_verb>1)
126  cout << "MOP> Building pb" << endl;
127  MAP::Pane_boundary pb(_pane);
128  if(_verb>1)
129  cout << "MOP> Finished building pb" << endl;
130  std::vector<bool> _is_isolated;
131  _is_isolated.clear();
132  if(_verb>1)
133  cout << "MOP> Determining border nodes" << endl;
134  if(_with_ghost)
135  pb.determine_border_nodes(_is_border, _is_isolated, NULL, 1);
136  else
137  pb.determine_border_nodes(_is_border, _is_isolated, NULL, 0);
138  if(_verb>1)
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]);
149 
150  }
151  _vertexBytes.resize(_with_ghost ? _pane->size_of_nodes() :
152  _pane->size_of_real_nodes());
153  if(_verb>1){
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;
160  }
161  if(_verb>0)
162  cout << "MOP> MesqPane::init done" << endl;
163  }
164 
165  // NEW
166  void MesqPane::get_all_elements( msq_std::vector<ElementHandle>& elements,
167  MsqError& err ){
168  elements.clear();
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;
174  }
175  }
176 
177  // NEW
178  void MesqPane::get_all_vertices( msq_std::vector<VertexHandle>& vertices,
179  MsqError& err ){
180  vertices.clear();
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;
186  }
187  }
188 
189 
190  void MesqPane::get_all_mesh( VertexHandle* vert_array, size_t vert_len,
191  ElementHandle* elem_array, size_t elem_len,
192  size_t* elem_conn_offsets, size_t offset_len,
193  size_t* elem_conn_indices, size_t index_len,
194  MsqError& err ){
195  if(_verb)
196  cout << "MOP> MesqPane::get_all_mesh" << endl;
197  int pane_size = _with_ghost ? _pane->size_of_nodes() :
198  _pane->size_of_real_nodes();
199 
200  COM_assertion_msg( (vert_len >= (size_t)pane_size),
201  "Vert_Len Must Be At Least Number of Nodes");
202 
203  for(int i = 1; i <= pane_size; ++i)
204  vert_array[i-1] = ((char*)NULL)+i;
205 
206  pane_size = _with_ghost ? _pane->size_of_elements() :
207  _pane->size_of_real_elements();
208 
209  COM_assertion_msg( (elem_len >= (size_t)pane_size),
210  "Array_Size Must Be At Least Number of Nodes");
211 
212  elem_conn_offsets[0] = 0;
213  Element_node_enumerator ene(_pane,1);
214  std::vector<int> nodes;
215 
216  for(int i = 1; i <= pane_size; ++i, ene.next()){
217 
218  elem_array[i-1] = ((char*)NULL)+i;
219 
220  elem_conn_offsets[i] = elem_conn_offsets[i-1]+ ene.size_of_nodes();
221 
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;
225  }
226  }
227 
229  if(_verb>1)
230  cout << "MOP> MesqPane::vertex_iterator" << endl;
231  return new MyEntityIterator(_with_ghost ? _pane->size_of_nodes() :
232  _pane->size_of_real_nodes());
233  }
234 
236  if(_verb>1)
237  cout << "MOP> MesqPane::element_iterator" << endl;
238  return new MyEntityIterator(_with_ghost ? _pane->size_of_elements() :
239  _pane->size_of_real_elements());
240  }
241 
243  bool fixed_flag_array[],
244  size_t num_vtx,
245  MsqError &err ){
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];
249  }
250  }
251 
252  bool MesqPane::vertex_is_fixed(VertexHandle vertex, MsqError & err){
253  if(_verb>1)
254  cout << "MOP> MesqPane::vertex_is_fixed" << endl;
255  uint node_id = (char*)vertex - (char*)NULL;
256  COM_assertion_msg(node_id <= _is_border.size(),
257  "Invalid vertex for MesqPane::vertex_is_fixed()");
258  return _is_border[node_id-1];
259  if(_verb>1)
260  cout << "MOP> MesqPane::vertex_is_fixed finished" << endl;
261  }
262 
263  void MesqPane::vertices_are_on_boundary(VertexHandle vert_array[], bool on_bnd[],
264  size_t num_vtx, MsqError &err){
265  if(_verb)
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]){
270  on_bnd[i] = true;
271  if(_verb>1)
272  std::cout << "MOP> Node " << node_id << " is on the boundary." << endl;
273  }
274  else{
275  on_bnd[i] = false;
276  }
277  }
278  if(_verb)
279  cout << "MOP> MesqPane::vertices_are_on_boundary finished" << endl;
280  }
281 
283  MsqVertex* coordinates,
284  size_t num_vtx,
285  MsqError &err){
286  if(_verb)
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();
291  if(!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));
306  }
307  }
308  else if (stride==1){
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),
315  *(xptr+offset+nn),
316  *(xptr+offset+2*nn));
317  }
318  }
319  else if (stride>=3){
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);
324  if(_verb>1){
325  cout << "MOP> Coords of node " << offset+1 << " = ["
326  << coordinates[i][0] << ","
327  << coordinates[i][1] << ","
328  << coordinates[i][2] << "]" << endl;
329  }
330  }
331  }
332  else{
334  "Invalid stride length for nodal coordinates.");
335  }
336  if(_verb)
337  cout << "MOP> MesqPane::vertices_get_coordinates finished" << endl;
338  }
339 
341  const Vector3D &coordinates,
342  MsqError &err){
343  int node_id = ((char*)vertex-(char*)NULL);
344  if(_verb)
345  cout << "MOP> MesqPane::vertex_set_coordinates, node = " << node_id << endl;
346  int offset = node_id - 1;
347  double * xptr = _pane->coordinates();
348  if(xptr){
349  xptr += offset *3;
350  if(_verb>2){
351  cout << "MOP> Coordinate: [" << *xptr << " , "
352  << *(xptr+1) << " , " << *(xptr+2) << "], ";
353  }
354  coordinates.get_coordinates(xptr);
355  if(_verb>2){
356  cout << "-> [" << *xptr << " , "
357  << *(xptr+1) << " , " << *(xptr+2) << "]" << endl;
358  }
359  }
360  else{
361  coordinates.get_coordinates(*(_pane->x_coordinates()+offset),
362  *(_pane->y_coordinates()+offset),
363  *(_pane->z_coordinates()+offset));
364  }
365  if(_verb)
366  cout << "MOP> MesqPane::vertex_set_coordinates finished" << endl;
367  }
368 
370  unsigned char byte, MsqError &err){
371  if(_verb)
372  cout << "MOP> MesqPane::vertex_set_byte" << endl;
373  int offset = ((char*)vertex - (char*)NULL) - 1;
374  _vertexBytes[offset] = byte;
375  if(_verb)
376  cout << "MOP> MesqPane::vertex_set_byte finished" << endl;
377  }
378 
380  unsigned char *byte_array,
381  size_t array_size, MsqError &err){
382  if(_verb)
383  cout << "MOP> MesqPane::vertices_set_byte" << endl;
384  int offset =0;
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];
388  }
389  if(_verb)
390  cout << "MOP> MesqPane::vertices_set_byte" << endl;
391  }
392 
393  // NEW
394  void MesqPane::vertices_set_byte( const VertexHandle *vert_array,
395  const unsigned char *byte_array,
396  size_t array_size,
397  MsqError &err ){
398  int offset =0;
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];
402  }
403  }
404 
406  unsigned char *byte, MsqError &err){
407  if(_verb)
408  cout << "MOP> MesqPane::vertex_get_byte" << endl;
409  int offset = ((char*)vertex - (char*)NULL) - 1;
410  *byte = _vertexBytes[offset];
411  }
412 
414  unsigned char *byte_array,
415  size_t array_size, MsqError &err){
416  if(_verb)
417  cout << "MOP> MesqPane::vertices_get_byte" << endl;
418  int offset =0;
419  for(size_t i = 0; i < array_size; ++i){
420  offset = ((char*)vertex[i] - (char*)NULL) - 1;
421  byte_array[i] = _vertexBytes[offset];
422  }
423  if(_verb)
424  cout << "MOP> MesqPane::vertices_get_byte finished" << endl;
425  }
426 
428  MsqError &err){
429  if(_verb)
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);
434  return elist.size();
435  if(_verb)
436  cout << "MOP> MesqPane::vertex_get_attached_element_count finished" << endl;
437  }
438 
440  ElementHandle* elem_array,
441  size_t sizeof_elem_array,
442  MsqError &err){
443  if(_verb)
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]);
452  }
453  if(_verb)
454  cout << "MOP> MesqPane::vertex_get_attached_elements finished" << endl;
455  }
456 
457  void MesqPane::
459  size_t num_vertex,
460  msq_std::vector<ElementHandle>& elements,
461  msq_std::vector<size_t>& offsets,
462  MsqError& err ){
463 
464  // Guess 6 elements to each node for initial memory allocation
465  // to avoid frequent memory allocation and swapping.
466  elements.reserve(6*num_vertex);
467  offsets.resize(num_vertex+1);
468  if(num_vertex > 0)
469  offsets[0] = 0;
470  std::vector<int> elist;
471  elist.clear();
472 
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]);
480  }
481  offsets[num_vertex] = offsets[num_vertex-1] + elist.size();
482 
483  // trim excess capacity
484  vector<ElementHandle>(elements).swap(elements);
485  }
486 
488  MsqError &err){
489  if(_verb)
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();
494  }
495 
496 
498  size_t num_handles,
499  MsqError& err ){
500  if(_verb)
501  cout << "MOP> MesqPane::get_vertex_use_count" << endl;
502  size_t count = 0;
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();
507  }
508  return count;
509  }
510 
512  size_t num_elems,
513  msq_std::vector<VertexHandle>& vert_handles,
514  msq_std::vector<size_t>& offsets,
515  MsqError &err){
516 
517  // std::cout << "elements_get_attached_vertices\n";
518 
519  offsets.clear();
520  vert_handles.clear();
521  offsets.resize(num_elems+1);
522  offsets[0] = 0;
523  std::vector<int> nodes;
524  nodes.clear();
525 
526  // guess 4 vertices per element
527  vert_handles.reserve(4*num_elems);
528 
529  // std::cout << "vert_handles = \n";
530 
531  for( size_t i=0; i< num_elems; ++i){
532  offsets[i] += nodes.size();
533  offsets[i+1] = offsets[i];
534  nodes.clear();
535 
536  int elem_id = ((char*)elem_handles[i] - (char*)NULL);
537  Element_node_enumerator ene(_pane,elem_id);
538  ene.get_nodes(nodes);
539 
540  for(uint j=0, nj= nodes.size(); j<nj; ++j){
541  vert_handles.push_back((char*)NULL + nodes[j]);
542  // std::cout << nodes[j] << " ";
543  }
544  // std::cout << "\n";
545  }
546  offsets[num_elems] += nodes.size();
547  msq_std::vector<VertexHandle>(vert_handles).swap(vert_handles);
548  // std::cout << "offsets = \n";
549  for(uint i=0; i < offsets.size(); ++i){
550  // std::cout << offsets[i] << " ";
551  }
552  // std::cout << "\n";
553 
554  }
555 
557  size_t num_elems,
558  VertexHandle *vert_handles,
559  size_t &sizeof_vert_handles,
560  size_t *csr_data,
561  size_t &sizeof_csr_data,
562  size_t *csr_offsets,
563  MsqError &err){
564  if(_verb)
565  cout << "MOP> MesqPane::elements_get_attached_vertices" << endl;
566  int vert_count = 0;
567  // maps vertex id's to position in vert_handles
568  std::map<int,int> itop_map;
569  std::map<int,int>::iterator pos;
570  if (num_elems == 0)
571  return;
572  csr_offsets[0] = 0;
573  // loop through elements
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;
580  // Check for space in csr_data
581  COM_assertion_msg( (sizeof_csr_data >= csr_offsets[i+1]),
582  "Not enough space in arg. csr_data");
583 
584  // Loop through vertices of current element
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);
588  // current vertex isn't in vert_handles, add it
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;
593  ++vert_count;
594  }
595  // add current vertex to csr_data
596  csr_data[csr_offsets[i] + j] = pos->second;
597  }
598  elist.clear();
599  }
600  sizeof_csr_data = csr_offsets[num_elems];
601  sizeof_vert_handles = vert_count;
602  if(_verb)
603  cout << "MOP> MesqPane::elements_get_attached_vertices" << endl;
604  }
605 
607  MsqError &err){
608  if(_verb)
609  cout << "MOP> MesqPane::element_get_topology" << endl;
610  int elem_id = ((char*)entity_handle-(char*)NULL);
611 
612  const COM::Connectivity *con = _pane->connectivity(elem_id);
613  COM_assertion_msg(con!=NULL, "con is NULL");
614  switch(con->element_type()){
615  case COM::Connectivity::TRI3 :
616  return TRIANGLE;
617  break;
618  case COM::Connectivity::QUAD4 :
619  return QUADRILATERAL;
620  break;
621  case COM::Connectivity::TET4 :
622  return TETRAHEDRON;
623  break;
624  case COM::Connectivity::HEX8 :
625  return HEXAHEDRON;
626  break;
627  case COM::Connectivity::PYRIMID5 :
628  return PYRAMID;
629  break;
630  case COM::Connectivity::PRISM6 :
631  return PRISM;
632  break;
633  default:
635  "Element type not supported by Mesquite.");
636  break;
637  }
638  // Control should never reach here...
639  // this 'return' gets rid of compiler warnings
640  return TRIANGLE;
641  }
642 
644  EntityTopology *element_topologies,
645  size_t num_elements, MsqError &err){
646  if(_verb >0)
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);
650  }
651  if(_verb >0)
652  cout << "MOP> MesqPane::element_get_topologies done" << endl;
653  }
654 
655  void MesqPane::elements_get_topologies(const ElementHandle *element_handle_array,
656  EntityTopology *element_topologies,
657  size_t num_elements, MsqError &err){
658  if(_verb >0)
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);
662  }
663  if(_verb >0)
664  cout << "MOP> MesqPane::element_get_topologies done" << endl;
665  }
666 
679  void* MesqPane::tag_create( const msq_std::string& tag_n,
680  TagType type, unsigned length,
681  const void* default_value,
682  MsqError &err){
683 
684  std::string tag_name(*(const_cast<std::string *>(&tag_n)));
685  if(_verb)
686  cout << "MOP> MesqPane::tag_create" << endl;
687 
688  tagStruct new_tag = {length, type, NULL,
689  NULL, tag_name};
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());
694  switch (type){
695  case BYTE :{
696 
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;
701 
702  temp = new std::vector<char>;
703  temp->reserve(nsize*length);
704  temp->resize(nsize*length);
705  new_tag.ndata = (void *)temp;
706 
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];
713  break;
714  }
715  case BOOL :{
716 
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;
721 
722  temp = new std::vector<bool>;
723  temp->reserve(nsize*length);
724  temp->resize(nsize*length);
725  new_tag.ndata = (void *) temp;
726 
727  for(uint i=0; i<esize*length; ++i)
728  (*((std::vector<bool>*)new_tag.edata))[i]
729  = ((bool *)default_value)[i];
730  for(uint i=0; i<nsize*length; ++i)
731  (*((std::vector<bool>*)new_tag.ndata))[i]
732  = ((bool *)default_value)[i];
733  break;
734  }
735  case INT :{
736 
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;
741 
742  temp = new std::vector<int>;
743  temp->reserve(nsize*length);
744  temp->resize(nsize*length);
745  new_tag.ndata = (void *) temp;
746 
747  for(uint i=0; i<esize*length; ++i)
748  (*((std::vector<int>*)new_tag.edata))[i]
749  = ((int *)default_value)[i];
750  for(uint i=0; i<nsize*length; ++i)
751  (*((std::vector<int>*)new_tag.ndata))[i]
752  = ((int *)default_value)[i];
753  break;
754  }
755  case DOUBLE :{
756 
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;
761 
762  temp = new std::vector<double>;
763  temp->reserve(nsize*length);
764  temp->resize(nsize*length);
765  new_tag.ndata = (void *) temp;
766 
767  for(uint i=0; i<esize*length; ++i)
768  (*((std::vector<double>*)new_tag.edata))[i]
769  = ((double *)default_value)[i];
770  for(uint i=0; i<nsize*length; ++i)
771  (*((std::vector<double>*)new_tag.ndata))[i]
772  = ((double *)default_value)[i];
773  break;
774  }
775  case HANDLE : {
776 
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;
781 
782  temp = new std::vector<void*>;
783  temp->reserve(nsize*length);
784  temp->resize(nsize*length);
785  new_tag.ndata = (void *) temp;
786 
787  for(uint i=0; i<esize*length; ++i)
788  (*((std::vector<void*>*)new_tag.edata))[i]
789  = ((void* *)default_value)[i];
790  for(uint i=0; i<nsize*length; ++i)
791  (*((std::vector<void*>*)new_tag.ndata))[i]
792  = ((void* *)default_value)[i];
793  break;
794  }
795  default :
797  "Unrecognized TagType.");
798  break;
799  }
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);
803  COM_assertion_msg(pos != s_to_t.end(),
804  "Unable to create tag for Mesquite.");
805  return &(pos->second);
806  }
807 
812  void MesqPane::tag_delete( TagHandle handle, MsqError& err ){
813  if(_verb)
814  cout << "MOP> MesqPane::tag_delete" << endl;
815  tagStruct* tag = (tagStruct*)handle;
816  switch ( (*tag).type){
817  case BYTE : {
818  std::vector<char>* v = (std::vector<char>*)(*tag).edata;
819  if (v!= NULL)
820  delete v;
821  v = (std::vector<char>*)(*tag).ndata;
822  if (v!= NULL)
823  delete v;
824  break;
825  }
826  case BOOL :{
827  std::vector<bool>* v = (std::vector<bool>*) (*tag).edata;
828  if (v!= NULL)
829  delete v;
830  v = (std::vector<bool>*) (*tag).ndata;
831  if (v!= NULL)
832  delete v;
833  break;
834  }
835  case INT :{
836  std::vector<int>* v = (std::vector<int>*) (*tag).edata;
837  if (v!= NULL)
838  delete v;
839  v = (std::vector<int>*) (*tag).ndata;
840  if (v!= NULL)
841  delete v;
842  break;
843  }
844  case DOUBLE :{
845  std::vector<double>* v = (std::vector<double>*) (*tag).edata;
846  if (v!= NULL)
847  delete v;
848  v = (std::vector<double>*) (*tag).ndata;
849  if (v!= NULL)
850  delete v;
851  break;
852  }
853  case HANDLE :{
854  std::vector<void*>* v = (std::vector<void*>*) (*tag).edata;
855  if (v!= NULL)
856  delete v;
857  v = (std::vector<void*>*) (*tag).ndata;
858  if (v!= NULL)
859  delete v;
860  break;
861  }
862  default:
864  "Unrecognized TagType.");
865  break;
866  }
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());
871  s_to_t.erase(n);
872  }
873 
874 
875 
883  TagHandle MesqPane::tag_get( const msq_std::string& name,
884  MsqError& err ){
885  if(_verb)
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())
890  return NULL;
891  else
892  return (TagHandle)(&(*pos));
893  }
894 
904  msq_std::string& name_out,
905  TagType& type_out,
906  unsigned& length_out,
907  MsqError& err ){
908  if(_verb)
909  cout << "MOP> MesqPane::tag_properties" << endl;
910  tagStruct* tag = (tagStruct*)handle;
911  name_out = (*tag).name;
912  type_out = (*tag).type;
913  length_out = (*tag).size;
914  }
915 
927  size_t num_elems,
928  const ElementHandle* elem_array,
929  const void* tag_data,
930  MsqError& err ){
931  if(_verb)
932  cout << "MOP> MesqPane::tag_set_element_data" << endl;
933  tagStruct* tag = (tagStruct*)handle;
934  int ne = 1 + (_with_ghost ? _pane->size_of_elements() :
935  _pane->size_of_real_elements());
936  switch ((*tag).type){
937  case BYTE : {
938  std::vector<char>* v = (std::vector<char>*)(*tag).edata;
939  uint tsize = ne*(*tag).size;
940  if (v->size() != tsize){
941  // This tag isn't used yet... should only have default value
942  COM_assertion_msg(v->size() == (*tag).size,
943  "Invalid TagHandle received from Mesquite");
944  v->reserve(tsize);
945  v->resize(tsize);
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];
949  }
950  }
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];
955  }
956  break;
957  }
958  case BOOL :{
959  std::vector<bool>* v = (std::vector<bool>*)(*tag).edata;
960  uint tsize = ne*(*tag).size;
961  if (v->size() != tsize){
962  // This tag isn't used yet... should only have default value
963  COM_assertion_msg(v->size() == (*tag).size,
964  "Invalid TagHandle received from Mesquite");
965  v->reserve(tsize);
966  v->resize(tsize);
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];
970  }
971  }
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];
976  }
977  break;
978  }
979  case INT :{
980  std::vector<int>* v = (std::vector<int>*)(*tag).edata;
981  uint tsize = ne*(*tag).size;
982  if (v->size() != tsize){
983  // This tag isn't used yet... should only have default value
984  COM_assertion_msg(v->size() == (*tag).size,
985  "Invalid TagHandle received from Mesquite");
986  v->reserve(tsize);
987  v->resize(tsize);
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];
991  }
992  }
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];
997  }
998  break;
999  }
1000  case DOUBLE :{
1001  std::vector<double>* v = (std::vector<double>*)(*tag).edata;
1002  uint tsize = ne*(*tag).size;
1003  if (v->size() != tsize){
1004  // This tag isn't used yet... should only have default value
1005  COM_assertion_msg(v->size() == (*tag).size,
1006  "Invalid TagHandle received from Mesquite");
1007  v->reserve(tsize);
1008  v->resize(tsize);
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];
1012  }
1013  }
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];
1018  }
1019  break;
1020  }
1021  case HANDLE : {
1022  std::vector<void*>* v = (std::vector<void*>*)(*tag).edata;
1023  uint tsize = ne*(*tag).size;
1024  if (v->size() != tsize){
1025  // This tag isn't used yet... should only have default value
1026  COM_assertion_msg(v->size() == (*tag).size,
1027  "Invalid TagHandle received from Mesquite");
1028  v->reserve(tsize);
1029  v->resize(tsize);
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];
1033  }
1034  }
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];
1039  }
1040  break;
1041  }
1042  default :
1044  "TagHandle with unrecgonized TagType received.");
1045  }
1046  }
1047 
1048 
1060  size_t num_elems,
1061  const VertexHandle* node_array,
1062  const void* tag_data,
1063  MsqError& err ){
1064  if(_verb)
1065  cout << "MOP> MesqPane::tag_set_vertex_data" << endl;
1066  tagStruct* tag = (tagStruct*)handle;
1067  uint nn = 1 + (_with_ghost ? _pane->size_of_nodes() :
1068  _pane->size_of_real_nodes());
1069  switch ((*tag).type){
1070  case BYTE : {
1071  std::vector<char>* v = (std::vector<char>*)(*tag).ndata;
1072  uint tsize = (nn)* (*tag).size;
1073  if (v->size() != tsize){
1074  // This tag isn't used yet... should only have default value
1075  COM_assertion_msg(v->size() == (*tag).size,
1076  "Invalid TagHandle received from Mesquite");
1077  v->reserve(tsize);
1078  v->resize(tsize);
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];
1082  }
1083  }
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];
1088  }
1089  break;
1090  }
1091  case BOOL :{
1092  std::vector<bool>* v = (std::vector<bool>*)(*tag).ndata;
1093  uint tsize = (nn)* (*tag).size;
1094  if (v->size() != tsize){
1095  // This tag isn't used yet... should only have default value
1096  COM_assertion_msg(v->size() == (*tag).size,
1097  "Invalid TagHandle received from Mesquite");
1098  v->reserve(tsize);
1099  v->resize(tsize);
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];
1103  }
1104  }
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];
1109  }
1110  break;
1111  }
1112  case INT :{
1113  std::vector<int>* v = (std::vector<int>*)(*tag).ndata;
1114  uint tsize = (nn)* (*tag).size;
1115  if (v->size() != tsize){
1116  // This tag isn't used yet... should only have default value
1117  COM_assertion_msg(v->size() == (*tag).size,
1118  "Invalid TagHandle received from Mesquite");
1119  v->reserve(tsize);
1120  v->resize(tsize);
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];
1124  }
1125  }
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];
1130  }
1131  break;
1132  }
1133  case DOUBLE :{
1134  std::vector<double>* v = (std::vector<double>*)(*tag).ndata;
1135  uint tsize = (nn)* (*tag).size;
1136  if (v->size() != tsize){
1137  // This tag isn't used yet... should only have default value
1138  COM_assertion_msg(v->size() == (*tag).size,
1139  "Invalid TagHandle received from Mesquite");
1140  v->reserve(tsize);
1141  v->resize(tsize);
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];
1145  }
1146  }
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];
1151  }
1152  break;
1153  }
1154  case HANDLE : {
1155  std::vector<void*>* v = (std::vector<void*>*)(*tag).ndata;
1156  uint tsize = (nn)* (*tag).size;
1157  if (v->size() != tsize){
1158  // This tag isn't used yet... should only have default value
1159  COM_assertion_msg(v->size() == (*tag).size,
1160  "Invalid TagHandle received from Mesquite");
1161  v->reserve(tsize);
1162  v->resize(tsize);
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];
1166  }
1167  }
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];
1172  }
1173  break;
1174  }
1175  }
1176  }
1177 
1178 
1190  size_t num_elems,
1191  const ElementHandle* elem_array,
1192  void* tag_data,
1193  MsqError& err ){
1194  if(_verb)
1195  cout << "MOP> MesqPane::tag_get_element_data" << endl;
1196  tagStruct* tag = (tagStruct*)handle;
1197  switch ((*tag).type){
1198  case BYTE : {
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];
1204  }
1205  break;
1206  }
1207  case BOOL :{
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];
1213  }
1214  break;
1215  }
1216  case INT :{
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];
1222  }
1223  break;
1224  }
1225  case DOUBLE :{
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];
1231  }
1232  break;
1233  }
1234  case HANDLE : {
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];
1240  }
1241  break;
1242  }
1243  }
1244  }
1245 
1257  size_t num_elems,
1258  const VertexHandle* node_array,
1259  void* tag_data,
1260  MsqError& err ){
1261  if(_verb)
1262  cout << "MOP> MesqPane::tag_get_vertex_data" << endl;
1263  tagStruct* tag = (tagStruct*)handle;
1264  switch ((*tag).type){
1265  case BYTE : {
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];
1271  }
1272  break;
1273  }
1274  case BOOL :{
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];
1280  }
1281  break;
1282  }
1283  case INT :{
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];
1289  }
1290  break;
1291  }
1292  case DOUBLE :{
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];
1298  }
1299  break;
1300  }
1301  case HANDLE : {
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];
1307  }
1308  break;
1309  }
1310  }
1311  }
1312 
1313 
1315  size_t num_handles, MsqError &err){
1316 
1317  if(_verb)
1318  cout << "MOP> MesqPane::release_entity_handles" << endl;
1319  }
1320 
1322  size_t num_handles, MsqError &err){
1323 
1324  if(_verb)
1325  cout << "MOP> MesqPane::release_entity_handles" << endl;
1326  }
1327 
1328  void MesqPane::release()
1329  {
1330  if(_verb)
1331  cout << "MOP> MesqPane::release()" << endl;
1332  }
1333 
1334 
1335 } // end namespace Mesquite
1336 #endif
1337 
1338 
1339 
1340 
1341 
1342 
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.
Definition: MesqPane_1_1.C:242
if(dy > dx)
void swap(int &a, int &b)
Definition: buildface.cpp:88
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.
Definition: MesqPane.C:305
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
Definition: MesqPane_1_1.C:458
void invert()
Invert Tetrahedrons.
Definition: MesqPane.C:45
virtual ElementIterator * element_iterator(MsqError &err)
Returns a pointer to an element iterator over this Pane.
Definition: MesqPane.C:149
A tag structure required by Mesquite.
Definition: MesqPane.h:487
TagType
The type of a tag.
EntityTopology
Definition: Mesquite.hpp:92
#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.
Definition: MesqPane_1_1.C:926
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.
Definition: MesqPane.C:186
virtual ~MesqPane()
Destructor.
Definition: MesqPane.C:38
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.
Definition: MesqPane.h:495
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.
Definition: MesqPane.C:127
void * TagHandle
Definition: MesqPane_1_1.h:101
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.
Definition: MesqPane.C:167
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
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 &quot;elem_handles&quot; array.
Definition: MesqPane.C:358
virtual size_t get_vertex_use_count(ElementHandle *handle_array, size_t num_handles, MsqError &err)
Definition: MesqPane_1_1.C:497
EntityIterator ElementIterator
Definition: MesqPane.h:86
EntityIterator VertexIterator
Definition: MesqPane.h:84
virtual size_t element_get_attached_vertex_count(ElementHandle elem, MsqError &err) const
Gets the number of vertices in this element.
Definition: MesqPane.C:349
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
Definition: roccomf90.h:20
virtual bool vertex_is_fixed(VertexHandle vertex, MsqError &err)
Tells wheter the vertex is allowed to be repositioned.
Definition: MesqPane.C:156
virtual void tag_delete(TagHandle handle, MsqError &err)
Remove a tag and all corresponding data.
Definition: MesqPane_1_1.C:812
NVec< 3, double > Vector3D
virtual void release()
Release a MesqPane from use.
Definition: MesqPane.C:593
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.
Definition: MesqPane.C:485
virtual void vertices_set_byte(VertexHandle *vert_array, unsigned char *byte_array, size_t array_size, MsqError &err)
Set mutliple vertex flags.
Definition: MesqPane.C:283
virtual TagHandle tag_create(const msq_std::string &tag_name, TagType type, unsigned length, const void *default_value, MsqError &err)
Create a tag.
Definition: MesqPane_1_1.C:679
blockLoc i
Definition: read.cpp:79
virtual size_t vertex_get_attached_element_count(VertexHandle vertex, MsqError &err) const
Gets the number of elements attached to this vertex.
Definition: MesqPane.C:319
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.
const NT & n
virtual void tag_properties(TagHandle handle, msq_std::string &name_out, TagType &type_out, unsigned &length_out, MsqError &err)
Get properites of tag.
Definition: MesqPane_1_1.C:903
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.
j indices j
Definition: Indexing.h:6
virtual TagHandle tag_get(const msq_std::string &name, MsqError &err)
Get handle for existing tag, by name.
Definition: MesqPane_1_1.C:883
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.
Definition: MesqPane.C:586
virtual VertexIterator * vertex_iterator(MsqError &err)
Returns a pointer to a vertex iterator over this Pane.
Definition: MesqPane.C:142
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.
Definition: MesqPane.C:331
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
virtual void vertex_get_byte(VertexHandle vertex, unsigned char *byte, MsqError &err)
Retrieve the byte value for the specified vertex.
Definition: MesqPane.C:297
virtual void get_all_vertices(VertexHandle *vert_array, size_t array_size, MsqError &err)
Fills array with handles to all vertices.
Definition: MesqPane.C:112
virtual void vertex_set_byte(VertexHandle vertex, unsigned char byte, MsqError &err)
Set a vertex flag.
Definition: MesqPane.C:273
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.
Definition: MesqPane_1_1.C:190
virtual EntityTopology element_get_topology(ElementHandle entity_handle, MsqError &err) const
Returns the topology of the given entity.
Definition: MesqPane.C:454
virtual void vertex_set_coordinates(VertexHandle vertex, const Vector3D &coordinates, MsqError &err)
Set the Location of a vertex.
Definition: MesqPane.C:244
void init()
Initialize the MesqPane.
Definition: MesqPane.C:68