v0.13.1
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
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 More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
boost::shared_ptr< BCspopMarkDOFsOnEntities (const std::string block_name)
 Get bc data and remove element. More...
 
auto getBcStructure (const std::string bc_id)
 Get the bc structure object. More...
 
BcMapByBlockNamegetBcMapByBlockName ()
 Get the bc map. More...
 
BcMarkerPtr getMergedBlocksMarker (std::vector< std::regex > bc_regex_vec)
 Get the Merged Boundary Marker object. More...
 
auto getMergedBlocksMarker (std::vector< string > bc_names)
 Get the Merged Boundary Marker object. More...
 
BcMarkerPtr getMergedBlocksMarker (const std::vector< BcMarkerPtr > &boundary_markers_ptr_vec)
 Get the Merged Blocks Marker object. More...
 
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 More...
 
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 More...
 
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. More...
 
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. More...
 
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 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 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 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 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)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
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. More...
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Private Attributes

MoFEM::CorecOre
 
BcMapByBlockName bcMapByBlockName
 

Detailed Description

Simple interface for fast problem set-up.

Examples
contact.cpp, free_surface.cpp, heat_equation.cpp, nonlinear_elastic.cpp, photon_diffusion.cpp, plastic.cpp, shallow_wave.cpp, thermo_elastic.cpp, and wave_equation.cpp.

Definition at line 23 of file BcManager.hpp.

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 147 of file BcManager.hpp.

◆ BcMarkerPtr

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

Definition at line 149 of file BcManager.hpp.

Constructor & Destructor Documentation

◆ BcManager()

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

Definition at line 16 of file BcManager.cpp.

16 : cOre(const_cast<Core &>(core)) {
17
18 if (!LogManager::checkIfChannelExist("BcMngWorld")) {
19 auto core_log = logging::core::get();
20
21 core_log->add_sink(
23 core_log->add_sink(
25 core_log->add_sink(
27
28 LogManager::setLog("BcMngWorld");
29 LogManager::setLog("BcMngSync");
30 LogManager::setLog("BcMngSelf");
31
32 MOFEM_LOG_TAG("BcMngWorld", "BcMng");
33 MOFEM_LOG_TAG("BcMngSync", "BcMng");
34 MOFEM_LOG_TAG("BcMngSelf", "BcMng");
35 }
36
37 MOFEM_LOG("BcMngWorld", Sev::noisy) << "BC manager created";
38}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:364
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:332
CoreTmp< 0 > Core
Definition: Core.hpp:1086
MoFEM::Core & cOre
Definition: BcManager.hpp:266
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:279
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:323
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:327
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:374
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:319

◆ ~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 215 of file BcManager.hpp.

216 {
217 auto full_name = std::string("(.*)_") + name + std::string("(.*)");
218 return checkBlock(bc, std::regex(full_name));
219 }
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
Definition: BcManager.hpp:203

◆ 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 203 of file BcManager.hpp.

204 {
205 return std::regex_match(bc.first, reg);
206 }

◆ 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 901 of file BcManager.cpp.

902 {
903
904 // Assumes that field name is consist with letters and numbers.
905 // No special characters.
906 auto field_rgx_str =
907 (boost::format("%s_([a-zA-Z0-9]*)_(.*)") % prb_name).str();
908 std::regex field_rgx(field_rgx_str);
909 std::smatch match_field_name;
910 std::string field_name;
911 std::string block_name;
912
913 if (std::regex_search(block_id, match_field_name, field_rgx)) {
914 field_name = match_field_name[1];
915 block_name = match_field_name[2];
916 } else {
918 "Field name and block name can not be resolved");
919 }
920
921 return std::make_pair(field_name, block_name);
922}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:595
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
constexpr auto field_name

◆ getBcMapByBlockName()

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

Get the bc map.

Returns
auto
Examples
contact.cpp, and photon_diffusion.cpp.

Definition at line 165 of file BcManager.hpp.

165{ return bcMapByBlockName; }
BcMapByBlockName bcMapByBlockName
Definition: BcManager.hpp:268

◆ getBcStructure()

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

Get the bc structure object.

Parameters
block_name
Returns
auto

Definition at line 156 of file BcManager.hpp.

156 {
157 return bcMapByBlockName.at(bc_id);
158 }

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

Definition at line 218 of file BcManager.cpp.

222 {
223 Interface &m_field = cOre;
224
225 const std::string bc_id =
226 block_prefix + "_" + field_name + "_" + block_name + "(.*)";
227
228 Range bc_ents;
229 for (auto bc : getBcMapByBlockName()) {
230 if (std::regex_match(bc.first, std::regex(bc_id))) {
231 bc_ents.merge(*(bc.second->getBcEntsPtr()));
232 MOFEM_LOG("BcMngWorld", Sev::verbose)
233 << "Get entities from block and add to IS. Block name " << bc.first;
234 }
235 }
236
237 SmartPetscObj<IS> is_bc;
238 auto get_is = [&]() {
240 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(bc_ents);
241 CHKERR m_field.getInterface<ISManager>()->isCreateProblemFieldAndRank(
242 problem_name, ROW, field_name, lo, hi, is_bc, &bc_ents);
243 if (is_expand) {
244 IS is_tmp;
245 CHKERR ISExpand(is_bc, is_expand, &is_tmp);
246 is_bc = SmartPetscObj<IS>(is_tmp);
247 }
248 CHKERR ISSort(is_bc);
250 };
251
252 if (get_is())
253 CHK_THROW_MESSAGE(MOFEM_DATA_INCONSISTENCY, "IS is not created");
254
255 return is_bc;
256}
@ ROW
Definition: definitions.h:123
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1955
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
Definition: BcManager.hpp:165

◆ 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 258 of file BcManager.cpp.

261 {
262 return getBlockIS(problem_name, block_name, field_name, problem_name, lo, hi,
263 is_expand);
264}
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.
Definition: BcManager.cpp:218

◆ 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 187 of file BcManager.cpp.

187 {
188 BcManager::BcMarkerPtr boundary_marker_ptr;
189 if (bcMapByBlockName.size()) {
190 for (auto b : bcMapByBlockName) {
191 for (auto &reg_name : bc_regex_vec) {
192 if (std::regex_match(b.first, reg_name)) {
193 if (!boundary_marker_ptr)
194 boundary_marker_ptr =
195 boost::make_shared<std::vector<char unsigned>>();
196 boundary_marker_ptr->resize(b.second->bcMarkers.size(), 0);
197 for (int i = 0; i != b.second->bcMarkers.size(); ++i) {
198 (*boundary_marker_ptr)[i] |= b.second->bcMarkers[i];
199 }
200 }
201 }
202 }
203 }
204 return boundary_marker_ptr;
205}
FTensor::Index< 'i', SPACE_DIM > i
boost::shared_ptr< std::vector< char unsigned > > BcMarkerPtr
Definition: BcManager.hpp:149

◆ 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 180 of file BcManager.hpp.

180 {
181 std::vector<std::regex> reg_vec(bc_names.size());
182 for (int i = 0; i != bc_names.size(); ++i) {
183 auto full_name = std::string("(.*)_") + bc_names[i] + std::string("(.*)");
184 reg_vec[i] = std::regex(full_name);
185 }
186 return getMergedBlocksMarker(reg_vec);
187 }
BcMarkerPtr getMergedBlocksMarker(std::vector< std::regex > bc_regex_vec)
Get the Merged Boundary Marker object.
Definition: BcManager.cpp:187

◆ getOptions()

MoFEMErrorCode MoFEM::BcManager::getOptions ( )

get options

Returns
error code

Definition at line 40 of file BcManager.cpp.

40 {
41 PetscBool flg = PETSC_TRUE;
43 ierr = PetscOptionsBegin(PETSC_COMM_WORLD, "", "BcManager options", "none");
44 ierr = PetscOptionsEnd();
47}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76

◆ 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 176 of file BcManager.cpp.

176 {
177 auto bc_it = bcMapByBlockName.find(block_name);
178 if (bc_it != bcMapByBlockName.end()) {
179 auto bc = bc_it->second;
180 bcMapByBlockName.erase(bc_it);
181 return bc;
182 }
183 return boost::shared_ptr<BCs>();
184}

◆ pushMarkDOFsOnEntities() [1/14]

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

Definition at line 87 of file BcManager.cpp.

91 {
92 Interface &m_field = cOre;
93 auto prb_mng = m_field.getInterface<ProblemsManager>();
95
96 auto get_dim = [&](const Range &ents) {
97 for (auto d : {3, 2, 1})
98 if (ents.num_of_dimension(d))
99 return d;
100 return 0;
101 };
102
103 auto get_adj_ents = [&](const Range &ents) {
104 Range verts;
105 CHKERR m_field.get_moab().get_connectivity(ents, verts, true);
106 const auto dim = get_dim(ents);
107 for (size_t d = 1; d < dim; ++d)
108 CHKERR m_field.get_moab().get_adjacencies(ents, d, false, verts,
109 moab::Interface::UNION);
110 verts.merge(ents);
111 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(verts);
112 return verts;
113 };
114
115 auto fix_disp = [&]() {
117
118 auto mark_fix_dofs = [&](std::vector<unsigned char> &marked_field_dofs,
119 const auto lo, const auto hi) {
120 return prb_mng->modifyMarkDofs(problem_name, ROW, field_name, lo, hi,
122 marked_field_dofs);
123 };
124
125 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
127 for (auto m : meshset_vec_ptr) {
128 auto bc = boost::make_shared<BCs>();
129 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
130 bc->bcEnts, true);
131 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(
132 bc->bcEnts);
133 CHKERR m->getAttributes(bc->bcAttributes);
134
135 MOFEM_LOG("BcMngWorld", Sev::verbose)
136 << "Found block " << m->getName() << " number of entities "
137 << bc->bcEnts.size() << " number of attributes "
138 << bc->bcAttributes.size() << " highest dim of entities "
139 << get_dim(bc->bcEnts);
140 CHKERR mark_fix_dofs(bc->bcMarkers, lo, hi);
141 if (get_low_dim_ents) {
142 auto low_dim_ents = get_adj_ents(bc->bcEnts);
143 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
144 low_dim_ents, bc->bcMarkers);
145 bc->bcEnts.swap(low_dim_ents);
146 } else
147 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
148 bc->bcEnts, bc->bcMarkers);
149
150 const std::string bc_id =
151 problem_name + "_" + field_name + "_" + m->getName();
152 bcMapByBlockName[bc_id] = bc;
153 }
155 };
156
157 CHKERR iterate_meshsets(
158
159 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
160
161 (boost::format("%s(.*)") % block_name).str()
162
163 ))
164
165 );
166
168 };
169
170 CHKERR fix_disp();
171
173}
const int dim
FTensor::Index< 'm', SPACE_DIM > m
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

