v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
MoFEM::BlockSetAttributes Struct Reference

Arbitrary block attributes data structure. More...

#include "src/multi_indices/MaterialBlocks.hpp"

Inheritance diagram for MoFEM::BlockSetAttributes:
[legend]
Collaboration diagram for MoFEM::BlockSetAttributes:
[legend]

Public Member Functions

struct __attribute__ ((packed)) _data_
 generic block attributes
 
std::size_t getSizeOfData () const
 get data structure size
 
const void * getDataPtr () const
 get pointer to data structure
 
 BlockSetAttributes ()
 
MoFEMErrorCode fill_data (const std::vector< double > &attributes)
 get data from structure
 
MoFEMErrorCode set_data (void *tag_ptr, unsigned int size) const
 set data on structure
 
- Public Member Functions inherited from MoFEM::GenericAttributeData
virtual const CubitBCType & getType () const
 get data type
 
virtual unsigned int getMinMumberOfAtributes () const
 get minimal number of attributes which blockset has to have
 
 GenericAttributeData (const CubitBCType type, const unsigned int min_number_of_atributes)
 

Public Attributes

_data_ data
 
- Public Attributes inherited from MoFEM::GenericAttributeData
const CubitBCType tYpe
 Type of data (f.e. MAT_ELATIC)
 
unsigned int minNumberOfAtributes
 minimal number of attributes
 

Friends

std::ostream & operator<< (std::ostream &os, const BlockSetAttributes &e)
 Print data.
 

Detailed Description

Arbitrary block attributes data structure.

Examples
mofem/atom_tests/mesh_insert_interface_atom.cpp.

Definition at line 81 of file MaterialBlocks.hpp.

Constructor & Destructor Documentation

◆ BlockSetAttributes()

MoFEM::BlockSetAttributes::BlockSetAttributes ( )
inline

Definition at line 104 of file MaterialBlocks.hpp.

105 bzero(&data, sizeof(data));
106 }
@ BLOCKSET
GenericAttributeData(const CubitBCType type, const unsigned int min_number_of_atributes)

Member Function Documentation

◆ __attribute__()

struct MoFEM::BlockSetAttributes::__attribute__ ( (packed)  )
inline

generic block attributes

Definition at line 74 of file MaterialBlocks.hpp.

86 {
87 double User1; // User attribute 1
88 double User2; // User attribute 2
89 double User3; // User attribute 3
90 double User4; // User attribute 4
91 double User5; // User attribute 5
92 double User6; // User attribute 6
93 double User7; // User attribute 7
94 double User8; // User attribute 8
95 double User9; // User attribute 9
96 double User10; // User attribute 10
97 };

◆ fill_data()

MoFEMErrorCode MoFEM::BlockSetAttributes::fill_data ( const std::vector< double > &  attributes)
inlinevirtual

get data from structure

Parameters
attributesvector of doubles
Returns
error code

Reimplemented from MoFEM::GenericAttributeData.

Definition at line 108 of file MaterialBlocks.hpp.

108 {
110 if (8 * attributes.size() > sizeof(data)) {
111 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
112 "data inconsistency, please review the number of material "
113 "properties defined");
114 }
115 bzero(&data, sizeof(data));
116 memcpy(&data, &attributes[0], 8 * attributes.size());
118 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

◆ getDataPtr()

const void * MoFEM::BlockSetAttributes::getDataPtr ( ) const
inlinevirtual

get pointer to data structure

Returns
pointer

Implements MoFEM::GenericAttributeData.

Definition at line 102 of file MaterialBlocks.hpp.

102{ return &data; }

◆ getSizeOfData()

std::size_t MoFEM::BlockSetAttributes::getSizeOfData ( ) const
inlinevirtual

get data structure size

Returns
size of structure in bytes

Implements MoFEM::GenericAttributeData.

Definition at line 101 of file MaterialBlocks.hpp.

101{ return sizeof(_data_); }

◆ set_data()

MoFEMErrorCode MoFEM::BlockSetAttributes::set_data ( void *  tag_ptr,
unsigned int  size 
) const
inlinevirtual

set data on structure

Parameters
tag_ptrpointer to tag on meshset
sizesize of data in bytes
Returns
error code

Reimplemented from MoFEM::GenericAttributeData.

Definition at line 119 of file MaterialBlocks.hpp.

119 {
121 if (size > sizeof(data)) {
122 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
123 "data inconsistency, please review the number of material "
124 "properties defined");
125 }
126 memcpy(tag_ptr, &data, size);
128 }

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const BlockSetAttributes &  e 
)
friend

Print data.

Definition at line 8 of file MaterialBlocks.cpp.

8 {
9 os << std::endl << "Blcok attributes" << std::endl;
10 os << "-------------------" << std::endl;
11 os << "User attribute 1 = " << e.data.User1 << std::endl;
12 os << "User attribute 2 = " << e.data.User2 << std::endl;
13 os << "User attribute 3 = " << e.data.User3 << std::endl;
14 os << "User attribute 4 = " << e.data.User4 << std::endl;
15 os << "User attribute 5 = " << e.data.User5 << std::endl;
16 os << "User attribute 6 = " << e.data.User6 << std::endl;
17 os << "User attribute 7 = " << e.data.User7 << std::endl;
18 os << "User attribute 8 = " << e.data.User7 << std::endl;
19 os << "User attribute 9 = " << e.data.User7 << std::endl;
20 os << "User attribute 10 = " << e.data.User10 << std::endl << std::endl;
21 return os;
22}

Member Data Documentation

◆ data

_data_ MoFEM::BlockSetAttributes::data

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