v0.15.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MoFEM::BcManager Struct Reference

Boundary condition manager for finite element problem setup. More...

#include "src/interfaces/BcManager.hpp"

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

Classes

struct  BCs
 Data structure storing boundary condition markers and attributes. More...
 

Public Types

using BcMapByBlockName = std::map< string, boost::shared_ptr< BCs > >
 Map of boundary condition blocks by name.
 
using BcMarkerPtr = boost::shared_ptr< std::vector< char unsigned > >
 Shared pointer to marker vector.
 

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for BcManager.
 
 BcManager (const MoFEM::Core &core)
 Constructor for BcManager.
 
virtual ~BcManager ()=default
 
MoFEMErrorCode getOptions ()
 Get command line options for BcManager.
 
MoFEMErrorCode pushMarkSideDofs (const std::string problem_name, const std::string block_name, const std::string field_name, int bridge_dim, int lo, int hi)
 Mark DOFs on side entities for boundary conditions.
 
MoFEMErrorCode removeSideDOFs (const std::string problem_name, const std::string block_name, const std::string field_name, int bridge_dim, int lo, int hi, bool is_distributed_mesh=true)
 Remove DOFs on side entities from problem.
 
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true, bool is_distributed_mesh=true)
 Remove DOFs from problem based on block entities.
 
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true)
 Mark DOFs on block entities for boundary conditions.
 
template<typename T >
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents=true, bool block_name_field_prefix=false, bool is_distributed_mesh=true)
 Remove DOFs based on boundary condition type template.
 
template<typename T >
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents=true, bool block_name_field_prefix=false)
 Mark DOFs based on boundary condition type template.
 
template<typename T >
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, bool get_low_dim_ents=true, bool is_distributed_mesh=true)
 Remove DOFs with explicit block specification.
 
template<typename T >
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, bool get_low_dim_ents=true)
 Mark DOFs with explicit block specification.
 
boost::shared_ptr< BCspopMarkDOFsOnEntities (const std::string block_name)
 Retrieve and remove boundary condition data.
 
auto getBcStructure (const std::string bc_id)
 Get boundary condition structure by identifier.
 
BcMapByBlockNamegetBcMapByBlockName ()
 Get the boundary condition map.
 
Range getMergedBlocksRange (std::vector< std::regex > bc_regex_vec)
 Merge entity ranges from multiple boundary condition blocks.
 
auto getMergedBlocksRange (std::vector< string > bc_names)
 Merge entity ranges by boundary condition names.
 
BcMarkerPtr getMergedBlocksMarker (std::vector< std::regex > bc_regex_vec)
 Merge DOF markers from multiple boundary condition blocks.
 
auto getMergedBlocksMarker (std::vector< string > bc_names)
 Merge DOF markers by boundary condition names.
 
BcMarkerPtr getMergedBlocksMarker (const std::vector< BcMarkerPtr > &boundary_markers_ptr_vec)
 Merge pre-existing marker vectors.
 
auto checkBlock (const std::pair< string, boost::shared_ptr< BCs > > &bc, std::regex reg)
 Check if boundary condition matches regular expression.
 
auto checkBlock (const std::pair< std::string, boost::shared_ptr< BCs > > &bc, std::string name)
 Check if boundary condition matches name pattern.
 
SmartPetscObj< IS > getBlockIS (const std::string block_prefix, const std::string block_name, const std::string field_name, const std::string problem_name, int lo, int hi, SmartPetscObj< IS > is_expand=SmartPetscObj< IS >())
 Create PETSc Index Set for boundary condition block.
 
SmartPetscObj< IS > getBlockIS (const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, SmartPetscObj< IS > is_expand=SmartPetscObj< IS >())
 Create PETSc Index Set for boundary condition block (simplified)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, bool get_low_dim_ents, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, const std::string block_name, bool get_low_dim_ents)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, bool get_low_dim_ents, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string block_name, const std::string field_name, bool get_low_dim_ents)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode removeBlockDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix, bool is_distributed_mesh)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
template<>
MoFEMErrorCode pushMarkDOFsOnEntities (const std::string problem_name, const std::string field_name, bool get_low_dim_ents, bool block_name_field_prefix)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 

Static Public Member Functions

static std::pair< std::string, std::string > extractStringFromBlockId (const std::string block_id, const std::string prb_name)
 Extract block name and block name from block id.
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 

Private Attributes

MoFEM::CorecOre
 
BcMapByBlockName bcMapByBlockName
 

Detailed Description

Boundary condition manager for finite element problem setup.

The BcManager provides a high-level, type-safe interface for applying boundary conditions to finite element problems. It serves as the bridge between MeshsetsManager's mesh-based boundary condition discovery and the actual implementation of Essential and Natural boundary conditions in finite element computations.

Connection to MeshsetsManager

BcManager operates as the application layer above MeshsetsManager:

Data Flow Architecture:

  1. MeshsetsManager: Discovers and organizes meshsets from mesh files
  2. BcManager: Translates meshset data into DOF-level operations
  3. Essential/Natural BC Classes: Use BcManager data for implementation

Information Transfer:

Essential vs Natural Boundary Conditions

BcManager provides the foundation for both Essential and Natural boundary condition implementations through different operational modes:

Essential Boundary Conditions (Dirichlet)

Implementation Strategy: Remove constrained DOFs from the finite element system

BcManager Role:

Typical Essential BC Workflow:

// 1. Mark DOFs for boundary condition
bc_manager.pushMarkDOFsOnEntities<DisplacementCubitBcData>(
problem_name, field_name);
// 2. Remove constrained DOFs from system
bc_manager.removeBlockDOFsOnEntities<DisplacementCubitBcData>(
problem_name, field_name);
// 3. Apply prescribed values to eliminated DOFs
// (handled by Essential BC implementation classes)
constexpr auto field_name
Definition of the displacement bc data structure.
Definition BCData.hpp:72

Examples: Fixed displacements, prescribed temperatures, velocity constraints

Natural Boundary Conditions (Neumann)

Implementation Strategy: Apply through load vectors and boundary integrals

BcManager Role:

Typical Natural BC Workflow:

// 1. Mark DOFs affected by boundary condition
bc_manager.pushMarkDOFsOnEntities<ForceCubitBcData>(
problem_name, field_name);
// 2. Get entity range for boundary integration
auto bc_data = bc_manager.getBcStructure(block_name);
auto entities = bc_data->getBcEntsPtr();
// 3. Integrate over boundary entities
// (handled by Natural BC implementation classes)
Definition of the force bc data structure.
Definition BCData.hpp:135

Examples: Applied forces, pressure loads, heat flux, traction boundaries

Usage with BC Implementation Classes

Essential and Natural BC implementation classes use BcManager as their data source:

Essential BC Classes Usage:

Natural BC Classes Usage:

Template Specialization System

BcManager uses template specializations to provide type-safe, physics-specific boundary condition handling:

NODESET vs SIDESET vs BLOCKSET Specializations:

Physics-Specific Specializations:

Key capabilities:

Examples
mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/tutorials/adv-0/plastic.cpp, mofem/tutorials/adv-2/thermo_elastic.cpp, mofem/tutorials/adv-4/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5/seepage.cpp, mofem/tutorials/fun-2/plot_base.cpp, mofem/tutorials/scl-1/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-10/initial_diffusion.cpp, mofem/tutorials/scl-10/photon_diffusion.cpp, mofem/tutorials/scl-6/heat_equation.cpp, mofem/tutorials/scl-7/wave_equation.cpp, mofem/tutorials/vec-3/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4/shallow_wave.cpp, mofem/tutorials/vec-5/free_surface.cpp, mofem/tutorials/vec-7/adjoint.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, and mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 384 of file BcManager.hpp.

Member Typedef Documentation

◆ BcMapByBlockName

using MoFEM::BcManager::BcMapByBlockName = std::map<string, boost::shared_ptr<BCs> >

Map of boundary condition blocks by name.

Definition at line 671 of file BcManager.hpp.

◆ BcMarkerPtr

using MoFEM::BcManager::BcMarkerPtr = boost::shared_ptr<std::vector<char unsigned> >

Shared pointer to marker vector.

Definition at line 673 of file BcManager.hpp.

Constructor & Destructor Documentation

◆ BcManager()

MoFEM::BcManager::BcManager ( const MoFEM::Core core)

Constructor for BcManager.

Parameters
corereference to MoFEM Core interface for accessing mesh and field data

Definition at line 41 of file BcManager.cpp.

41 : cOre(const_cast<Core &>(core)) {
42
43 if (!LogManager::checkIfChannelExist("BcMngWorld")) {
44 auto core_log = logging::core::get();
45
46 core_log->add_sink(
48 core_log->add_sink(
50 core_log->add_sink(
52
53 LogManager::setLog("BcMngWorld");
54 LogManager::setLog("BcMngSync");
55 LogManager::setLog("BcMngSelf");
56
57 MOFEM_LOG_TAG("BcMngWorld", "BcMng");
58 MOFEM_LOG_TAG("BcMngSync", "BcMng");
59 MOFEM_LOG_TAG("BcMngSelf", "BcMng");
60 }
61
62 MOFEM_LOG("BcMngWorld", Sev::noisy) << "BC manager created";
63}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
CoreTmp< 0 > Core
Definition Core.hpp:1148
MoFEM::Core & cOre
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.

◆ ~BcManager()

virtual MoFEM::BcManager::~BcManager ( )
virtualdefault

Member Function Documentation

◆ extractStringFromBlockId()

std::pair< std::string, std::string > MoFEM::BcManager::extractStringFromBlockId ( const std::string  block_id,
const std::string  prb_name 
)
static

Extract block name and block name from block id.

Parameters
block_id
prb_name
Returns
std::pair<std::string, std::string>

Definition at line 1223 of file BcManager.cpp.

1224 {
1225
1226 // Assumes that field name is consist with letters and numbers.
1227 // No special characters.
1228 auto field_rgx_str =
1229 (boost::format("%s_([a-zA-Z0-9]*)_(.*)") % prb_name).str();
1230 std::regex field_rgx(field_rgx_str);
1231 std::smatch match_field_name;
1232 std::string field_name;
1233 std::string block_name;
1234
1235 if (std::regex_search(block_id, match_field_name, field_rgx)) {
1236 field_name = match_field_name[1];
1237 block_name = match_field_name[2];
1238 } else {
1240 "Field name and block name can not be resolved");
1241 }
1242
1243 return std::make_pair(field_name, block_name);
1244}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31

◆ pushMarkDOFsOnEntities() [1/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  block_name,
const std::string  field_name,
bool  get_low_dim_ents 
)

Definition at line 1084 of file BcManager.cpp.

1086 {
1088
1089 CHKERR pushMarkDOFsOnEntities(problem_name, block_name, field_name, 0,
1090 MAX_DOFS_ON_ENTITY, get_low_dim_ents);
1091
1092 auto regex_str =
1093 (boost::format("%s_%s_%s(.*)") % problem_name % field_name % block_name)
1094 .str();
1095
1096 for (auto &m : bcMapByBlockName) {
1097
1098 auto &bc_id = m.first;
1099
1100 if (std::regex_match(bc_id, std::regex(regex_str))) {
1101
1102 auto &bc = m.second;
1103 bc->tempBcPtr = boost::make_shared<TemperatureCubitBcData>();
1104 bc->tempBcPtr->data.flag1 = 1;
1105 if (bc->bcAttributes.empty()) {
1106 bc->tempBcPtr->data.value1 = 0;
1107 MOFEM_LOG("BcMngWorld", Sev::warning)
1108 << "Expected one attribute on block but have "
1109 << bc->bcAttributes.size();
1110 } else if (bc->bcAttributes.size() >= 1) {
1111 bc->tempBcPtr->data.value1 = bc->bcAttributes[0];
1112 }
1113 }
1114 }
1115
1117}
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
#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.
MoFEMErrorCode pushMarkDOFsOnEntities(const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true)
Mark DOFs on block entities for boundary conditions.
FTensor::Index< 'm', 3 > m
BcMapByBlockName bcMapByBlockName

◆ pushMarkDOFsOnEntities() [2/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [3/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [4/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [5/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [6/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [7/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [8/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [9/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [10/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [11/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [12/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [13/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [14/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [15/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [16/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

◆ pushMarkDOFsOnEntities() [17/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 588 of file BcManager.cpp.

591 {
592 Interface &m_field = cOre;
593 auto prb_mng = m_field.getInterface<ProblemsManager>();
595
596 // if(problem_name.size()==0)
597 // MOFEM_LOG("BcMngWorld", Sev::warning)
598 // << "Argument problem_name has no effect";
599
600 if (block_name_field_prefix)
601 MOFEM_LOG("BcMngWorld", Sev::warning)
602 << "Argument block_name_field_prefix=true has no effect";
603
604 auto fix_disp = [&]() {
606
607 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
609 for (auto m : meshset_vec_ptr) {
610 auto bc = boost::make_shared<BCs>();
611 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
612 bc->bcEnts, true);
613 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
614 CHKERR m->getBcDataStructure(*(bc->dispBcPtr));
615
616 MOFEM_LOG("BcMngWorld", Sev::verbose)
617 << "Found block DISPLACEMENTSET id = " << m->getMeshsetId();
618 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->dispBcPtr;
619
620 MOFEM_LOG("BcMngSync", Sev::noisy)
621 << "Found block DISPLACEMENTSET id = " << m->getMeshsetId()
622 << " nb. of entities " << bc->bcEnts.size()
623 << " highest dim of entities "
624 << BcManagerImplTools::get_dim(bc->bcEnts);
625 MOFEM_LOG("BcMngSync", Sev::noisy) << *bc->dispBcPtr;
626 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
627
628 if (problem_name.size()) {
629
630 if (bc->dispBcPtr->data.flag1)
631 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
633 bc->bcMarkers);
634 if (bc->dispBcPtr->data.flag2)
635 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
637 bc->bcMarkers);
638 if (bc->dispBcPtr->data.flag3)
639 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
641 bc->bcMarkers);
642 if (bc->dispBcPtr->data.flag4) {
643
644 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
646 bc->bcMarkers);
647 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
649 bc->bcMarkers);
650 }
651 if (bc->dispBcPtr->data.flag5) {
652
653 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
655 bc->bcMarkers);
656 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
658 bc->bcMarkers);
659 }
660 if (bc->dispBcPtr->data.flag6) {
661
662 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
664 bc->bcMarkers);
665 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
667 bc->bcMarkers);
668 }
669 }
670
671 if (get_low_dim_ents) {
672 auto low_dim_ents =
673 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
674 bc->bcEnts.swap(low_dim_ents);
675 }
676
677 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
678 bc->bcEnts);
679 if (problem_name.size())
680 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
681 bc->bcEnts, bc->bcMarkers);
682
683 const std::string bc_id =
684 problem_name + "_" + field_name + "_DISPLACEMENTSET" +
685 boost::lexical_cast<std::string>(m->getMeshsetId());
686 bcMapByBlockName[bc_id] = bc;
687 }
689 };
690
691 CHKERR iterate_meshsets(
692
693 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
695
696 );
697
699 };
700
701 CHKERR fix_disp();
702
704}
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
@ ROW
@ NODESET
@ DISPLACEMENTSET
auto get_dim(const Range &ents)
Definition BcManager.cpp:10
auto get_adj_ents(moab::Interface &moab, const Range &ents)
Definition BcManager.cpp:17
DeprecatedCoreInterface Interface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ pushMarkDOFsOnEntities() [18/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 707 of file BcManager.cpp.

709 {
710 Interface &m_field = cOre;
711 auto prb_mng = m_field.getInterface<ProblemsManager>();
713
714 if (block_name_field_prefix)
715 MOFEM_LOG("BcMngWorld", Sev::warning)
716 << "Argument block_name_field_prefix=true has no effect";
717
718 auto fix_temp = [&]() {
720
721 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
723 for (auto m : meshset_vec_ptr) {
724 auto bc = boost::make_shared<BCs>();
725 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
726 bc->bcEnts, true);
727 bc->tempBcPtr = boost::make_shared<TemperatureCubitBcData>();
728 CHKERR m->getBcDataStructure(*(bc->tempBcPtr));
729
730 MOFEM_LOG("BcMngWorld", Sev::verbose)
731 << "Found block TEMPERATURESET id = " << m->getMeshsetId();
732 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->tempBcPtr;
733
734 CHKERR prb_mng->modifyMarkDofs(
735 problem_name, ROW, field_name, 0, MAX_DOFS_ON_ENTITY,
736 ProblemsManager::MarkOP::OR, 1, bc->bcMarkers);
737
738 if (get_low_dim_ents) {
739 auto low_dim_ents =
740 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
741 bc->bcEnts.swap(low_dim_ents);
742 }
743
744 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
745 bc->bcEnts);
746 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
747 bc->bcEnts, bc->bcMarkers);
748
749 const std::string bc_id =
750 problem_name + "_" + field_name + "_TEMPERATURESET" +
751 boost::lexical_cast<std::string>(m->getMeshsetId());
752 bcMapByBlockName[bc_id] = bc;
753 }
755 };
756
757 CHKERR iterate_meshsets(
758
759 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
761
762 );
763
765 };
766
767 CHKERR fix_temp();
768
770}
@ TEMPERATURESET

◆ pushMarkDOFsOnEntities() [19/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 773 of file BcManager.cpp.

775 {
776 Interface &m_field = cOre;
777 auto prb_mng = m_field.getInterface<ProblemsManager>();
779
780 if (block_name_field_prefix)
781 MOFEM_LOG("BcMngWorld", Sev::warning)
782 << "Argument block_name_field_prefix=true has no effect";
783
784 auto fix_disp = [&]() {
786
787 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
789 for (auto m : meshset_vec_ptr) {
790 auto bc = boost::make_shared<BCs>();
791 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
792 bc->bcEnts, true);
793 bc->heatFluxBcPtr = boost::make_shared<HeatFluxCubitBcData>();
794 CHKERR m->getBcDataStructure(*(bc->heatFluxBcPtr));
795
796 CHKERR prb_mng->modifyMarkDofs(
797 problem_name, ROW, field_name, 0, MAX_DOFS_ON_ENTITY,
798 ProblemsManager::MarkOP::OR, 1, bc->bcMarkers);
799
800 MOFEM_LOG("BcMngWorld", Sev::inform)
801 << "Found block HEATFLUX id = " << m->getMeshsetId();
802 MOFEM_LOG("BcMngWorld", Sev::inform) << *bc->heatFluxBcPtr;
803
804 if (get_low_dim_ents) {
805 auto low_dim_ents =
806 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
807 bc->bcEnts.swap(low_dim_ents);
808 }
809
810 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
811 bc->bcEnts);
812 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
813 bc->bcEnts, bc->bcMarkers);
814
815 const std::string bc_id =
816 problem_name + "_" + field_name + "_HEATFLUXSET" +
817 boost::lexical_cast<std::string>(m->getMeshsetId());
818 bcMapByBlockName[bc_id] = bc;
819 }
821 };
822
823 CHKERR iterate_meshsets(
824
825 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(SIDESET |
827
828 );
829
831 };
832
833 CHKERR fix_disp();
834
836}
@ HEATFLUXSET
@ SIDESET