◆ pushMarkDOFsOnEntities() [2/14]

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

◆ pushMarkDOFsOnEntities() [3/14]

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

◆ pushMarkDOFsOnEntities() [4/14]

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

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

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

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

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 483 of file BcManager.cpp.

486 {
487 Interface &m_field = cOre;
488 auto prb_mng = m_field.getInterface<ProblemsManager>();
490
491 if (block_name_field_prefix)
492 MOFEM_LOG("BcMngWorld", Sev::warning)
493 << "Argument block_name_field_prefix=true has no effect";
494
495 auto get_dim = [&](const Range &ents) {
496 for (auto d : {3, 2, 1})
497 if (ents.num_of_dimension(d))
498 return d;
499 return 0;
500 };
501
502 auto get_adj_ents = [&](const Range &ents) {
503 Range verts;
504 CHKERR m_field.get_moab().get_connectivity(ents, verts, true);
505 const auto dim = get_dim(ents);
506 for (size_t d = 1; d < dim; ++d)
507 CHKERR m_field.get_moab().get_adjacencies(ents, d, false, verts,
508 moab::Interface::UNION);
509 verts.merge(ents);
510 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(verts);
511 return verts;
512 };
513
514 auto fix_disp = [&]() {
516
517 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
519 for (auto m : meshset_vec_ptr) {
520 auto bc = boost::make_shared<BCs>();
521 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
522 bc->bcEnts, true);
523
524 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
525 CHKERR m->getBcDataStructure(*(bc->dispBcPtr));
526
527 MOFEM_LOG("BcMngWorld", Sev::verbose)
528 << "Found block DISPLACEMENTSET number of entities "
529 << bc->bcEnts.size() << " highest dim of entities "
530 << get_dim(bc->bcEnts);
531 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->dispBcPtr;
532
533 if (bc->dispBcPtr->data.flag1)
534 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 0, 0,
536 bc->bcMarkers);
537 if (bc->dispBcPtr->data.flag2)
538 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 1, 1,
540 bc->bcMarkers);
541 if (bc->dispBcPtr->data.flag3)
542 CHKERR prb_mng->modifyMarkDofs(problem_name, ROW, field_name, 2, 2,
544 bc->bcMarkers);
545
546 if (get_low_dim_ents) {
547 auto low_dim_ents = get_adj_ents(bc->bcEnts);
548 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
549 low_dim_ents, bc->bcMarkers);
550 bc->bcEnts.swap(low_dim_ents);
551 } else
552 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
553 bc->bcEnts, bc->bcMarkers);
554
555 const std::string bc_id =
556 problem_name + "_" + field_name + "_DISPLACEMENTSET" +
557 boost::lexical_cast<std::string>(m->getMeshsetId());
558 bcMapByBlockName[bc_id] = bc;
559 }
561 };
562
563 CHKERR iterate_meshsets(
564
565 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
567
568 );
569
571 };
572
573 CHKERR fix_disp();
574
576}
@ NODESET
Definition: definitions.h:146
@ DISPLACEMENTSET
Definition: definitions.h:150

