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

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

#include <Element_accessors.h>

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

Public Types

typedef unsigned int Size
 

Public Member Functions

 Element_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   _offset
 
   const Value *   _vs
 
}; 
 

Detailed Description

template<class Value>
class Element_vectors_k_const< Value >

This is a helper class for accessing elemental data.

Definition at line 318 of file Element_accessors.h.

Member Typedef Documentation

typedef unsigned int Size

Definition at line 320 of file Element_accessors.h.

Constructor & Destructor Documentation

Default constructor.

Definition at line 323 of file Element_accessors.h.

323 : _attr(NULL), _vs(NULL) {}

Member Function Documentation

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

Definition at line 350 of file Element_accessors.h.

References Element_vectors_k_const< Value >::_attr, Element_vectors_k_const< Value >::_offset, Element_vectors_k_const< Value >::_vs, COM_assertion, j, and Attribute::size_of_components().

Referenced by Element_vectors_k< Value >::operator()(), Element_vectors_k_const< Value >::operator[](), and Element_vectors_k< Value >::operator[]().

350  {
351  if ( _attr) {
353  const Attribute *aj = _attr+j+1;
354  return reinterpret_cast<const Value*>
355  (aj->pointer())[_offset*aj->stride()];
356  }
357  else
358  return _vs[j];
359  }
#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
j indices j
Definition: Indexing.h:6
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 361 of file Element_accessors.h.

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

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

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

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 363 of file Element_accessors.h.

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

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

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 326 of file Element_accessors.h.

References Element_vectors_k_const< Value >::_attr, Element_vectors_k_const< Value >::_vs, and Element_node_enumerator::id().

Referenced by Window_manifold_2::elements_to_nodes(), and Element_vectors_k< Value >::set().

326  {
327  _attr = NULL;
328  _vs = &p[(ene.id()-1)*strd];
329  }
int id() const
Get the local id of the element within the pane.

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 332 of file Element_accessors.h.

References Element_vectors_k_const< Value >::_attr, Element_vectors_k_const< Value >::_offset, Element_vectors_k_const< Value >::_vs, COM_assertion, COM_get_sizeof(), Attribute::data_type(), Pane::id(), Element_node_enumerator::id(), Attribute::is_elemental(), Attribute::pane(), Attribute::pointer(), Attribute::size_of_components(), and Attribute::stride().

332  {
333  COM_assertion( a->is_elemental() && a->pane()->id());
334  COM_assertion( sizeof(Value)==COM_get_sizeof( a->data_type(),1));
335 
336  int ncomp = a->size_of_components();
337  int strd = a->stride();
338  if ( ncomp<=strd) {
339  const Value *p = reinterpret_cast<const Value*>(a->pointer());
340  _attr = NULL;
341  _vs = &p[(ene.id()-1)*strd];
342  }
343  else {
344  _attr = a;
345  _offset = ene.id()-1;
346  }
347  }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
int id() const
Get the local id of the element within the pane.
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
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
const Pane * pane() const
Obtain a constant pointer to the owner pane of the attribute.
Definition: Attribute.h:172
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
bool is_elemental() const
Checks whether the attribute is associated with an element.
Definition: Attribute.h:192
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: