v0.15.0
Loading...
Searching...
No Matches
MoFEM::BcManager Struct Reference

Simple interface for fast problem set-up. More...

#include "src/interfaces/BcManager.hpp"

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

Classes

struct  BCs
 Data structure storing bc markers and atributes. More...
 

Public Types

using BcMapByBlockName = std::map<string, boost::shared_ptr<BCs>>
 
using BcMarkerPtr = boost::shared_ptr<std::vector<char unsigned>>
 

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 BcManager (const MoFEM::Core &core)
 
virtual ~BcManager ()=default
 
MoFEMErrorCode getOptions ()
 get options
 
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 side DOFs.
 
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 side DOFs.
 
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.
 
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 block DOFs.
 
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)
 Mark block DOFs.
 
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 block DOFs.
 
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)
 Mark block DOFs.
 
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 block DOFs.
 
boost::shared_ptr< BCspopMarkDOFsOnEntities (const std::string block_name)
 Get bc data and remove element.
 
auto getBcStructure (const std::string bc_id)
 Get the bc structure object.
 
BcMapByBlockNamegetBcMapByBlockName ()
 Get the bc map.
 
Range getMergedBlocksRange (std::vector< std::regex > bc_regex_vec)
 Merge block ranges.
 
auto getMergedBlocksRange (std::vector< string > bc_names)
 Merge block ranges.
 
BcMarkerPtr getMergedBlocksMarker (std::vector< std::regex > bc_regex_vec)
 Get the Merged Boundary Marker object.
 
auto getMergedBlocksMarker (std::vector< string > bc_names)
 Get the Merged Boundary Marker object.
 
BcMarkerPtr getMergedBlocksMarker (const std::vector< BcMarkerPtr > &boundary_markers_ptr_vec)
 Get the Merged Blocks Marker object.
 
auto checkBlock (const std::pair< string, boost::shared_ptr< BCs > > &bc, std::regex reg)
 check if given boundary condition name is in the map bc element
 
auto checkBlock (const std::pair< std::string, boost::shared_ptr< BCs > > &bc, std::string name)
 check if given boundary condition name is in the map bc element
 
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 >())
 Get block IS.
 
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 >())
 Get block IS.
 
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 form 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

Member Typedef Documentation

◆ BcMapByBlockName

using MoFEM::BcManager::BcMapByBlockName = std::map<string, boost::shared_ptr<BCs>>
Todo
Add markers for standard BCs from cubit on Nodests and Sidesets used bu cubit for displacements, forces, etc. Also add function to add blockset by id and type.

Definition at line 222 of file BcManager.hpp.

◆ BcMarkerPtr

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

Definition at line 224 of file BcManager.hpp.

Constructor & Destructor Documentation

◆ BcManager()

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

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.
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

◆ checkBlock() [1/2]

auto MoFEM::BcManager::checkBlock ( const std::pair< std::string, boost::shared_ptr< BCs > > & bc,
std::string name )
inline

check if given boundary condition name is in the map bc element

Parameters
bcelement of the map
namebc name
Returns
auto

Definition at line 314 of file BcManager.hpp.

315 {
316 auto full_name = std::string("(.*)_") + name + std::string("(.*)");
317 return checkBlock(bc, std::regex(full_name));
318 }
auto checkBlock(const std::pair< string, boost::shared_ptr< BCs > > &bc, std::regex reg)
check if given boundary condition name is in the map bc element

◆ checkBlock() [2/2]

auto MoFEM::BcManager::checkBlock ( const std::pair< string, boost::shared_ptr< BCs > > & bc,
std::regex reg )
inline

check if given boundary condition name is in the map bc element

Parameters
bcelement of the map
regbc regex
Returns
auto

Definition at line 302 of file BcManager.hpp.

303 {
304 return std::regex_match(bc.first, reg);
305 }

◆ 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 form 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
constexpr auto field_name

◆ getBcMapByBlockName()

BcMapByBlockName & MoFEM::BcManager::getBcMapByBlockName ( )
inline

Get the bc map.

Returns
auto
Examples
photon_diffusion.cpp.

Definition at line 240 of file BcManager.hpp.

240{ return bcMapByBlockName; }
BcMapByBlockName bcMapByBlockName

◆ getBcStructure()

auto MoFEM::BcManager::getBcStructure ( const std::string bc_id)
inline

Get the bc structure object.

Parameters
block_name
Returns
auto

Definition at line 231 of file BcManager.hpp.

231 {
232 return bcMapByBlockName.at(bc_id);
233 }

◆ getBlockIS() [1/2]

SmartPetscObj< IS > MoFEM::BcManager::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>() )