◆ pushMarkDOFsOnEntities() [9/14]

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 579 of file BcManager.cpp.

581 {
582 Interface &m_field = cOre;
583 auto prb_mng = m_field.getInterface<ProblemsManager>();
585
586 if (block_name_field_prefix)
587 MOFEM_LOG("BcMngWorld", Sev::warning)
588 << "Argument block_name_field_prefix=true has no effect";
589
590 auto get_dim = [&](const Range &ents) {
591 for (auto d : {3, 2, 1})
592 if (ents.num_of_dimension(d))
593 return d;
594 return 0;
595 };
596
597 auto get_adj_ents = [&](const Range &ents) {
598 Range verts;
599 CHKERR m_field.get_moab().get_connectivity(ents, verts, true);
600 const auto dim = get_dim(ents);
601 for (size_t d = 1; d < dim; ++d)
602 CHKERR m_field.get_moab().get_adjacencies(ents, d, false, verts,
603 moab::Interface::UNION);
604 verts.merge(ents);
605 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(verts);
606 return verts;
607 };
608
609 auto fix_disp = [&]() {
611
612 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
614 for (auto m : meshset_vec_ptr) {
615 auto bc = boost::make_shared<BCs>();
616 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
617 bc->bcEnts, true);
618 bc->tempBcPtr = boost::make_shared<TemperatureCubitBcData>();
619 CHKERR m->getBcDataStructure(*(bc->tempBcPtr));
620
621 MOFEM_LOG("BcMngWorld", Sev::verbose)
622 << "Found block TEMPERATURESET number of entities "
623 << bc->bcEnts.size() << " highest dim of entities "
624 << get_dim(bc->bcEnts);
625 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->tempBcPtr;
626
627 CHKERR prb_mng->modifyMarkDofs(
628 problem_name, ROW, field_name, 0, MAX_DOFS_ON_ENTITY,
629 ProblemsManager::MarkOP::OR, 1, bc->bcMarkers);
630
631 if (get_low_dim_ents) {
632 auto low_dim_ents = get_adj_ents(bc->bcEnts);
633 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
634 low_dim_ents, bc->bcMarkers);
635 bc->bcEnts.swap(low_dim_ents);
636 } else
637 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
638 bc->bcEnts, bc->bcMarkers);
639
640 const std::string bc_id =
641 problem_name + "_" + field_name + "_TEMPERATURESET" +
642 boost::lexical_cast<std::string>(m->getMeshsetId());
643 bcMapByBlockName[bc_id] = bc;
644 }
646 };
647
648 CHKERR iterate_meshsets(
649
650 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
652
653 );
654
656 };
657
658 CHKERR fix_disp();
659
661}
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:236
@ TEMPERATURESET
Definition: definitions.h:155

◆ pushMarkDOFsOnEntities() [10/14]

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 664 of file BcManager.cpp.

