710 {
712
713 constexpr int numNodes = 3;
714 constexpr int numEdges = 3;
715
716 auto &m_field = fe_raw_ptr->
mField;
717 auto fe_ptr = static_cast<Fe *>(fe_raw_ptr);
718 auto fe_handle = fe_ptr->getFEEntityHandle();
719
720 auto set_base_quadrature = [&]() {
722 int rule = 2 * (order_data + 1);
726 }
730 }
732 fe_ptr->gaussPts.resize(3, nb_gauss_pts, false);
733 cblas_dcopy(nb_gauss_pts, &
QUAD_2D_TABLE[rule]->points[1], 3,
734 &fe_ptr->gaussPts(0, 0), 1);
735 cblas_dcopy(nb_gauss_pts, &
QUAD_2D_TABLE[rule]->points[2], 3,
736 &fe_ptr->gaussPts(1, 0), 1);
738 &fe_ptr->gaussPts(2, 0), 1);
739 auto &data = fe_ptr->dataOnElement[
H1];
740 data->dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 3,
741 false);
742 double *shape_ptr =
743 &*data->dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin();
744 cblas_dcopy(3 * nb_gauss_pts,
QUAD_2D_TABLE[rule]->points, 1, shape_ptr,
745 1);
746 data->dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE).resize(3, 2,
false);
747 std::copy(
749 data->dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE).data().begin());
750
751 } else {
754 }
756 };
757
758 CHKERR set_base_quadrature();
759
760 auto set_gauss_pts = [&](auto &ref_gauss_pts) {
762 fe_ptr->gaussPts.swap(ref_gauss_pts);
763 const size_t nb_gauss_pts = fe_ptr->gaussPts.size2();
764 auto &data = fe_ptr->dataOnElement[
H1];
765 data->dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 3);
766 double *shape_ptr =
767 &*data->dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin();
769 &fe_ptr->gaussPts(1, 0), nb_gauss_pts);
771 };
772
773 auto refine_quadrature = [&]() {
775
776 moab::Core moab_ref;
777 double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0};
779 for (int nn = 0; nn != numNodes; nn++)
780 CHKERR moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
782 CHKERR moab_ref.create_element(MBTRI, nodes, numNodes, tri);
785
786 Range ref_tri(tri, tri);
788 CHKERR m_field_ref.
get_moab().get_adjacencies(ref_tri, 1,
true, edges,
789 moab::Interface::UNION);
792
793 Range nodes_at_front;
794 for (int nn = 0; nn != numNodes; nn++) {
796 CHKERR moab_ref.side_element(tri, 0, nn, ent);
797 nodes_at_front.insert(ent);
798 }
799
801 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
802 for (int ee = 0; ee != numEdges; ee++) {
804 CHKERR moab_ref.side_element(tri, 1, ee, ent);
805 CHKERR moab_ref.add_entities(meshset, &ent, 1);
806 }
807
808
812 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(0),
814
815
816
817
818
819
820 CHKERR m_ref->addVerticesInTheMiddleOfEdges(ref_edges,
824 ->updateMeshsetByEntitiesChildren(meshset,
BitRefLevel().set(1),
825 meshset, MBEDGE, true);
827 ->updateMeshsetByEntitiesChildren(meshset,
BitRefLevel().set(1),
828 meshset, MBTRI, true);
829
830
831 Range output_ref_tris;
833 ->getEntitiesByTypeAndRefLevel(
835
836#ifndef NDEBUG
838#endif
839
840 MatrixDouble ref_coords(output_ref_tris.size(), 9,
false);
841 int tt = 0;
842 for (Range::iterator tit = output_ref_tris.begin();
843 tit != output_ref_tris.end(); tit++, tt++) {
844 int num_nodes;
846 CHKERR moab_ref.get_connectivity(*tit, conn, num_nodes,
false);
847 CHKERR moab_ref.get_coords(conn, num_nodes, &ref_coords(tt, 0));
848 }
849
850 auto &data = fe_ptr->dataOnElement[
H1];
851 const size_t nb_gauss_pts = fe_ptr->gaussPts.size2();
852 MatrixDouble ref_gauss_pts(3, nb_gauss_pts * ref_coords.size1());
854 int gg = 0;
855 for (size_t tt = 0; tt != ref_coords.size1(); tt++) {
856 double *tri_coords = &ref_coords(tt, 0);
859 auto det = t_normal.
l2();
860 for (size_t ggg = 0; ggg != nb_gauss_pts; ++ggg, ++gg) {
861 for (
int dd = 0;
dd != 2;
dd++) {
862 ref_gauss_pts(dd, gg) = shape_n(ggg, 0) * tri_coords[3 * 0 +
dd] +
863 shape_n(ggg, 1) * tri_coords[3 * 1 +
dd] +
864 shape_n(ggg, 2) * tri_coords[3 * 2 +
dd];
865 }
867 << ref_gauss_pts(0, gg) << ", " << ref_gauss_pts(1, gg);
868 ref_gauss_pts(2, gg) = fe_ptr->gaussPts(2, ggg) * det;
869 }
870 }
871
872 int num_nodes;
874 CHKERR m_field.get_moab().get_connectivity(fe_handle, conn, num_nodes,
875 true);
876 std::bitset<numNodes> all_nodes;
877 for (auto nn = 0; nn != numNodes; ++nn) {
878 all_nodes.set(nn);
879 }
880
883
885 };
886
887 CHKERR refine_quadrature();
888
890}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
#define QUAD_2D_TABLE_SIZE
#define QUAD_3D_TABLE_SIZE
static QUAD *const QUAD_2D_TABLE[]
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Mesh refinement interface.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static std::map< long int, MatrixDouble > mapRefCoords