Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Pane_node_enumerator Class Reference

#include <Pane_node_accessors.h>

Collaboration diagram for Pane_node_enumerator:

Public Member Functions

 Pane_node_enumerator ()
 
 Pane_node_enumerator (const Pane *pane, int i, const Connectivity *conn=NULL)
 Constructor for an element in a structured or an unstructured mesh. More...
 
int next ()
 Go to the next element within the connectivity tables of a pane. More...
 
int dimension () const
 Get the dimension of the base pane. More...
 
int id () const
 Get the local id of the element within the pane. More...
 
const Panepane () const
 

Protected Member Functions

bool position_allowed3D ()
 Determine in the current node number is a real node or a ghost node If it is a ghost node, return false. More...
 
bool position_allowed2D ()
 Determine in the current node number is a real node or a ghost node If it is a ghost node, return false. More...
 
void set_first ()
 

Protected Attributes

const Pane_pane
 
const Connectivity_conn
 
int _node_num
 
int ni
 
int nj
 
int nk
 
int _buffer
 
int _size_of_nodes
 

Detailed Description

Definition at line 40 of file Pane_node_accessors.h.

Constructor & Destructor Documentation

Definition at line 42 of file Pane_node_accessors.h.

42 : _pane(NULL){}
COM_BEGIN_NAME_SPACE Pane_node_enumerator ( const Pane pane,
int  i,
const Connectivity conn = NULL 
)

Constructor for an element in a structured or an unstructured mesh.

If conn==NULL, then i is an element index local to the pane. If conn!=NULL, then i is an element index local to the connectivity.

Definition at line 33 of file Pane_node_accessors.C.

References _buffer, _node_num, _pane, _size_of_nodes, COM_assertion, Pane::dimension(), i, Pane::is_unstructured(), ni, nj, nk, set_first(), Pane::size_i(), Pane::size_j(), Pane::size_k(), Pane::size_of_ghost_layers(), and Pane::size_of_nodes().