◆ pushMarkDOFsOnEntities() [20/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 839 of file BcManager.cpp.

842 {
844
845 auto mark_dofs = [&](const string block_name, const int &idx_0,
846 const int &idx_1) {
848 if (block_name_field_prefix) {
849 const string field_block = field_name + "_" + block_name;
850 CHKERR pushMarkDOFsOnEntities(problem_name, field_block, field_name,
851 idx_0, idx_1, get_low_dim_ents);
852 } else {
853
854 CHKERR pushMarkDOFsOnEntities(problem_name, block_name, field_name, idx_0,
855 idx_1, get_low_dim_ents);
856 }
858 };
859
860 // displacement
861 CHKERR mark_dofs("FIX_X", 0, 0);
862 CHKERR mark_dofs("FIX_Y", 1, 1);
863 CHKERR mark_dofs("FIX_Z", 2, 2);
864 CHKERR mark_dofs("FIX_ALL", 0, MAX_DOFS_ON_ENTITY);
865
866 // rotation
867 CHKERR mark_dofs("ROTATE_X", 1, 1);
868 CHKERR mark_dofs("ROTATE_X", 2, 2);
869 CHKERR mark_dofs("ROTATE_Y", 0, 0);
870 CHKERR mark_dofs("ROTATE_Y", 2, 2);
871 CHKERR mark_dofs("ROTATE_Z", 0, 0);
872 CHKERR mark_dofs("ROTATE_Z", 1, 1);
873 CHKERR mark_dofs("ROTATE_ALL", 0, MAX_DOFS_ON_ENTITY);
874
875 std::string regex_str;
876 if (block_name_field_prefix) {
877 regex_str = (boost::format("%s_%s_%s_(.*)") % problem_name % field_name %
879 .str();
880 } else {
881 regex_str = (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
882 }
883
884 for (auto &m : bcMapByBlockName) {
885 auto &bc_id = m.first;
886 if (std::regex_match(bc_id, std::regex(regex_str))) {
887 auto &bc = m.second;
888 if (std::regex_match(bc_id, std::regex("(.*)_FIX_X(.*)"))) {
889 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
890 bc->dispBcPtr->data.flag1 = 1;
891 if (bc->bcAttributes.empty()) {
892 bc->dispBcPtr->data.value1 = 0;
893 MOFEM_LOG("BcMngWorld", Sev::warning)
894 << "Expected one attribute on block but have "
895 << bc->bcAttributes.size();
896 } else if (bc->bcAttributes.size() >= 1) {
897 bc->dispBcPtr->data.value1 = bc->bcAttributes[0];
898 }
899 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add X " << bc_id;
900 MOFEM_LOG("BcMngWorld", Sev::inform) << *bc->dispBcPtr;
901 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_Y(.*)"))) {
902 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
903 bc->dispBcPtr->data.flag2 = 1;
904 if (bc->bcAttributes.empty()) {
905 bc->dispBcPtr->data.value2 = 0;
906 MOFEM_LOG("BcMngWorld", Sev::warning)
907 << "Expected one attribute on block but have "
908 << bc->bcAttributes.size();
909 } else if (bc->bcAttributes.size() == 1) {
910 bc->dispBcPtr->data.value2 = bc->bcAttributes[0];
911 } else if (bc->bcAttributes.size() >= 2) {
912 bc->dispBcPtr->data.value2 = bc->bcAttributes[1];
913 }
914 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Y " << bc_id;
915 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
916 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_Z(.*)"))) {
917 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
918 bc->dispBcPtr->data.flag3 = 1;
919 if (bc->bcAttributes.empty()) {
920 bc->dispBcPtr->data.value3 = 0;
921 MOFEM_LOG("BcMngWorld", Sev::warning)
922 << "Expected one attribute on block but have "
923 << bc->bcAttributes.size();
924 } else if (bc->bcAttributes.size() == 1) {
925 bc->dispBcPtr->data.value3 = bc->bcAttributes[0];
926 } else if (bc->bcAttributes.size() == 3) {
927 bc->dispBcPtr->data.value3 = bc->bcAttributes[2];
928 }
929 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Z " << bc_id;
930 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
931 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_ALL(.*)"))) {
932 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
933 bc->dispBcPtr->data.flag1 = 1;
934 bc->dispBcPtr->data.flag2 = 1;
935 bc->dispBcPtr->data.flag3 = 1;
936 if (bc->bcAttributes.size() >= 1) {
937 bc->dispBcPtr->data.value1 = bc->bcAttributes[0];
938 }
939 if (bc->bcAttributes.size() >= 2) {
940 bc->dispBcPtr->data.value2 = bc->bcAttributes[1];
941 }
942 if (bc->bcAttributes.size() >= 3) {
943 bc->dispBcPtr->data.value3 = bc->bcAttributes[2];
944 }
945 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add ALL " << bc_id;
946 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
947 } else if (std::regex_match(bc_id, std::regex("(.*)_ROTATE_X(.*)"))) {
948 bc->dispBcPtr =
949 boost::make_shared<DisplacementCubitBcDataWithRotation>();
950 bc->dispBcPtr->data.flag4 = 1;
951 bc->dispBcPtr->data.flag5 = 0;
952 bc->dispBcPtr->data.flag6 = 0;
953 // for the ROTATE_X block the angles can be specified with either one or
954 // three attributes, e.g. 1, coords or 1,0,0,coords
955 if (bc->bcAttributes.empty()) {
956 bc->dispBcPtr->data.value4 = 0;
957 MOFEM_LOG("BcMngWorld", Sev::warning)
958 << "Expected one attribute on block on block (angle (1 or 3), "
959 "center coords(3) but have "
960 << bc->bcAttributes.size();
961 } else if (bc->bcAttributes.size() >= 1) {
962 bc->dispBcPtr->data.value4 = bc->bcAttributes[0];
963 }
964 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add X " << bc_id;
965 MOFEM_LOG("BcMngWorld", Sev::inform) << *bc->dispBcPtr;
966 if (bc->bcAttributes.size() == 4 || bc->bcAttributes.size() == 6) {
967 if (auto ext_disp_bc =
968 dynamic_cast<DisplacementCubitBcDataWithRotation *>(
969 bc->dispBcPtr.get())) {
970 auto &o = ext_disp_bc->rotOffset;
971 for (int a = 0; a != 3; ++a)
972 o[a] = bc->bcAttributes[bc->bcAttributes.size() - 3 + a];
973 MOFEM_LOG("BcMngWorld", Sev::inform)
974 << "Add Rotate X Center: " << o[0] << " " << o[1] << " "
975 << o[2];
976 }
977 }
978 } else if (std::regex_match(bc_id, std::regex("(.*)_ROTATE_Y(.*)"))) {
979 bc->dispBcPtr =
980 boost::make_shared<DisplacementCubitBcDataWithRotation>();
981 bc->dispBcPtr->data.flag4 = 0;
982 bc->dispBcPtr->data.flag5 = 1;
983 bc->dispBcPtr->data.flag6 = 0;
984 // for the ROTATE_Y block the angles can be specified with either one or
985 // three attributes, e.g. 1, coords or 0,1,0,coords
986 if (bc->bcAttributes.empty()) {
987 bc->dispBcPtr->data.value5 = 0;
988 MOFEM_LOG("BcMngWorld", Sev::warning)
989 << "Expected one attribute on block on block (angle (1 or 3), "
990 "center coords(3) but have "
991 << bc->bcAttributes.size();
992 } else if (bc->bcAttributes.size() == 1 ||
993 bc->bcAttributes.size() == 4) {
994 bc->dispBcPtr->data.value5 = bc->bcAttributes[0];
995 } else if (bc->bcAttributes.size() == 6) {
996 bc->dispBcPtr->data.value5 = bc->bcAttributes[1];
997 }
998 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Y " << bc_id;
999 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
1000 if (bc->bcAttributes.size() == 4 || bc->bcAttributes.size() == 6) {
1001 if (auto ext_disp_bc =
1002 dynamic_cast<DisplacementCubitBcDataWithRotation *>(
1003 bc->dispBcPtr.get())) {
1004 auto &o = ext_disp_bc->rotOffset;
1005 for (int a = 0; a != 3; ++a)
1006 o[a] = bc->bcAttributes[bc->bcAttributes.size() - 3 + a];
1007 MOFEM_LOG("BcMngWorld", Sev::inform)
1008 << "Add Rotate Y Center: " << o[0] << " " << o[1] << " "
1009 << o[2];
1010 }
1011 }
1012 } else if (std::regex_match(bc_id, std::regex("(.*)_ROTATE_Z(.*)"))) {
1013 bc->dispBcPtr =
1014 boost::make_shared<DisplacementCubitBcDataWithRotation>();
1015 bc->dispBcPtr->data.flag4 = 0;
1016 bc->dispBcPtr->data.flag5 = 0;
1017 bc->dispBcPtr->data.flag6 = 1;
1018 // for the ROTATE_Z block the angles can be specified with either one or
1019 // three attributes, e.g. 1, coords or 0,0,1,coords
1020 if (bc->bcAttributes.empty()) {
1021 bc->dispBcPtr->data.value6 = 0;
1022 MOFEM_LOG("BcMngWorld", Sev::warning)
1023 << "Expected one attribute on block (angle (1 or 3), center "
1024 "coords(3) but have "
1025 << bc->bcAttributes.size();
1026 } else if (bc->bcAttributes.size() == 1 ||
1027 bc->bcAttributes.size() == 4) {
1028 bc->dispBcPtr->data.value6 = bc->bcAttributes[0];
1029 } else if (bc->bcAttributes.size() == 3 ||
1030 bc->bcAttributes.size() == 6) {
1031 bc->dispBcPtr->data.value6 = bc->bcAttributes[2];
1032 }
1033 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Z " << bc_id;
1034 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
1035 if (bc->bcAttributes.size() == 4 || bc->bcAttributes.size() == 6) {
1036 if (auto ext_disp_bc =
1037 dynamic_cast<DisplacementCubitBcDataWithRotation *>(
1038 bc->dispBcPtr.get())) {
1039 auto &o = ext_disp_bc->rotOffset;
1040 for (int a = 0; a != 3; ++a)
1041 o[a] = bc->bcAttributes[bc->bcAttributes.size() - 3 + a];
1042 MOFEM_LOG("BcMngWorld", Sev::inform)
1043 << "Add Rotate Z Center: " << o[0] << " " << o[1] << " "
1044 << o[2];
1045 }
1046 }
1047 } else if (std::regex_match(bc_id, std::regex("(.*)_ROTATE_ALL(.*)"))) {
1048 bc->dispBcPtr =
1049 boost::make_shared<DisplacementCubitBcDataWithRotation>();
1050 bc->dispBcPtr->data.flag4 = 1;
1051 bc->dispBcPtr->data.flag5 = 1;
1052 bc->dispBcPtr->data.flag6 = 1;
1053 if (bc->bcAttributes.size() >= 1) {
1054 bc->dispBcPtr->data.value4 = bc->bcAttributes[0];
1055 }
1056 if (bc->bcAttributes.size() >= 2) {
1057 bc->dispBcPtr->data.value5 = bc->bcAttributes[1];
1058 }
1059 if (bc->bcAttributes.size() >= 3) {
1060 bc->dispBcPtr->data.value6 = bc->bcAttributes[2];
1061 }
1062 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add ALL " << bc_id;
1063 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
1064 if (bc->bcAttributes.size() > 3) {
1065 if (auto ext_disp_bc =
1066 dynamic_cast<DisplacementCubitBcDataWithRotation *>(
1067 bc->dispBcPtr.get())) {
1068 auto &o = ext_disp_bc->rotOffset;
1069 for (int a = 0; a != 3; ++a)
1070 o[a] = bc->bcAttributes[3 + a];
1071 MOFEM_LOG("BcMngWorld", Sev::inform)
1072 << "Add Rotate ALL Center: " << o[0] << " " << o[1] << " "
1073 << o[2];
1074 }
1075 }
1076 }
1077 }
1078 }
1079
1081}
constexpr double a
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

◆ pushMarkDOFsOnEntities() [21/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1120 of file BcManager.cpp.

1122 {
1124 // that marks DOFs and create data when are set by cubit nodesets.
1125 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
1126 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1127 // that marks DOFs and create data when are set by blocsket.
1128 CHKERR pushMarkDOFsOnEntities<BcDisplacementMeshsetType<BLOCKSET>>(
1129 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1130 // get normal displacements boundary conditions.
1131 CHKERR pushMarkDOFsOnEntities<BcNormalDisplacementMeshsetType<BLOCKSET>>(
1132 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1133 // get analytical displacements boundary conditions.
1134 CHKERR pushMarkDOFsOnEntities<BcAnalyticalDisplacementMeshsetType<BLOCKSET>>(
1135 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1137}

◆ pushMarkDOFsOnEntities() [22/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1158 of file BcManager.cpp.

1160 {
1162 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<TEMPERATURESET>>(
1163 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1164
1165 auto get_block_name = [&]() {
1166 if (block_name_field_prefix)
1167 return (boost::format("%s_FIX_SCALAR") % field_name).str();
1168 else
1169 return field_name;
1170 };
1171
1172 CHKERR pushMarkDOFsOnEntities<BcScalarMeshsetType<BLOCKSET>>(
1173 problem_name, get_block_name(), field_name, get_low_dim_ents);
1175}

◆ pushMarkDOFsOnEntities() [23/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1201 of file BcManager.cpp.

1203 {
1205 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
1206 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1208}

◆ pushMarkDOFsOnEntities() [24/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1247 of file BcManager.cpp.

1249 {
1250 Interface &m_field = cOre;
1251 auto prb_mng = m_field.getInterface<ProblemsManager>();
1253
1254 if (problem_name.empty())
1255 MOFEM_LOG("BcMngWorld", Sev::warning) << "Argument problem_name is empty";
1256
1257 if (block_name_field_prefix)
1258 MOFEM_LOG("BcMngWorld", Sev::warning)
1259 << "Argument block_name_field_prefix=true has no effect";
1260
1261 auto fix_force = [&]() {
1263
1264 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
1266 for (auto m : meshset_vec_ptr) {
1267 auto bc = boost::make_shared<BCs>();
1268 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1269 bc->bcEnts, true);
1270 bc->forceBcPtr = boost::make_shared<ForceCubitBcData>();
1271 CHKERR m->getBcDataStructure(*(bc->forceBcPtr));
1272
1273 MOFEM_LOG("BcMngWorld", Sev::verbose)
1274 << "Found block FORCESET id = " << m->getMeshsetId();
1275 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->forceBcPtr;
1276
1277 MOFEM_LOG("BcMngSync", Sev::noisy)
1278 << "Found block FORCESET id = " << m->getMeshsetId()
1279 << " nb. of entities " << bc->bcEnts.size()
1280 << " highest dim of entities "
1281 << BcManagerImplTools::get_dim(bc->bcEnts);
1282 MOFEM_LOG("BcMngSync", Sev::noisy) << *bc->forceBcPtr;
1283 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1284
1285 if (problem_name.size()) {
1286
1287 if (bc->forceBcPtr->data.value2 > 0)
1288 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
1290 bc->bcMarkers);
1291 if (bc->forceBcPtr->data.value3 > 0)
1292 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
1294 bc->bcMarkers);
1295 if (bc->forceBcPtr->data.value4 > 0)
1296 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
1298 bc->bcMarkers);
1299
1300 if (bc->forceBcPtr->data.value5 > 0) {
1301
1302 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
1304 bc->bcMarkers);
1305 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
1307 bc->bcMarkers);
1308 }
1309 if (bc->forceBcPtr->data.value5) {
1310
1311 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
1313 bc->bcMarkers);
1314 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
1316 bc->bcMarkers);
1317 }
1318 if (bc->forceBcPtr->data.value6) {
1319
1320 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
1322 bc->bcMarkers);
1323 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
1325 bc->bcMarkers);
1326 }
1327 }
1328
1329 if (get_low_dim_ents) {
1330 auto low_dim_ents =
1331 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
1332 bc->bcEnts.swap(low_dim_ents);
1333 }
1334
1335 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1336 bc->bcEnts);
1337 if (problem_name.size())
1338 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
1339 bc->bcEnts, bc->bcMarkers);
1340
1341 const std::string bc_id =
1342 problem_name + "_" + field_name + "_FORCESET" +
1343 boost::lexical_cast<std::string>(m->getMeshsetId());
1344 bcMapByBlockName[bc_id] = bc;
1345 }
1347 };
1348
1349 CHKERR iterate_meshsets(
1350
1351 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(NODESET |
1352 FORCESET)
1353
1354 );
1355
1357 };
1358
1359 CHKERR fix_force();
1360
1362}
@ FORCESET