666 {
667 Interface &m_field = cOre;
668 auto prb_mng = m_field.getInterface<ProblemsManager>();
670
671 if (block_name_field_prefix)
672 MOFEM_LOG("BcMngWorld", Sev::warning)
673 << "Argument block_name_field_prefix=true has no effect";
674
675 auto get_dim = [&](const Range &ents) {
676 for (auto d : {3, 2, 1})
677 if (ents.num_of_dimension(d))
678 return d;
679 return 0;
680 };
681
682 auto get_adj_ents = [&](const Range &ents) {
683 Range verts;
684 CHKERR m_field.get_moab().get_connectivity(ents, verts, true);
685 const auto dim = get_dim(ents);
686 for (size_t d = 1; d < dim; ++d)
687 CHKERR m_field.get_moab().get_adjacencies(ents, d, false, verts,
688 moab::Interface::UNION);
689 verts.merge(ents);
690 CHKERR m_field.getInterface<CommInterface>()->synchroniseEntities(verts);
691 return verts;
692 };
693
694 auto fix_disp = [&]() {
696
697 auto iterate_meshsets = [&](auto &&meshset_vec_ptr) {
699 for (auto m : meshset_vec_ptr) {
700 auto bc = boost::make_shared<BCs>();
701 CHKERR m_field.get_moab().get_entities_by_handle(m->getMeshset(),
702 bc->bcEnts, true);
703 bc->heatFluxBcPtr = boost::make_shared<HeatFluxCubitBcData>();
704 CHKERR m->getBcDataStructure(*(bc->heatFluxBcPtr));
705
706 MOFEM_LOG("BcMngWorld", Sev::verbose)
707 << "Found block HEATFLUX number of entities " << bc->bcEnts.size()
708 << " highest dim of entities " << get_dim(bc->bcEnts);
709 MOFEM_LOG("BcMngWorld", Sev::verbose) << *bc->heatFluxBcPtr;
710
711 CHKERR prb_mng->modifyMarkDofs(
712 problem_name, ROW, field_name, 0, MAX_DOFS_ON_ENTITY,
713 ProblemsManager::MarkOP::OR, 1, bc->bcMarkers);
714
715 if (get_low_dim_ents) {
716 auto low_dim_ents = get_adj_ents(bc->bcEnts);
717 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
718 low_dim_ents, bc->bcMarkers);
719 bc->bcEnts.swap(low_dim_ents);
720 } else
721 CHKERR prb_mng->markDofs(problem_name, ROW, ProblemsManager::AND,
722 bc->bcEnts, bc->bcMarkers);
723
724 const std::string bc_id =
725 problem_name + "_" + field_name + "_HEATFLUXSET" +
726 boost::lexical_cast<std::string>(m->getMeshsetId());
727 bcMapByBlockName[bc_id] = bc;
728 }
730 };
731
732 CHKERR iterate_meshsets(
733
734 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(SIDESET |
736
737 );
738
740 };
741
742 CHKERR fix_disp();
743
745}
@ HEATFLUXSET
Definition: definitions.h:156
@ SIDESET
Definition: definitions.h:147

◆ pushMarkDOFsOnEntities() [11/14]

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 748 of file BcManager.cpp.

