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

this struct keeps basic methods for moab meshset about material and boundary conditions More...

#include <src/multi_indices/BCMultiIndices.hpp>

Collaboration diagram for MoFEM::CubitMeshSets:
[legend]

Public Member Functions

 CubitMeshSets (Interface &moab, const EntityHandle _meshset)
 
 CubitMeshSets (Interface &moab, const CubitBCType _cubit_bc_type, const int _msId)
 
int getMeshsetId () const
 get meshset id as it set in preprocessing software More...
 
CubitBCType getBcType () const
 get type of meshset More...
 
EntityHandle getMeshset () const
 get bc meshset More...
 
unsigned long int getBcTypeULong () const
 get bc meshset type More...
 
unsigned long int getMaksedBcTypeULong () const
 get meshset type and mask More...
 
PetscErrorCode getMeshsetIdEntitiesByDimension (Interface &moab, const int dimension, Range &entities, const bool recursive=false) const
 get entities form meshset More...
 
PetscErrorCode getMeshsetIdEntitiesByDimension (Interface &moab, Range &entities, const bool recursive=false) const
 get entities form meshset More...
 
PetscErrorCode getMeshsetIdEntitiesByType (Interface &moab, const EntityType type, Range &entities, const bool recursive=false) const
 get entities by type More...
 
PetscErrorCode getTypeFromBcData (const std::vector< char > &bc_data, CubitBCType &type) const
 Function that returns the CubitBCType type of the contents of bc_data. More...
 
PetscErrorCode getTypeFromBcData (CubitBCType &type) const
 Function that returns the CubitBCType type of the contents of bc_data. More...
 
PetscErrorCode getBcData (std::vector< char > &bc_data) const
 get bc_data vector from MoFEM database More...
 
PetscErrorCode getBlockHeaderData (std::vector< unsigned int > &material_data) const
 get block_headers vector from MoFEM database More...
 
PetscErrorCode printBlockHeaderData (std::ostream &os) const
 print material_data int stream given by os More...
 
PetscErrorCode printBcData (std::ostream &os) const
 print bc_data int stream given by os More...
 
PetscErrorCode getTypeFromName (const std::string &name, CubitBCType &type) const
 Function that returns the CubitBCType type of the block name, sideset name etc. More...
 
PetscErrorCode getTypeFromName (CubitBCType &type) const
 Function that returns the CubitBCType type of the block name, sideset name etc. More...
 
PetscErrorCode getAttributes (std::vector< double > &attributes) const
 get Cubit block attributes More...
 
PetscErrorCode setAttributes (moab::Interface &moab, const std::vector< double > &attributes)
 cet Cubit block attributes More...
 
PetscErrorCode printAttributes (std::ostream &os) const
 print the attributes vector More...
 
std::string getName () const
 get name of block, sideset etc. (this is set in Cubit block properties) More...
 
PetscErrorCode printName (std::ostream &os) const
 print name of block, sideset etc. (this is set in Cubit setting properties) More...
 
template<class ATTRIBUTE_TYPE >
PetscErrorCode getAttributeDataStructure (ATTRIBUTE_TYPE &data) const
 fill data structure with data saved on meshset More...
 
template<class ATTRIBUTE_TYPE >
PetscErrorCode setAttributeDataStructure (const ATTRIBUTE_TYPE &data)
 fill meshset data with data on structure More...
 
template<class CUBIT_BC_DATA_TYPE >
PetscErrorCode getBcDataStructure (CUBIT_BC_DATA_TYPE &data) const
 
template<class CUBIT_BC_DATA_TYPE >
PetscErrorCode setBcDataStructure (CUBIT_BC_DATA_TYPE &data)
 
PetscErrorCode getTagsHanlders (Interface &moab)
 

Public Attributes

EntityHandle meshset
 
CubitBCType cubitBcType
 type of meshset from cubit NodeSet, BlockSet, SideSet and more More...
 
std::vector< Tag > tag_handles
 vector of tag handles to types of data passed from cubit More...
 
intmsId
 cubit meshset ID More...
 
char * tag_bc_data
 
int tag_bc_size
 
unsigned inttag_block_header_data
 
doubletag_block_attributes
 
int tag_block_attributes_size
 
char * tagName
 
const CubitBCType meshsets_mask
 
Tag nsTag
 
Tag ssTag
 
Tag nsTag_data
 
Tag ssTag_data
 
Tag bhTag
 
Tag bhTag_header
 
Tag thBlockAttribs
 
Tag entityNameTag
 

Friends

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

Detailed Description

this struct keeps basic methods for moab meshset about material and boundary conditions

Definition at line 28 of file BCMultiIndices.hpp.

Constructor & Destructor Documentation