◆ pushMarkDOFsOnEntities() [25/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1365 of file BcManager.cpp.

1367 {
1368 Interface &m_field = cOre;
1369 auto prb_mng = m_field.getInterface<ProblemsManager>();
1371
1372 if (problem_name.size() == 0)
1373 MOFEM_LOG("BcMngWorld", Sev::warning) << "Argument problem_name is empty";
1374
1375 auto get_force_block = [&](auto block_name) {
1377
1378 for (auto m :
1379 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1380
1381 (boost::format("%s(.*)") % block_name).str()
1382
1383 ))
1384
1385 ) {
1386
1387 const auto block_name = m->getName();
1388
1389 MOFEM_LOG("BcMngWorld", Sev::inform)
1390 << "Found force block " << block_name;
1391
1392 auto bc = boost::make_shared<BCs>();
1393 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1394 bc->bcEnts, true);
1395
1396 CHKERR m->getAttributes(bc->bcAttributes);
1397 if (bc->bcAttributes.size() < 3) {
1398 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1399 "At least three block attributes for force block are expected");
1400 }
1401
1402 bc->forceBcPtr = boost::make_shared<ForceCubitBcData>();
1403 // For details look at ForceCubitBcData in
1404 // mofem/src/multi_indices/BCData.hpp
1405 bc->forceBcPtr->data.value1 = 1;
1406 bc->forceBcPtr->data.value3 = bc->bcAttributes[0];
1407 bc->forceBcPtr->data.value4 = bc->bcAttributes[1];
1408 bc->forceBcPtr->data.value5 = bc->bcAttributes[2];
1409
1410 MOFEM_LOG("BcMngWorld", Sev::inform) << *bc->forceBcPtr;
1411 MOFEM_LOG("BcMngSync", Sev::noisy)
1412 << "Found block FORCESET id = " << m->getMeshsetId()
1413 << " nb. of entities " << bc->bcEnts.size()
1414 << " highest dim of entities "
1415 << BcManagerImplTools::get_dim(bc->bcEnts);
1416 MOFEM_LOG("BcMngSync", Sev::noisy) << *bc->forceBcPtr;
1417 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1418
1419 if (problem_name.size()) {
1420
1421 if (bc->forceBcPtr->data.value2 > 0)
1422 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
1424 bc->bcMarkers);
1425 if (bc->forceBcPtr->data.value3 > 0)
1426 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
1428 bc->bcMarkers);
1429 if (bc->forceBcPtr->data.value4 > 0)
1430 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
1432 bc->bcMarkers);
1433 }
1434
1435 if (get_low_dim_ents) {
1436 auto low_dim_ents =
1437 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
1438 bc->bcEnts.swap(low_dim_ents);
1439 }
1440
1441 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1442 bc->bcEnts);
1443 if (problem_name.size())
1444 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
1445 bc->bcEnts, bc->bcMarkers);
1446
1447 const std::string bc_id =
1448 problem_name + "_" + field_name + "_" + block_name;
1449 bcMapByBlockName[bc_id] = bc;
1450 }
1452 };
1453
1454 CHKERR get_force_block("FORCE");
1455
1457}
IFACE getInterface() const
Get interface pointer to pointer of interface.

