static char help[] =
"...\n\n";
GAUSS>::OpSource<BASE_DIM, SPACE_DIM>;
constexpr
double a0 = 0.0;
constexpr
double a1 = 2.0;
constexpr
double a2 = -15.0 *
a0;
constexpr
double a3 = -20.0 / 6 *
a1;
constexpr
double a4 = 15.0 *
a0;
constexpr
double a5 =
a1;
constexpr
double a6 = -
a0;
double z) {
x + y*y + x*x*x,
y + z*x + y*y*y,
z + x*x + z*z*z);
}
diffFun(const double x, const double y, const double z) {
1. + 3 * x * x,
2. * y,
0.,
z,
1. + 3 * y * y,
x,
2 * x, 0., 1. + 3 * z * z);
}
};
boost::shared_ptr<MatrixDouble> ptrVals;
boost::shared_ptr<MatrixDouble> ptrGrad;
boost::shared_ptr<MatrixDouble> ptr_grad)
:
EleOp(
NOSPACE, OPSPACE), ptrVals(ptr_vals), ptrGrad(ptr_grad) {}
const int nb_gauss_pts = getGaussPts().size2();
auto t_vals_from_op = getFTensor1FromMat<SPACE_DIM>(*ptrVals);
auto t_grad_from_op = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*ptrGrad);
for (int gg = 0; gg != nb_gauss_pts; gg++) {
const double x = getCoordsAtGaussPts()(gg, 0);
const double y = getCoordsAtGaussPts()(gg, 1);
const double z = getCoordsAtGaussPts()(gg, 2);
double err_val = sqrt(delta_val(
i) * delta_val(
i));
MOFEM_LOG(
"SELF", Sev::verbose) <<
"Approximation error: " << err_val;
err_val);
double err_diff_val = sqrt(delta_diff_val(
i,
j) * delta_diff_val(
i,
j));
"Wrong derivative of value %4.3e", err_diff_val);
++t_vals_from_op;
++t_grad_from_op;
}
}
};
int main(
int argc,
char *argv[]) {
try {
DMType dm_name = "DMMOFEM";
enum bases { AINSWORTH, DEMKOWICZ, LASBASETOP };
const char *list_bases[] = {"ainsworth", "demkowicz"};
PetscBool flg;
PetscInt choice_base_value = AINSWORTH;
LASBASETOP, &choice_base_value, &flg);
if (flg != PETSC_TRUE)
if (choice_base_value == AINSWORTH)
else if (choice_base_value == DEMKOWICZ)
return p;
};
auto assemble_matrices_and_vectors = [&]() {
pipeline_mng->getOpDomainRhsPipeline(), {HDIV});
pipeline_mng->getOpDomainRhsPipeline().push_back(
pipeline_mng->getOpDomainLhsPipeline(), {HDIV});
pipeline_mng->getOpDomainLhsPipeline().push_back(
[](double x, double, double) { return 1; })
);
return 2 * p_data + 1;
};
};
auto solve_problem = [&] {
auto solver = pipeline_mng->createKSP();
CHKERR KSPSetFromOptions(solver);
CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
};
auto check_solution = [&] {
pipeline_mng->getOpDomainLhsPipeline().clear();
pipeline_mng->getOpDomainRhsPipeline().clear();
auto ptr_values = boost::make_shared<MatrixDouble>();
auto ptr_grad = boost::make_shared<MatrixDouble>();
pipeline_mng->getOpDomainRhsPipeline(), {HDIV});
pipeline_mng->getOpDomainRhsPipeline().push_back(
pipeline_mng->getOpDomainRhsPipeline().push_back(
ptr_grad));
pipeline_mng->getOpDomainRhsPipeline().push_back(
CHKERR pipeline_mng->loopFiniteElements();
};
CHKERR assemble_matrices_and_vectors();
}
}