750 {
751 Interface &m_field = cOre;
752 auto prb_mng = m_field.getInterface<ProblemsManager>();
754
755 if (block_name_field_prefix) {
757 problem_name, (boost::format("%s_FIX_X") % field_name).str(),
758 field_name, 0, 0, get_low_dim_ents);
760 problem_name, (boost::format("%s_FIX_Y") % field_name).str(),
761 field_name, 1, 1, get_low_dim_ents);
763 problem_name, (boost::format("%s_FIX_Z") % field_name).str(),
764 field_name, 2, 2, get_low_dim_ents);
766 problem_name, (boost::format("%s_FIX_ALL") % field_name).str(),
767 field_name, 0, MAX_DOFS_ON_ENTITY, get_low_dim_ents);
768 } else {
769 CHKERR pushMarkDOFsOnEntities(problem_name, "FIX_X", field_name, 0, 0,
770 get_low_dim_ents);
771 CHKERR pushMarkDOFsOnEntities(problem_name, "FIX_Y", field_name, 1, 1,
772 get_low_dim_ents);
773 CHKERR pushMarkDOFsOnEntities(problem_name, "FIX_Z", field_name, 2, 2,
774 get_low_dim_ents);
775 CHKERR pushMarkDOFsOnEntities(problem_name, "FIX_ALL", field_name, 0,
776 MAX_DOFS_ON_ENTITY, get_low_dim_ents);
777 }
778
779 auto regex_str =
780 (boost::format("%s_%s_(.*)") % problem_name % field_name).str();
781
782 for (auto &m : bcMapByBlockName) {
783 auto &bc_id = m.first;
784 if (std::regex_match(bc_id, std::regex(regex_str))) {
785 auto &bc = m.second;
786 if (std::regex_match(bc_id, std::regex("(.*)_FIX_X(.*)"))) {
787 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
788 bc->dispBcPtr->data.flag1 = 1;
789 if (bc->bcAttributes.size() == 1) {
790 bc->dispBcPtr->data.value1 = bc->bcAttributes[0];
791 } else if (bc->bcAttributes.size() == 3) {
792 bc->dispBcPtr->data.value1 = bc->bcAttributes[0];
793 } else {
794 MOFEM_LOG("BcMngWorld", Sev::warning)
795 << "Expected one atributes on block but have "
796 << bc->bcAttributes.size();
797 }
798 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add X " << bc_id;
799 MOFEM_LOG("BcMngWorld", Sev::inform) << *bc->dispBcPtr;
800 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_Y(.*)"))) {
801 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
802 bc->dispBcPtr->data.flag2 = 1;
803 if (bc->bcAttributes.size() == 1) {
804 bc->dispBcPtr->data.value2 = bc->bcAttributes[0];
805 } else if (bc->bcAttributes.size() <= 2) {
806 bc->dispBcPtr->data.value2 = bc->bcAttributes[1];
807 } else {
808 MOFEM_LOG("BcMngWorld", Sev::warning)
809 << "Expected one atributes on block but have "
810 << bc->bcAttributes.size();
811 }
812 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Y " << bc_id;
813 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
814 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_Z(.*)"))) {
815 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
816 bc->dispBcPtr->data.flag3 = 1;
817 if (bc->bcAttributes.size() == 1) {
818 bc->dispBcPtr->data.value3 = bc->bcAttributes[0];
819 } else if (bc->bcAttributes.size() <= 3) {
820 bc->dispBcPtr->data.value3 = bc->bcAttributes[2];
821 } else {
822 MOFEM_LOG("BcMngWorld", Sev::warning)
823 << "Expected one atributes on block but have "
824 << bc->bcAttributes.size();
825 }
826 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add Z " << bc_id;
827 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
828 } else if (std::regex_match(bc_id, std::regex("(.*)_FIX_ALL(.*)"))) {
829 bc->dispBcPtr = boost::make_shared<DisplacementCubitBcData>();
830 bc->dispBcPtr->data.flag1 = 1;
831 bc->dispBcPtr->data.flag2 = 1;
832 bc->dispBcPtr->data.flag3 = 1;
833 if (bc->bcAttributes.size() >= 1) {
834 bc->dispBcPtr->data.value1 = bc->bcAttributes[0];
835 }
836 if (bc->bcAttributes.size() >= 2) {
837 bc->dispBcPtr->data.value2 = bc->bcAttributes[1];
838 }
839 if (bc->bcAttributes.size() >= 3) {
840 bc->dispBcPtr->data.value3 = bc->bcAttributes[2];
841 }
842 MOFEM_LOG("BcMngWorld", Sev::inform) << "Add ALL " << bc_id;
843 MOFEM_LOG("BcMngWorld", Sev::inform) << *(bc->dispBcPtr);
844 }
845 }
846 }
847
849}
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.
Definition: BcManager.cpp:87

◆ pushMarkDOFsOnEntities() [12/14]

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 852 of file BcManager.cpp.