◆ pushMarkDOFsOnEntities() [26/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1460 of file BcManager.cpp.

1462 {
1464
1465 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<FORCESET>>(
1466 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1467
1468 CHKERR pushMarkDOFsOnEntities<BcForceMeshsetType<BLOCKSET>>(
1469 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1470
1471 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<PRESSURESET>>(
1472 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1473
1474 CHKERR pushMarkDOFsOnEntities<BcPressureMeshsetType<BLOCKSET>>(
1475 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1476
1477 CHKERR pushMarkDOFsOnEntities<BcAnalyticalTractionMeshsetType<BLOCKSET>>(
1478 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1479
1481}

◆ pushMarkDOFsOnEntities() [27/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1729 of file BcManager.cpp.

1732 {
1733 Interface &m_field = cOre;
1735
1736 if (problem_name.size() == 0)
1737 MOFEM_LOG("BcMngWorld", Sev::warning) << "Argument problem_name is empty";
1738
1739 auto get_normal_disp_block = [&](auto block_name) {
1741
1742 for (auto m :
1743 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1744
1745 (boost::format("%s(.*)") % block_name).str()
1746
1747 ))
1748
1749 ) {
1750
1751 std::string bc_id =
1752 problem_name + "_" + field_name + "_" + m->getName();
1753 std::string regex_str;
1754 if (block_name_field_prefix) {
1755 regex_str = (boost::format("%s_%s_%s_%s(.*)") % problem_name %
1756 field_name % field_name % block_name)
1757 .str();
1758 } else {
1759 regex_str = (boost::format("%s_%s_%s(.*)") % problem_name % field_name %
1760 block_name)
1761 .str();
1762 }
1763
1764 if (std::regex_match(bc_id, std::regex(regex_str))) {
1765
1766 MOFEM_LOG("BcMngWorld", Sev::inform)
1767 << "Normal displacement block " << m->getName();
1768
1769 auto bc = boost::make_shared<BCs>();
1770 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1771 bc->bcEnts, true);
1772
1773 CHKERR m->getAttributes(bc->bcAttributes);
1774 if (bc->bcAttributes.size() < 1) {
1775 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1776 "At least one block attribute expected");
1777 }
1778
1779 // normal is applied in the current configuration
1780 auto current_normal =
1781 bc->bcAttributes.size() <= 1 ? false : bc->bcAttributes[1];
1782
1783 MOFEM_LOG("BcMngSync", Sev::noisy)
1784 << "Found block NATURAL_DISPLACEMENT id = " << m->getMeshsetId()
1785 << " nb. of entities " << bc->bcEnts.size()
1786 << " highest dim of entities "
1787 << BcManagerImplTools::get_dim(bc->bcEnts) << " value "
1788 << bc->bcAttributes[0] << " current normal " << current_normal;
1789 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1790
1791 if (get_low_dim_ents) {
1792 auto low_dim_ents =
1793 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
1794 bc->bcEnts.swap(low_dim_ents);
1795 }
1796
1797 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1798 bc->bcEnts);
1799 bcMapByBlockName[bc_id] = bc;
1800 }
1801 }
1803 };
1804
1805 CHKERR get_normal_disp_block("NORMAL_DISPLACEMENT");
1806
1808}

◆ pushMarkDOFsOnEntities() [28/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1811 of file BcManager.cpp.

1814 {
1815 Interface &m_field = cOre;
1817
1818 if (problem_name.size() == 0)
1819 MOFEM_LOG("BcMngWorld", Sev::warning) << "Argument problem_name is empty";
1820
1821 auto get_analytical_disp_block = [&](auto block_name) {
1823
1824 for (auto m :
1825 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1826
1827 (boost::format("%s(.*)") % block_name).str()
1828
1829 ))
1830
1831 ) {
1832
1833 std::string bc_id = problem_name + "_" + field_name + "_" + m->getName();
1834 std::string regex_str;
1835 if (block_name_field_prefix) {
1836 regex_str = (boost::format("%s_%s_%s_%s(.*)") % problem_name %
1837 field_name % field_name % block_name)
1838 .str();
1839 } else {
1840 regex_str = (boost::format("%s_%s_%s(.*)") % problem_name % field_name %
1841 block_name)
1842 .str();
1843 }
1844
1845 if (std::regex_match(bc_id, std::regex(regex_str))) {
1846
1847 MOFEM_LOG("BcMngWorld", Sev::inform)
1848 << "Found analytical displacement block " << m->getName();
1849
1850 auto bc = boost::make_shared<BCs>();
1851 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1852 bc->bcEnts, true);
1853
1854 CHKERR m->getAttributes(bc->bcAttributes);
1855 if (bc->bcAttributes.size() < 3) {
1856 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1857 "At least three block attribute expected");
1858 }
1859
1860 MOFEM_LOG("BcMngSync", Sev::noisy)
1861 << "Found block ANALYTICAL_DISPLACEMENT id = " << m->getMeshsetId()
1862 << " nb. of entities " << bc->bcEnts.size()
1863 << " highest dim of entities "
1864 << BcManagerImplTools::get_dim(bc->bcEnts) << " value "
1865 << bc->bcAttributes[0] << bc->bcAttributes[1] << bc->bcAttributes[2];
1866 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1867
1868 if (get_low_dim_ents) {
1869 auto low_dim_ents =
1870 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
1871 bc->bcEnts.swap(low_dim_ents);
1872 }
1873
1874 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1875 bc->bcEnts);
1876 bcMapByBlockName[bc_id] = bc;
1877 }
1878 }
1880 };
1881
1882 CHKERR get_analytical_disp_block("ANALYTICAL_DISPLACEMENT");
1883
1885}