Get block IS.

Parameters
block_prefixfor hashmap
block_namefor hash map
field_namefor hash map and IS
problem_namefor IS
lo
hi
is_expandis to extend
Returns
SmartPetscObj<IS>
Examples
heat_equation.cpp, and wave_equation.cpp.

Definition at line 241 of file BcManager.cpp.

245 {
246 Interface &m_field = cOre;
247
248 const std::string bc_id =
249 block_prefix + "_" + field_name + "_" + block_name + "(.*)";
250
251 Range bc_ents;
252 for (auto bc : getBcMapByBlockName()) {
253 if (std::regex_match(bc.first, std::regex(bc_id))) {
254 bc_ents.merge(*(bc.second->getBcEntsPtr()));
255 MOFEM_LOG("BcMngWorld", Sev::verbose)
256 << "Get entities from block and add to IS. Block name " << bc.first;
257 }
258 }
259
260 SmartPetscObj<IS> is_bc;
261 auto get_is = [&]() {
263 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(bc_ents);
264 CHKERR m_field.getInterface<ISManager>()->isCreateProblemFieldAndRank(
265 problem_name, ROW, field_name, lo, hi, is_bc, &bc_ents);
266 if (is_expand) {
267 IS is_tmp;
268 CHKERR ISExpand(is_bc, is_expand, &is_tmp);
269 is_bc = SmartPetscObj<IS>(is_tmp);
270 }
271 CHKERR ISSort(is_bc);
273 };
274
275 if (get_is())
276 CHK_THROW_MESSAGE(MOFEM_DATA_INCONSISTENCY, "IS is not created");
277
278 return is_bc;
279}
@ ROW
#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.
DeprecatedCoreInterface Interface
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.

◆ getBlockIS() [2/2]

SmartPetscObj< IS > MoFEM::BcManager::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>() )

Get block IS.

Parameters
problem_name
block_name
field_name
lo
hi
is_expandis to extend
Returns
SmartPetscObj<IS>

Definition at line 281 of file BcManager.cpp.

284 {
285 return getBlockIS(problem_name, block_name, field_name, problem_name, lo, hi,
286 is_expand);
287}
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 >())
Get block IS.

◆ getMergedBlocksMarker() [1/3]

BcMarkerPtr MoFEM::BcManager::getMergedBlocksMarker ( const std::vector< BcMarkerPtr > & boundary_markers_ptr_vec)

Get the Merged Blocks Marker object.

Parameters
boundary_markers_ptr_vecvector of boundary markers to merge
Returns
BcMarkerPtr

◆ getMergedBlocksMarker() [2/3]

BcManager::BcMarkerPtr MoFEM::BcManager::getMergedBlocksMarker ( std::vector< std::regex > bc_regex_vec)

Get the Merged Boundary Marker object.

Parameters
bc_regex_vecboundary name regex vector
Returns
boundaryMarker

Definition at line 210 of file BcManager.cpp.

210 {
211 BcManager::BcMarkerPtr boundary_marker_ptr;
212 if (bcMapByBlockName.size()) {
213 for (auto b : bcMapByBlockName) {
214 for (auto &reg_name : bc_regex_vec) {
215 if (std::regex_match(b.first, reg_name)) {
216 if (!boundary_marker_ptr)
217 boundary_marker_ptr =
218 boost::make_shared<std::vector<char unsigned>>();
219 boundary_marker_ptr->resize(b.second->bcMarkers.size(), 0);
220 for (int i = 0; i != b.second->bcMarkers.size(); ++i) {
221 (*boundary_marker_ptr)[i] |= b.second->bcMarkers[i];
222 }
223 }
224 }
225 }
226 }
227 return boundary_marker_ptr;
228}
FTensor::Index< 'i', SPACE_DIM > i
boost::shared_ptr< std::vector< char unsigned > > BcMarkerPtr

◆ getMergedBlocksMarker() [3/3]

auto MoFEM::BcManager::getMergedBlocksMarker ( std::vector< string > bc_names)
inline

Get the Merged Boundary Marker object.

Parameters
bc_namesvector of boundary names
Returns
boundaryMarker

Definition at line 278 of file BcManager.hpp.

278 {
279 std::vector<std::regex> reg_vec(bc_names.size());
280 for (int i = 0; i != bc_names.size(); ++i) {
281 auto full_name = std::string("(.*)_") + bc_names[i] + std::string("(.*)");
282 reg_vec[i] = std::regex(full_name);
283 }
284 return getMergedBlocksMarker(reg_vec);
285 }
BcMarkerPtr getMergedBlocksMarker(std::vector< std::regex > bc_regex_vec)
Get the Merged Boundary Marker object.

◆ getMergedBlocksRange() [1/2]

Range MoFEM::BcManager::getMergedBlocksRange ( std::vector< std::regex > bc_regex_vec)

Merge block ranges.

Parameters
bc_regex_vec
Returns
Range

Definition at line 195 of file BcManager.cpp.

195 {
196 Range ents;
197 if (bcMapByBlockName.size()) {
198 for (auto b : bcMapByBlockName) {
199 for (auto &reg_name : bc_regex_vec) {
200 if (std::regex_match(b.first, reg_name)) {
201 ents.merge(b.second->bcEnts);
202 }
203 }
204 }
205 }
206 return ents;
207}

◆ getMergedBlocksRange() [2/2]

auto MoFEM::BcManager::getMergedBlocksRange ( std::vector< string > bc_names)
inline

Merge block ranges.

Parameters
bc_names
Returns
auto

Definition at line 256 of file BcManager.hpp.

256 {
257 std::vector<std::regex> reg_vec(bc_names.size());
258 for (int i = 0; i != bc_names.size(); ++i) {
259 auto full_name = std::string("(.*)_") + bc_names[i] + std::string("(.*)");
260 reg_vec[i] = std::regex(full_name);
261 }
262 return getMergedBlocksRange(reg_vec);
263 }
Range getMergedBlocksRange(std::vector< std::regex > bc_regex_vec)
Merge block ranges.

◆ getOptions()

MoFEMErrorCode MoFEM::BcManager::getOptions ( )

get options

Returns
error code

Definition at line 65 of file BcManager.cpp.

65 {
67 PetscOptionsBegin(PETSC_COMM_WORLD, "", "BcManager options", "none");
68 PetscOptionsEnd();
70}
#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 ...

◆ popMarkDOFsOnEntities()

boost::shared_ptr< BcManager::BCs > MoFEM::BcManager::popMarkDOFsOnEntities ( const std::string block_name)

Get bc data and remove element.

Parameters
block_name
Returns
boost::shared_ptr<BCs>

Definition at line 185 of file BcManager.cpp.

185 {
186 auto bc_it = bcMapByBlockName.find(block_name);
187 if (bc_it != bcMapByBlockName.end()) {
188 auto bc = bc_it->second;
189 bcMapByBlockName.erase(bc_it);
190 return bc;
191 }
192 return boost::shared_ptr<BCs>();
193}

◆ pushMarkDOFsOnEntities() [1/35]

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.
FTensor::Index< 'm', 3 > m
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 block DOFs.

◆ pushMarkDOFsOnEntities() [2/35]

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

Mark block DOFs.

Parameters
problem_name
field_name
block_name
get_low_dim_entsget lower dimension entities
Returns
MoFEMErrorCode

◆ pushMarkDOFsOnEntities() [3/35]

MoFEMErrorCode MoFEM::BcManager::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 block DOFs.

Parameters
problem_name
block_name
field_name
lolowest coefficient
hihighest coefficient
get_low_dim_entsget lower dimension entities field name
Returns
MoFEMErrorCode
Examples
EshelbianPlasticity.cpp.

Definition at line 110 of file BcManager.cpp.

114 {
115 Interface &m_field = cOre;
116 auto prb_mng = m_field.getInterface<ProblemsManager>();
118
119 // if(problem_name.size())
120 // MOFEM_LOG("BcMngWorld", Sev::warning)
121 // << "Argument problem_name has no effect";
122
123 auto fix_disp = [&]() {
125
126 auto mark_fix_dofs = [&](std::vector<unsigned char> &marked_field_dofs,
127 const auto lo, const auto hi) {
128 return prb_mng->modifyMarkDofs(problem_name, ROW, field_name, lo, hi,
130 marked_field_dofs);
131 };
132
133 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
135 for (auto m : meshset_vec_ptr) {
136 auto bc = boost::make_shared<BCs>();
137 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
138 bc->bcEnts, true);
139 CHKERR m->getAttributes(bc->bcAttributes);
140
141 if (problem_name.size())
142 CHKERR mark_fix_dofs(bc->bcMarkers, lo, hi);
143 MOFEM_LOG("BcMngWorld", Sev::verbose)
144 << "Found block " << m->getName() << " number of attributes "
145 << bc->bcAttributes.size();
146
147 if (get_low_dim_ents) {
148 auto low_dim_ents =
149 BcManagerImplTools::get_adj_ents(m_field.get_moab(), bc->bcEnts);
150 bc->bcEnts.swap(low_dim_ents);
151 }
152
153 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
154 bc->bcEnts);
155 if (problem_name.size())
156 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
157 bc->bcEnts, bc->bcMarkers);
158
159 const std::string bc_id =
160 problem_name + "_" + field_name + "_" + m->getName();
161 bcMapByBlockName[bc_id] = bc;
162 }
164 };
165
166 CHKERR iterate_meshsets(
167
168 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
169
170 (boost::format("%s(.*)") % block_name).str()
171
172 ))
173
174 );
175
177 };
178
179 CHKERR fix_disp();
180
182}
auto get_adj_ents(moab::Interface &moab, const Range &ents)
Definition BcManager.cpp:17
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ pushMarkDOFsOnEntities() [4/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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/35]

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() [18/35]

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() [19/35]

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.
@ NODESET
@ DISPLACEMENTSET
auto get_dim(const Range &ents)
Definition BcManager.cpp:10

◆ pushMarkDOFsOnEntities() [20/35]

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() [21/35]

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() [22/35]

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

◆ pushMarkDOFsOnEntities() [23/35]

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.
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.
1129 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1130 // get normal displacements boundary conditions.
1132 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1133 // get analytical displacements boundary conditions.
1135 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1137}

◆ pushMarkDOFsOnEntities() [24/35]

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 {
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
1173 problem_name, get_block_name(), field_name, get_low_dim_ents);
1175}

◆ pushMarkDOFsOnEntities() [25/35]

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 {
1206 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1208}

◆ pushMarkDOFsOnEntities() [26/35]

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() [27/35]

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}

◆ pushMarkDOFsOnEntities() [28/35]

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
1466 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1467
1469 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1470
1472 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1473
1475 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1476
1478 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
1479
1481}

◆ pushMarkDOFsOnEntities() [29/35]

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() [30/35]

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() [31/35]

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() [32/35]

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() [33/35]

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() [34/35]

template<typename T >
MoFEMErrorCode MoFEM::BcManager::pushMarkDOFsOnEntities ( const std::string problem_name,
const std::string field_name,
bool get_low_dim_ents = true,
bool block_name_field_prefix = false )

Mark block DOFs.

Parameters
problem_name
field_name
get_low_dim_entsget lower dimension entities
block_name_field_prefix
Returns
MoFEMErrorCode

◆ pushMarkDOFsOnEntities() [35/35]

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 )

◆ pushMarkSideDofs()

MoFEMErrorCode MoFEM::BcManager::pushMarkSideDofs ( const std::string problem_name,
const std::string block_name,
const std::string field_name,
int bridge_dim,
int lo,
int hi )

Mark side DOFs.

Parameters
problem_name
block_name
field_name
lo
hi
Returns
MoFEMErrorCode

Definition at line 1630 of file BcManager.cpp.

1635 {
1636 Interface &m_field = cOre;
1638
1639 if (problem_name.empty())
1641
1642 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
1643 auto prb_mng = m_field.getInterface<ProblemsManager>();
1645 for (auto m : meshset_vec_ptr) {
1646 auto bc = boost::make_shared<BCs>();
1647 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
1648 bc->bcEnts, true);
1649 CHKERR m->getAttributes(bc->bcAttributes);
1650
1651 bc->dofsViewPtr = boost::make_shared<BCs::DofsView>();
1652
1653 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
1654 bc->bcEnts);
1655 CHKERR prb_mng->getSideDofsOnBrokenSpaceEntities(
1656 *(bc->dofsViewPtr), problem_name, ROW, field_name, bc->bcEnts,
1657 bridge_dim, lo, hi);
1658 CHKERR prb_mng->markDofs(problem_name, ROW, *(bc->dofsViewPtr),
1659 ProblemsManager::OR, bc->bcMarkers);
1660
1661 MOFEM_LOG("BcMngWorld", Sev::inform)
1662 << "Found block " << m->getName() << " number of attributes "
1663 << bc->bcAttributes.size() << " number of entities "
1664 << bc->bcEnts.size();
1665
1666 const std::string bc_id =
1667 problem_name + "_" + field_name + "_" + m->getName();
1668 bcMapByBlockName[bc_id] = bc;
1669 }
1671 };
1672
1673 CHKERR iterate_meshsets(
1674
1675 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1676
1677 (boost::format("%s(.*)") % block_name).str()
1678
1679 ))
1680
1681 );
1682
1684}

◆ query_interface()

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

Implements MoFEM::UnknownInterface.

Definition at line 34 of file BcManager.cpp.

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

◆ removeBlockDOFsOnEntities() [1/25]

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/25]

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
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/25]

template<typename T >
MoFEMErrorCode MoFEM::BcManager::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 )

Mark block DOFs.

