31 #ifndef __ROCCOM_ATTRIBUTE_H__
32 #define __ROCCOM_ATTRIBUTE_H__
85 const std::string &
unit)
98 const std::string &
name,
int id);
112 const std::string &
name()
const {
return _name; }
164 return (
void*)(((
const Attribute*)
this)->get_addr(i,
j));
264 static bool is_digit(
char c) {
return c>=
'0' && c<=
'9'; }
274 void *
allocate(
int strd,
int cap,
bool force) throw(COM_exception);
283 void copy_array(
void *buf,
int strd,
int nitem,
287 void append_array( const
void *from,
int strd,
int nitem) throw(COM_exception);
295 void inherit(
Attribute *a,
bool clone,
bool withghost,
int depth=0) throw(COM_exception);
void inherit(Attribute *a, bool clone, bool withghost, int depth=0)
Inherit from parent. If depth>0, then the procedure is for the subcomponents.
Attribute * _parent
Parent attribute being used.
int COM_Type
Indices for derived data types.
int _ngitems
Size of ghost items.
A Pane object contains a mesh, pane attribute, and field variables.
bool size_set() const
Returns whether the size for the attribute has been set.
bool initialized() const
Returns whether the array for the attribute has been set or allocated.
int _nbytes_strd
Number of bytes of the stride.
int maxsize_of_real_items() const
Obtain the maximum allowed number of real items in the attribute.
void set_pointer(void *p, int strd, int cap, int offset, bool is_const)
Set the physical address of the attribute values.
An Attribute object is a data member of a window.
static bool compatible_types(COM_Type t1, COM_Type t2)
static bool is_digit(char c)
Shorter_size _status
Indicating whether it has been initialized.
const void * get_addr(int i, int j=0) const
Obtain the address of the jth component of the ith item, where 0<=i<size_of_items.
bool is_windowed() const
Checks whether the attribute is associated with the window.
A Window object contains multiple panes and multiple data attributes.
static const int _keysizes[COM_NUM_KEYWORDS]
Default sizes.
int status() const
Obtain the status of the attribute.
Pane * pane()
Obtain a modifiable pointer to the owner pane of the attribute.
Attribute * parent()
Parent attribute used by this object.
real *8 function offset(vNorm, x2, y2, z2)
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
int maxsize_of_items() const
Obtain the maximum allowed number of items in the attribute.
Shorter_size location() const
Obtain the location of the attribute.
Encapsulates the states of an exception.
int deallocate()
Deallocate memory if it was allocated by allocate().
const std::string & unit() const
Obtain the unit of the attribute.
static const COM_Type _keytypes[COM_NUM_KEYWORDS]
Default data types.
int capacity() const
Obtain the capacity of the array.
Attribute * root()
Root of use-inheritance.
unsigned int Size
Unsighed int.
const void * pointer() const
Obtain a constant pointer to the physical address.
int stride_in_bytes() const
Obtain the stride of the attribute in bytes.
Attribute()
Default constructor.
std::string _unit
Unit of the attribute.
int size_of_ghost_items() const
Obtain the number of ghost items in the attribute.
Pane * _pane
Pointer to its owner pane.
void * _ptr
Physical address of the attribute.
Shorter_size _loc
Location.
const std::string & name() const
Obtain the name of the attribute.
int _gap
Gap between the IDs of real and ghost items.
std::string _name
Name of the attribute.
bool allocated() const
Returns whether the array for the attribute has been set or allocated.
Attribute(Pane *pane, int i)
Constructor for keywords. The default nitems for keywords is 0.
int stride() const
Obtain the stride of the attribute in base datatype.
bool is_nodal() const
Checks whether the attribute is associated with a node.
int maxsize_of_ghost_items() const
Obtain the maximum allowed number of items in the attribute.
void set_size(int nitems, int ngitems=0)
Set the size of items and ghost items.
int size_of_real_items() const
Obtain the number of real items in the attribute.
void * pointer()
Obtain a modifiable pointer to the physical address.
const Pane * pane() const
Obtain a constant pointer to the owner pane of the attribute.
const Attribute * parent() const
bool is_staggered() const
Check how the attribute values are organized.
COM_Type _type
Base data type of the attribute.
int _ncomp
Number of components.
void * allocate(int strd, int cap, bool force)
Allocate memory for the attribute.
bool is_panel() const
Checks whether the attribute is associated with a pane.
Attribute(Pane *pane, const std::string &name, int id, Shorter_size loc, int type, const int ncomp, const std::string &unit)
Create an attribute with name n in window w.
int _nitems
Size of total items. Default value is -1.
void copy_array(void *buf, int strd, int nitem, int offset=0, int direction=COPY_IN)
Attribute & operator=(const Attribute &)
static const char _keylocs[COM_NUM_KEYWORDS]
Default locations.
unsigned char Shorter_size
One byte unsighed int.
COM_Type data_type() const
Obtain the data type of each component of the attribute.
int id() const
Obtain the id (or index) of the attribute.
static const char * _keywords[COM_NUM_KEYWORDS]
List of keywords.
bool empty() const
Check whether the number of items of the attribute is zero.
bool is_const() const
Returns whether the array is set to be read-only.
bool is_elemental() const
Checks whether the attribute is associated with an element.
int size_of_items() const
Obtain the number of items in the attribute.
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
static int get_sizeof(COM_Type type, int count=1)
const Attribute * root() const
int size_of_components() const
Obtain the number of components in the attribute.
void append_array(const void *from, int strd, int nitem)