◆ CubitMeshSets() [1/2]

MoFEM::CubitMeshSets::CubitMeshSets ( Interface moab,
const EntityHandle  _meshset 
)

Definition at line 50 of file BCMultiIndices.cpp.

50  :
51  meshset(_meshset),
53  msId(NULL),
54  tag_bc_data(NULL),
55  tag_bc_size(0),
59  tagName(NULL),
61 
62  ierr = getTagsHanlders(moab); CHKERRABORT(PETSC_COMM_WORLD,ierr);
63  ErrorCode rval;
64  rval = moab.tag_get_tags_on_entity(meshset,tag_handles); MOAB_THROW(rval);
65  std::vector<Tag>::iterator tit = tag_handles.begin();
66  for(;tit!=tag_handles.end();tit++) {
67  if(
68  *tit == nsTag ||
69  *tit == ssTag ||
70  *tit == bhTag) {
71  rval = moab.tag_get_by_ptr(*tit,&meshset,1,(const void **)&msId); MOAB_THROW(rval);
72  }
73  if(*tit == nsTag) {
74  if(*msId != -1) {
76  }
77  }
78  if(*tit == ssTag) {
79  if(*msId != -1) {
81  }
82  }
83  if(*tit == bhTag) {
84  if(*msId != -1) {
86  }
87  }
88  if((*tit == nsTag_data)||(*tit == ssTag_data)) {
89  rval = moab.tag_get_by_ptr(
90  *tit,&meshset,1,(const void **)&tag_bc_data,&tag_bc_size
91  ); MOAB_THROW(rval);
92 
93  ierr = getTypeFromBcData(cubitBcType); if(ierr>0) THROW_MESSAGE("unrecognized bc_data type");
94  }
95  if(*tit == bhTag_header) {
96  int tag_length;
97  rval = moab.tag_get_length(*tit,tag_length);
98  rval = moab.tag_get_by_ptr(
99  *tit,&meshset,1,(const void **)&tag_block_header_data
100  ); MOAB_THROW(rval);
101  if(tag_block_header_data[1]>0) cubitBcType |= MATERIALSET;
102  }
103  if(*tit == thBlockAttribs) {
104  rval = moab.tag_get_by_ptr(
106  ); MOAB_THROW(rval);
107  }
108  if(*tit == entityNameTag) {
109  rval = moab.tag_get_by_ptr(entityNameTag,&meshset,1,(const void **)&tagName); MOAB_THROW(rval);
110 
111  ierr = getTypeFromName(cubitBcType); if(ierr>0) THROW_MESSAGE("unrecognized Cubit name type");
112  }
113  }
114 
115  //If BC set has name, unset UNKNOWNNAME
116  if(
117  cubitBcType.to_ulong() & (
119  FORCESET|
120  PRESSURESET|
121  VELOCITYSET|
124  HEATFLUXSET|
126  )
127  ) {
128  if( (cubitBcType & CubitBCType(UNKNOWNNAME)).any() ) {
130  }
131  }
132 
133 }
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
const CubitBCType meshsets_mask
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:389
#define MOAB_THROW(a)
Definition: definitions.h:376
std::vector< Tag > tag_handles
vector of tag handles to types of data passed from cubit
std::bitset< 32 > CubitBCType
Definition: Common.hpp:125
PetscErrorCode getTypeFromName(const std::string &name, CubitBCType &type) const
Function that returns the CubitBCType type of the block name, sideset name etc.
PetscErrorCode getTagsHanlders(Interface &moab)
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more
unsigned int * tag_block_header_data
int * msId
cubit meshset ID
PetscErrorCode getTypeFromBcData(const std::vector< char > &bc_data, CubitBCType &type) const
Function that returns the CubitBCType type of the contents of bc_data.

◆ CubitMeshSets() [2/2]

MoFEM::CubitMeshSets::CubitMeshSets ( Interface moab,
const CubitBCType  _cubit_bc_type,
const int  _msId 
)

Definition at line 134 of file BCMultiIndices.cpp.

134  :
135 cubitBcType(_cubit_bc_type),msId(NULL),
136 tag_bc_data(NULL),
137 tag_bc_size(0),
141 tagName(NULL),
143 
144  ierr = getTagsHanlders(moab); CHKERRABORT(PETSC_COMM_WORLD,ierr);
145  ErrorCode rval;
146  rval = moab.create_meshset(MESHSET_SET|MESHSET_TRACK_OWNER,meshset); MOAB_THROW(rval);
147  switch(cubitBcType.to_ulong()) {
148  case NODESET:
149  rval = moab.tag_set_data(nsTag,&meshset,1,&_ms_id); MOAB_THROW(rval);
150  rval = moab.tag_get_by_ptr(nsTag,&meshset,1,(const void **)&msId); MOAB_THROW(rval);
151  break;
152  case SIDESET:
153  rval = moab.tag_set_data(ssTag,&meshset,1,&_ms_id); MOAB_THROW(rval);
154  rval = moab.tag_get_by_ptr(ssTag,&meshset,1,(const void **)&msId); MOAB_THROW(rval);
155  break;
156  case BLOCKSET:
157  rval = moab.tag_set_data(bhTag,&meshset,1,&_ms_id); MOAB_THROW(rval);
158  rval = moab.tag_get_by_ptr(bhTag,&meshset,1,(const void **)&msId); MOAB_THROW(rval);
159  break;
160  default:
161  {
162  PetscTraceBackErrorHandler(
163  PETSC_COMM_WORLD,
164  __LINE__,PETSC_FUNCTION_NAME,__FILE__,
165  MOFEM_DATA_INCONSISTENCY,PETSC_ERROR_INITIAL,"data inconstancy",PETSC_NULL
166  );
167  PetscMPIAbortErrorHandler(PETSC_COMM_WORLD,
168  __LINE__,PETSC_FUNCTION_NAME,__FILE__,
169  MOFEM_DATA_INCONSISTENCY,PETSC_ERROR_INITIAL,"data inconstancy",PETSC_NULL
170  );
171  }
172  }
173 }
static PetscErrorCode ierr
Definition: Common.hpp:26
static MoABErrorCode rval
Definition: Common.hpp:25
const CubitBCType meshsets_mask
#define MOAB_THROW(a)
Definition: definitions.h:376
PetscErrorCode getTagsHanlders(Interface &moab)
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more
unsigned int * tag_block_header_data
int * msId
cubit meshset ID

Member Function Documentation

◆ getAttributeDataStructure()

template<class ATTRIBUTE_TYPE >
PetscErrorCode MoFEM::CubitMeshSets::getAttributeDataStructure ( ATTRIBUTE_TYPE &  data) const

fill data structure with data saved on meshset

Definition at line 280 of file BCMultiIndices.hpp.

280  {
281  PetscFunctionBegin;
282 
283  if((cubitBcType&data.getType()).none()) {
284  SETERRQ(
285  PETSC_COMM_SELF,
287  "attributes are not for ATTRIBUTE_TYPE structure"
288  );
289  }
290  std::vector<double> attributes;
291  ierr = getAttributes(attributes); CHKERRQ(ierr);
292  ierr = data.fill_data(attributes); CHKERRQ(ierr);
293  PetscFunctionReturn(0);
294  }
PetscErrorCode getAttributes(std::vector< double > &attributes) const
get Cubit block attributes
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ getAttributes()

PetscErrorCode MoFEM::CubitMeshSets::getAttributes ( std::vector< double > &  attributes) const

get Cubit block attributes

Parameters
attributesis the vector where the block attribute data will be stored

Definition at line 315 of file BCMultiIndices.cpp.

315  {
316  PetscFunctionBegin;
317  attributes.resize(tag_block_attributes_size);
320  }
321  PetscFunctionReturn(0);
322 }

◆ getBcData()

PetscErrorCode MoFEM::CubitMeshSets::getBcData ( std::vector< char > &  bc_data) const

get bc_data vector from MoFEM database

Parameters
bc_datais the in/out vector were bc_data will be stored

Definition at line 215 of file BCMultiIndices.cpp.

215  {
216  PetscFunctionBegin;
217  bc_data.resize(tag_bc_size);
218  copy(&tag_bc_data[0],&tag_bc_data[tag_bc_size],bc_data.begin());
219  PetscFunctionReturn(0);
220 }

◆ getBcDataStructure()

template<class CUBIT_BC_DATA_TYPE >
PetscErrorCode MoFEM::CubitMeshSets::getBcDataStructure ( CUBIT_BC_DATA_TYPE &  data) const

Definition at line 319 of file BCMultiIndices.hpp.

319  {
320  PetscFunctionBegin;
321 
322  if((cubitBcType&data.tYpe).none()) {
323  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"bc_data are not for CUBIT_BC_DATA_TYPE structure");
324  }
325  std::vector<char> bc_data;
326  getBcData(bc_data);
327  ierr = data.fill_data(bc_data); CHKERRQ(ierr);
328  PetscFunctionReturn(0);
329  }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
PetscErrorCode getBcData(std::vector< char > &bc_data) const
get bc_data vector from MoFEM database
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ getBcType()

CubitBCType MoFEM::CubitMeshSets::getBcType ( ) const

get type of meshset

Deprecated:
use getMeshsetId() instead

See CubitBC for set of types of meshsets.

Returns
meshset type

Definition at line 62 of file BCMultiIndices.hpp.

62 { return cubitBcType; }
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ getBcTypeULong()

unsigned long int MoFEM::CubitMeshSets::getBcTypeULong ( ) const

get bc meshset type

Deprecated:
Use getMeshset() instead
Returns
return type as unsigned integer

Definition at line 79 of file BCMultiIndices.hpp.

79  {
80  return cubitBcType.to_ulong();
81  }
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ getBlockHeaderData()

PetscErrorCode MoFEM::CubitMeshSets::getBlockHeaderData ( std::vector< unsigned int > &  material_data) const

get block_headers vector from MoFEM database

Parameters
material_datais the in/out vector were the material data will be stored

Definition at line 222 of file BCMultiIndices.cpp.

222  {
223  PetscFunctionBegin;
224  material_data.resize(3);
225  copy(&tag_block_header_data[0],&tag_block_header_data[3],material_data.begin());
226  PetscFunctionReturn(0);
227 }
unsigned int * tag_block_header_data

◆ getMaksedBcTypeULong()

unsigned long int MoFEM::CubitMeshSets::getMaksedBcTypeULong ( ) const

get meshset type and mask

Returns
type is returned as unsigned integer

Definition at line 87 of file BCMultiIndices.hpp.

87  {
88  return (cubitBcType&meshsets_mask).to_ulong();
89  }
const CubitBCType meshsets_mask
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ getMeshset()

EntityHandle MoFEM::CubitMeshSets::getMeshset ( ) const

get bc meshset

Returns
meshset entity handle

Definition at line 68 of file BCMultiIndices.hpp.

68 { return meshset; }

◆ getMeshsetId()

int MoFEM::CubitMeshSets::getMeshsetId ( ) const

get meshset id as it set in preprocessing software

Returns
id of meshset

Definition at line 49 of file BCMultiIndices.hpp.

49 { return *msId; }
int * msId
cubit meshset ID

◆ getMeshsetIdEntitiesByDimension() [1/2]

PetscErrorCode MoFEM::CubitMeshSets::getMeshsetIdEntitiesByDimension ( Interface moab,
const int  dimension,
Range &  entities,
const bool  recursive = false 
) const

get entities form meshset

Parameters
moabmoab instance
dimensiondimension of entities
entitiesrange of returned entities
recursivetrue if meshset should be searched recursively
Returns
error code

Definition at line 174 of file BCMultiIndices.cpp.

