Testing projection child and parent.
static char help[] =
"...\n\n";
};
};
double operator()(const double x, const double y, const double z) {
return x * x + y * y + x * y + pow(x, 3) + pow(y, 3) + pow(x, 4) +
pow(y, 4);
}
};
private:
checkResults(boost::function<
bool(
FEMethod *fe_method_ptr)> test_bit);
boost::shared_ptr<VectorDouble> approxVals;
};
template <
int FIELD_DIM>
struct OpError;
};
boost::shared_ptr<CommonData> commonDataPtr;
OpError(boost::shared_ptr<CommonData> &common_data_ptr)
if (
const size_t nb_dofs = data.
getIndices().size()) {
const int nb_integration_pts = getGaussPts().size2();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
nf.clear();
const double volume = getMeasure();
double error = 0;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
const double alpha = t_w * volume;
t_coords(2));
error += alpha * pow(diff, 2);
for (
size_t r = 0;
r != nb_dofs; ++
r) {
nf[
r] += alpha * t_row_base * diff;
++t_row_base;
}
++t_w;
++t_val;
++t_coords;
}
const int index = 0;
CHKERR VecSetValue(commonDataPtr->L2Vec, index, error, ADD_VALUES);
}
}
};
template <typename ELE_OP, typename PARENT_ELE>
PARENT_ELE parent_fe(this->getPtrFE()->mField);
<< "parent_coords in op "
<<
static_cast<ELE_OP *
>(op_ptr)->getCoordsAtGaussPts();
parent_coords =
static_cast<ELE_OP *
>(op_ptr)->getCoordsAtGaussPts();
};
parent_fe.getOpPtrVector().push_back(op);
MOFEM_LOG(
"SELF", Sev::noisy) <<
"fe name " << this->getFEName();
CHKERR this->loopParent(this->getFEName(), &parent_fe);
MOFEM_LOG(
"SELF", Sev::noisy) <<
"parent_coords " << parent_coords;
MOFEM_LOG(
"SELF", Sev::noisy) <<
"child_coords " << child_coords;
child_coords -= parent_coords;
MOFEM_LOG(
"SELF", Sev::noisy) <<
"Corrds diffs" << child_coords;
for (
auto d : child_coords.data())
"Parent and child global coords at integration points are "
"diffrent norm = %3.2e",
}
};
const auto &
bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
};
}
auto refine_mesh = [&](auto bit_level1) {
CHKERR moab.get_entities_by_type(*meshset_level0_ptr, MBEDGE,
edges_to_refine);
int ii = 0;
for (Range::iterator eit = edges_to_refine.begin();
eit != edges_to_refine.end(); eit++, ii++) {
int numb = ii % 2;
if (numb == 0) {
CHKERR moab.add_entities(*meshset_ref_edges_ptr, &*eit, 1);
}
}
CHKERR refine->addVerticesInTheMiddleOfEdges(*meshset_ref_edges_ptr,
if (simpleInterface->
getDim() == 3) {
CHKERR refine->refineTets(*meshset_level0_ptr, bit_level1,
VERBOSE);
}
else if (simpleInterface->
getDim() == 2) {
CHKERR refine->refineTris(*meshset_level0_ptr, bit_level1,
VERBOSE);
} else {
"Dimension not handled by test");
}
};
bit_level1.set(1);
CHKERR refine_mesh(bit_level1);
}
}
auto rule = [](
int,
int,
int p) ->
int {
return 2 * p; };
auto test_bit_parent = [](
FEMethod *fe_ptr) {
const auto &
bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
};
parent_op_lhs->doWorkRhsHook = [&](
DataOperator *op_ptr,
int side,
MOFEM_LOG(
"SELF", Sev::noisy) <<
"LHS Pipeline FE";
domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
CHKERR domain_op->loopChildren(domain_op->getFEName(),
} else {
}
};
parent_op_rhs->doWorkRhsHook = [&](
DataOperator *op_ptr,
int side,
MOFEM_LOG(
"SELF", Sev::noisy) <<
"RHS Pipeline FE";
domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
CHKERR domain_op->loopChildren(domain_op->getFEName(),
}
};
}
MOFEM_LOG(
"WORLD", Sev::inform) <<
"Solve problem";
CHKERR KSPSetFromOptions(solver);
auto dm = simpleInterface->
getDM();
CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
}
auto refine_mesh = [&]() {
*meshset_level1_ptr);
bit_level1,
BitRefLevel().set(), MBEDGE, edges_to_refine);
CHKERR refine->addVerticesInTheMiddleOfEdges(edges_to_refine, bit_level2,
if (simpleInterface->
getDim() == 3) {
CHKERR refine->refineTets(*meshset_level1_ptr, bit_level2,
VERBOSE);
}
else if (simpleInterface->
getDim() == 2) {
CHKERR refine->refineTris(*meshset_level1_ptr, bit_level2,
VERBOSE);
} else {
"Dimension not handled by test");
}
CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets,
true);
for (
auto m : meshsets) {
->updateMeshsetByEntitiesChildren(
m, bit_level2,
m, MBMAXTYPE,
false);
}
};
bit_level0 | bit_level1);
auto project_data = [&]() {
auto rule = [](
int,
int,
int p) ->
int {
return 2 * p; };
auto test_bit_ref = [](
FEMethod *fe_ptr) {
const auto &
bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
};
auto field_vals_ptr = boost::make_shared<VectorDouble>();
auto domainParentRhs = boost::make_shared<DomainParentEle>(mField);
domainParentRhs->getOpPtrVector().push_back(
new OpRunParent(domainParentRhs, bit_level2, bit_level2,
PETSC>::LinearForm<GAUSS>::OpBaseTimesScalar<1>;
};
}
boost::function<
bool(
FEMethod *fe_method_ptr)> test_bit) {
auto rule = [](
int,
int,
int p) ->
int {
return 2 * p + 1; };
auto common_data_ptr = boost::make_shared<CommonData>();
common_data_ptr->approxVals = boost::make_shared<VectorDouble>();
common_data_ptr->approxVals));
CHKERR VecZeroEntries(common_data_ptr->L2Vec);
CHKERR VecZeroEntries(common_data_ptr->resVec);
CHKERR VecAssemblyBegin(common_data_ptr->L2Vec);
CHKERR VecAssemblyEnd(common_data_ptr->L2Vec);
CHKERR VecAssemblyBegin(common_data_ptr->resVec);
CHKERR VecAssemblyEnd(common_data_ptr->resVec);
double nrm2;
CHKERR VecNorm(common_data_ptr->resVec, NORM_2, &nrm2);
const double *array;
CHKERR VecGetArrayRead(common_data_ptr->L2Vec, &array);
MOFEM_LOG_C(
"WORLD", Sev::inform,
"Error %6.4e Vec norm %6.4e\n",
std::sqrt(array[0]), nrm2);
CHKERR VecRestoreArrayRead(common_data_ptr->L2Vec, &array);
constexpr
double eps = 1e-8;
"Not converged solution err = %6.4e", nrm2);
}
int main(
int argc,
char *argv[]) {
try {
DMType dm_name = "DMMOFEM";
}
}