35  : _pane(pane), _conn( _pane->is_structured()?NULL:
36  (conn==NULL?pane->connectivity(i-1):conn))
37 {
38  if ( _pane->is_unstructured()) {
39  if (i == 0) {
40  _node_num = 1;
42  }
43 
44  }
45  else if ( _pane->dimension()==2) {
46  ni = _pane->size_i();
47  nj = _pane->size_j();
48  nk=1;
50  _buffer = _buffer < 0 ? 0 : _buffer;
51  _node_num = 1;
52  set_first();
53  } else if ( _pane->dimension()==3) {
54  ni = _pane->size_i();
55  nj = _pane->size_i();
56  nk = _pane->size_k();
58  _buffer = _buffer < 0 ? 0 : _buffer;
59  _node_num = 1;
60  set_first();
61  } else {
62  COM_assertion(false); // Not yet supported.
63  }
64 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
const Connectivity * _conn
bool is_structured() const
Is mesh of the pane structured?
Definition: Pane.h:110
Size size_k() const
Get the number of nodes in k-dimension if the mesh is structured.
Definition: Pane.h:222
Size size_of_ghost_layers() const
Dimension of the pane.
Definition: Pane.h:212
blockLoc i
Definition: read.cpp:79
Size size_j() const
Get the number of nodes in j-dimension if the mesh is structured.
Definition: Pane.h:219
bool is_unstructured() const
Is mesh of the pane unstructured?
Definition: Pane.h:103
Size size_of_nodes() const
Get the total number of nodes in the pane (including ghost nodes).
Definition: Pane.h:118
int dimension() const
Dimension of the pane.
Definition: Pane.h:99
Connectivity * connectivity(Size i)
Obtain the connectivity table containing the element with the given ID.
Definition: Pane.C:99
Size size_i() const
Get the number of nodes in i-dimension if the mesh is structured.
Definition: Pane.h:216

Here is the call graph for this function:

Member Function Documentation

int dimension ( ) const
inline

Get the dimension of the base pane.

Definition at line 54 of file Pane_node_accessors.h.

References _pane, and Pane::dimension().

54 { return _pane->dimension(); }
int dimension() const
Dimension of the pane.
Definition: Pane.h:99

Here is the call graph for this function:

int id ( ) const
inline

Get the local id of the element within the pane.

Definition at line 57 of file Pane_node_accessors.h.

References _node_num.

57  {
58  return _node_num;
59  }
int next ( )

Go to the next element within the connectivity tables of a pane.

Return the next allowed node number.

For structured meshes with ghost layers, one cannot number sequentially, so this method iterates to the next allowed node number

Definition at line 103 of file Pane_node_accessors.C.

References _node_num, _pane, _size_of_nodes, COM_assertion, Pane::dimension(), Pane::is_unstructured(), position_allowed2D(), and position_allowed3D().

103  {
104 
105  if (_node_num == _size_of_nodes)
106  return _node_num;
107 
108  if (_pane->is_unstructured()) {
109  return _node_num++;
110  }
111  else if (_pane->dimension()==2) { // Structured mesh
112  _node_num++;
113  while (!position_allowed2D()){
114  _node_num++;
115  }
116  return _node_num;
117  }
118  else if (_pane->dimension()==3) {
119 
120  _node_num++;
121  while (!position_allowed3D()){
122  _node_num++;
123  }
124  return _node_num++;
125  }
126  else {
127 
128  COM_assertion(false); // Not yet supported.
129  return -1;
130  }
131 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
bool position_allowed2D()
Determine in the current node number is a real node or a ghost node If it is a ghost node...
bool is_unstructured() const
Is mesh of the pane unstructured?
Definition: Pane.h:103
bool position_allowed3D()
Determine in the current node number is a real node or a ghost node If it is a ghost node...
int dimension() const
Dimension of the pane.
Definition: Pane.h:99

Here is the call graph for this function:

const Pane* pane ( ) const
inline

Definition at line 62 of file Pane_node_accessors.h.

References _pane.

62 { return _pane; }
bool position_allowed2D ( )
protected

Determine in the current node number is a real node or a ghost node If it is a ghost node, return false.

Definition at line 86 of file Pane_node_accessors.C.

References _buffer, _node_num, ni, nj, and nk.

Referenced by next().

86  {
87  int indx = _node_num - 1;
88  if (((indx%(ni*nj))/ni) < _buffer) //too near top
89  return false;
90  else if ( indx%ni < _buffer ) //too far left
91  return false;
92  else if ( indx%ni > (ni-_buffer) ) //too far right
93  return false;
94  else if ( (indx%(ni*nj))/ni > (nk-_buffer) ) //too near bottom
95  return false;
96 
97  else return true;
98 }

Here is the caller graph for this function:

bool position_allowed3D ( )
protected

Determine in the current node number is a real node or a ghost node If it is a ghost node, return false.

Definition at line 67 of file Pane_node_accessors.C.

References _buffer, _node_num, ni, nj, and nk.

Referenced by next().

67  {
68  int indx = _node_num - 1;
69  if (indx < ni*nj*_buffer) //too low
70  return false;
71  else if (((indx%(ni*nj))/ni) < _buffer) //too near top
72  return false;
73  else if ( indx%ni < _buffer ) //too far left
74  return false;
75  else if ( indx%ni > (ni-_buffer) ) //too far right
76  return false;
77  else if ( (indx%(ni*nj))/ni > (nk-_buffer) ) //too near bottom
78  return false;
79  else if ( indx > ni*nj*(nk-_buffer) ) //too high
80  return false;
81  else return true;
82 }

Here is the caller graph for this function:

void set_first ( )
inlineprotected

Definition at line 75 of file Pane_node_accessors.h.

References _buffer, _node_num, ni, and nj.

Referenced by Pane_node_enumerator().

Here is the caller graph for this function:

Member Data Documentation

int _buffer
protected
const Connectivity* _conn
protected

Definition at line 66 of file Pane_node_accessors.h.

int _node_num
protected
const Pane* _pane
protected

Definition at line 65 of file Pane_node_accessors.h.

Referenced by dimension(), next(), pane(), and Pane_node_enumerator().

int _size_of_nodes
protected

Definition at line 74 of file Pane_node_accessors.h.

Referenced by next(), and Pane_node_enumerator().

int ni
protected
int nj
protected
int nk
protected

The documentation for this class was generated from the following files: