v0.15.0
Loading...
Searching...
No Matches
Files | Classes | Macros | Functions
MeshsetsManager

Interface for meshsets with entities with data and boundary conditions. More...

Collaboration diagram for MeshsetsManager:

Files

file  MeshsetsManager.hpp
 MeshsetsManager interface.
 

Classes

struct  MoFEM::MeshsetsManager
 Interface for managing meshsets containing materials and boundary conditions. More...
 

Macros

#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
 Iterator that loops over all the Cubit MeshSets in a moFEM field.
 
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
 Iterator that loops over a specific Cubit MeshSet in a moFEM field.
 
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
 Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
 
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
 Iterator that loops over Cubit BlockSet having a particular name.
 

Functions

CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getBegin () const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getEnd () const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getBegin (const unsigned int cubit_bc_type) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getEnd (const unsigned int cubit_bc_type) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeBegin (const unsigned int cubit_bc_type) const
 get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeEnd (const unsigned int cubit_bc_type) const
 get end iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getBegin (const std::string &name) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getEnd (const std::string &name) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
bool MoFEM::MeshsetsManager::checkMeshset (const int ms_id, const CubitBCType cubit_bc_type) const
 check for CUBIT Id and CUBIT type
 
MoFEMErrorCode MoFEM::MeshsetsManager::addMeshset (const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
 add cubit meshset
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
const CubitMeshSetsMoFEM::MeshsetsManager::getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type) const
 get cubit meshset
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const CubitBCType cubit_bc_type, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer by bc type.
 
std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr (const CubitBCType cubit_bc_type) const
 Get vector of pointer by bc type.
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const string name, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const std::regex reg_exp_name, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr (const std::regex reg_exp_name) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
 get entities from CUBIT/meshset of a particular entity dimension
 
MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, Range &entities, const bool recursive=true) const
 get entities related to CUBIT/meshset,
 
MoFEMErrorCode MoFEM::MeshsetsManager::getMeshset (const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
 get meshset from CUBIT Id and CUBIT type
 
MoFEMErrorCode MoFEM::MeshsetsManager::getMeshsetsByType (const unsigned int cubit_bc_type, Range &meshsets) const
 get all CUBIT meshsets by CUBIT type
 

Detailed Description

Interface for meshsets with entities with data and boundary conditions.

Macro Definition Documentation

◆ _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_ (   MESHSET_MANAGER,
  CUBITBCTYPE,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByType::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(CUBITBCTYPE); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(CUBITBCTYPE); \
IT++
constexpr IntegrationType IT

Iterator that loops over a specific Cubit MeshSet in a moFEM field.

Parameters
mFieldmoFEM Field
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
iterator
Examples
ElasticityMixedFormulation.hpp, HookeElement.cpp, add_cubit_meshsets.cpp, bone_adaptation.cpp, elasticity.cpp, field_blas.cpp, nonlinear_dynamics.cpp, and simple_elasticity.cpp.

Definition at line 49 of file MeshsetsManager.hpp.

103 : public UnknownInterface {
104
105 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
106 UnknownInterface **iface) const;
107
108 MoFEM::Core &cOre;
109 MeshsetsManager(const MoFEM::Core &core);
110 virtual ~MeshsetsManager() = default;
111
112 /**
113 * \brief get tags handlers used on meshsets
114
115 * On meshsets range of tags in set. Depending on tag type and data on that
116 * tag type of meshset could be determined. This function get hanldes to
117 * tags.
118 *
119 * Most of the tags are followinf convention used by MoAB or Cubit and other
120 * meshing softwares, f.e. gmesh.
121
122 */
123 MoFEMErrorCode getTags(int verb = -1);
124
125 static MoFEMErrorCode getTags(moab::Interface &moab, Tag &nsTag, Tag &ssTag,
126 Tag &nsTag_data, Tag &ssTag_data, Tag &bhTag,
127 Tag &bhTag_header, int verb = -1);
128
129 /**
130 * \brief get tag handle used to store "id" of NODESET
131 */
132 inline Tag get_nsTag() const { return nsTag; }
133
134 /**
135 * \brief get tag handle used to store "id" of SIDESET
136 */
137 inline Tag get_ssTag() const { return ssTag; }
138
139 /**
140 * \brief get tag handle used to store boundary data on NODESET
141 */
142 inline Tag get_nsTag_data() const { return nsTag_data; }
143
144 /**
145 * \brief get tag handle used to store boundary data on SIDESET
146 */
147 inline Tag get_ssTag_data() const { return ssTag_data; }
148
149 /**
150 * \brief get tag handle used to store "id" of BLOCKSET
151 */
152 inline Tag get_bhTag() const { return bhTag; }
153
154 /**
155 * \brief get tag handle used to store of block set header (Used by Cubit)
156 */
157 inline Tag get_bhTag_header() const { return bhTag_header; }
158
159 /**
160 * \brief return pointer to meshset manager
161 */
162 MeshsetsManager *get_meshsets_manager_ptr() { return this; }
163
164 /**
165 * \brief return pointer to meshset manager
166 */
167 const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
168
169 /**
170 * \brief clear multi-index container
171 * @return error code
172 */
173 MoFEMErrorCode clearMap();
174
175 /**
176 * \brier initialize container form data on mesh
177 * @return [description]
178 */
179 MoFEMErrorCode initialiseDatabaseFromMesh(int verb = DEFAULT_VERBOSITY);
180
181 /**
182 * @brief Read meshsets
183 *
184 * @param verb
185 * @return MoFEMErrorCode
186 */
187 MoFEMErrorCode readMeshsets(int verb = DEFAULT_VERBOSITY);
188
189 /**
190 * @brief Broadcast meshsets
191 *
192 * @param verb
193 * @return MoFEMErrorCode
194 */
195 MoFEMErrorCode broadcastMeshsets(int verb = DEFAULT_VERBOSITY);
196
197 template <class CUBIT_BC_DATA_TYPE>
198 MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
199 unsigned long int type) const;
200
201 /**
202 * \brief print meshsets with displacement boundary conditions data
203 * structure
204 */
205 MoFEMErrorCode printDisplacementSet() const;
206
207 /**
208 * \brief print meshsets with pressure boundary conditions data structure
209 */
210 MoFEMErrorCode printPressureSet() const;
211
212 /**
213 * \brief print meshsets with force boundary conditions data structure
214 */
215 MoFEMErrorCode printForceSet() const;
216
217 /**
218 * \brief print meshsets with temperature boundary conditions data structure
219 */
220 MoFEMErrorCode printTemperatureSet() const;
221
222 /**
223 * \brief print meshsets with heat flux boundary conditions data structure
224 */
225 MoFEMErrorCode printHeatFluxSet() const;
226
227 /**
228 * \brief print meshsets with material data structure set on it
229 */
230 MoFEMErrorCode printMaterialsSet() const;
231
232 inline CubitMeshSet_multiIndex &getMeshsetsMultindex() {
233 return cubitMeshsets;
234 }
235
236 /**
237 * \ingroup mofem_meshset_mng
238 * \brief get begin iterator of cubit mehset of given type (instead you can
239 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
240 *
241 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
242 * ...
243 * }
244 *
245 */
246 inline CubitMeshSet_multiIndex::iterator getBegin() const {
247 return cubitMeshsets.begin();
248 }
249
250 /**
251 * \ingroup mofem_meshset_mng
252 * \brief get begin iterator of cubit mehset of given type (instead you can
253 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
254 *
255 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
256 * ...
257 * }
258 *
259 */
260 CubitMeshSet_multiIndex::iterator getEnd() const {
261 return cubitMeshsets.end();
262 }
263
264 /**
265 * \brief get begin iterator of cubit mehset of given type (instead you can
266 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
267 * \ingroup mofem_meshset_mng
268
269 *
270 *
271 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
272 {
273 * ...
274 * }
275 *
276 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
277 */
278 inline CubitMeshsetByType::iterator
279 getBegin(const unsigned int cubit_bc_type) const {
280 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
281 cubit_bc_type);
282 }
283
284 /**
285 * \brief get begin iterator of cubit mehset of given type (instead you can
286 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
287 * \ingroup mofem_meshset_mng
288
289 *
290 *
291 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
292 {
293 * ...
294 * }
295 *
296 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
297 */
298 inline CubitMeshsetByType::iterator
299 getEnd(const unsigned int cubit_bc_type) const {
300 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
301 cubit_bc_type);
302 }
303
304 /**
305 * \brief get end iterator of cubit meshset of given type (instead you can
306 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
307 * \ingroup mofem_meshset_mng
308
309 *
310 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
311 * ...
312 * }
313 *
314 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
315 */
316 inline CubitMeshsetByMask::iterator
317 getBySetTypeBegin(const unsigned int cubit_bc_type) const {
318 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
319 cubit_bc_type);
320 }
321
322 /**
323 * \brief get end iterator of cubit mehset of given type (instead you can
324 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
325 * \ingroup mofem_meshset_mng
326
327 *
328 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
329 * ...
330 * }
331 *
332 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
333 */
334 inline CubitMeshsetByMask::iterator
335 getBySetTypeEnd(const unsigned int cubit_bc_type) const {
336 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
337 cubit_bc_type);
338 }
339
340 /**
341 * \brief get begin iterator of cubit mehset of given type (instead you can
342 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
343 * \ingroup mofem_meshset_mng
344
345 *
346 *
347 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
348 {
349 * ...
350 * }
351 *
352 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
353 */
354 inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
355 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
356 }
357
358 /**
359 * \brief get begin iterator of cubit mehset of given type (instead you can
360 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
361 * \ingroup mofem_meshset_mng
362
363 *
364 *
365 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
366 {
367 * ...
368 * }
369 *
370 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
371 */
372 inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
373 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
374 }
375
376 /**
377 * \brief check for CUBIT Id and CUBIT type
378 * \ingroup mofem_meshset_mng
379
380 \todo All cubit interface functions should be outsourced to dedicated
381 interface
382
383 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
384 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
385 */
386 bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
387
388 /**
389 * \brief check if meshset of given name exist
390 * @param name name of meshset
391 * @return error code
392 */
393 bool checkMeshset(const string name,
394 int *const number_of_meshsets_ptr = NULL) const;
395
396 /**
397 * \brief add cubit meshset
398 * \ingroup mofem_meshset_mng
399
400 *
401 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
402 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET
403 * \param name of set
404
405 */
406 MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
407 const std::string name = "");
408
409 /**
410 * \brief add entities to cubit meshset
411 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
412 * @param ms_id id of meshset
413 * @param ents entities to add
414 * @return error code
415 */
416 MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
417 const int ms_id, const Range &ents);
418
419 /**
420 * \brief add entities to cubit meshset
421 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
422 * @param ms_id id of meshset
423 * @param ents pointer to entities array
424 * @param nb_ents number of entities in array
425 * @return error code
426 */
427 MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
428 const int ms_id, const EntityHandle *ents,
429 const int nb_ents);
430
431 /**
432 * \brief set attributes to cubit meshset
433 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
434 * NODESET, SIDESET
435 * @param ms_id id of meshset
436 * @param attributes attributes
437 * @param name set name to blockset
438 * @return error code
439 */
440 MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id,
441 const std::vector<double> &attributes,
442 const std::string name = "");
443
444 /**
445 * \brief set (material) data structure to cubit meshset
446 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
447 * NODESET, SIDESET
448 * @param ms_id id of meshset
449 * @param attributes attributes
450 * @return error code
451 */
452 MoFEMErrorCode setAtributesByDataStructure(const CubitBCType cubit_bc_type,
453 const int ms_id,
454 const GenericAttributeData &data,
455 const std::string name = "");
456
457 /**
458 * \brief set boundary data structure to meshset
459 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
460 * NODESET, SIDESET
461 * @param ms_id id of meshset
462 * @param data data structure
463 * @return error code
464 */
465 MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
466 const GenericCubitBcData &data);
467
468 /**
469 * \brief delete cubit meshset
470 * \ingroup mopfem_bc
471
472 *
473 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
474 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
475 *
476 */
477 MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
478 const MoFEMTypes bh = MF_EXIST);
479
480 /**
481 * \brief get cubit meshset
482 * \ingroup mofem_meshset_mng
483 *
484 *
485 */
487 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
488 const CubitMeshSets **cubit_meshset_ptr) const;
489
490 /**
491 * \brief get cubit meshset
492 * \ingroup mofem_meshset_mng
493 *
494 *
495 */
496 const CubitMeshSets *
497 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type) const;
498
499 /**
500 * @brief Get vector of pointer by bc type
501 *
502 * \ingroup mofem_meshset_mng
503 *
504 * @param std::vector<const CubitMeshSets *>
505 * @return MoFEMErrorCode
506 */
508 getCubitMeshsetPtr(const CubitBCType cubit_bc_type,
509 std::vector<const CubitMeshSets *> &vec_ptr) const;
510
511/**
512 * @brief Get vector of pointer by bc type
513 *
514 * \ingroup mofem_meshset_mng
515 *
516 * @return MoFEMErrorCode
517 */
518 std::vector<const CubitMeshSets *>
519 getCubitMeshsetPtr(const CubitBCType cubit_bc_type) const;
520
521 /**
522 * \brief get cubit meshset
523 *
524 * \ingroup mofem_meshset_mng
525 */
527 getCubitMeshsetPtr(const string name,
528 const CubitMeshSets **cubit_meshset_ptr) const;
529
530 /**
531 * @brief Get vector of pointer to blocksets with name satisfying regular
532 * expression.
533 *
534 * \ingroup mofem_meshset_mng
535 *
536 * @param reg_exp_name
537 * @param std::vector<const CubitMeshSets *>
538 * @return MoFEMErrorCode
539 */
541 getCubitMeshsetPtr(const std::regex reg_exp_name,
542 std::vector<const CubitMeshSets *> &vec_ptr) const;
543
544 /**
545 * @brief Get vector of pointer to blocksets with name satisfying regular
546 * expression.
547 *
548 * \ingroup mofem_meshset_mng
549 *
550 * \code
551 for (auto m :
552 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
553
554 (boost::format("%s(.*)") % block_name).str()
555
556 ))
557
558 ) {
559 MOFEM_LOG("WORLD", Sev::inform) << m->getName();
560
561 Rants ents;
562 m_field.get_moab().get_entities_by_dimension(
563 m->getMeshset(), 0, ents, false);
564
565 auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
566 MoFEMFunctionBegin;
567 if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
568 MOFEM_LOG("SYNC", Sev::inform) << ents_ptr->getName() << ": " <<
569 ent_ptr->getEntFieldData();
570 }
571 MoFEMFunctionReturn(0);
572 };
573
574 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
575 print_vets, "VELOCITIES", &ents);
576 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
577 print_vets, "DISPLACEMENTS", &ents);
578 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
579 }
580 * \endcode
581 *
582 * @param reg_exp_name
583 * @return std::vector<const CubitMeshSets *>
584 */
585 std::vector<const CubitMeshSets *>
586 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
587
588 /**
589 * \brief get entities from CUBIT/meshset of a particular entity dimension
590 * \ingroup mofem_meshset_mng
591
592 * Nodeset can contain nodes, edges, triangles and tets. This applies to
593 other meshsets too.
594 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
595 volume which is done by default in Cubit,
596 * Hence if all nodes on a particular nodeset are required,
597 * one should get all triangles or tetrahedrons for which the nodeset was
598 create in Cubit,
599 * and get all the connectivities of tris/tets.
600
601 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
602 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
603 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
604 Volume(tetrahedral))
605 * \param Range containing the retrieved entities
606 * \param recursive If true, meshsets containing meshsets are queried
607 recursively. Returns the contents of meshsets, but not the meshsets
608 themselves if true.
609 */
610 MoFEMErrorCode getEntitiesByDimension(const int ms_id,
611 const unsigned int cubit_bc_type,
612 const int dimension, Range &entities,
613 const bool recursive = true) const;
614
615 /**
616 * \brief get entities related to CUBIT/meshset,
617 * \ingroup mofem_meshset_mng
618
619 * NODESET will get Vertices only, even if the NODESET contains edges, tris
620 and tets
621 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
622 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
623
624 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
625 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
626 * \param Range containing the retrieved entities related to the
627 * \param recursive If true, meshsets containing meshsets are queried
628 recursively. Returns the contents of meshsets, but not the meshsets
629 themselves if true.
630 */
631 MoFEMErrorCode getEntitiesByDimension(const int ms_id,
632 const unsigned int cubit_bc_type,
633 Range &entities,
634 const bool recursive = true) const;
635
636 /**
637 * \ingroup mofem_meshset_mng
638 * \brief get meshset from CUBIT Id and CUBIT type
639 *
640 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
641 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
642 * \param meshset where to store the retrieved entities
643 */
644 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
645 EntityHandle &meshset) const;
646
647 /**
648 * @brief Check if meshset constains entities
649 *
650 * @param ms_id
651 * @param cubit_bc_type
652 * @param entities
653 * @param num_entities
654 * @param operation_type
655 * @return true
656 * @return false
657 */
658 bool checkIfMeshsetContainsEntities(
659 const int ms_id, const unsigned int cubit_bc_type,
660 const EntityHandle *entities, int num_entities,
661 const int operation_type = moab::Interface::INTERSECT);
662
663 /**
664 * \ingroup mofem_meshset_mng
665 * \brief get all CUBIT meshsets by CUBIT type
666 *
667 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
668 * \param meshsets is range of meshsets
669 */
670 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
671 Range &meshsets) const;
672
673 /**
674 * \brief add blocksets reading config file
675
676 Example of config file
677 \code
678
679 [block_1001]
680
681 # Example applying attributes to blockset
682
683 id=2001
684 add=BLOCKSET
685 user1=1.0 # attribute value 1
686 user2=2.0 # you can set up to 10 attributes (if needed could be easily
687 extended to more, let us know)
688 user3=3.0
689
690 [block_1002]
691
692 # Example applying material block (isotropic elastic material)
693
694 id=2002
695 add=BLOCKSET
696 name=MAT_ELASTIC
697 young=10
698 poisson=0.25
699 thermalexpansion=0
700
701 [block_1003]
702
703 # Example applying displacement constrains
704
705 id=2003
706 add=NODESET
707
708 # Each flag means that boundary consition on displacements is set.
709 disp_flag1=1 # Setting constrains in x- direction
710 disp_flag2=1 # Setting constrains in y- direction
711 disp_flag3=1 # Setting constrains in z- direction
712 disp_flag4=1 # Setting constrains on rotation over x- axis
713 disp_flag5=1 # Setting constrains on rotation over y- axis
714 disp_flag6=1 # Setting constrains on rotation over z-axis
715 disp_ux=1 # value of disp in x- direction
716 disp_uy=2
717 disp_uz=3
718 disp_rx=4 # value of rotation in y-direction
719 disp_ry=5
720 disp_rz=6
721
722 # Note above values could be interpreted differently if needed.
723
724 [block_1004]
725
726 # Example applying force boundary conditions
727
728 id=2004
729 add=NODESET
730 force_magnitude=1
731 moment_magnitude=1
732 force_fx=1
733 force_fy=1
734 force_fz=1
735 moment_mx=1
736 moment_my=1
737 moment_mz=1
738
739 [block_1005]
740
741 # Example applying pressure boundary conditions
742
743 id=2005
744 add=SIDESET
745 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
746 pressure is interpreted as total force
747 pressure_magnitude=1
748
749 # Example applying temperature boundary conditions
750
751 [block_1006]
752
753 id=2006
754 add=NODESET
755 temperature_flag1=1 # 0: N/A, 1: temperature value applied
756 temperature_t=1
757
758 [block_1007]
759
760 id=2007
761 add=SIDESET
762 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
763 heatflux_magnitude=1
764
765 [block_1008]
766
767 # Example applying material block (isotropic thermal material)
768
769 id=2008
770 add=BLOCKSET
771 name=MAT_THERMAL # Hast to be set for Thermal Mat
772 conductivity=1
773 capacity=1
774
775 [block_1009]
776
777 # Example applying interface
778 id=2009
779 add=SIDESET
780 interface_type=1
781
782 [block_1010]
783
784 # Example applying material block for interface element
785
786 id=2010
787 add=BLOCKSET
788 name=MAT_INTERF
789 interface_alpha = 1
790 interface_beta = 0
791 interface_ft = 1
792 interface_Gf = 1
793
794
795 [block_1009]
796
797 # Example applying material block (isotropic trans iso material)
798
799 id=2011
800 add=BLOCKSET
801 name=MAT_ELASTIC_TRANS_ISO
802 Youngp=1
803 Youngz=2
804 Poissonp=3
805 Poissonpz=4
806 Shearzp=5
807
808 [SET_ATTR_foo]
809
810 # Example set atttributes to block name "foo"
811 number_of_attributes=3
812 user1=1
813 user2=2
814 user3=3
815
816 \endcode
817
818 * @param file_name config file
819 * @return error code
820
821 */
822 MoFEMErrorCode setMeshsetFromFile(const string file_name,
823 const bool clean_file_options = true);
824
825 /**
826 * \brief get name of config file from line command '-meshsets_config'
827 * @return error code
828
829 Option is "-meshsets_config file_name.cfg"
830
831 */
832 MoFEMErrorCode setMeshsetFromFile();
833
834 /**
835 * @brief save cubit meshset entities on the moab mesh
836 *
837 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
838 * @param cubit_bc_type type of a cubit mesheset
839 * @param file_name optional name for the file
840 * @param file_type optional file type for moab (VTK MOAB)
841 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
842 * @return MoFEMErrorCode
843 */
845 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
846 const std::string file_name = "out_meshset.vtk",
847 const std::string file_type = "VTK",
848 const std::string options = "") const;
849
850 /**
851 * @brief save cubit meshset entities on the moab mesh
852 *
853 * @param ms_id id of the cubit meshset
854 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
855 * @param dim dimension of the entities
856 * @param file_name optional name for the file
857 * @param file_type optional file type for moab (VTK MOAB)
858 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
859 * @return MoFEMErrorCode
860 */
861 MoFEMErrorCode saveMeshsetToFile(
862 const int ms_id, const unsigned int cubit_bc_type, const int dim,
863 const std::string file_name = "out_meshset.vtk",
864 const bool recursive = false, const std::string file_type = "VTK",
865 const std::string options = "") const;
866
867 /**
868 * \brief Get config file options, use with care
869 * @return error code
870 */
871 inline boost::shared_ptr<boost::program_options::options_description> &
872 getConfigFileOptionsPtr() {
873 return configFileOptionsPtr;
874 }
875
876 /**
877 * @brief Update all blolsets, sidesets and node sets
878 *
879 * @param bit
880 * @return MoFEMErrorCode
881 */
882 MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit);
883
884 static bool broadcastMeshsetsOn; ///< if true meshsets are synchronised
885 ///< between processors
886
887 static void sortMeshsets(std::vector<const CubitMeshSets *> &vec_ptr);
888
889protected:
890 Tag nsTag;
891 Tag ssTag;
892 Tag nsTag_data;
893 Tag ssTag_data;
894 Tag bhTag;
895 Tag bhTag_header;
896
897 // cubit
898 CubitMeshSet_multiIndex cubitMeshsets; ///< cubit meshsets
899 boost::shared_ptr<boost::program_options::options_description>
900 configFileOptionsPtr; ///< config file options
901
902};
903
904template <class CUBIT_BC_DATA_TYPE>
905MoFEMErrorCode MeshsetsManager::printBcSet(CUBIT_BC_DATA_TYPE &data,
906 unsigned long int type) const {
908 const MoFEM::Interface &m_field = cOre;
909 const moab::Interface &moab = m_field.get_moab();
910 for (auto it : getCubitMeshsetPtr(type)) {
911 CHKERR it->getBcDataStructure(data);
912 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
913 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
914 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
915 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
916 int nb;
917 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
918 if (nb > 0) {
919 MOFEM_LOG("MeshsetMngSync", Sev::inform)
920 << "msId " << it->getMeshsetId() << " number of "
921 << moab::CN::EntityTypeName(t) << " " << nb;
922 }
923 }
924 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
925 }
927}
928
929} // namespace MoFEM
930
931#endif //__MESHSETSMANAGER_HPP__
932
933/**
934 * \defgroup mofem_meshset_mng MeshsetsManager
935 * \brief Interface for meshsets with entities with data and boundary conditions
936 *
937 * \ingroup mofem
938 **/
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
@ DEFAULT_VERBOSITY
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
@ MF_EXIST
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
multi_index_container< CubitMeshSets, indexed_by< hashed_unique< tag< Meshset_mi_tag >, member< CubitMeshSets, EntityHandle, &CubitMeshSets::meshset > >, ordered_non_unique< tag< CubitMeshsetType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getBcTypeULong > >, ordered_non_unique< tag< CubitMeshsetMaskedType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > >, ordered_non_unique< tag< CubitMeshsets_name >, const_mem_fun< CubitMeshSets, std::string, &CubitMeshSets::getName > >, hashed_unique< tag< Composite_Cubit_msId_And_MeshsetType_mi_tag >, composite_key< CubitMeshSets, const_mem_fun< CubitMeshSets, int, &CubitMeshSets::getMeshsetId >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > > > > > CubitMeshSet_multiIndex
Stores data about meshsets (see CubitMeshSets) storing data about boundary conditions,...
constexpr double t
plate stiffness
Definition plate.cpp:58
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Core (interface) class.
Definition Core.hpp:82
Deprecated interface functions.

