Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MesqPane.h
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 // $Id: MesqPane.h,v 1.3 2008/12/06 08:45:24 mtcampbe Exp $
38 #ifndef MESQPANE_H
39 #define MESQPANE_H
40 
41 #ifndef USE_STD_INCLUDES
42 #define USE_STD_INCLUDES 1
43 #endif
44 
45 #ifndef USE_C_PREFIX_INCLUDES
46 #define USE_C_PREFIX_INCLUDES 1
47 #endif
48 
49 #include "Mesquite.hpp"
50 #include "MeshInterface.hpp"
51 #include "MesquiteError.hpp"
52 #include "InstructionQueue.hpp"
53 #include "MeshSet.hpp"
54 #include "TerminationCriterion.hpp"
55 #include "QualityAssessor.hpp"
56 
57 // algorithms
58 #include "MeanRatioQualityMetric.hpp"
59 #include "EdgeLengthQualityMetric.hpp"
60 #include "LPtoPTemplate.hpp"
61 #include "FeasibleNewton.hpp"
62 #include "ConjugateGradient.hpp"
63 #include "MsqMessage.hpp"
64 using namespace Mesquite;
65 #include "MeshInterface.hpp"
66 #include "MesquiteError.hpp"
67 #include "MsqVertex.hpp"
68 
69 #include "Pane.h"
70 #include "Pane_boundary.h"
71 #include "Dual_connectivity.h"
72 #include "mopbasic.h"
73 #include "roccom_devel.h"
74 
75 #define MESQUITE_BEGIN_NAMESPACE namespace Mesquite{
76 #define MESQUITE_END_NAMESPACE }
77 
78 using namespace std;
81 
82 using std::string;
83 
87 
89 
95 class MesqPane : public Mesquite::Mesh {
96 
97  inline size_t vertices_in_topology(EntityTopology);
98 
99 public:
100 
105 
113  MesqPane(COM::Pane* p, bool with_ghost = true)
114  : _pane(p), _verb(0), _with_ghost(with_ghost){
115  init();
116  }
117 
119  virtual ~MesqPane();
120 
121  //\}
122  // end of Constructors and Destructors
123 
128 
134  void invert();
135 
137 
141  void init();
142 
144  void set_verb(int verb){
145  _verb = verb;
146  }
147 
148  //\} End of Miscellaneous functions
149 
150 
155  virtual int get_geometric_dimension(MsqError &err) const {
157  if(_verb >1) std::cout << "MesqPane::get_geometric_dimension" << std::endl;
158  return 3;
159  }
160 
162  virtual size_t get_total_vertex_count(MsqError &err) const {
163  if(_verb >1) std::cout << "MesqPane::get_total_vertex_count" << std::endl;
164  return _with_ghost ? _pane->size_of_nodes() : _pane->size_of_real_nodes();
165  }
166 
168  virtual size_t get_total_element_count(MsqError &err) const {
169  if(_verb >1) std::cout << "MesqPane::get_total_element_count" << std::endl;
170  return _with_ghost ? _pane->size_of_elements() : _pane->size_of_real_elements(); }
171 
172 
174 
180  virtual void get_all_vertices(VertexHandle *vert_array,
181  size_t array_size, MsqError &err);
182 
184 
190  virtual void get_all_elements(ElementHandle *elem_array,
191  size_t array_size, MsqError &err);
192 
193 
195 
201  virtual VertexIterator* vertex_iterator(MsqError &err);
202 
204 
210  virtual ElementIterator* element_iterator(MsqError &err);
211 
212  //\}
213  // end Inherited Operations on Entire Mesh
214 
219 
224  virtual bool vertex_is_fixed(VertexHandle vertex, MsqError &err);
225 
227 
232  virtual void vertices_are_on_boundary(VertexHandle vert_array[], bool on_bnd[],
233  size_t num_vtx, MsqError &err);
234 
236 
241  virtual void vertices_get_coordinates(VertexHandle vert_array[],
242  Mesquite::MsqVertex* const &coordinates,
243  const size_t &num_vtx,
244  MsqError &err);
245 
247 
251  virtual void vertex_set_coordinates(VertexHandle vertex,
252  const Vector3D &coordinates,
253  MsqError &err);
254 
256 
265  virtual void vertex_set_byte (VertexHandle vertex,
266  unsigned char byte, MsqError &err);
267 
269 
278  virtual void vertices_set_byte (VertexHandle *vert_array,
279  unsigned char *byte_array,
280  size_t array_size, MsqError &err);
281 
283 
287  virtual void vertex_get_byte(VertexHandle vertex,
288  unsigned char *byte, MsqError &err);
289 
291 
295  virtual void vertices_get_byte(VertexHandle *vertex,
296  unsigned char *byte_array,
297  size_t array_size, MsqError &err);
298 
299  //\}
300  // end Inherited Vertex Properties
301 
306  virtual size_t vertex_get_attached_element_count(VertexHandle vertex,
310  MsqError &err) const;
311 
313  virtual void vertex_get_attached_elements(VertexHandle vertex,
314  ElementHandle* elem_array,
315  size_t sizeof_elem_array,
316  MsqError &err);
317 
318  //\}
319  // end Inherited Vertex Topology
320 
325  virtual size_t element_get_attached_vertex_count(ElementHandle elem,
327  MsqError &err) const;
328 
330 
363  virtual void elements_get_attached_vertices(ElementHandle *elem_handles,
364  size_t num_elems,
365  VertexHandle *vert_handles,
366  size_t &sizeof_vert_handles,
367  size_t *csr_data,
368  size_t &sizeof_csr_data,
369  size_t *csr_offsets,
370  MsqError &err);
371 
373 
388  virtual void elements_get_attached_vertex_indices(ElementHandle element[],
389  size_t num_elems,
390  size_t index_array[],
391  size_t array_size,
392  size_t* offsets,
393  MsqError &err);
394 
396  virtual EntityTopology element_get_topology(ElementHandle entity_handle,
397  MsqError &err) const;
398 
400 
403  virtual void elements_get_topologies(ElementHandle *element_handle_array,
404  EntityTopology *element_topologies,
405  size_t num_elements, MsqError &err);
406 
407  //\}
408  // end Inherited Element Topology
409 
410 
415  virtual void element_tag_create(const string tag_name,
417  int tag_size,
418  TagHandle& tag_handle,
419  MsqError &err);
420 
422  virtual void* tag_get_handle(const string tag_name, MsqError &err);
423 
424 
426 
431  virtual void elements_set_tag_data(const size_t num_elements,
432  const TagHandle tag_handle,
433  TagDataPt const tag_data_array,
434  const int& tag_size,
435  MsqError &err);
436 
438 
443  virtual void elements_get_tag_data(const size_t num_elements,
444  const TagHandle tag_handle,
445  TagDataPt &tag_data_array,
446  int& tag_size,
447  MsqError &err);
448  //\}
449  // end Inherited Tags
450 
455  virtual void release_entity_handles(EntityHandle *handle_array,
457  size_t num_handles, MsqError &err);
458 
460 
467  virtual void release();
468 
469  //\}
470  // end of Inherited Memory Management.
471 
472 
473 protected:
474  COM::Pane* _pane;
475  MAP::Pane_dual_connectivity* _dc;
476  std::vector<bool> _is_border;
477  std::vector<unsigned char> _vertexBytes;
478 
479  int _verb; // 1 for function start/end
480  // 2 for all information
481  // 0 = nothing
482 
483  bool _with_ghost; // If true(default), then use ghost information.
484 
485 
487  struct tag {
488  void* pt; // points to the beginning of the dense tag array
489  int size; // size is the increment to use to go from one tag to the next
490  };
491  std::map<std::string, MesqPane::tag> denseTags;
492 };
493 
496 public:
497 
499  MyEntityIterator(uint size){ _cur = 1; _size = size;}
500 
503  {_cur = 0;
504  _size = 0;
505  }
506 
508  virtual void restart(){
509  _cur = 1;
510  };
511 
513  virtual Mesh::EntityHandle operator*() const {
514  if (_cur > _size)
515  return 0;
516  else
517  return (char*)NULL+_cur;
518  }
519 
521  virtual void operator++(){
522  _cur ++;
523  }
524 
526 
530  virtual bool is_at_end() const{
531  if (_cur <= _size) return 0;
532  else return 1;
533  }
534 private:
535  uint _cur; // The current node's position.
536  uint _size;// The size of the element array
537 };
538 
540 // end namespace MESQUITE
541 #endif
542 
543 
544 
545 
546 
547 
Iterates through a set of entities. An EntityIterator is typically obtained via Mesh::vertex_iterator...
EntityIterator VertexIterator
void set_verb(int verb)
Set the MesqPane verbose level (int, &gt;= 0)
Definition: MesqPane.h:144
subroutine invert(a, nrow, det)
Definition: v3d8_me.f90:1392
Contains the prototypes for the Pane object.
A tag structure required by Mesquite.
Definition: MesqPane.h:487
Used to hold the error state and return it to the application.
EntityTopology
Definition: Mesquite.hpp:92
A class for iterating through a Panes vertices or elements.
Definition: MesqPane.h:495
virtual ~MyEntityIterator()
Destructor.
Definition: MesqPane.h:502
std::map< std::string, MesqPane::tag > denseTags
Definition: MesqPane.h:491
This file contains the Mesquite mesh interface. Many users will want to implement a concrete class de...
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
virtual Mesh::EntityHandle operator*() const
Return the handle currently being pointed to by the iterator.
Definition: MesqPane.h:513
void * EntityHandle
Opaque EntityHandle type and tag type.
#define MESQUITE_BEGIN_NAMESPACE
Definition: MesqPane.h:75
MesqPane(COM::Pane *p, bool with_ghost=true)
Construct from a pane.
Definition: MesqPane.h:113
virtual void operator++()
Move to the next entity.
Definition: MesqPane.h:521
void * pt
Definition: MesqPane.h:488
MAP::Pane_dual_connectivity * _dc
Definition: MesqPane.h:475
std::vector< unsigned char > _vertexBytes
Definition: MesqPane.h:477
#define MESQUITE_END_NAMESPACE
Definition: MesqPane.h:76
COM::Pane * _pane
Definition: MesqPane.h:474
A class enabling Mesquite calls on Rocmop panes.
Definition: MesqPane.h:95
size_t vertices_in_topology(EntityTopology)
A Mesquite::Mesh is a collection of mesh elements which are composed of mesh vertices. Intermediate objects are not accessible through this interface (where intermediate objects include things like the faces of a hex, or an element&#39;s edges).
virtual void restart()
Moves the iterator back to the first entity in the list.
Definition: MesqPane.h:508
virtual size_t get_total_element_count(MsqError &err) const
Returns the number of elements.
Definition: MesqPane.h:168
MyEntityIterator(uint size)
Constructor.
Definition: MesqPane.h:499
std::vector< bool > _is_border
Definition: MesqPane.h:476
virtual bool is_at_end() const
Check if we are at the end of the entites.
Definition: MesqPane.h:530
virtual size_t get_total_vertex_count(MsqError &err) const
Returns the number of nodes.
Definition: MesqPane.h:162
void * TagHandle
Type used to refer to a tag defintion.
EntityIterator ElementIterator
bool _with_ghost
Definition: MesqPane.h:483
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
int _verb
Definition: MesqPane.h:479
Utility for detecting boundaries of a pane.
USE_MOP_NAMESPACE
Definition: metric_demo.C:33