Template Parameters
BCSET
Parameters
problem_name
field_name
block_name
get_low_dim_ents
is_distributed_mesh
Returns
MoFEMErrorCode

◆ removeBlockDOFsOnEntities() [4/25]

MoFEMErrorCode MoFEM::BcManager::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.

Parameters
problem_name
block_name
field_name
lolowest coefficient
hihighest coefficient
get_low_dim_entsget lower dimension entities
is_distributed_meshdistributed mesh
Returns
MoFEMErrorCode
Examples
poisson_2d_homogeneous.cpp, schur_test_diag_mat.cpp, and tensor_divergence_operator.cpp.

Definition at line 72 of file BcManager.cpp.

75 {
76 Interface &m_field = cOre;
77 auto prb_mng = m_field.getInterface<ProblemsManager>();
79
80 CHKERR pushMarkDOFsOnEntities(problem_name, block_name, field_name, lo, hi,
81 get_low_dim_ents);
82
83 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
84 const int hi) {
85 if (is_distributed_mesh)
86 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
87 hi);
88 else
89 return prb_mng->removeDofsOnEntitiesNotDistributed(
90 problem_name, field_name, ents, lo, hi);
91 };
92
93 for (auto m :
94 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
95
96 (boost::format("%s(.*)") % block_name).str()
97
98 ))
99
100 ) {
101 const std::string bc_id =
102 problem_name + "_" + field_name + "_" + m->getName();
103 CHKERR remove_dofs_on_ents(bcMapByBlockName.at(bc_id)->bcEnts, lo, hi);
104 bcMapByBlockName.at(bc_id)->bcMarkers = std::vector<unsigned char>();
105 }
106
108}

◆ removeBlockDOFsOnEntities() [5/25]

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/25]

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/25]

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/25]

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/25]

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/25]

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/25]

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/25]

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/25]

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() [14/25]

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() [15/25]

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
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() [16/25]

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
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() [17/25]

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
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() [18/25]

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
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() [19/25]

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.
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
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}
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.
Definition BcManager.cpp:72

◆ removeBlockDOFsOnEntities() [20/25]

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 {
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
1195 problem_name, get_block_name(), field_name, get_low_dim_ents,
1196 is_distributed_mesh);
1198}

◆ removeBlockDOFsOnEntities() [21/25]

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 {
1217 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1218 is_distributed_mesh);
1220}

◆ removeBlockDOFsOnEntities() [22/25]

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
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() [23/25]

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
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() [24/25]

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
1620 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1621 is_distributed_mesh);
1622
1624 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
1625 is_distributed_mesh);
1626
1628};

◆ removeBlockDOFsOnEntities() [25/25]

template<typename T >
MoFEMErrorCode MoFEM::BcManager::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 )

Mark block DOFs.

Template Parameters
BCSET
Parameters
problem_name
field_name
get_low_dim_ents
is_distributed_mesh
block_name_field_prefix
Returns
MoFEMErrorCode

◆ removeSideDOFs()

MoFEMErrorCode MoFEM::BcManager::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 side DOFs.

Parameters
problem_name
block_name
field_name
lo
hi
is_distributed_mesh
Returns
MoFEMErrorCode
Examples
plot_base.cpp, and test_broken_space.cpp.

Definition at line 1686 of file BcManager.cpp.

1690 {
1691 Interface &m_field = cOre;
1693
1694 CHKERR pushMarkSideDofs(problem_name, block_name, field_name, bridge_dim, lo,
1695 hi);
1696
1697 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
1699 auto prb_mng = m_field.getInterface<ProblemsManager>();
1700 for (auto m : meshset_vec_ptr) {
1701 const std::string bc_id =
1702 problem_name + "_" + field_name + "_" + m->getName();
1703 auto &bc = bcMapByBlockName.at(bc_id);
1704 CHKERR prb_mng->removeDofs(problem_name, ROW, *(bc->dofsViewPtr), lo, hi);
1705 CHKERR prb_mng->removeDofs(problem_name, COL, *(bc->dofsViewPtr), lo, hi);
1706 }
1708 };
1709
1710 if (is_distributed_mesh) {
1711
1712 CHKERR iterate_meshsets(
1713
1714 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
1715
1716 (boost::format("%s(.*)") % block_name).str()
1717
1718 ))
1719
1720 );
1721 } else {
1722 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Not implemented");
1723 }
1724
1726}
@ COL
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 side DOFs.

Member Data Documentation

◆ bcMapByBlockName

BcMapByBlockName MoFEM::BcManager::bcMapByBlockName
private

Definition at line 367 of file BcManager.hpp.

◆ cOre

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

Definition at line 365 of file BcManager.hpp.


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