◆ _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_ (   MESHSET_MANAGER,
  NAME,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByName::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(NAME); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(NAME); \
IT++

Iterator that loops over Cubit BlockSet having a particular name.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
NAMEname
ITiterator

Example:

for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,"SOME_BLOCK_NAME",it) {
...
}
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.

Definition at line 94 of file MeshsetsManager.hpp.

◆ _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_ (   MESHSET_MANAGER,
  CUBITBCTYPE,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByMask::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeBegin( \
CUBITBCTYPE); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeEnd( \
CUBITBCTYPE); \
IT++

Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
iterator

Example:

Examples
MagneticElement.hpp, Remodeling.cpp, UnsaturatedFlow.hpp, add_cubit_meshsets.cpp, continuity_check_on_contact_prism_side_ele.cpp, cubit_bc_test.cpp, elasticity.cpp, forces_and_sources_testing_flat_prism_element.cpp, helmholtz.cpp, mesh_cut.cpp, mesh_insert_interface_atom.cpp, navier_stokes.cpp, photon_diffusion.cpp, and unsaturated_transport.cpp.

Definition at line 71 of file MeshsetsManager.hpp.

◆ _IT_CUBITMESHSETS_FOR_LOOP_

#define _IT_CUBITMESHSETS_FOR_LOOP_ (   MESHSET_MANAGER,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshSet_multiIndex::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(); \
IT++

Iterator that loops over all the Cubit MeshSets in a moFEM field.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
iterator
Examples
add_cubit_meshsets.cpp, bone_adaptation.cpp, continuity_check_on_contact_prism_side_ele.cpp, forces_and_sources_testing_flat_prism_element.cpp, mesh_insert_interface_atom.cpp, split_sideset.cpp, and unsaturated_transport.cpp.

Definition at line 34 of file MeshsetsManager.hpp.

Function Documentation

◆ addMeshset()

MoFEMErrorCode MoFEM::MeshsetsManager::addMeshset ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const std::string  name = "" 
)

#include <src/interfaces/MeshsetsManager.hpp>

add cubit meshset

Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
ms_idid of the BLOCKSET/SIDESET/BLOCKSET
nameof set
Examples
EshelbianPlasticity.cpp, add_cubit_meshsets.cpp, and mesh_cut.cpp.

Definition at line 396 of file MeshsetsManager.cpp.

398 {
399 Interface &m_field = cOre;
400 moab::Interface &moab = m_field.get_moab();
402 if (checkMeshset(ms_id, cubit_bc_type)) {
403 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
404 "such cubit meshset is already there id = %d", ms_id);
405 }
406
407 CubitMeshSets cmeshset(moab, cubit_bc_type, ms_id);
408 if ((cmeshset.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET))
409 .any()) {
410 auto p = cubitMeshsets.insert(cmeshset);
411 if (!p.second) {
412 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
413 "meshset not inserted");
414 }
415 if (name.size() > 0) {
416 bool success =
417 cubitMeshsets.modify(p.first, CubitMeshSets_change_name(moab, name));
418 if (!success) {
419 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
420 "name to cubit meshset can not be set");
421 }
422 }
423 }
424
426}
@ SIDESET
@ BLOCKSET
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
std::bitset< 32 > CubitBCType
Definition Types.hpp:52
DeprecatedCoreInterface Interface
moab::Interface & get_moab()
Definition Core.hpp:322
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets

◆ checkMeshset()

bool MoFEM::MeshsetsManager::checkMeshset ( const int  ms_id,
const CubitBCType  cubit_bc_type 
) const

#include <src/interfaces/MeshsetsManager.hpp>

check for CUBIT Id and CUBIT type

Todo:
All cubit interface functions should be outsourced to dedicated interface
Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
Examples
heat_equation.cpp, mesh_cut.cpp, mesh_smoothing.cpp, and reaction_diffusion.cpp.

Definition at line 371 of file MeshsetsManager.cpp.

372 {
373 auto miit =
374 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
375 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
376 if (miit !=
377 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
378 return true;
379 }
380 return false;
381}

◆ getBegin() [1/3]

CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getBegin ( ) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_FOR_LOOP(mField,it) { ... }

Definition at line 247 of file MeshsetsManager.hpp.

247 {
248 return cubitMeshsets.begin();
249 }

◆ getBegin() [2/3]

CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getBegin ( const std::string &  name) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 355 of file MeshsetsManager.hpp.

355 {
356 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
357 }

◆ getBegin() [3/3]

CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getBegin ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 280 of file MeshsetsManager.hpp.

280 {
281 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
282 cubit_bc_type);
283 }

◆ getBySetTypeBegin()

CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeBegin ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 318 of file MeshsetsManager.hpp.

318 {
319 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
320 cubit_bc_type);
321 }

◆ getBySetTypeEnd()

CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeEnd ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get end iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 336 of file MeshsetsManager.hpp.

336 {
337 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
338 cubit_bc_type);
339 }

◆ getCubitMeshsetPtr() [1/7]

std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const CubitBCType  cubit_bc_type) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer by bc type.

Returns
MoFEMErrorCode

Definition at line 649 of file MeshsetsManager.cpp.

649 {
650 std::vector<const CubitMeshSets *> vec_ptr;
651 CHK_MOAB_THROW(getCubitMeshsetPtr(cubit_bc_type, vec_ptr),
652 "Error in getting meshsets by name");
653 return vec_ptr;
654}
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset

◆ getCubitMeshsetPtr() [2/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const CubitBCType  cubit_bc_type,
std::vector< const CubitMeshSets * > &  vec_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer by bc type.

Parameters
std::vector<constCubitMeshSets *>
Returns
MoFEMErrorCode

Definition at line 635 of file MeshsetsManager.cpp.

637 {
639 auto r = cubitMeshsets.get<CubitMeshsetType_mi_tag>().equal_range(
640 cubit_bc_type.to_ulong());
641 for (auto it = r.first; it != r.second; ++it) {
642 vec_ptr.push_back(&*it);
643 }
644 sortMeshsets(vec_ptr);
646}
int r
Definition sdf.py:8
static void sortMeshsets(std::vector< const CubitMeshSets * > &vec_ptr)

◆ getCubitMeshsetPtr() [3/7]

const CubitMeshSets * MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const int  ms_id,
const CubitBCType  cubit_bc_type 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Definition at line 608 of file MeshsetsManager.cpp.

609 {
610 const CubitMeshSets *cubit_meshset_ptr;
612 getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr),
613 "Get not get meshset");
614 return cubit_meshset_ptr;
615}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.

◆ getCubitMeshsetPtr() [4/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const int  ms_id,
const CubitBCType  cubit_bc_type,
const CubitMeshSets **  cubit_meshset_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Examples
EshelbianPlasticity.cpp, mofem/tutorials/vec-7/adjoint.cpp, seepage.cpp, and thermo_elastic.cpp.

Definition at line 589 of file MeshsetsManager.cpp.

591 {
592 Interface &m_field = cOre;
594 auto miit =
595 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
596 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
597 if (miit !=
598 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
599 *cubit_meshset_ptr = &*miit;
600 } else {
601 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
602 "msId = %d is not there", ms_id);
603 }
605}

◆ getCubitMeshsetPtr() [5/7]

std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const std::regex  reg_exp_name) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer to blocksets with name satisfying regular expression.

for (auto m :
(boost::format("%s(.*)") % block_name).str()
))
) {
MOFEM_LOG("WORLD", Sev::inform) << m->getName();
Rants ents;
m_field.get_moab().get_entities_by_dimension(
m->getMeshset(), 0, ents, false);
auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
MOFEM_LOG("SYNC", Sev::inform) << ents_ptr->getName() << ": " <<
ent_ptr->getEntFieldData();
}
};
CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
print_vets, "VELOCITIES", &ents);
CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
print_vets, "DISPLACEMENTS", &ents);
MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
}
FTensor::Index< 'm', 3 > m
Interface for managing meshsets containing materials and boundary conditions.
IFACE getInterface() const
Get interface pointer to pointer of interface.
Parameters
reg_exp_name
Returns
std::vector<const CubitMeshSets *>

Definition at line 673 of file MeshsetsManager.cpp.

673 {
674 std::vector<const CubitMeshSets *> vec_ptr;
675 CHK_MOAB_THROW(getCubitMeshsetPtr(reg_exp_name, vec_ptr),
676 "Error in getting meshsets by name");
677 return vec_ptr;
678}

