v0.16.3
Loading...
Searching...
No Matches
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
 
std::size_t getSizeOfData () const
 get data structure size
 
const void * getDataPtr () const
 get pointer to data structure
 
 Mat_Elastic ()
 
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 Mat_Elastic &e)
 Print Mat_Elastic data.
 

Detailed Description

Elastic material data structure.

Examples
cell_forces.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/cubit_bc_test.cpp, and mofem/users_modules/basic_finite_elements/src/impl/HookeElement.cpp.

Definition at line 139 of file MaterialBlocks.hpp.

Constructor & Destructor Documentation

◆ Mat_Elastic()

MoFEM::Mat_Elastic::Mat_Elastic ( )
inline

Definition at line 161 of file MaterialBlocks.hpp.

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

Member Function Documentation

◆ __attribute__()

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

block tag data structute

< Young's modulus

< Poisson's ratio

< Thermal expansion

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)
inlinevirtual

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 SETERRQ(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) %zu !< %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()
@ 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 ...
unsigned int minNumberOfAtributes
minimal number of attributes

◆ getDataPtr()

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

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
inlinevirtual

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
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 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 Symbol 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

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