v0.13.1
Public Member Functions | Public Attributes | Friends | List of all members
MoFEM::Mat_Elastic Struct Reference

Elastic material data structure. More...

#include <src/multi_indices/MaterialBlocks.hpp>

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

Public Member Functions

struct __attribute__ ((packed)) _data_
 block tag data structute More...
 
std::size_t getSizeOfData () const
 get data structure size More...
 
const void * getDataPtr () const
 get pointer to data structure More...
 
 Mat_Elastic ()
 
MoFEMErrorCode fill_data (const std::vector< double > &attributes)
 get data from structure More...
 
MoFEMErrorCode set_data (void *tag_ptr, unsigned int size) const
 set data on structure More...
 
- Public Member Functions inherited from MoFEM::GenericAttributeData
virtual MoFEMErrorCode fill_data (const std::vector< double > &attributes)
 get data from structure More...
 
virtual MoFEMErrorCode set_data (void *tag_ptr, unsigned int size) const
 set data on structure More...
 
virtual const CubitBCTypegetType () const
 get data type More...
 
virtual unsigned int getMinMumberOfAtributes () const
 get minimal number of attributes which blockset has to have More...
 
virtual std::size_t getSizeOfData () const =0
 get data structure size More...
 
virtual const void * getDataPtr () const =0
 get pointer to data structure More...
 
 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) More...
 
unsigned int minNumberOfAtributes
 minimal number of attributes More...
 

Friends

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

Detailed Description

Elastic material data structure.

Examples
HookeElement.cpp, add_cubit_meshsets.cpp, and cubit_bc_test.cpp.

Definition at line 139 of file MaterialBlocks.hpp.

Constructor & Destructor Documentation

◆ Mat_Elastic()

MoFEM::Mat_Elastic::Mat_Elastic ( )

Definition at line 161 of file MaterialBlocks.hpp.

162 bzero(&data, sizeof(data));
163 };
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
Definition: definitions.h:159
GenericAttributeData(const CubitBCType type, const unsigned int min_number_of_atributes)

Member Function Documentation

◆ __attribute__()

struct MoFEM::Mat_Elastic::__attribute__ ( (packed)  )

block tag data structute

Definition at line 132 of file MaterialBlocks.hpp.

144 {
145 double Young; ///< Young's modulus
146 double Poisson; ///< Poisson's ratio
147 double ThermalExpansion; ///< Thermal expansion
148 double User1; // User attribute 2 // For some models is reserved for density
149 double User2; // User attribute 3
150 double User3; // User attribute 4
151 double User4; // User attribute 5
152 double User5; // User attribute 6
153 double User6; // User attribute 7
154 double User7; // User attribute 8
155 };

◆ fill_data()

MoFEMErrorCode MoFEM::Mat_Elastic::fill_data ( const std::vector< double > &  attributes)
virtual

get data from structure

Parameters
attributesvector of doubles
Returns
error code

Reimplemented from MoFEM::GenericAttributeData.

Definition at line 165 of file MaterialBlocks.hpp.

165 {
167 if (attributes.size() < minNumberOfAtributes) {
168 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
169 "Young modulus and/or Poisson ratio is not defined. (top tip: "
170 "check number of ELASTIC block attributes) %d !< %d",
171 attributes.size(), minNumberOfAtributes);
172 }
173 if (8 * attributes.size() > sizeof(data)) {
174 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
175 "data inconsistency, please review the number of material "
176 "properties defined");
177 }
178 bzero(&data, sizeof(data));
179 memcpy(&data, &attributes[0], 8 * attributes.size());
181 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ 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 ...
Definition: definitions.h:440
unsigned int minNumberOfAtributes
minimal number of attributes

◆ getDataPtr()

const void * MoFEM::Mat_Elastic::getDataPtr ( ) const
virtual

get pointer to data structure

Returns
pointer

Implements MoFEM::GenericAttributeData.

Definition at line 159 of file MaterialBlocks.hpp.

159{ return &data; }

◆ getSizeOfData()

std::size_t MoFEM::Mat_Elastic::getSizeOfData ( ) const
virtual

get data structure size

Returns
size of structure in bytes

Implements MoFEM::GenericAttributeData.

Definition at line 158 of file MaterialBlocks.hpp.

158{ return sizeof(data); };

◆ set_data()

MoFEMErrorCode MoFEM::Mat_Elastic::set_data ( void *  tag_ptr,
unsigned int  size 
) const
virtual

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 182 of file MaterialBlocks.hpp.

182 {
184 if (size > sizeof(data)) {
185 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
186 "data inconsistency, please review the number of material "
187 "properties defined");
188 }
189 memcpy(tag_ptr, &data, size);
191 }

Friends And Related Function Documentation

◆ operator<<

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

Print Mat_Elastic data.

Definition at line 24 of file MaterialBlocks.cpp.

24 {
25 os << std::endl << "Material Properties" << std::endl;
26 os << "-------------------" << std::endl;
27 os << "Young's modulus = " << e.data.Young << std::endl;
28 os << "Poisson's ratio = " << e.data.Poisson << std::endl;
29 os << "Thermal expansion = " << e.data.ThermalExpansion << std::endl;
30 os << "User attribute 1 = " << e.data.User1 << std::endl;
31 os << "User attribute 2 = " << e.data.User2 << std::endl;
32 os << "User attribute 3 = " << e.data.User3 << std::endl;
33 os << "User attribute 4 = " << e.data.User4 << std::endl;
34 os << "User attribute 5 = " << e.data.User5 << std::endl;
35 os << "User attribute 6 = " << e.data.User6 << std::endl;
36 os << "User attribute 7 = " << e.data.User7 << std::endl << std::endl;
37 return os;
38}

Member Data Documentation

◆ data

_data_ MoFEM::Mat_Elastic::data
Examples
HookeElement.cpp, and add_cubit_meshsets.cpp.

Definition at line 157 of file MaterialBlocks.hpp.


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