854 {
856 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
857 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
858 CHKERR pushMarkDOFsOnEntities<BcVectorMeshsetType<BLOCKSET>>(
859 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
861}

◆ pushMarkDOFsOnEntities() [13/14]

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 879 of file BcManager.cpp.

881 {
883 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
884 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
886}

◆ pushMarkDOFsOnEntities() [14/14]

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
Returns
MoFEMErrorCode

◆ query_interface()

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

Implements MoFEM::UnknownInterface.

Definition at line 9 of file BcManager.cpp.

10 {
12 *iface = const_cast<BcManager *>(this);
14}
BcManager(const MoFEM::Core &core)
Definition: BcManager.cpp:16

◆ removeBlockDOFsOnEntities() [1/14]

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
block_name_field_prefixblock name is expected to have prefix with field name
is_distributed_meshdistributed mesh
Returns
MoFEMErrorCode

Definition at line 49 of file BcManager.cpp.

52 {
53 Interface &m_field = cOre;
54 auto prb_mng = m_field.getInterface<ProblemsManager>();
56
57 CHKERR pushMarkDOFsOnEntities(problem_name, block_name, field_name, lo, hi,
58 get_low_dim_ents);
59
60 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
61 const int hi) {
62 if (is_distributed_mesh)
63 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
64 hi);
65 else
66 return prb_mng->removeDofsOnEntitiesNotDistributed(
67 problem_name, field_name, ents, lo, hi);
68 };
69
70 for (auto m :
71 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
72
73 (boost::format("%s(.*)") % block_name).str()
74
75 ))
76
77 ) {
78 const std::string bc_id =
79 problem_name + "_" + field_name + "_" + m->getName();
80 CHKERR remove_dofs_on_ents(bcMapByBlockName.at(bc_id)->bcEnts, lo, hi);
81 bcMapByBlockName.at(bc_id)->bcMarkers = std::vector<unsigned char>();
82 }
83
85}

◆ removeBlockDOFsOnEntities() [2/14]

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

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

◆ removeBlockDOFsOnEntities() [4/14]

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

◆ removeBlockDOFsOnEntities() [5/14]

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

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

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

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 267 of file BcManager.cpp.

271 {
272 Interface &m_field = cOre;
273 auto prb_mng = m_field.getInterface<ProblemsManager>();
275
276 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
277 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
278
279 std::array<Range, 3> ents_to_remove;
280
281 for (auto m :
282
283 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
285
286 const std::string bc_id =
287 problem_name + "_" + field_name + "_DISPLACEMENTSET" +
288 boost::lexical_cast<std::string>(m->getMeshsetId());
289
290 auto bc = bcMapByBlockName.at(bc_id);
291
292 if (bc->dispBcPtr)
293 if (bc->dispBcPtr->data.flag1) {
294 ents_to_remove[0].merge(bc->bcEnts);
295 }
296 if (bc->dispBcPtr->data.flag2) {
297 ents_to_remove[1].merge(bc->bcEnts);
298 }
299 if (bc->dispBcPtr->data.flag3) {
300 ents_to_remove[2].merge(bc->bcEnts);
301 }
302
303 bc->bcMarkers = std::vector<unsigned char>();
304 }
305
306 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
307 const int hi) {
308 if (is_distributed_mesh)
309 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
310 hi);
311 else
312 return prb_mng->removeDofsOnEntitiesNotDistributed(
313 problem_name, field_name, ents, lo, hi);
314 };
315
316 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
317 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
318 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
319
321}

◆ removeBlockDOFsOnEntities() [9/14]

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 324 of file BcManager.cpp.

328 {
329 Interface &m_field = cOre;
330 auto prb_mng = m_field.getInterface<ProblemsManager>();
332
333 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<TEMPERATURESET>>(
334 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
335
336 Range ents_to_remove;
337
338 for (auto m :
339
340 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(
342
343 ) {
344 const std::string bc_id =
345 problem_name + "_" + field_name + "_TEMPERATURESET" +
346 boost::lexical_cast<std::string>(m->getMeshsetId());
347 auto bc = bcMapByBlockName.at(bc_id);
348 ents_to_remove.merge(bc->bcEnts);
349 bc->bcMarkers = std::vector<unsigned char>();
350 }
351
352 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
353 const int hi) {
354 if (is_distributed_mesh)
355 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
356 hi);
357 else
358 return prb_mng->removeDofsOnEntitiesNotDistributed(
359 problem_name, field_name, ents, lo, hi);
360 };
361
362 CHKERR remove_dofs_on_ents(ents_to_remove, 0, MAX_DOFS_ON_ENTITY);
363
365}

◆ removeBlockDOFsOnEntities() [10/14]

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 368 of file BcManager.cpp.