◆ getCubitMeshsetPtr() [6/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const std::regex  reg_exp_name,
std::vector< const CubitMeshSets * > &  vec_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer to blocksets with name satisfying regular expression.

Parameters
reg_exp_name
std::vector<constCubitMeshSets *>
Returns
MoFEMErrorCode

Definition at line 656 of file MeshsetsManager.cpp.

658 {
660 auto r =
661 cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().equal_range(BLOCKSET);
662 for (; r.first != r.second; ++r.first) {
663 const auto name = r.first->getName();
664 if (std::regex_match(name, reg_exp_name)) {
665 vec_ptr.push_back(&*r.first);
666 }
667 }
668 sortMeshsets(vec_ptr);
670}

◆ getCubitMeshsetPtr() [7/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const string  name,
const CubitMeshSets **  cubit_meshset_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Definition at line 617 of file MeshsetsManager.cpp.

618 {
619 Interface &m_field = cOre;
621 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
622 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
623 if (std::distance(miit, hi_miit) == 0) {
624 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
625 "meshset name <%s> is not there", name.c_str());
626 }
627 if (std::distance(miit, hi_miit) > 1) {
628 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
629 "more that one meshser of that name <%s>", name.c_str());
630 }
631 *cubit_meshset_ptr = &*miit;
633}

◆ getEnd() [1/3]

CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getEnd ( ) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_FOR_LOOP(mField,it) { ... }

Definition at line 261 of file MeshsetsManager.hpp.

261 {
262 return cubitMeshsets.end();
263 }

◆ getEnd() [2/3]

CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getEnd ( const std::string &  name) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 373 of file MeshsetsManager.hpp.

373 {
374 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
375 }

◆ getEnd() [3/3]

CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getEnd ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 300 of file MeshsetsManager.hpp.

300 {
301 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
302 cubit_bc_type);
303 }

◆ getEntitiesByDimension() [1/2]

MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension ( const int  ms_id,
const unsigned int  cubit_bc_type,
const int  dimension,
Range entities,
const bool  recursive = true 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get entities from CUBIT/meshset of a particular entity dimension

Nodeset can contain nodes, edges, triangles and tets. This applies to other meshsets too. The nodeset's meshset contain the nodes in the MIDDLE of the surface or volume which is done by default in Cubit, Hence if all nodes on a particular nodeset are required, one should get all triangles or tetrahedrons for which the nodeset was create in Cubit, and get all the connectivities of tris/tets.

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
dimensions(0 - Nodes, 1 - Edges, 2 - Faces, 3 - Volume(tetrahedral))
Rangecontaining the retrieved entities
recursiveIf true, meshsets containing meshsets are queried recursively. Returns the contents of meshsets, but not the meshsets themselves if true.
Examples
mesh_cut.cpp, and prism_elements_from_surface.cpp.

Definition at line 680 of file MeshsetsManager.cpp.

682 {
683 Interface &m_field = cOre;
684 moab::Interface &moab = m_field.get_moab();
686 auto miit =
687 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
688 boost::make_tuple(msId, cubit_bc_type));
689 if (miit !=
690 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
691 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, dimension, entities,
692 recursive);
693 } else {
694 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
695 "msId = %d is not there", msId);
696 }
698}

◆ getEntitiesByDimension() [2/2]

MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension ( const int  ms_id,
const unsigned int  cubit_bc_type,
Range entities,
const bool  recursive = true 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get entities related to CUBIT/meshset,

NODESET will get Vertices only, even if the NODESET contains edges, tris and tets SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
Rangecontaining the retrieved entities related to the
recursiveIf true, meshsets containing meshsets are queried recursively. Returns the contents of meshsets, but not the meshsets themselves if true.

Definition at line 700 of file MeshsetsManager.cpp.

702 {
703 Interface &m_field = cOre;
704 moab::Interface &moab = m_field.get_moab();
706 auto miit =
707 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
708 boost::make_tuple(ms_id, cubit_bc_type));
709 if (miit !=
710 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
711 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, entities, recursive);
712 } else {
713 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
714 "ms_id = %d is not there", ms_id);
715 }
717}

◆ getMeshset()

MoFEMErrorCode MoFEM::MeshsetsManager::getMeshset ( const int  ms_id,
const unsigned int  cubit_bc_type,
EntityHandle meshset 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get meshset from CUBIT Id and CUBIT type

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
meshsetwhere to store the retrieved entities
Examples
free_surface.cpp, and mesh_cut.cpp.

Definition at line 719 of file MeshsetsManager.cpp.

721 {
722 Interface &m_field = cOre;
724 auto miit =
725 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
726 boost::make_tuple(ms_id, cubit_bc_type));
727 if (miit !=
728 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
729 meshset = miit->meshset;
730 } else {
731 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
732 "ms_id = %d is not there", ms_id);
733 }
735}

◆ getMeshsetsByType()

MoFEMErrorCode MoFEM::MeshsetsManager::getMeshsetsByType ( const unsigned int  cubit_bc_type,
Range meshsets 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get all CUBIT meshsets by CUBIT type

Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more).
meshsetsis range of meshsets

Definition at line 753 of file MeshsetsManager.cpp.

754 {
756 auto miit =
757 cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(cubit_bc_type);
758 auto hi_miit =
759 cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(cubit_bc_type);
760 for (; miit != hi_miit; miit++) {
761 meshsets.insert(miit->meshset);
762 }
764}