v0.8.23
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 const CubitBCTypegetType () const
 get data type More...
 
virtual unsigned int getMinMumberOfAtributes () const
 get minimal number of attributes which blockset has to have 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
cubit_bc_test.cpp, and HookeElement.cpp.

Definition at line 152 of file MaterialBlocks.hpp.

Constructor & Destructor Documentation

◆ Mat_Elastic()

MoFEM::Mat_Elastic::Mat_Elastic ( )

Definition at line 174 of file MaterialBlocks.hpp.

175  bzero(&data, sizeof(data));
176  };
GenericAttributeData(const CubitBCType type, const unsigned int min_number_of_atributes)
block name is "MAT_ELASTIC"
Definition: definitions.h:222

Member Function Documentation

◆ __attribute__()

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

block tag data structute

Definition at line 157 of file MaterialBlocks.hpp.

157  {
158  double Young; ///< Young's modulus
159  double Poisson; ///< Poisson's ratio
160  double ThermalExpansion; ///< Thermal expansion
161  double User1; // User attribute 2 // For some models is reserved for density
162  double User2; // User attribute 3
163  double User3; // User attribute 4
164  double User4; // User attribute 5
165  double User5; // User attribute 6
166  double User6; // User attribute 7
167  double User7; // User attribute 8
168  };

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

178  {
180  if (attributes.size() < minNumberOfAtributes) {
181  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
182  "Young modulus and/or Poisson ratio is not defined. (top tip: "
183  "check number of ELASTIC block attributes) %d !< %d",
184  attributes.size(), minNumberOfAtributes);
185  }
186  if (8 * attributes.size() > sizeof(data)) {
187  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
188  "data inconsistency, please review the number of material "
189  "properties defined");
190  }
191  bzero(&data, sizeof(data));
192  memcpy(&data, &attributes[0], 8 * attributes.size());
194  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
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 172 of file MaterialBlocks.hpp.

172 { 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 171 of file MaterialBlocks.hpp.

171 { 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 195 of file MaterialBlocks.hpp.

195  {
197  if (size > sizeof(data)) {
198  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
199  "data inconsistency, please review the number of material "
200  "properties defined");
201  }
202  memcpy(tag_ptr, &data, size);
204  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508

Friends And Related Function Documentation

◆ operator<<

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

Print Mat_Elastic data.

Definition at line 596 of file BCMultiIndices.cpp.

596  {
597  os << std::endl << "Material Properties" << std::endl;
598  os << "-------------------" << std::endl;
599  os << "Young's modulus = " << e.data.Young << std::endl;
600  os << "Poisson's ratio = " << e.data.Poisson << std::endl;
601  os << "Thermal expansion = " << e.data.ThermalExpansion << std::endl;
602  os << "User attribute 1 = " << e.data.User1 << std::endl;
603  os << "User attribute 2 = " << e.data.User2 << std::endl;
604  os << "User attribute 3 = " << e.data.User3 << std::endl;
605  os << "User attribute 4 = " << e.data.User4 << std::endl;
606  os << "User attribute 5 = " << e.data.User5 << std::endl;
607  os << "User attribute 6 = " << e.data.User6 << std::endl;
608  os << "User attribute 7 = " << e.data.User7 << std::endl << std::endl;
609  return os;
610 }

Member Data Documentation

◆ data

_data_ MoFEM::Mat_Elastic::data
Examples
HookeElement.cpp.

Definition at line 168 of file MaterialBlocks.hpp.


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