371 {
372 Interface &m_field = cOre;
373 auto prb_mng = m_field.getInterface<ProblemsManager>();
375
376 CHKERR pushMarkDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
377 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
378
379 Range ents_to_remove;
380
381 for (auto m :
382
383 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(NODESET |
385
386 ) {
387 const std::string bc_id =
388 problem_name + "_" + field_name + "_HEATFLUXSET" +
389 boost::lexical_cast<std::string>(m->getMeshsetId());
390 auto bc = bcMapByBlockName.at(bc_id);
391 ents_to_remove.merge(bc->bcEnts);
392 bc->bcMarkers = std::vector<unsigned char>();
393 }
394
395 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
396 const int hi) {
397 if (is_distributed_mesh)
398 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
399 hi);
400 else
401 return prb_mng->removeDofsOnEntitiesNotDistributed(
402 problem_name, field_name, ents, lo, hi);
403 };
404
405 CHKERR remove_dofs_on_ents(ents_to_remove, 0, MAX_DOFS_ON_ENTITY);
406
408}

◆ removeBlockDOFsOnEntities() [11/14]

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 411 of file BcManager.cpp.

415 {
416 Interface &m_field = cOre;
417 auto prb_mng = m_field.getInterface<ProblemsManager>();
419
420 CHKERR pushMarkDOFsOnEntities<BcVectorMeshsetType<BLOCKSET>>(
421 problem_name, field_name, get_low_dim_ents, block_name_field_prefix);
422
423 std::array<Range, 3> ents_to_remove;
424
425 for (auto m :
426
427 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(BLOCKSET)) {
428
429 const auto block_name = m->getName();
430
431 std::string bc_id;
432 if (block_name_field_prefix)
433 bc_id = problem_name + "_" + m->getName();
434 else
435 bc_id = problem_name + "_" + field_name + "_" + m->getName();
436
437 auto str = boost::format("%s_%s_((FIX_(ALL|X|Y|Z))|("
438 "DISPLACEMENT)|(ROTATION)|(TEMP))(.*)")
439
440 % problem_name % field_name;
441
442 if (std::regex_match(bc_id, std::regex(str.str()))) {
443
444 auto bc = bcMapByBlockName.at(bc_id);
445
446 if (auto disp_bc = bc->dispBcPtr) {
447 if (disp_bc->data.flag1) {
448 ents_to_remove[0].merge(bc->bcEnts);
449 }
450 if (disp_bc->data.flag2) {
451 ents_to_remove[1].merge(bc->bcEnts);
452 }
453 if (disp_bc->data.flag3) {
454 ents_to_remove[2].merge(bc->bcEnts);
455 }
456 } else if (auto temp_bc = bc->tempBcPtr) {
457 ents_to_remove[0].merge(bc->bcEnts);
458 } else {
459 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
460 "BC type not implemented");
461 }
462 }
463 }
464
465 auto remove_dofs_on_ents = [&](const Range &ents, const int lo,
466 const int hi) {
467 if (is_distributed_mesh)
468 return prb_mng->removeDofsOnEntities(problem_name, field_name, ents, lo,
469 hi);
470 else
471 return prb_mng->removeDofsOnEntitiesNotDistributed(
472 problem_name, field_name, ents, lo, hi);
473 };
474
475 CHKERR remove_dofs_on_ents(ents_to_remove[0], 0, 0);
476 CHKERR remove_dofs_on_ents(ents_to_remove[1], 1, 1);
477 CHKERR remove_dofs_on_ents(ents_to_remove[2], 2, 2);
478
480}
@ BLOCKSET
Definition: definitions.h:148

◆ removeBlockDOFsOnEntities() [12/14]

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 864 of file BcManager.cpp.

867 {
869 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<DISPLACEMENTSET>>(
870 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
871 is_distributed_mesh);
872 CHKERR removeBlockDOFsOnEntities<BcVectorMeshsetType<BLOCKSET>>(
873 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
874 is_distributed_mesh);
876}

◆ removeBlockDOFsOnEntities() [13/14]

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 889 of file BcManager.cpp.

892 {
894 CHKERR removeBlockDOFsOnEntities<BcMeshsetType<HEATFLUXSET>>(
895 problem_name, field_name, get_low_dim_ents, block_name_field_prefix,
896 is_distributed_mesh);
898}

◆ removeBlockDOFsOnEntities() [14/14]

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

Member Data Documentation

◆ bcMapByBlockName

BcMapByBlockName MoFEM::BcManager::bcMapByBlockName
private

Definition at line 268 of file BcManager.hpp.

◆ cOre

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

Definition at line 266 of file BcManager.hpp.


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