12 boost::shared_ptr<ForcesAndSourcesCore> this_ele_ptr,
17 parentElePtr(parent_ele_ptr), bitParent(bit_parent),
18 bitParentMask(bit_parent_mask), thisElePtr(this_ele_ptr),
19 bitThis(bit_this), bitThisMask(bit_this_mask), verbosity(verb),
28 auto check = [&](
auto &b,
auto &
m) {
29 return ((
bit & b).any()) && ((
bit &
m) ==
bit);
57 boost::shared_ptr<ForcesAndSourcesCore> parent_ele_ptr,
62 fieldName(
field_name), opParentType(op_parent_type),
63 parentElePtr(parent_ele_ptr), bitChild(bit_child),
64 bitChildMask(bit_child_mask), bitParentEnt(bit_parent_ent),
65 bitParentEntMask(bit_parent_ent_mask), verbosity(verb),
75 boost::shared_ptr<ForcesAndSourcesCore> parent_ele_ptr,
80 fieldName(
""), approxSpace(space), opParentType(op_parent_type),
81 parentElePtr(parent_ele_ptr), bitChild(bit_child),
82 bitChildMask(bit_child_mask), bitParentEnt(bit_parent_ent),
83 bitParentEntMask(bit_parent_ent_mask), verbosity(verb),
92 const bool error_if_no_base) {
93 int count_meshset_sides = 0;
96 auto check = [](
auto &b,
auto &
m,
auto &
bit) {
97 return ((
bit & b).any()) && ((
bit &
m) ==
bit);
100 auto set_child_data = [](
auto &parent_data,
auto &child_data) {
102 child_data.getEntDataBitRefLevel() = parent_data.getEntDataBitRefLevel();
103 child_data.sPace = parent_data.getSpace();
104 child_data.bAse = parent_data.getBase();
105 child_data.sEnse = parent_data.getSense();
106 child_data.oRder = parent_data.getOrder();
107 child_data.iNdices.swap(parent_data.getIndices());
108 child_data.localIndices.swap(parent_data.getLocalIndices());
109 child_data.dOfs.swap(parent_data.getFieldDofs());
110 child_data.fieldData.swap(parent_data.getFieldData());
111 child_data.fieldEntities.swap(parent_data.getFieldEntities());
121 auto set_child_base = [](
auto &parent_data,
auto &child_data) {
123 child_data.resetFieldDependentData();
124 child_data.getEntDataBitRefLevel() = parent_data.getEntDataBitRefLevel();
125 child_data.sPace = parent_data.getSpace();
126 child_data.getEntDataBitRefLevel() = parent_data.getEntDataBitRefLevel();
135 for (
auto derivative = 0; derivative != BaseDerivatives::LastDerivative;
141 auto child_base = child_data.getNSharedPtr(
145 child_base = boost::make_shared<MatrixDouble>();
146 child_base->swap(*parent_base);
154 auto switch_of_dofs_children = [](
auto &parent_ent_data,
auto &child_data) {
156 for (
auto i : parent_ent_data.getIndices()) {
158 for (
auto &child_ent_data : child_data) {
159 auto it = std::find(child_ent_data.getIndices().begin(),
160 child_ent_data.getIndices().end(),
i);
161 if (it != child_ent_data.getIndices().end()) {
163 std::distance(child_ent_data.getIndices().begin(), it);
164 child_ent_data.getIndices()[dof_idx] = -1;
165 child_ent_data.getLocalIndices()[dof_idx] = -1;
166 child_ent_data.getFieldData()[dof_idx] = 0;
176 auto do_work_parent_hook = [&](
DataOperator *op_ptr,
int side,
181 BitRefLevel &bit_ent = data.getEntDataBitRefLevel();
185 ++count_meshset_sides;
189 <<
"Add entity data to meshset "
190 <<
"side/type: " << side <<
"/" << CN::EntityTypeName(type)
195 auto &data_on_meshset = entities_field_data.
dataOnEntities[MBENTITYSET];
196 if (data_on_meshset.size() < count_meshset_sides) {
198 data_on_meshset.transfer(data_on_meshset.end(),
202 count_meshset_sides);
206 auto &child_data_meshset =
211 CHKERR set_child_base(data, child_data_meshset);
212 child_data_meshset.resetFieldDependentData();
216 auto &field_entities = data.getFieldEntities();
219 if (field_entities.size() > 1) {
221 for (
auto dof : data.getFieldDofs()) {
222 auto &bit_ent = dof->getBitRefLevel();
224 data.getIndices()[dof_idx] = -1;
225 data.getLocalIndices()[dof_idx] = -1;
226 data.getFieldData()[dof_idx] = 0;
234 for (
auto field_ent : field_entities) {
236 <<
"Parent field entity bit: " << field_ent->getBitRefLevel()
237 <<
" " << *field_ent;
242 if (field_entities.size()) {
243 boost::container::static_vector<EntityType, 128> ents_type;
244 ents_type.reserve(field_entities.size());
245 for (
auto fe : field_entities)
246 ents_type.push_back(fe->getEntType());
247 std::sort(ents_type.begin(), ents_type.end());
249 auto end = std::unique(ents_type.begin(), ents_type.end());
250 for (
auto it_t = ents_type.begin(); it_t != end; ++it_t)
251 CHKERR switch_of_dofs_children(
253 if (type == MBENTITYSET)
254 CHKERR switch_of_dofs_children(
258 CHKERR set_child_data(data, child_data_meshset);
273 auto loop_parent_fe = [&]() {
276 parentElePtr->getOpPtrVector().back().doWorkRhsHook = do_work_parent_hook;
282 if (
getGaussPts().size1() != parent_gauss_pts.size1()) {
284 MOFEM_LOG(
"SELF", Sev::error) << parent_gauss_pts;
286 "Wrong number of weights");
288 if (
getGaussPts().size2() != parent_gauss_pts.size2()) {
290 "Wrong number of integration points");
302 <<
"Number of meshset entities "
306 auto &data_on_meshset = entities_field_data.
dataOnEntities[MBENTITYSET];
307 auto it = data_on_meshset.begin();
309 if (count_meshset_sides < data_on_meshset.size()) {
310 for (
auto s = 0; s != count_meshset_sides; ++s)
316 auto set_up_derivative_ent_data = [&](
auto &entities_field_data,
317 auto &derivative_entities_field_data) {
324 auto &ents_data = entities_field_data.
dataOnEntities[MBENTITYSET];
325 auto &dev_ents_data =
326 derivative_entities_field_data.dataOnEntities[MBENTITYSET];
327 dev_ents_data.clear();
328 for (
auto c = 0;
c < ents_data.size(); ++
c) {
329 boost::shared_ptr<EntData> ent_data_ptr(data_ptr, &ents_data[
c]);
330 dev_ents_data.push_back(
new DerivedEntData(ent_data_ptr));
336 CHKERR set_up_derivative_ent_data(
344 for (
auto &data : entities_field_data.
dataOnEntities[MBENTITYSET]) {
345 for (
auto dof : data.getFieldDofs()) {
346 auto &bit_dof = dof->getBitRefLevel();
348 auto ent = dof->getEnt();
349 if (side_table.find(ent) == side_table.end()) {
351 "Adjacency not found");
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FieldSpace
approximation spaces
static const char *const FieldSpaceNames[]
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
static const char *const ApproximationBaseNames[]
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'm', SPACE_DIM > m
#define MOFEM_LOG(channel, severity)
Log.
SeverityLevel
Severity levels.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
constexpr auto field_name
base operator to do operations at Gauss Pt. level
Derived ata on single entity (This is passed as argument to DataOperator::doWork)
Data on single entity (This is passed as argument to DataOperator::doWork)
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode loopThis(const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over parent elements. This function calls finite element with is oper...
MoFEMErrorCode loopParent(const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over parent elements. This function calls finite element with is oper...
std::string getFEName() const
Get name of the element.
ForcesAndSourcesCore * getPtrFE() const
OpType
Controls loop over entities on element.
@ OPSPACE
operator do Work is execute on space data
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
structure to get information form mofem into EntitiesFieldData
auto & getDataOnElementBySpaceArray()
Get data on entities and space.
const BitRefLevel bitParentEntMask
const BitRefLevel bitParentEnt
MoFEMErrorCode opRhs(EntitiesFieldData &data, const bool error_if_no_base=false)
const BitRefLevel bitChildMask
boost::ptr_deque< EntitiesFieldData::EntData > poolEntsVector
boost::shared_ptr< ForcesAndSourcesCore > parentElePtr
OpAddParentEntData(std::string field_name, OpType op_parent_type, boost::shared_ptr< ForcesAndSourcesCore > parent_ele_ptr, BitRefLevel bit_child, BitRefLevel bit_child_mask, BitRefLevel bit_parent_ent, BitRefLevel bit_parent_ent_mask, int verb=QUIET, Sev sev=Sev::noisy)
Construct a new Op Add Parent Ent Data object.
const BitRefLevel bitChild
const BitRefLevel bitThisMask
const BitRefLevel bitParent
boost::shared_ptr< ForcesAndSourcesCore > parentElePtr
boost::shared_ptr< ForcesAndSourcesCore > thisElePtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const BitRefLevel bitParentMask
OpRunParent(boost::shared_ptr< ForcesAndSourcesCore > parent_ele_ptr, BitRefLevel bit_parent, BitRefLevel bit_parent_mask, boost::shared_ptr< ForcesAndSourcesCore > this_ele_ptr, BitRefLevel bit_this, BitRefLevel bit_this_mask, int verb=QUIET, Sev sev=Sev::noisy)
Construct a new Op Run Parent object.
const BitRefLevel bitThis