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

Body force data structure. More...

#include <src/multi_indices/MaterialBlocks.hpp>

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

Public Member Functions

struct __attribute__ ((packed)) _data_
 body forces More...
 
std::size_t getSizeOfData () const
 get data structure size More...
 
const void * getDataPtr () const
 get pointer to data structure More...
 
 Block_BodyForces ()
 
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 Block_BodyForces &e)
 Print Mat_Elastic data. More...
 

Detailed Description

Body force data structure.

Definition at line 313 of file MaterialBlocks.hpp.

Constructor & Destructor Documentation

◆ Block_BodyForces()

MoFEM::Block_BodyForces::Block_BodyForces ( )
inline

Definition at line 334 of file MaterialBlocks.hpp.

Member Function Documentation

◆ __attribute__()

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

body forces

< material density

< acceleration X

< acceleration Y

< acceleration Z

Definition at line 318 of file MaterialBlocks.hpp.

318  {
319  double density; ///< material density
320  double acceleration_x; ///< acceleration X
321  double acceleration_y; ///< acceleration Y
322  double acceleration_z; ///< acceleration Z
323  double User4; // User attribute 4
324  double User5; // User attribute 5
325  double User6; // User attribute 6
326  double User7; // User attribute 7
327  double User8; // User attribute 8
328  };

◆ fill_data()

MoFEMErrorCode MoFEM::Block_BodyForces::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 336 of file MaterialBlocks.hpp.

336  {
338  if (attributes.size() < minNumberOfAtributes) {
339  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
340  "Material density and/or acceleration is not defined. (top tip: "
341  "check number of THERMAL block atributes)");
342  }
343  if (8 * attributes.size() > sizeof(data)) {
344  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
345  "data inconsistency, please review the number of material "
346  "properties defined");
347  }
348  bzero(&data, sizeof(data));
349  memcpy(&data, &attributes[0], 8 * attributes.size());
351  }

◆ getDataPtr()

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

get pointer to data structure

Returns
pointer

Implements MoFEM::GenericAttributeData.

Definition at line 332 of file MaterialBlocks.hpp.

332 { return &data; }

◆ getSizeOfData()

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

get data structure size

Returns
size of structure in bytes

Implements MoFEM::GenericAttributeData.

Definition at line 331 of file MaterialBlocks.hpp.

331 { return sizeof(data); }

◆ set_data()

MoFEMErrorCode MoFEM::Block_BodyForces::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 352 of file MaterialBlocks.hpp.

352  {
354  if (size > sizeof(data)) {
355  SETERRQ(PETSC_COMM_SELF, 1,
356  "data inconsistency, please review the number of material "
357  "properties defined");
358  }
359  memcpy(tag_ptr, &data, size);
361  }

Friends And Related Function Documentation

◆ operator<<

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

Print Mat_Elastic data.

Definition at line 87 of file MaterialBlocks.cpp.

87  {
88  os << std::endl << "Block Body Forces" << std::endl;
89  os << "-------------------" << std::endl;
90  os << "density = " << e.data.density << std::endl;
91  os << "acceleration_x = " << e.data.acceleration_x << std::endl;
92  os << "acceleration_y = " << e.data.acceleration_y << std::endl;
93  os << "acceleration_z = " << e.data.acceleration_z << std::endl;
94  os << "User attribute 4 = " << e.data.User4 << std::endl;
95  os << "User attribute 5 = " << e.data.User5 << std::endl;
96  os << "User attribute 6 = " << e.data.User6 << std::endl;
97  os << "User attribute 7 = " << e.data.User7 << std::endl;
98  os << "User attribute 8 = " << e.data.User8 << std::endl << std::endl;
99  return os;
100 }

Member Data Documentation

◆ data

_data_ MoFEM::Block_BodyForces::data

Definition at line 328 of file MaterialBlocks.hpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::GenericAttributeData::minNumberOfAtributes
unsigned int minNumberOfAtributes
minimal number of attributes
Definition: MaterialBlocks.hpp:52
BODYFORCESSET
@ BODYFORCESSET
block name is "BODY_FORCES"
Definition: definitions.h:175
MoFEM::GenericAttributeData::GenericAttributeData
GenericAttributeData(const CubitBCType type, const unsigned int min_number_of_atributes)
Definition: MaterialBlocks.hpp:74
MoFEM::Block_BodyForces::data
_data_ data
Definition: MaterialBlocks.hpp:328
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453