Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Element_node_vectors_k_const< Value > Class Template Reference

This is a helper class for accessing nodal data. More...

#include <Element_accessors.h>

Inheritance diagram for Element_node_vectors_k_const< Value >:
Collaboration diagram for Element_node_vectors_k_const< Value >:

Public Types

enum  { MAX_NODES =9 }
 
typedef unsigned int Size
 

Public Member Functions

 Element_node_vectors_k_const ()
 Default constructor. More...
 
void set (const Value *p, Element_node_enumerator &ene, int strd)
 initialize the accessor with a pointer and a specific stride. More...
 
void set (const Attribute *a, Element_node_enumerator &ene)
 initialize the accessor from an attribute assiciated with a pane. More...
 
const Value & operator() (int i, int j) const
 
const Value & operator() (int i) const
 
const Value & operator[] (int i) const
 

Protected Attributes

const Attribute_attr
 
union {
   int   _offsets [MAX_NODES]
 
   const Value *   _vs [MAX_NODES]
 
}; 
 

Detailed Description

template<class Value>
class Element_node_vectors_k_const< Value >

This is a helper class for accessing nodal data.

Definition at line 234 of file Element_accessors.h.

Member Typedef Documentation

typedef unsigned int Size

Definition at line 237 of file Element_accessors.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MAX_NODES 

Definition at line 236 of file Element_accessors.h.

Constructor & Destructor Documentation

Default constructor.

Definition at line 240 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::_vs.

240  : _attr(NULL)
241  { std::fill_n( _vs, 9, reinterpret_cast<Value*>(NULL)); }
const Value * _vs[MAX_NODES]

Member Function Documentation

const Value& operator() ( int  i,
int  j 
) const
inline

Definition at line 271 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::_attr, Element_node_vectors_k_const< Value >::_offsets, Element_node_vectors_k_const< Value >::_vs, COM_assertion, i, j, and Attribute::size_of_components().

Referenced by Element_node_vectors_k< Value >::operator()(), Element_node_vectors_k_const< Value >::operator[](), and Element_node_vectors_k< Value >::operator[]().

271  {
272  if ( _attr) {
274  const Attribute *aj = _attr+j+1;
275  return reinterpret_cast<const Value*>
276  (aj->pointer())[_offsets[i]*aj->stride()];
277  }
278  else
279  return _vs[i][j];
280  }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
An Attribute object is a data member of a window.
Definition: Attribute.h:51
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
const Value * _vs[MAX_NODES]
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

const Value& operator() ( int  i) const
inline

Definition at line 282 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::operator()().

Referenced by Element_node_vectors_k_const< Value >::operator()().

282 { return operator()(i,0); }
blockLoc i
Definition: read.cpp:79
const Value & operator()(int i, int j) const

Here is the call graph for this function:

Here is the caller graph for this function:

const Value& operator[] ( int  i) const
inline

Definition at line 284 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::operator()().

284 { return operator()(i,0); }
blockLoc i
Definition: read.cpp:79
const Value & operator()(int i, int j) const

Here is the call graph for this function:

void set ( const Value *  p,
Element_node_enumerator ene,
int  strd 
)
inline

initialize the accessor with a pointer and a specific stride.

Definition at line 244 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::_attr, Element_node_vectors_k_const< Value >::_vs, COM_assertion, i, Element_node_vectors_k_const< Value >::MAX_NODES, and Element_node_enumerator::size_of_nodes().

Referenced by Rocsurf::compute_bounded_volumes(), Rocsurf::compute_element_areas(), Rocsurf::compute_element_normals(), Rocsurf::compute_signed_volumes(), Rocsurf::compute_swept_volumes(), Window_manifold_2::elements_to_nodes(), Rocmop::evaluate_face_normals(), get_normal(), Rocsurf::integrate(), FaceOffset_3::obtain_face_offset(), Rocmop::redistribute_vertices_smooth(), Element_node_vectors_k< Value >::set(), and turb_flowlmmetric().

244  {
246  _attr = NULL;
247  for ( int i=ene.size_of_nodes()-1; i>=0; --i)
248  _vs[i] = &p[(ene[i]-1)*strd];
249  }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
blockLoc i
Definition: read.cpp:79
int size_of_nodes() const
Number of nodes per element.
const Value * _vs[MAX_NODES]

Here is the call graph for this function:

Here is the caller graph for this function:

void set ( const Attribute a,
Element_node_enumerator ene 
)
inline

initialize the accessor from an attribute assiciated with a pane.

Definition at line 252 of file Element_accessors.h.

References Element_node_vectors_k_const< Value >::_attr, Element_node_vectors_k_const< Value >::_offsets, Element_node_vectors_k_const< Value >::_vs, COM_assertion, COM_get_sizeof(), Attribute::data_type(), i, Pane::id(), Attribute::is_nodal(), Attribute::pane(), Attribute::pointer(), Attribute::size_of_components(), Element_node_enumerator::size_of_nodes(), and Attribute::stride().

252  {
253  COM_assertion( a->is_nodal() && a->pane()->id());
254  COM_assertion( sizeof(Value)==COM_get_sizeof( a->data_type(),1));
255 
256  int ncomp = a->size_of_components();
257  int strd = a->stride();
258  int nn = ene.size_of_nodes();
259  if ( ncomp<=strd) {
260  const Value *p = reinterpret_cast<const Value*>(a->pointer());
261  _attr = NULL;
262  for ( int i=0; i<nn; ++i) _vs[i] = &p[(ene[i]-1)*strd];
263  }
264  else {
265  _attr = a;
266  for ( int i=0; i<nn; ++i) _offsets[i] = ene[i]-1;
267  }
268  }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
blockLoc i
Definition: read.cpp:79
int size_of_nodes() const
Number of nodes per element.
int COM_get_sizeof(const COM_Type type, int c)
Definition: roccom_c++.h:560
int stride() const
Obtain the stride of the attribute in base datatype.
Definition: Attribute.h:233
bool is_nodal() const
Checks whether the attribute is associated with a node.
Definition: Attribute.h:194
const Pane * pane() const
Obtain a constant pointer to the owner pane of the attribute.
Definition: Attribute.h:172
const Value * _vs[MAX_NODES]
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Get the ID of the pane.
Definition: Pane.h:96
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Member Data Documentation

union { ... }

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