◆ pushMarkDOFsOnEntities() [29/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1888 of file BcManager.cpp.

1890 {
1891 Interface &m_field = cOre;
1893
1894 if (block_name_field_prefix)
1895 MOFEM_LOG("BcMngWorld", Sev::warning)
1896 << "Argument block_name_field_prefix=true has no effect";
1897
1898 auto fix_pressure = [&]() {
1900
1901 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
1903 for (auto m : meshset_vec_ptr) {
1904 auto bc = boost::make_shared<BCs>();
1905 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1906 bc->bcEnts, true);
1907 bc->pressureBcPtr = boost::make_shared<PressureCubitBcData>();
1908 CHKERR m->getBcDataStructure(*(bc->pressureBcPtr));
1909
1910 MOFEM_LOG("BcMngWorld", Sev::verbose)
1911 << "Found block FORCESET id = " << m->getMeshsetId();
1912 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->pressureBcPtr;
1913
1914 MOFEM_LOG("BcMngSync", Sev::noisy)
1915 << "Found block FORCESET id = " << m->getMeshsetId()
1916 << " nb. of entities " << bc->bcEnts.size()
1917 << " highest dim of entities "
1918 << BcManagerImplTools::get_dim(bc->bcEnts);
1919 MOFEM_LOG("BcMngSync", Sev::noisy) << *bc->forceBcPtr;
1920 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1921
1922 if (get_low_dim_ents) {
1923 auto low_dim_ents =
1924 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
1925 bc->bcEnts.swap(low_dim_ents);
1926 }
1927
1928 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1929 bc->bcEnts);
1930 const std::string bc_id =
1931 problem_name + "_" + field_name + "_FORCESET" +
1932 boost::lexical_cast<std::string>(m->getMeshsetId());
1933 bcMapByBlockName[bc_id] = bc;
1934 }
1936 };
1937
1938 CHKERR iterate_meshsets(
1939
1940 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(SIDESET |
1941 FORCESET)
1942
1943 );
1944
1946 };
1947
1948 CHKERR fix_pressure();
1949
1951}

◆ pushMarkDOFsOnEntities() [30/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 1954 of file BcManager.cpp.

1957 {
1958 Interface &m_field = cOre;
1960
1961 auto get_pressure_block = [&](auto block_name) {
1963
1964 for (auto m :
1965 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1966
1967 (boost::format("%s(.*)") % block_name).str()
1968
1969 ))
1970
1971 ) {
1972
1973 std::string bc_id = problem_name + "_" + field_name + "_" + m->getName();
1974 std::string regex_str;
1975 if (block_name_field_prefix) {
1976 regex_str = (boost::format("%s_%s_%s_%s(.*)") % problem_name %
1977 field_name % field_name % block_name)
1978 .str();
1979 } else {
1980 regex_str = (boost::format("%s_%s_%s(.*)") % problem_name % field_name %
1981 block_name)
1982 .str();
1983 }
1984
1985 if (std::regex_match(bc_id, std::regex(regex_str))) {
1986
1987 MOFEM_LOG("BcMngWorld", Sev::inform)
1988 << "Found force block " << block_name;
1989
1990 auto bc = boost::make_shared<BCs>();
1991 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1992 bc->bcEnts, true);
1993
1994 CHKERR m->getAttributes(bc->bcAttributes);
1995 if (bc->bcAttributes.size() < 1) {
1996 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1997 "At least one block attribute expected");
1998 }
1999
2000 bc->pressureBcPtr = boost::make_shared<PressureCubitBcData>();
2001 bc->pressureBcPtr->data.value1 = 1;
2002
2003 MOFEM_LOG("BcMngWorld", Sev::verbose)
2004 << "Found block PRESSURE id = " << m->getMeshsetId();
2005 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->pressureBcPtr;
2006
2007 MOFEM_LOG("BcMngSync", Sev::noisy)
2008 << "Found block PRESSURE id = " << m->getMeshsetId()
2009 << " nb. of entities " << bc->bcEnts.size()
2010 << " highest dim of entities "
2011 << BcManagerImplTools::get_dim(bc->bcEnts) << " value "
2012 << bc->bcAttributes[0];
2013 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
2014
2015 if (get_low_dim_ents) {
2016 auto low_dim_ents =
2017 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
2018 bc->bcEnts.swap(low_dim_ents);
2019 }
2020
2021 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
2022 bc->bcEnts);
2023 const std::string bc_id =
2024 problem_name + "_" + field_name + "_" + block_name;
2025 bcMapByBlockName[bc_id] = bc;
2026 }
2027 }
2029 };
2030
2031 CHKERR get_pressure_block("PRESSURE");
2032
2034}

◆ pushMarkDOFsOnEntities() [31/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix 
)

Definition at line 2037 of file BcManager.cpp.

2040 {
2041 Interface &m_field = cOre;
2043
2044 auto get_analytical_traction_block = [&](auto block_name) {
2046
2047 for (auto m :
2048 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
2049
2050 (boost::format("%s(.*)") % block_name).str()
2051
2052 ))
2053
2054 ) {
2055
2056 std::string bc_id = problem_name + "_" + field_name + "_" + m->getName();
2057 std::string regex_str;
2058 if (block_name_field_prefix) {
2059 regex_str = (boost::format("%s_%s_%s_%s(.*)") % problem_name %
2060 field_name % field_name % block_name)
2061 .str();
2062 } else {
2063 regex_str = (boost::format("%s_%s_%s(.*)") % problem_name % field_name %
2064 block_name)
2065 .str();
2066 }
2067
2068 if (std::regex_match(bc_id, std::regex(regex_str))) {
2069
2070 MOFEM_LOG("BcMngWorld", Sev::inform)
2071 << "Found analytical traction block " << m->getName();
2072
2073 auto bc = boost::make_shared<BCs>();
2074 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
2075 bc->bcEnts, true);
2076
2077 CHKERR m->getAttributes(bc->bcAttributes);
2078 if (bc->bcAttributes.size() < 3) {
2079 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
2080 "At least one block attribute expected");
2081 }
2082
2083 MOFEM_LOG("BcMngSync", Sev::noisy)
2084 << "Found block ANALTICAL_TRACTION id = " << m->getMeshsetId()
2085 << " nb. of entities " << bc->bcEnts.size()
2086 << " highest dim of entities "
2087 << BcManagerImplTools::get_dim(bc->bcEnts) << " values "
2088 << bc->bcAttributes[0] << bc->bcAttributes[1] << bc->bcAttributes[2];
2089 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
2090
2091 if (get_low_dim_ents) {
2092 auto low_dim_ents =
2093 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
2094 bc->bcEnts.swap(low_dim_ents);
2095 }
2096 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
2097 bc->bcEnts);
2098 bcMapByBlockName[bc_id] = bc;
2099 }
2100 }
2102 };
2103 CHKERR get_analytical_traction_block("ANALYTICAL_TRACTION");
2104
2106}

◆ pushMarkDOFsOnEntities() [32/32]

template<>
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
const std::string  block_name,
bool  get_low_dim_ents 
)

◆ query_interface()

MoFEMErrorCode MoFEM::BcManager::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Query interface for BcManager.

Parameters
type_indextype index for the interface to query
ifacepointer to store the interface
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::UnknownInterface.

Definition at line 34 of file BcManager.cpp.

35 {
37 *iface = const_cast<BcManager *>(this);
39}
BcManager(const MoFEM::Core &core)
Constructor for BcManager.
Definition BcManager.cpp:41

◆ removeBlockDOFsOnEntities() [1/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  block_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [2/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  block_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  is_distributed_mesh 
)

Definition at line 532 of file BcManager.cpp.

536 {
537 Interface &m_field = cOre;
538 auto prb_mng = m_field.getInterface<ProblemsManager>();
540
541 CHKERR pushMarkDOFsOnEntities<BcScalarMeshsetType<BLOCKSET>>(
542 problem_name, block_name, field_name, get_low_dim_ents);
543
544 Range ents_to_remove;
545
546 for (auto m :
547
548 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
550
551 std::string bc_id = problem_name + "_" + field_name + "_" + m->getName();
552
553 auto str = boost::format("%s_%s_%s(.*)")
554
555 % problem_name % field_name % block_name;
556
557 if (std::regex_match(bc_id, std::regex(str.str()))) {
558
559 auto bc = bcMapByBlockName.at(bc_id);
560
561 if (auto temp_bc = bc->tempBcPtr) {
562 if (temp_bc->data.flag1) {
563 ents_to_remove.merge(bc->bcEnts);
564 }
565 } else {
566 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
567 "BC type not implemented");
568 }
569 }
570 }
571
572 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
573 const int hi) {
574 if (is_distributed_mesh)
575 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
576 hi);
577 else
578 return prb_mng->removeDofsOnEntitiesNotDistributed(
579 problem_name, field_name, ents, lo, hi);
580 };
581
582 CHKERR remove_dofs_on_ents(ents_to_remove, 0, MAX_DOFS_ON_ENTITY);
583
585}
@ UNKNOWNNAME
@ BLOCKSET

◆ removeBlockDOFsOnEntities() [3/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [4/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [5/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [6/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [7/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [8/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [9/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [10/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [11/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [12/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

◆ removeBlockDOFsOnEntities() [13/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 290 of file BcManager.cpp.

294 {
295 Interface &m_field = cOre;
296 auto prb_mng = m_field.getInterface<ProblemsManager>();
298
299 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
300 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
301
302 std::array<Range, 3> ents_to_remove;
303
304 for (auto m :
305
306 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
308
309 const std::string bc_id =
310 problem_name + "_" + field_name + "_DISPLACEMENTSET" +
311 boost::lexical_cast<std::string>(m->getMeshsetId());
312
313 auto bc = bcMapByBlockName.at(bc_id);
314
315 if (bc->dispBcPtr) {
316 if (bc->dispBcPtr->data.flag1) {
317 ents_to_remove[0].merge(bc->bcEnts);
318 }
319 if (bc->dispBcPtr->data.flag2) {
320 ents_to_remove[1].merge(bc->bcEnts);
321 }
322 if (bc->dispBcPtr->data.flag3) {
323 ents_to_remove[2].merge(bc->bcEnts);
324 }
325 if (bc->dispBcPtr->data.flag4) {
326 ents_to_remove[1].merge(bc->bcEnts);
327 ents_to_remove[2].merge(bc->bcEnts);
328 }
329 if (bc->dispBcPtr->data.flag5) {
330 ents_to_remove[0].merge(bc->bcEnts);
331 ents_to_remove[2].merge(bc->bcEnts);
332 }
333 if (bc->dispBcPtr->data.flag6) {
334 ents_to_remove[0].merge(bc->bcEnts);
335 ents_to_remove[1].merge(bc->bcEnts);
336 }
337 }
338 bc->bcMarkers = std::vector<unsigned char>();
339 }
340
341 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
342 const int hi) {
343 if (is_distributed_mesh)
344 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
345 hi);
346 else
347 return prb_mng->removeDofsOnEntitiesNotDistributed(
348 problem_name, field_name, ents, lo, hi);
349 };
350
351 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
352 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
353 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
354
356}

◆ removeBlockDOFsOnEntities() [14/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 359 of file BcManager.cpp.

363 {
364 Interface &m_field = cOre;
365 auto prb_mng = m_field.getInterface<ProblemsManager>();
367
368 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<TEMPERATURESET>>(
369 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
370
371 Range ents_to_remove;
372
373 for (auto m :
374
375 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
377
378 ) {
379 const std::string bc_id =
380 problem_name + "_" + field_name + "_TEMPERATURESET" +
381 boost::lexical_cast<std::string>(m->getMeshsetId());
382 auto bc = bcMapByBlockName.at(bc_id);
383 ents_to_remove.merge(bc->bcEnts);
384 bc->bcMarkers = std::vector<unsigned char>();
385 }
386
387 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
388 const int hi) {
389 if (is_distributed_mesh)
390 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
391 hi);
392 else
393 return prb_mng->removeDofsOnEntitiesNotDistributed(
394 problem_name, field_name, ents, lo, hi);
395 };
396
397 CHKERR remove_dofs_on_ents(ents_to_remove, 0, MAX_DOFS_ON_ENTITY);
398
400}

◆ removeBlockDOFsOnEntities() [15/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 403 of file BcManager.cpp.

406 {
407 Interface &m_field = cOre;
408 auto prb_mng = m_field.getInterface<ProblemsManager>();
410
411 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
412 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
413
414 Range ents_to_remove;
415
416 for (auto m :
417
418 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(NODESET |
420
421 ) {
422 const std::string bc_id =
423 problem_name + "_" + field_name + "_HEATFLUXSET" +
424 boost::lexical_cast<std::string>(m->getMeshsetId());
425 auto bc = bcMapByBlockName.at(bc_id);
426 ents_to_remove.merge(bc->bcEnts);
427 bc->bcMarkers = std::vector<unsigned char>();
428 }
429
430 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
431 const int hi) {
432 if (is_distributed_mesh)
433 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
434 hi);
435 else
436 return prb_mng->removeDofsOnEntitiesNotDistributed(
437 problem_name, field_name, ents, lo, hi);
438 };
439
440 CHKERR remove_dofs_on_ents(ents_to_remove, 0, MAX_DOFS_ON_ENTITY);
441
443}

◆ removeBlockDOFsOnEntities() [16/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 446 of file BcManager.cpp.

450 {
451 Interface &m_field = cOre;
452 auto prb_mng = m_field.getInterface<ProblemsManager>();
454
455 CHKERR pushMarkDOFsOnEntities<BcDisplacementMeshsetType<BLOCKSET>>(
456 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
457
458 std::array<Range, 3> ents_to_remove;
459
460 for (auto m :
461
462 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
464
465 const auto block_name = m->getName();
466
467 std::string bc_id = problem_name + "_" + field_name + "_" + block_name;
468 std::string regex_str;
469 if (block_name_field_prefix) {
470 regex_str = (boost::format("%s_%s_%s_((FIX_(ALL|X|Y|Z))|("
471 "DISPLACEMENT|ROTATE))(.*)") %
472 problem_name % field_name % field_name)
473 .str();
474 } else {
475 regex_str = (boost::format("%s_%s_((FIX_(ALL|X|Y|Z))|("
476 "DISPLACEMENT|ROTATE))(.*)") %
477 problem_name % field_name)
478 .str();
479 }
480
481 if (std::regex_match(bc_id, std::regex(regex_str))) {
482
483 auto bc = bcMapByBlockName.at(bc_id);
484
485 if (auto disp_bc = bc->dispBcPtr) {
486 if (disp_bc->data.flag1) {
487 ents_to_remove[0].merge(bc->bcEnts);
488 }
489 if (disp_bc->data.flag2) {
490 ents_to_remove[1].merge(bc->bcEnts);
491 }
492 if (disp_bc->data.flag3) {
493 ents_to_remove[2].merge(bc->bcEnts);
494 }
495 if (disp_bc->data.flag4) {
496 ents_to_remove[1].merge(bc->bcEnts);
497 ents_to_remove[2].merge(bc->bcEnts);
498 }
499 if (disp_bc->data.flag5) {
500 ents_to_remove[0].merge(bc->bcEnts);
501 ents_to_remove[2].merge(bc->bcEnts);
502 }
503 if (disp_bc->data.flag6) {
504 ents_to_remove[0].merge(bc->bcEnts);
505 ents_to_remove[1].merge(bc->bcEnts);
506 }
507 } else {
508 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
509 "BC type not implemented");
510 }
511 }
512 }
513
514 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
515 const int hi) {
516 if (is_distributed_mesh)
517 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
518 hi);
519 else
520 return prb_mng->removeDofsOnEntitiesNotDistributed(
521 problem_name, field_name, ents, lo, hi);
522 };
523
524 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
525 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
526 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
527
529}

◆ removeBlockDOFsOnEntities() [17/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1140 of file BcManager.cpp.

1143 {
1145 // that remove DOFs when are set by cubit nodesets.
1146 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
1147 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1148 is_distributed_mesh);
1149 // that remove DOFs when are by blocksets
1150 CHKERR removeBlockDOFsOnEntities<BcDisplacementMeshsetType<BLOCKSET>>(
1151 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1152 is_distributed_mesh);
1153 // add more ways to remove bcs when appropiate
1155}

◆ removeBlockDOFsOnEntities() [18/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1178 of file BcManager.cpp.

1181 {
1183 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<TEMPERATURESET>>(
1184 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1185 is_distributed_mesh);
1186
1187 auto get_block_name = [&]() {
1188 if (block_name_field_prefix)
1189 return (boost::format("%s_FIX_SCALAR") % field_name).str();
1190 else
1191 return field_name;
1192 };
1193
1194 CHKERR removeBlockDOFsOnEntities<BcScalarMeshsetType<BLOCKSET>>(
1195 problem_name, get_block_name(), field_name, get_low_dim_ents,
1196 is_distributed_mesh);
1198}

◆ removeBlockDOFsOnEntities() [19/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1211 of file BcManager.cpp.

1214 {
1216 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
1217 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1218 is_distributed_mesh);
1220}

◆ removeBlockDOFsOnEntities() [20/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1484 of file BcManager.cpp.

1487 {
1488 Interface &m_field = cOre;
1489 auto prb_mng = m_field.getInterface<ProblemsManager>();
1491
1492 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<FORCESET>>(
1493 problem_name, field_name, get_low_dim_ents);
1494
1495 std::array<Range, 3> ents_to_remove;
1496
1497 for (auto m :
1498
1499 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(NODESET |
1500 FORCESET)) {
1501
1502 const auto block_name = m->getName();
1503 std::string bc_id = problem_name + "_" + field_name + "_" + block_name;
1504
1505 auto str = boost::format("%s_%s_%s(.*)")
1506
1507 % problem_name % field_name % block_name;
1508
1509 if (std::regex_match(bc_id, std::regex(str.str()))) {
1510
1511 auto bc = bcMapByBlockName.at(bc_id);
1512
1513 if (auto force_bc = bc->forceBcPtr) {
1514 if (force_bc->data.value3 > 0) {
1515 ents_to_remove[0].merge(bc->bcEnts);
1516 }
1517 if (force_bc->data.value4 > 0) {
1518 ents_to_remove[1].merge(bc->bcEnts);
1519 }
1520 if (force_bc->data.value5 > 0) {
1521 ents_to_remove[2].merge(bc->bcEnts);
1522 }
1523 } else {
1524 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1525 "BC type not implemented");
1526 }
1527 }
1528 }
1529
1530 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
1531 const int hi) {
1532 if (is_distributed_mesh)
1533 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
1534 hi);
1535 else
1536 return prb_mng->removeDofsOnEntitiesNotDistributed(
1537 problem_name, field_name, ents, lo, hi);
1538 };
1539
1540 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
1541 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
1542 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
1543
1545}

◆ removeBlockDOFsOnEntities() [21/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1548 of file BcManager.cpp.

1552 {
1553 Interface &m_field = cOre;
1554 auto prb_mng = m_field.getInterface<ProblemsManager>();
1556
1557 CHKERR pushMarkDOFsOnEntities<BcForceMeshsetType<BLOCKSET>>(
1558 problem_name, field_name, get_low_dim_ents);
1559
1560 std::array<Range, 3> ents_to_remove;
1561
1562 for (auto m :
1563
1564 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
1565 BLOCKSET | UNKNOWNNAME)) {
1566
1567 const auto block_name = m->getName();
1568 std::string bc_id = problem_name + "_" + field_name + "_" + block_name;
1569
1570 auto str = boost::format("%s_%s_%s(.*)")
1571
1572 % problem_name % field_name % block_name;
1573
1574 if (std::regex_match(bc_id, std::regex(str.str()))) {
1575
1576 auto bc = bcMapByBlockName.at(bc_id);
1577
1578 if (auto force_bc = bc->forceBcPtr) {
1579 if (force_bc->data.value3 > 0) {
1580 ents_to_remove[0].merge(bc->bcEnts);
1581 }
1582 if (force_bc->data.value4 > 0) {
1583 ents_to_remove[1].merge(bc->bcEnts);
1584 }
1585 if (force_bc->data.value5 > 0) {
1586 ents_to_remove[2].merge(bc->bcEnts);
1587 }
1588 } else {
1589 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1590 "BC type not implemented");
1591 }
1592 }
1593 }
1594
1595 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
1596 const int hi) {
1597 if (is_distributed_mesh)
1598 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
1599 hi);
1600 else
1601 return prb_mng->removeDofsOnEntitiesNotDistributed(
1602 problem_name, field_name, ents, lo, hi);
1603 };
1604
1605 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
1606 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
1607 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
1608
1610}

◆ removeBlockDOFsOnEntities() [22/22]

template<>
MoFEMErrorCode MoFEM::BcManager::removeBlockDOFsOnEntities ( const std::string  problem_name,
const std::string  field_name,
bool  get_low_dim_ents,
bool  block_name_field_prefix,
bool  is_distributed_mesh 
)

Definition at line 1613 of file BcManager.cpp.

1616 {
1618
1619 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<FORCESET>>(
1620 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1621 is_distributed_mesh);
1622
1623 CHKERR removeBlockDOFsOnEntities<BcForceMeshsetType<BLOCKSET>>(
1624 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1625 is_distributed_mesh);
1626
1628};

Member Data Documentation

◆ bcMapByBlockName

BcMapByBlockName MoFEM::BcManager::bcMapByBlockName
private

Definition at line 876 of file BcManager.hpp.

◆ cOre

MoFEM::Core& MoFEM::BcManager::cOre
private

Definition at line 874 of file BcManager.hpp.


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