1 #include <libmesh/equation_systems.h>
2 #include <libmesh/mesh.h>
3 #include <libmesh/node.h>
4 #include <libmesh/dof_map.h>
5 #include <libmesh/mesh_generation.h>
6 #include <libmesh/replicated_mesh.h>
7 #include <libmesh/mesh_function.h>
8 #include <libmesh/numeric_vector.h>
9 #include <libmesh/mesh_refinement.h>
10 #include <libmesh/sparse_matrix.h>
11 #include "libmesh/string_to_enum.h"
12 #include <libmesh/cell_tet4.h>
13 #include <libmesh/zero_function.h>
14 #include <libmesh/linear_implicit_system.h>
15 #include <libmesh/transient_system.h>
16 #include <libmesh/quadrature_gauss.h>
17 #include <libmesh/node_elem.h>
18 #include <libmesh/edge_edge2.h>
19 #include <libmesh/dg_fem_context.h>
20 #include <libmesh/enum_solver_type.h>
21 #include <libmesh/enum_preconditioner_type.h>
22 #include <libmesh/linear_solver.h>
23 #include <libmesh/parallel.h>
57 map_type & coupled_elements)
override
64 for (
const auto & elem :
as_range(range_begin, range_end))
66 if (elem->id() == node_elem_id_1)
68 if (elem->processor_id() != p)
70 coupled_elements.insert (std::make_pair(elem, null_mat));
74 coupled_elements.insert (std::make_pair(neighbor, null_mat));
77 if (elem->id() == node_elem_id_2)
79 if (elem->processor_id() != p)
81 coupled_elements.insert (std::make_pair(elem, null_mat));
85 coupled_elements.insert (std::make_pair(neighbor, null_mat));
104 { this->mesh_reinit(); }
110 const std::string& system_name)
119 std::vector<dof_id_type> dof_indices;
124 for ( ; el != end_el; ++el)
126 const Elem* elem = *el;
133 dof_map.dof_indices (elem, dof_indices);
134 const unsigned int n_dofs = dof_indices.size();
136 Ke.
resize (n_dofs, n_dofs);
139 for(
unsigned int i=0; i<n_dofs; i++)
153 dof_indices.resize(6);
168 const unsigned int n_dofs = dof_indices.size();
169 Ke.
resize (n_dofs, n_dofs);
172 for(
unsigned int i=0; i<n_dofs; i++)
196 std::vector<dof_id_type> dof_indices;
225 const std::vector<Real> &JxW = elem_fe->
get_JxW();
226 const std::vector<std::vector<Real> >& phi = elem_fe->
get_phi();
227 const std::vector<std::vector<RealGradient> >& dphi = elem_fe->
get_dphi();
232 for (
unsigned int qp=0; qp != n_qpoints; qp++)
233 for (
unsigned int i=0; i != n_dofs; i++)
234 for (
unsigned int j=0; j != n_dofs; j++)
237 for (
unsigned int qp=0; qp != n_qpoints; qp++)
238 for (
unsigned int i=0; i != n_dofs; i++)
246 for (context.
side = 0; context.
side != elem->n_sides(); ++context.
side)
263 const std::vector<Real> &JxW_face = side_fe->
get_JxW();
264 const std::vector<std::vector<Real> >& phi_face = side_fe->
get_phi();
266 FEBase* neighbor_side_fe = NULL;
271 const std::vector<std::vector<Real> >& phi_neighbor_face =
278 for (
unsigned int qp=0; qp<n_sidepoints; qp++)
280 for (
unsigned int i=0; i<n_dofs; i++)
281 for (
unsigned int j=0; j<n_dofs; j++)
284 JxW_face[qp] * phi_face[i][qp] * phi_face[j][qp];
287 for (
unsigned int i=0; i<n_dofs; i++)
288 for (
unsigned int j=0; j<n_neighbor_dofs; j++)
291 JxW_face[qp] * phi_face[i][qp] * phi_neighbor_face[j][qp];
294 for (
unsigned int i=0; i<n_neighbor_dofs; i++)
295 for (
unsigned int j=0; j<n_neighbor_dofs; j++)
298 JxW_face[qp] * phi_neighbor_face[i][qp] * phi_neighbor_face[j][qp];
301 for (
unsigned int i=0; i<n_neighbor_dofs; i++)
302 for (
unsigned int j=0; j<n_dofs; j++)
305 JxW_face[qp] * phi_neighbor_face[i][qp] * phi_face[j][qp];
335 const Real & x = p(0);
336 const Real & y = LIBMESH_DIM > 1 ? p(1) : 0;
337 const Real & z = LIBMESH_DIM > 2 ? p(2) : 0;
339 return x*(1-x)*(1-x) + x*x*(1-y) + x*(1-y)*(1-z) + y*(1-y)*z + z*(1-z)*(1-z);
348 const Real & x = p(0);
349 const Real & y = LIBMESH_DIM > 1 ? p(1) : 0;
350 const Real & z = LIBMESH_DIM > 2 ? p(2) : 0;
352 return x + 2*y + 3*z - 1;
361 const Real & x = p(0);
362 const Real & y = LIBMESH_DIM > 1 ? p(1) : 0;
363 const Real & z = LIBMESH_DIM > 2 ? p(2) : 0;
365 return (3*x < 1) + (3*y < 2) + (3*z > 2);
373 virtual std::unique_ptr<FunctionBase<Number>>
clone ()
const
374 {
return libmesh_make_unique<TripleFunction>(offset); }
378 const Real = 0.)
override
381 virtual void operator() (
const Point & p,
385 libmesh_assert_greater(output.
size(), 0);
387 output(0) =
cubic_test(p, params,
"",
"") + offset;
388 if (output.
size() > 0)
390 if (output.
size() > 1)
401 return cubic_test(p, params,
"",
"") + offset;
420 CPPUNIT_TEST( testProjectHierarchicEdge3 );
422 CPPUNIT_TEST( testProjectHierarchicQuad9 );
423 CPPUNIT_TEST( testProjectHierarchicTri6 );
424 #ifdef LIBMESH_HAVE_SOLVER
425 CPPUNIT_TEST( testBlockRestrictedVarNDofs );
427 #endif // LIBMESH_DIM > 1
429 CPPUNIT_TEST( testProjectHierarchicHex27 );
430 CPPUNIT_TEST( testProjectMeshFunctionHex27 );
431 CPPUNIT_TEST( testBoundaryProjectCube );
432 #ifdef LIBMESH_HAVE_SOLVER
433 CPPUNIT_TEST( testAssemblyWithDgFemContext );
435 #endif // LIBMESH_DIM > 2
436 #ifdef LIBMESH_HAVE_SOLVER
437 CPPUNIT_TEST( testDofCouplingWithVarGroups );
440 #ifdef LIBMESH_ENABLE_AMR
441 #ifdef LIBMESH_HAVE_METAPHYSICL
442 #ifdef LIBMESH_HAVE_PETSC
443 CPPUNIT_TEST( testProjectMatrixEdge2 );
445 CPPUNIT_TEST( testProjectMatrixQuad4 );
446 CPPUNIT_TEST( testProjectMatrixTri3 );
447 #endif // LIBMESH_DIM > 1
449 CPPUNIT_TEST( testProjectMatrixHex8 );
450 CPPUNIT_TEST( testProjectMatrixTet4 );
451 #endif // LIBMESH_DIM > 2
452 #endif // LIBMESH_HAVE_PETSC
453 #endif // LIBMESH_HAVE_METAPHYSICL
454 #endif // LIBMESH_ENABLE_AMR
456 CPPUNIT_TEST_SUITE_END();
462 std::set<subdomain_id_type> & u_subdomains,
463 std::set<subdomain_id_type> & v_subdomains,
464 std::set<subdomain_id_type> & w_subdomains,
467 const Elem * elem = locator(p);
471 if (u_subdomains.count(sbd_id))
473 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(0,p)),
483 if (v_subdomains.count(sbd_id))
485 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(1,p)),
495 if (w_subdomains.count(sbd_id))
497 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(2,p)),
524 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
525 v_subdomains {1, 2, 3, 4},
526 w_subdomains {0, 1, 2, 3, 4};
538 elem->subdomain_id() = elem->id();
542 sys.project_solution(&tfunc);
549 locator->enable_out_of_mesh_mode();
550 for (
Real x = 0.1; x < 1; x += 0.2)
551 tripleValueTest(
Point(x), sys, *locator,
552 u_subdomains, v_subdomains, w_subdomains,
555 #ifdef LIBMESH_ENABLE_AMR
557 if ((elem->id()/2)%2)
562 locator->enable_out_of_mesh_mode();
563 for (
Real x = 0.1; x < 1; x += 0.2)
564 tripleValueTest(
Point(x), sys, *locator,
565 u_subdomains, v_subdomains, w_subdomains,
578 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
579 v_subdomains {1, 2, 3, 4},
580 w_subdomains {0, 1, 2, 3, 4};
592 elem->subdomain_id() = elem->id()/2;
596 sys.project_solution(&tfunc);
603 locator->enable_out_of_mesh_mode();
604 for (
Real x = 0.1; x < 1; x += 0.2)
605 for (
Real y = 0.1; y < 1; y += 0.2)
606 tripleValueTest(
Point(x,y), sys, *locator,
607 u_subdomains, v_subdomains, w_subdomains,
610 #ifdef LIBMESH_ENABLE_AMR
612 if ((elem->id()/2)%2)
617 locator->enable_out_of_mesh_mode();
618 for (
Real x = 0.1; x < 1; x += 0.2)
619 for (
Real y = 0.1; y < 1; y += 0.2)
620 tripleValueTest(
Point(x,y), sys, *locator,
621 u_subdomains, v_subdomains, w_subdomains,
634 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
635 v_subdomains {1, 2, 3, 4},
636 w_subdomains {0, 1, 2, 3, 4};
644 0., 1., 0., 1., 0., 1.,
648 elem->subdomain_id() = elem->id()/6;
652 sys.project_solution(&tfunc);
659 locator->enable_out_of_mesh_mode();
660 for (
Real x = 0.1; x < 1; x += 0.2)
661 for (
Real y = 0.1; y < 1; y += 0.2)
662 for (
Real z = 0.1; z < 1; z += 0.2)
663 tripleValueTest(
Point(x,y,z), sys, *locator,
664 u_subdomains, v_subdomains, w_subdomains,
667 #ifdef LIBMESH_ENABLE_AMR
669 if ((elem->id()/2)%2)
674 locator->enable_out_of_mesh_mode();
675 for (
Real x = 0.1; x < 1; x += 0.2)
676 for (
Real y = 0.1; y < 1; y += 0.2)
677 for (
Real z = 0.1; z < 1; z += 0.2)
678 tripleValueTest(
Point(x,y,z), sys, *locator,
679 u_subdomains, v_subdomains, w_subdomains,
696 0., 1., 0., 1., 0., 1.,
702 std::vector<unsigned int> variables;
704 std::sort(variables.begin(),variables.end());
706 std::unique_ptr< NumericVector<Number> > mesh_function_vector =
708 mesh_function_vector->init(sys.
n_dofs(),
false,
SERIAL);
709 sys.
solution->localize( *mesh_function_vector );
712 *mesh_function_vector,
715 mesh_function.
init();
728 0., 1., 0., 1., 0., 1.,
734 for (
Real x = 0.1; x < 1; x += 0.2)
735 for (
Real y = 0.1; y < 1; y += 0.2)
736 for (
Real z = 0.1; z < 1; z += 0.2)
765 0., 1., 0., 1., 0., 1.,
769 std::set<dof_id_type> projected_nodes_set;
773 for (
auto side : elem->side_index_range())
775 std::vector<boundary_id_type> vec_to_fill;
778 auto vec_it = std::find(vec_to_fill.begin(), vec_to_fill.end(), SIDE_BOUNDARY_ID);
779 if (vec_it != vec_to_fill.end())
781 for (
unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
783 if( elem->is_node_on_side(node_index, side))
785 projected_nodes_set.insert(elem->node_id(node_index));
796 side_max_x = 0, side_min_y = 0,
797 side_max_y = 0, side_max_z = 0;
800 found_side_max_x =
false, found_side_max_y =
false,
801 found_side_min_y =
false, found_side_max_z =
false;
803 for (
auto side : elem->side_index_range())
808 found_side_max_x =
true;
814 found_side_min_y =
true;
820 found_side_max_y =
true;
826 found_side_max_z =
true;
833 if (found_side_max_x && found_side_max_y && found_side_max_z)
834 for (
auto n : elem->node_index_range())
835 if (elem->is_node_on_side(n, side_max_x) &&
836 elem->is_node_on_side(n, side_max_y) &&
837 elem->is_node_on_side(n, side_max_z))
839 projected_nodes_set.insert(elem->node_id(n));
846 if (found_side_max_x && found_side_min_y)
847 for (
auto e : elem->edge_index_range())
848 if (elem->is_edge_on_side(e, side_max_x) &&
849 elem->is_edge_on_side(e, side_min_y))
853 for (
unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
855 if (elem->is_node_on_edge(node_index, e))
857 projected_nodes_set.insert(elem->node_id(node_index));
867 std::set<boundary_id_type> boundary_ids;
868 boundary_ids.insert(NODE_BOUNDARY_ID);
869 boundary_ids.insert(EDGE_BOUNDARY_ID);
870 boundary_ids.insert(SIDE_BOUNDARY_ID);
871 std::vector<unsigned int> variables;
872 variables.push_back(u_var);
883 Real ref_l1_norm = static_cast<Real>(
mesh.
n_nodes()) - static_cast<Real>(projected_nodes_set.size());
901 Point new_point_a(2.);
902 Point new_point_b(3.);
906 new_edge_elem->
set_node(0) = new_node_a;
907 new_edge_elem->
set_node(1) = new_node_b;
916 node_elem_2->
set_node(0) = new_node_a;
929 std::set<subdomain_id_type> theta_subdomains;
930 theta_subdomains.insert(10);
945 equation_systems.
init ();
969 0., 1., 0., 1., 0., 1.,
996 for (; el != el_end; ++el)
997 if ((*el)->centroid()(0) <= 0.5 && (*el)->centroid()(1) <= 0.5)
998 (*el)->subdomain_id() = 0;
1000 (*el)->subdomain_id() = 1;
1009 std::set<subdomain_id_type> block0;
1010 std::set<subdomain_id_type> block1;
1015 equation_systems.
init();
1017 std::vector<dof_id_type> u0_dofs;
1019 std::vector<dof_id_type> u1_dofs;
1022 std::set<dof_id_type> sys_u0_dofs;
1024 std::set<dof_id_type> sys_u1_dofs;
1030 mesh.
comm().set_union(sys_u0_dofs);
1031 mesh.
comm().set_union(sys_u1_dofs);
1033 const std::size_t c9 = 9;
1034 const std::size_t c21 = 21;
1035 CPPUNIT_ASSERT_EQUAL(c9, u0_dofs.size());
1036 CPPUNIT_ASSERT_EQUAL(c21, u1_dofs.size());
1037 CPPUNIT_ASSERT_EQUAL(c9, sys_u0_dofs.size());
1038 CPPUNIT_ASSERT_EQUAL(c21, sys_u1_dofs.size());
1041 #ifdef LIBMESH_ENABLE_AMR
1042 #ifdef LIBMESH_HAVE_METAPHYSICL
1043 #ifdef LIBMESH_HAVE_PETSC
1065 std::set<dof_id_type> coarse_nodes({0,1,2,3,4});
1066 std::vector<dof_id_type> node_order_f({0,5,1,6,2,7,3,8,4});
1069 int n_old_dofs = sys.
n_dofs();
1072 std::map <dof_id_type, dof_id_type> node2dof_c;
1076 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1085 std::map <dof_id_type, dof_id_type> node2dof_f;
1089 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1093 int n_new_dofs = sys.
n_dofs();
1097 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1100 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1103 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1108 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1111 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1117 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1119 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1123 auto cdof_id = node2dof_c.find(node_id);
1124 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1131 auto node_loc = std::find(node_order_f.begin(), node_order_f.end(), node_id);
1134 auto dof_p = node2dof_c.find(node_p);
1135 auto dof_n = node2dof_c.find(node_n);
1137 gold_mat.
set(fdof_id, dof_p->second, 0.5);
1138 gold_mat.
set(fdof_id, dof_n->second, 0.5);
1146 gold_mat.
add(-1.0, proj_mat);
1165 if (elem_type == Utility::string_to_enum<ElemType>(
"QUAD4"))
1170 else if (elem_type == Utility::string_to_enum<ElemType>(
"TRI3"))
1179 std::set<dof_id_type> coarse_nodes;
1180 std::map<dof_id_type, std::vector<dof_id_type>> side_nbr_nodes;
1181 std::map<dof_id_type, std::vector<dof_id_type>> int_nbr_nodes;
1184 if (elem_type == Utility::string_to_enum<ElemType>(
"QUAD4"))
1186 coarse_nodes.insert({0,1,2,3,4,5,6,7,8});
1188 side_nbr_nodes.insert({9, {0,1}});
1189 side_nbr_nodes.insert({14, {1,2}});
1190 side_nbr_nodes.insert({11, {0,3}});
1191 side_nbr_nodes.insert({12, {1,4}});
1192 side_nbr_nodes.insert({16, {2,5}});
1193 side_nbr_nodes.insert({13, {3,4}});
1194 side_nbr_nodes.insert({17, {4,5}});
1195 side_nbr_nodes.insert({19, {3,6}});
1196 side_nbr_nodes.insert({20, {4,7}});
1197 side_nbr_nodes.insert({23, {5,8}});
1198 side_nbr_nodes.insert({21, {6,7}});
1199 side_nbr_nodes.insert({24, {7,8}});
1201 int_nbr_nodes.insert({10, {0,1,3,4}});
1202 int_nbr_nodes.insert({15, {1,2,4,5}});
1203 int_nbr_nodes.insert({18, {3,4,6,7}});
1204 int_nbr_nodes.insert({22, {4,5,7,8}});
1206 else if (elem_type == Utility::string_to_enum<ElemType>(
"TRI3"))
1208 coarse_nodes.insert({0,1,2,3});
1210 side_nbr_nodes.insert({4, {0,1}});
1211 side_nbr_nodes.insert({5, {0,3}});
1212 side_nbr_nodes.insert({6, {1,3}});
1213 side_nbr_nodes.insert({7, {0,2}});
1214 side_nbr_nodes.insert({8, {2,3}});
1218 int n_old_dofs = sys.
n_dofs();
1221 std::map <dof_id_type, dof_id_type> node2dof_c;
1225 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1234 std::map <dof_id_type, dof_id_type> node2dof_f;
1238 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1242 int n_new_dofs = sys.
n_dofs();
1246 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1249 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1252 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1257 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1260 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1266 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1268 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1272 auto cdof_id = node2dof_c.find(node_id);
1273 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1276 else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1280 auto node_nbrs = side_nbr_nodes.find(node_id);
1281 for (
auto nbr : node_nbrs->second)
1283 auto nbr_dof = node2dof_c.find(nbr);
1284 gold_mat.
set(fdof_id, nbr_dof->second, 0.5);
1292 auto node_nbrs = int_nbr_nodes.find(node_id);
1293 for (
auto nbr : node_nbrs->second)
1295 auto nbr_dof = node2dof_c.find(nbr);
1296 gold_mat.
set(fdof_id, nbr_dof->second, 0.25);
1305 proj_mat.
add(-1.0, gold_mat);
1324 if (elem_type == Utility::string_to_enum<ElemType>(
"HEX8"))
1327 0., 1., 0., 1., 0., 1.,
1329 else if (elem_type == Utility::string_to_enum<ElemType>(
"TET4"))
1350 std::set<dof_id_type> coarse_nodes;
1351 std::map<dof_id_type, std::vector<dof_id_type>> side_nbr_nodes;
1352 std::map<dof_id_type, std::vector<dof_id_type>> face_nbr_nodes;
1353 std::map<dof_id_type, std::vector<dof_id_type>> int_nbr_nodes;
1355 if (elem_type == Utility::string_to_enum<ElemType>(
"HEX8"))
1357 coarse_nodes.insert({0,1,2,3,4,5,6,7});
1360 side_nbr_nodes.insert({8, {0,1}});
1361 side_nbr_nodes.insert({10, {0,2}});
1362 side_nbr_nodes.insert({15, {1,3}});
1363 side_nbr_nodes.insert({18, {2,3}});
1364 side_nbr_nodes.insert({11, {0,4}});
1365 side_nbr_nodes.insert({16, {1,5}});
1366 side_nbr_nodes.insert({21, {3,7}});
1367 side_nbr_nodes.insert({20, {2,6}});
1368 side_nbr_nodes.insert({22, {4,5}});
1369 side_nbr_nodes.insert({24, {4,6}});
1370 side_nbr_nodes.insert({25, {5,7}});
1371 side_nbr_nodes.insert({26, {6,7}});
1373 face_nbr_nodes.insert({12, {0,1,4,5}});
1374 face_nbr_nodes.insert({9 , {0,1,2,3}});
1375 face_nbr_nodes.insert({14, {0,2,4,6}});
1376 face_nbr_nodes.insert({17, {1,3,5,7}});
1377 face_nbr_nodes.insert({19, {2,3,6,7}});
1378 face_nbr_nodes.insert({23, {4,5,6,7}});
1380 int_nbr_nodes.insert({13, {0,1,2,3,4,5,6,7}});
1382 else if (elem_type == Utility::string_to_enum<ElemType>(
"TET4"))
1384 coarse_nodes.insert({0,1,2,3});
1387 side_nbr_nodes.insert({4, {0,1}});
1388 side_nbr_nodes.insert({5, {0,2}});
1389 side_nbr_nodes.insert({6, {0,3}});
1390 side_nbr_nodes.insert({7, {1,2}});
1391 side_nbr_nodes.insert({8, {1,3}});
1392 side_nbr_nodes.insert({9, {2,3}});
1396 int n_old_dofs = sys.
n_dofs();
1399 std::map <dof_id_type, dof_id_type> node2dof_c;
1403 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1412 std::map <dof_id_type, dof_id_type> node2dof_f;
1416 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1420 int n_new_dofs = sys.
n_dofs();
1424 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1427 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1430 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1435 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1438 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1444 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1446 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1450 auto cdof_id = node2dof_c.find(node_id);
1451 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1454 else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1458 auto node_nbrs = side_nbr_nodes.find(node_id);
1459 for (
auto nbr : node_nbrs->second)
1461 auto nbr_dof = node2dof_c.find(nbr);
1462 gold_mat.
set(fdof_id, nbr_dof->second, 0.5);
1466 else if ( face_nbr_nodes.find(node_id) != face_nbr_nodes.end() )
1470 auto node_nbrs = face_nbr_nodes.find(node_id);
1471 for (
auto nbr : node_nbrs->second)
1473 auto nbr_dof = node2dof_c.find(nbr);
1474 gold_mat.
set(fdof_id, nbr_dof->second, 0.25);
1482 auto node_nbrs = int_nbr_nodes.find(node_id);
1483 for (
auto nbr : node_nbrs->second)
1485 auto nbr_dof = node2dof_c.find(nbr);
1486 gold_mat.
set(fdof_id, nbr_dof->second, 0.125);
1495 proj_mat.
add(-1.0, gold_mat);
1499 #endif // LIBMESH_HAVE_PETSC
1500 #endif // LIBMESH_HAVE_METAPHYSICL
1501 #endif // LIBMESH_ENABLE_AMR
1510 #ifdef LIBMESH_ENABLE_AMR
1511 #ifdef LIBMESH_HAVE_METAPHYSICL
1512 #ifdef LIBMESH_HAVE_PETSC
1519 #endif // LIBMESH_HAVE_PETSC
1520 #endif // LIBMESH_HAVE_METAPHYSICL
1521 #endif // LIBMESH_ENABLE_AMR