3 #ifndef __SMOOTHER_HPP__
4 #define __SMOOTHER_HPP__
7 #error "MoFEM need to be compiled with ADOL-C"
12 struct SmootherBlockData {
23 CHKERRABORT(PETSC_COMM_SELF,
ierr);
28 ierr = PetscOptionsBegin(PETSC_COMM_WORLD,
"",
29 "Get stabilisation element options",
"none");
31 PetscBool smoothing_on =
sTabilised ? PETSC_TRUE : PETSC_FALSE;
32 CHKERR PetscOptionsBool(
"-smoothing_stabilise",
33 "all nodes controlled by smoothing element",
"",
34 smoothing_on, &smoothing_on, PETSC_NULL);
35 sTabilised = (smoothing_on == PETSC_TRUE) ?
true :
false;
36 ierr = PetscOptionsEnd();
44 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
46 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
52 std::map<int, NonlinearElasticElement::BlockData>
setOfBlocks;
66 CHKERR VolumeElementForcesAndSourcesCore::preProcess();
113 CHKERR VolumeElementForcesAndSourcesCore::postProcess();
118 boost::shared_ptr<MyVolumeFE>
feRhsPtr;
119 boost::shared_ptr<MyVolumeFE>
feLhsPtr;
122 MyVolumeFE &getLoopFeRhs() {
return feRhs; }
124 MyVolumeFE &getLoopFeLhs() {
return feLhs; }
131 struct OpJacobianSmoother
137 int tag,
bool jacobian)
139 field_name, data, common_data, tag, jacobian, false, false) {}
148 for (
int dd1 = 0; dd1 < 3; dd1++) {
149 for (
int dd2 = 0; dd2 < 3; dd2++) {
177 int nb_dofs = row_data.getIndices().size();
178 int *indices_ptr = &row_data.getIndices()[0];
181 iNdices.resize(nb_dofs,
false);
182 noalias(
iNdices) = row_data.getIndices();
189 VectorDofs::iterator dit = dofs.begin();
190 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
220 const std::string vel_field,
const std::string
field_name,
225 crack_area_tangent_constrains
240 int nb_row = row_data.getIndices().size();
241 int nb_col = col_data.getIndices().size();
242 int *row_indices_ptr = &row_data.getIndices()[0];
243 int *col_indices_ptr = &col_data.getIndices()[0];
254 VectorDofs::iterator dit = dofs.begin();
255 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
266 nb_col, col_indices_ptr, &
k(0, 0), ADD_VALUES);
270 const auto bit_number_for_crack_area_tangent_constrain =
272 const auto bit_number_for_mesh_position =
276 double *f_tangent_front_mesh_array;
278 &f_tangent_front_mesh_array);
283 for (
int nn = 0; nn < 4; nn++) {
286 auto dit = row_dofs->get<Unique_mi_tag>().lower_bound(
287 DofEntity::getLoFieldEntityUId(
288 bit_number_for_crack_area_tangent_constrain,
getConn()[nn]));
289 auto hi_dit = row_dofs->get<Unique_mi_tag>().upper_bound(
290 DofEntity::getHiFieldEntityUId(
291 bit_number_for_crack_area_tangent_constrain,
getConn()[nn]));
294 if (std::distance(dit, hi_dit) > 0) {
297 auto diit = row_dofs->get<Unique_mi_tag>().lower_bound(
298 DofEntity::getLoFieldEntityUId(bit_number_for_mesh_position,
301 auto hi_diit = row_dofs->get<Unique_mi_tag>().upper_bound(
302 DofEntity::getHiFieldEntityUId(bit_number_for_mesh_position,
306 for (; diit != hi_diit; diit++) {
308 for (
int ddd = 0; ddd < nb_col; ddd++) {
311 diit->get()->getPetscGlobalDofIdx()) {
314 "data inconsistency %d != %d",
316 diit->get()->getPetscGlobalDofIdx());
319 if (diit->get()->getPetscLocalDofIdx() == -1) {
321 "data inconsistency");
324 f_tangent_front_mesh_array[diit->get()
325 ->getPetscLocalDofIdx()] *
326 k(3 * nn + diit->get()->getDofCoeffIdx(), ddd);
327 int lambda_idx = dit->get()->getPetscGlobalDofIdx();
329 &col_indices_ptr[ddd], &
g, ADD_VALUES);
335 &f_tangent_front_mesh_array);
343 #endif //__SMOOTHER_HPP__