174  {
175  PetscFunctionBegin;
176  ErrorCode rval;
177  //rval = moab.list_entity(meshset); CHKERRQ_MOAB(rval);
178  rval = moab.get_entities_by_dimension(meshset,dimension,entities,recursive);
179  if(rval != MB_SUCCESS) {
180  std::ostringstream ss;
181  ss << "bc set " << *this << std::endl;
182  PetscPrintf(PETSC_COMM_WORLD,ss.str().c_str());
183  }
184  CHKERRQ_MOAB(rval);
185  PetscFunctionReturn(0);
186 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25

◆ getMeshsetIdEntitiesByDimension() [2/2]

PetscErrorCode MoFEM::CubitMeshSets::getMeshsetIdEntitiesByDimension ( Interface moab,
Range &  entities,
const bool  recursive = false 
) const

get entities form meshset

Deprecated:
Use getMeshsetIdEntitiesByDimension() instead

Use if meshset have predefined dimension

Parameters
moabmoab instance
entitiesrange of returned entities
recursivetrue if meshset should be searched recursively
Returns
error code

Definition at line 187 of file BCMultiIndices.cpp.

187  {
188  PetscFunctionBegin;
189  if((cubitBcType&CubitBCType(BLOCKSET)).any()) {
190  if(tag_block_header_data!=NULL) {
191  return getMeshsetIdEntitiesByDimension(moab,tag_block_header_data[2],entities,recursive);
192  } else {
193  SETERRQ(PETSC_COMM_SELF,1,"dimension unknown");
194  }
195  }
196  if((cubitBcType&CubitBCType(NODESET)).any()) {
197  return getMeshsetIdEntitiesByDimension(moab,0,entities,recursive);
198  }
199  PetscFunctionReturn(0);
200 }
PetscErrorCode getMeshsetIdEntitiesByDimension(Interface &moab, const int dimension, Range &entities, const bool recursive=false) const
get entities form meshset
std::bitset< 32 > CubitBCType
Definition: Common.hpp:125
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more
unsigned int * tag_block_header_data

◆ getMeshsetIdEntitiesByType()

PetscErrorCode MoFEM::CubitMeshSets::getMeshsetIdEntitiesByType ( Interface moab,
const EntityType  type,
Range &  entities,
const bool  recursive = false 
) const

get entities by type

Deprecated:
Use getMeshsetIdEntitiesByDimension() instead
Parameters
moabmoab instance
typetype of entity
entitiesreturned entities
recursivetrue if meshset should be searched recursively
Returns
error code

Definition at line 201 of file BCMultiIndices.cpp.

201  {
202  PetscFunctionBegin;
203  ErrorCode rval;
204  //rval = moab.list_entity(meshset); CHKERRQ_MOAB(rval);
205  rval = moab.get_entities_by_type(meshset,type,entities,recursive);
206  if(rval != MB_SUCCESS) {
207  std::ostringstream ss;
208  ss << "bc set " << *this << std::endl;
209  PetscPrintf(PETSC_COMM_WORLD,ss.str().c_str());
210  }
211  CHKERRQ_MOAB(rval);
212  PetscFunctionReturn(0);
213 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25

◆ getName()

std::string MoFEM::CubitMeshSets::getName ( ) const

get name of block, sideset etc. (this is set in Cubit block properties)

Block Name Conventions:

Materials are defined with block names starting with MAT_ e.g. MAT_ELASTIC_abcd, MAT_FRACTcdef etc. Solution procedures are defined with block names starting with SOL_ e.g. SOL_ELASTIC_xx, SOL_NLELASTICxx, SOL_FRACTabcd etc.

List of materials/solution procedures

Block name / Number of attributes / (1) Attribute 1, (2) Attribute 2 etc.

MAT_ELASTIC / 10 / (1) Young's modulus (2) Poisson's ratio (3) User attribute 8 ... (10) User attribute 8

MAT_ELASTIC_TRANSISO / 5 / (1) Young's modulus in xy plane (Ep) (2) Young's modulus in z-direction (Ez) (3) Poisson's ratio in xy plane (vp) (4) Poisson's ratio in z-direction (vpz) (5) Shear modulus in z-direction (Gzp)

MAT_INTERF / 1 / (1) Elastic modulus multiplier

To be extended as appropriate

Definition at line 251 of file BCMultiIndices.cpp.

251  {
252  if(tagName!=NULL) {
253  return std::string(tagName);
254  } else {
255  return "NoNameSet";
256  }
257 }

◆ getTagsHanlders()

PetscErrorCode MoFEM::CubitMeshSets::getTagsHanlders ( Interface moab)

Definition at line 33 of file BCMultiIndices.cpp.

33  {
34  PetscFunctionBegin;
35  ErrorCode rval;
36  rval = moab.tag_get_handle(DIRICHLET_SET_TAG_NAME,nsTag); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
37  rval = moab.tag_get_handle(NEUMANN_SET_TAG_NAME,ssTag); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
38  rval = moab.tag_get_handle((
39  std::string(DIRICHLET_SET_TAG_NAME)+"__BC_DATA").c_str(),nsTag_data
40  ); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
41  rval = moab.tag_get_handle(
42  (std::string(NEUMANN_SET_TAG_NAME)+"__BC_DATA").c_str(),ssTag_data
43  ); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
44  rval = moab.tag_get_handle(MATERIAL_SET_TAG_NAME,bhTag); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
45  rval = moab.tag_get_handle(BLOCK_HEADER,bhTag_header); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
46  rval = moab.tag_get_handle(BLOCK_ATTRIBUTES,thBlockAttribs); CHKERRQ_MOAB(rval); MOAB_THROW(rval);
47  rval = moab.tag_get_handle(NAME_TAG_NAME,entityNameTag); CHKERRQ_MOAB(rval);MOAB_THROW(rval);
48  PetscFunctionReturn(0);
49 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
#define MOAB_THROW(a)
Definition: definitions.h:376

◆ getTypeFromBcData() [1/2]

PetscErrorCode MoFEM::CubitMeshSets::getTypeFromBcData ( const std::vector< char > &  bc_data,
CubitBCType type 
) const

Function that returns the CubitBCType type of the contents of bc_data.

Deprecated:
Use getMeshsetIdEntitiesByType() instead

Definition at line 267 of file BCMultiIndices.cpp.

267  {
268  PetscFunctionBegin;
269 
270  //See CubitBCType in common.hpp
271  if(bc_data.size()==0) {
272  PetscFunctionReturn(0);
273  }
274 
275  if (strcmp (&bc_data[0],"Displacement") == 0) type |= DISPLACEMENTSET;
276  else if (strcmp (&bc_data[0],"Force") == 0) type |= FORCESET;
277  else if (strcmp (&bc_data[0],"Velocity") == 0) type |= VELOCITYSET;
278  else if (strcmp (&bc_data[0],"Acceleration") == 0) type |= ACCELERATIONSET;
279  else if (strcmp (&bc_data[0],"Temperature") == 0) type |= TEMPERATURESET;
280  else if (strcmp (&bc_data[0],"Pressure") == 0) type |= PRESSURESET;
281  else if (strcmp (&bc_data[0],"HeatFlux") == 0) type |= HEATFLUXSET;
282  else if (strcmp (&bc_data[0],"cfd_bc") == 0) type |= INTERFACESET;
283  else type |= UNKNOWNNAME;
284 
285 
286  PetscFunctionReturn(0);
287 }

◆ getTypeFromBcData() [2/2]

PetscErrorCode MoFEM::CubitMeshSets::getTypeFromBcData ( CubitBCType type) const

Function that returns the CubitBCType type of the contents of bc_data.

Definition at line 288 of file BCMultiIndices.cpp.

288  {
289  PetscFunctionBegin;
290 
291  std::vector<char> bc_data;
292  ierr = getBcData(bc_data); CHKERRQ(ierr);
293  ierr = getTypeFromBcData(bc_data,type); CHKERRQ(ierr);
294  PetscFunctionReturn(0);
295 }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
PetscErrorCode getBcData(std::vector< char > &bc_data) const
get bc_data vector from MoFEM database
PetscErrorCode getTypeFromBcData(const std::vector< char > &bc_data, CubitBCType &type) const
Function that returns the CubitBCType type of the contents of bc_data.

◆ getTypeFromName() [1/2]

PetscErrorCode MoFEM::CubitMeshSets::getTypeFromName ( const std::string &  name,
CubitBCType type 
) const

Function that returns the CubitBCType type of the block name, sideset name etc.

Definition at line 350 of file BCMultiIndices.cpp.

350  {
351  PetscFunctionBegin;
352 
353  //See CubitBCType in common.hpp
354  if (name.compare(0,11,"MAT_ELASTIC") == 0) {
355  type |= MAT_ELASTICSET;
356  } else if (name.compare(0,11,"MAT_THERMAL") == 0) {
357  type |= MAT_THERMALSET;
358  } else if (name.compare(0,12,"MAT_MOISTURE") == 0) {
359  type |= MAT_MOISTURESET;
360  } else if (name.compare(0,10,"MAT_INTERF") == 0) {
361  type |= MAT_INTERFSET;
362  } else if (name.compare(0,11,"BODY_FORCES") == 0) {
363  type |= BODYFORCESSET;
364  }
365  //To be extended as appropriate
366  else { type |= UNKNOWNNAME; }
367 
368  PetscFunctionReturn(0);
369 }
block name is "MAT_MOISTURE"
Definition: definitions.h:226
block name is "MAT_THERMAL"
Definition: definitions.h:224
block name is "BODY_FORCES"
Definition: definitions.h:225
block name is "MAT_ELASTIC"
Definition: definitions.h:222

◆ getTypeFromName() [2/2]

PetscErrorCode MoFEM::CubitMeshSets::getTypeFromName ( CubitBCType type) const

Function that returns the CubitBCType type of the block name, sideset name etc.

Definition at line 371 of file BCMultiIndices.cpp.

371  {
372  PetscFunctionBegin;
373 
374  std::string name = getName();
375  ierr = getTypeFromName(name,type); CHKERRQ(ierr);
376  PetscFunctionReturn(0);
377 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getTypeFromName(const std::string &name, CubitBCType &type) const
Function that returns the CubitBCType type of the block name, sideset name etc.
CHKERRQ(ierr)
std::string getName() const
get name of block, sideset etc. (this is set in Cubit block properties)

◆ printAttributes()

PetscErrorCode MoFEM::CubitMeshSets::printAttributes ( std::ostream &  os) const

print the attributes vector

Deprecated:
Use getAttributes() instead

f.e. it->printAttributes(cout), i.e. printing to standard output f.e. it->printAttributes(std::cerr), i.e. printing to standard error output

Definition at line 336 of file BCMultiIndices.cpp.

336  {
337  PetscFunctionBegin;
338  std::vector<double> attributes;
339  getAttributes(attributes);
340  os << std::endl;
341  os << "Block attributes" << std::endl;
342  os << "----------------" << std::endl;
343  for(unsigned int ii = 0;ii<attributes.size();ii++) {
344  os << "attr. no: " << ii+1 << " value: " << attributes[ii] << std::endl;
345  }
346  os << std::endl;
347  PetscFunctionReturn(0);
348 }
PetscErrorCode getAttributes(std::vector< double > &attributes) const
get Cubit block attributes

◆ printBcData()

PetscErrorCode MoFEM::CubitMeshSets::printBcData ( std::ostream &  os) const

print bc_data int stream given by os

f.e. it->printBcData(cout), i.e. printing to standard output f.e. it->printBcData(std::cerr), i.e. printing to standard error output

Definition at line 297 of file BCMultiIndices.cpp.

297  {
298  PetscFunctionBegin;
299  std::vector<char> bc_data;
300  getBcData(bc_data);
301  os << "bc_data = ";
302  std::vector<char>::iterator vit = bc_data.begin();
303  for(;vit!=bc_data.end();vit++) {
304  os << std::hex << (int)((unsigned char)*vit) << " ";
305  }
306  os << ": ";
307  vit = bc_data.begin();
308  for(;vit!=bc_data.end();vit++) {
309  os << *vit;
310  }
311  os << std::endl;
312  PetscFunctionReturn(0);
313 }
PetscErrorCode getBcData(std::vector< char > &bc_data) const
get bc_data vector from MoFEM database

◆ printBlockHeaderData()

PetscErrorCode MoFEM::CubitMeshSets::printBlockHeaderData ( std::ostream &  os) const

print material_data int stream given by os

f.e. it->print_Cubit_material_data(cout), i.e. printing to standard output f.e. it->print_Cubit_material_data(std::cerr), i.e. printing to standard error output

Definition at line 229 of file BCMultiIndices.cpp.

229  {
230  PetscFunctionBegin;
231  if(tag_block_header_data!=NULL) {
232  std::vector<unsigned int> material_data;
233  getBlockHeaderData(material_data);
234  os << "block_header_data = ";
235  std::vector<unsigned int>::iterator vit = material_data.begin();
236  for(;vit!=material_data.end();vit++) {
237  os << std::hex << (int)((unsigned int)*vit) << " ";
238  }
239  os << ": ";
240  vit = material_data.begin();
241  for(;vit!=material_data.end();vit++) {
242  os << *vit;
243  }
244  os << std::endl;
245  } else {
246  os << "no block header data" << std::endl;
247  }
248  PetscFunctionReturn(0);
249 }
PetscErrorCode getBlockHeaderData(std::vector< unsigned int > &material_data) const
get block_headers vector from MoFEM database
unsigned int * tag_block_header_data

◆ printName()

PetscErrorCode MoFEM::CubitMeshSets::printName ( std::ostream &  os) const

print name of block, sideset etc. (this is set in Cubit setting properties)

Deprecated:
Use getName() instead

e.g. it->printName(cout), i.e. printing to standard output e.g it->printName(std::cerr), i.e. printing to standard error output

Definition at line 259 of file BCMultiIndices.cpp.

259  {
260  PetscFunctionBegin;
261  std::string name = getName();
262  os << std::endl;
263  os << "Block name: " << name << std::endl;
264  PetscFunctionReturn(0);
265 }
std::string getName() const
get name of block, sideset etc. (this is set in Cubit block properties)

◆ setAttributeDataStructure()

template<class ATTRIBUTE_TYPE >
PetscErrorCode MoFEM::CubitMeshSets::setAttributeDataStructure ( const ATTRIBUTE_TYPE &  data)

fill meshset data with data on structure

Deprecated:
Use getAttributeDataStructure() instead

Definition at line 307 of file BCMultiIndices.hpp.

307  {
308  PetscFunctionBegin;
309 
310  if((cubitBcType&data.getType()).none()) {
311  SETERRQ(PETSC_COMM_SELF,1,"attributes are not for ATTRIBUTE_TYPE structure");
312  }
313  double *ptr = const_cast<double*>(tag_block_attributes);
314  ierr = data.set_data(ptr,8*tag_block_attributes_size); CHKERRQ(ierr);
315  PetscFunctionReturn(0);
316  }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
CubitBCType cubitBcType
type of meshset from cubit NodeSet, BlockSet, SideSet and more

◆ setAttributes()

PetscErrorCode MoFEM::CubitMeshSets::setAttributes ( moab::Interface &  moab,
const std::vector< double > &  attributes 
)

cet Cubit block attributes

Parameters
attributesis the vector where the block attribute data will be stored

Definition at line 324 of file BCMultiIndices.cpp.

324  {
325 
326  PetscFunctionBegin;
327  int tag_size[] = { (int)attributes.size() };
328  void const* tag_data[] = { &*attributes.begin() };
329  rval = moab.tag_set_by_ptr(thBlockAttribs,&meshset,1,tag_data,tag_size); CHKERRQ_MOAB(rval);
330  rval = moab.tag_get_by_ptr(
332  ); CHKERRQ_MOAB(rval);
333  PetscFunctionReturn(0);
334 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25

◆ setBcDataStructure()

template<class CUBIT_BC_DATA_TYPE >
PetscErrorCode MoFEM::CubitMeshSets::setBcDataStructure ( CUBIT_BC_DATA_TYPE &  data)
Deprecated:
Use getBcDataStructure() instead

Definition at line 339 of file BCMultiIndices.hpp.

339  {
340  PetscFunctionBegin;
341 
342  char *ptr = const_cast<char*>(tag_bc_data);
343  ierr = data.set_data(ptr,tag_bc_size); CHKERRQ(ierr);
344  PetscFunctionReturn(0);
345  }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 379 of file BCMultiIndices.cpp.

379  {
380 
381  // get name of cubit meshset
382  std::ostringstream ss;
383  unsigned jj = 0;
384  while(1<<jj != LASTSET_BC) {
385  const CubitBCType jj_bc_type = 1<<jj;
386  if((e.cubitBcType&jj_bc_type).any()) {
387  string bc_type_name;
388  ss << " " << string(CubitBCNames[jj+1]);
389  }
390  ++jj;
391  }
392 
393  // push data to stream
394  os << "meshset " << e.meshset << " type" << ss.str();
395  if(e.msId != NULL) os << " msId " << *(e.msId);
396  if(e.tagName!=NULL) {
397  os << " name " << e.getName();
398  }
399  if(e.tag_block_header_data != NULL) {
400  os << " block header: ";
401  os << " blockCol = " << e.tag_block_header_data[0];
402  os << " blockMat = " << e.tag_block_header_data[1];
403  os << " blockDimension = " << e.tag_block_header_data[2];
404  }
405 
406  return os;
407 }
std::bitset< 32 > CubitBCType
Definition: Common.hpp:125
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
Definition: definitions.h:238

Member Data Documentation

◆ bhTag

Tag MoFEM::CubitMeshSets::bhTag

Definition at line 349 of file BCMultiIndices.hpp.

◆ bhTag_header

Tag MoFEM::CubitMeshSets::bhTag_header

Definition at line 349 of file BCMultiIndices.hpp.

◆ cubitBcType

CubitBCType MoFEM::CubitMeshSets::cubitBcType

type of meshset from cubit NodeSet, BlockSet, SideSet and more

Definition at line 31 of file BCMultiIndices.hpp.

◆ entityNameTag

Tag MoFEM::CubitMeshSets::entityNameTag

Definition at line 349 of file BCMultiIndices.hpp.

◆ meshset

EntityHandle MoFEM::CubitMeshSets::meshset

Definition at line 30 of file BCMultiIndices.hpp.

◆ meshsets_mask

const CubitBCType MoFEM::CubitMeshSets::meshsets_mask

Definition at line 40 of file BCMultiIndices.hpp.

◆ msId

int* MoFEM::CubitMeshSets::msId

cubit meshset ID

Definition at line 33 of file BCMultiIndices.hpp.

◆ nsTag

Tag MoFEM::CubitMeshSets::nsTag

Definition at line 349 of file BCMultiIndices.hpp.

◆ nsTag_data

Tag MoFEM::CubitMeshSets::nsTag_data

Definition at line 349 of file BCMultiIndices.hpp.

◆ ssTag

Tag MoFEM::CubitMeshSets::ssTag

Definition at line 349 of file BCMultiIndices.hpp.

◆ ssTag_data

Tag MoFEM::CubitMeshSets::ssTag_data

Definition at line 349 of file BCMultiIndices.hpp.

◆ tag_bc_data

char* MoFEM::CubitMeshSets::tag_bc_data

Definition at line 34 of file BCMultiIndices.hpp.

◆ tag_bc_size

int MoFEM::CubitMeshSets::tag_bc_size

Definition at line 35 of file BCMultiIndices.hpp.

◆ tag_block_attributes

double* MoFEM::CubitMeshSets::tag_block_attributes

Definition at line 37 of file BCMultiIndices.hpp.

◆ tag_block_attributes_size

int MoFEM::CubitMeshSets::tag_block_attributes_size

Definition at line 38 of file BCMultiIndices.hpp.

◆ tag_block_header_data

unsigned int* MoFEM::CubitMeshSets::tag_block_header_data

Definition at line 36 of file BCMultiIndices.hpp.

◆ tag_handles

std::vector<Tag> MoFEM::CubitMeshSets::tag_handles

vector of tag handles to types of data passed from cubit

Definition at line 32 of file BCMultiIndices.hpp.

◆ tagName

char* MoFEM::CubitMeshSets::tagName

Definition at line 39 of file BCMultiIndices.hpp.

◆ thBlockAttribs

Tag MoFEM::CubitMeshSets::thBlockAttribs

Definition at line 349 of file BCMultiIndices.hpp.


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