54 using namespace QuadTreeNames;
57 unsigned n_p = nnode_1d();
59 Father_bound[n_p].resize(n_p*n_p,4);
62 for(
unsigned n=0;n<n_p*n_p;n++)
63 {
for(
unsigned ison=0;ison<4;ison++) {Father_bound[n_p](n,ison)=
Tree::OMEGA;}}
68 Father_bound[n_p](0,
SW) =
SW;
70 for (
unsigned n=1;n<n_p;n++) {Father_bound[n_p](n,
SW) =
S;}
72 for(
unsigned n=1;n<n_p;n++) {Father_bound[n_p](n_p*n,
SW) =
W;}
78 Father_bound[n_p](n_p*(n_p-1),
NW) =
NW;
80 for(
unsigned n=1;n<n_p;n++) {Father_bound[n_p](n_p*(n_p-1)+n,
NW) =
N;}
82 for(
unsigned n=0;n<(n_p-1);n++) {Father_bound[n_p](n_p*n,
NW) =
W;}
88 Father_bound[n_p](n_p*n_p-1,
NE) =
NE;
90 for(
unsigned n=0;n<(n_p-1);n++) {Father_bound[n_p](n_p*(n_p-1)+n,
NE) =
N;}
92 for(
unsigned n=0;n<(n_p-1);n++) {Father_bound[n_p](n_p-1 + n_p*n,
NE) =
E;}
98 Father_bound[n_p](n_p-1,
SE) =
SE;
100 for(
unsigned n=0;n<(n_p-1);n++) {Father_bound[n_p](n,
SE) =
S;}
102 for(
unsigned n=1;n<n_p;n++) {Father_bound[n_p](n_p-1 + n_p*n,
SE) =
E;}
126 using namespace QuadTreeNames;
129 unsigned nvalue=ncont_interpolated_values();
131 Vector<int> bound_cons1(nvalue), bound_cons2(nvalue);
141 get_edge_bcs(bound,bound_cons);
146 get_edge_bcs(
S,bound_cons1);
147 get_edge_bcs(
E,bound_cons2);
149 for(
unsigned k=0;k<nvalue;k++)
150 {bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
155 get_edge_bcs(
S,bound_cons1);
156 get_edge_bcs(
W,bound_cons2);
158 for(
unsigned k=0;k<nvalue;k++)
159 {bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
164 get_edge_bcs(
N,bound_cons1);
165 get_edge_bcs(
W,bound_cons2);
167 for(
unsigned k=0;k<nvalue;k++)
168 {bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
173 get_edge_bcs(
N,bound_cons1);
174 get_edge_bcs(
E,bound_cons2);
176 for(
unsigned k=0;k<nvalue;k++)
177 {bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
182 OOMPH_CURRENT_FUNCTION,
183 OOMPH_EXCEPTION_LOCATION);
199 using namespace QuadTreeNames;
202 unsigned n_p = nnode_1d();
204 unsigned left_node, right_node;
210 left_node = n_p*(n_p-1);
211 right_node = n_p*n_p - 1;
221 right_node = n_p*(n_p-1);
226 right_node = n_p*n_p - 1;
230 std::ostringstream error_stream;
232 <<
"Wrong edge " << edge <<
" passed to get_edge_bcs(..)" << std::endl;
235 OOMPH_CURRENT_FUNCTION,
236 OOMPH_EXCEPTION_LOCATION);
240 unsigned maxnvalue=ncont_interpolated_values();
245 for(
unsigned k=0;k<maxnvalue;k++)
248 node_pt(left_node)->is_pinned(k)*node_pt(right_node)->is_pinned(k);
263 std::set<unsigned>& boundary)
const 265 using namespace QuadTreeNames;
268 unsigned n_p = nnode_1d();
270 int left_node=-1, right_node=-1;
276 left_node = n_p*(n_p-1);
277 right_node = n_p*n_p - 1;
287 right_node = n_p*(n_p-1);
292 right_node = n_p*n_p - 1;
305 right_node = n_p*n_p - 1;
309 right_node = n_p*(n_p-1);
313 std::ostringstream error_stream;
315 <<
"Wrong edge " << edge <<
" passed" << std::endl;
318 OOMPH_CURRENT_FUNCTION,
319 OOMPH_EXCEPTION_LOCATION);
326 std::set<unsigned>* right_boundaries_pt=0;
328 node_pt(right_node)->get_boundaries_pt(right_boundaries_pt);
331 if(right_boundaries_pt!=0)
337 copy(right_boundaries_pt->begin(),
338 right_boundaries_pt->end(),
339 inserter(boundary,boundary.begin()));
344 std::set<unsigned>* left_boundaries_pt=0;
345 node_pt(left_node)->get_boundaries_pt(left_boundaries_pt);
347 if(left_boundaries_pt!=0)
351 std::set_intersection(right_boundaries_pt->begin(),
352 right_boundaries_pt->end(),
353 left_boundaries_pt->begin(),
354 left_boundaries_pt->end(),
355 inserter(boundary,boundary.begin()));
373 using namespace QuadTreeNames;
376 unsigned n_p = nnode_1d();
385 unsigned start=0, multiplier=1;
394 std::ostringstream error_stream;
395 error_stream<<
"Coordinate " << s[0] <<
" " << s[1]
396 <<
" is not on South edge\n";
399 OOMPH_CURRENT_FUNCTION,
400 OOMPH_EXCEPTION_LOCATION);
410 std::ostringstream error_stream;
411 error_stream<<
"Coordinate " << s[0] <<
" " << s[1]
412 <<
" is not on North edge\n";
415 OOMPH_CURRENT_FUNCTION,
416 OOMPH_EXCEPTION_LOCATION);
427 std::ostringstream error_stream;
428 error_stream<<
"Coordinate " << s[0] <<
" " << s[1]
429 <<
" is not on West edge\n";
432 OOMPH_CURRENT_FUNCTION,
433 OOMPH_EXCEPTION_LOCATION);
444 std::ostringstream error_stream;
445 error_stream<<
"Coordinate " << s[0] <<
" " << s[1]
446 <<
" is not on East edge\n";
449 OOMPH_CURRENT_FUNCTION,
450 OOMPH_EXCEPTION_LOCATION);
461 std::ostringstream error_stream;
463 <<
"Wrong edge " << edge <<
" passed" << std::endl;
466 OOMPH_CURRENT_FUNCTION,
467 OOMPH_EXCEPTION_LOCATION);
471 double inter_zeta = 0.0;
473 for(
unsigned n=0;n<n_p;n++)
476 unsigned node_number = start + multiplier*n;
478 node_pt(node_number)->get_coordinates_on_boundary(boundary,zeta);
480 inter_zeta += zeta[0]*psi(node_number);
484 zeta[0] = inter_zeta;
500 using namespace QuadTreeNames;
504 if(s_fraction[0]==0.0) {edges.push_back(
W);}
505 if(s_fraction[0]==1.0) {edges.push_back(
E);}
506 if(s_fraction[1]==0.0) {edges.push_back(
S);}
507 if(s_fraction[1]==1.0) {edges.push_back(
N);}
510 unsigned n_size = edges.size();
512 if(n_size==0) {
return 0;}
519 int neigh_edge, diff_level;
520 bool in_neighbouring_tree;
523 for(
unsigned j=0;j<n_size;j++)
527 neigh_pt = quadtree_pt()->
528 gteq_edge_neighbour(edges[j],translate_s,s_lo_neigh,s_hi_neigh,
529 neigh_edge,diff_level,in_neighbouring_tree);
545 for(
unsigned i=0;
i<2;
i++)
547 s[
i] = s_lo_neigh[
i] + s_fraction[translate_s[
i]]*
548 (s_hi_neigh[
i] - s_lo_neigh[
i]);
552 Node* neighbour_node_pt =
556 if(neighbour_node_pt!=0)
560 if(in_neighbouring_tree)
564 quadtree_pt()->root_pt()->is_neighbour_periodic(edges[j]);
567 return neighbour_node_pt;
606 bool& was_already_built,
607 std::ofstream &new_nodes_file)
609 using namespace QuadTreeNames;
612 unsigned n_p = nnode_1d();
615 if(Father_bound[n_p].nrow()==0) {setup_father_bounds();}
630 "Something fishy here: I have no father and yet \n";
632 "I have no nodes. Who has created me then?!\n";
635 OOMPH_CURRENT_FUNCTION,
636 OOMPH_EXCEPTION_LOCATION);
641 was_already_built=
false;
652 unsigned ntstorage=time_stepper_pt->ntstorage();
660 "Can't handle generalised nodal positions (yet).",
661 OOMPH_CURRENT_FUNCTION,
662 OOMPH_EXCEPTION_LOCATION);
709 for(
unsigned i=0;
i<2;
i++)
722 if(father_el_pt->
node_pt(0)==0)
725 "Trouble: father_el_pt->node_pt(0)==0\n Can't build son element!\n",
726 OOMPH_CURRENT_FUNCTION,
727 OOMPH_EXCEPTION_LOCATION);
737 for(
unsigned i0=0;i0<n_p;i0++)
740 s_fraction[0] = local_one_d_fraction_of_node(i0,0);
742 s[0] = s_lo[0] + (s_hi[0]-s_lo[0])*s_fraction[0];
744 for(
unsigned i1=0;i1<n_p;i1++)
747 s_fraction[1] = local_one_d_fraction_of_node(i1,1);
749 s[1] = s_lo[1] + (s_hi[1]-s_lo[1])*s_fraction[1];
769 bool node_done=
false;
777 if(created_node_pt!=0)
780 node_pt(jnod) = created_node_pt;
788 for(
unsigned t=0;
t<ntstorage;
t++)
797 unsigned n_val_at_node = created_node_pt->
nvalue();
798 unsigned n_val_from_function = prev_values.size();
800 unsigned n_var = n_val_at_node < n_val_from_function ?
801 n_val_at_node : n_val_from_function;
803 for(
unsigned k=0;k<n_var;k++)
805 created_node_pt->
set_value(
t,k,prev_values[k]);
821 bool is_periodic=
false;;
823 node_created_by_neighbour(s_fraction,is_periodic);
826 if(created_node_pt!=0)
835 Node* neighbour_node_pt = created_node_pt;
838 int father_bound=Father_bound[n_p](jnod,son_type);
845 std::set<unsigned> boundaries;
855 if (boundaries.size()>1)
858 "boundaries.size()!=1 seems a bit strange..\n",
859 OOMPH_CURRENT_FUNCTION,
860 OOMPH_EXCEPTION_LOCATION);
864 if(boundaries.size() == 0)
866 std::ostringstream error_stream;
868 <<
"Periodic node is not on a boundary...\n" 870 << created_node_pt->
x(0) <<
" " 871 << created_node_pt->
x(1) <<
"\n";
874 OOMPH_CURRENT_FUNCTION,
875 OOMPH_EXCEPTION_LOCATION);
881 construct_boundary_node(jnod,time_stepper_pt);
884 make_periodic(neighbour_node_pt);
886 new_node_pt.push_back(created_node_pt);
889 for (
unsigned t=0;
t<ntstorage;
t++)
897 father_el_pt->
get_x(
t,s,x_prev);
899 for(
unsigned i=0;
i<2;
i++)
901 created_node_pt->x(
t,
i) = x_prev[
i];
907 for(std::set<unsigned>::iterator it = boundaries.begin();
908 it != boundaries.end(); ++it)
924 created_node_pt->set_coordinates_on_boundary(*it,zeta);
935 node_pt(jnod) = created_node_pt;
949 bool is_periodic=
false;;
951 node_created_by_son_of_neighbour(s_fraction,is_periodic);
954 if(created_node_pt!=0)
963 Node* neighbour_node_pt = created_node_pt;
966 int father_bound=Father_bound[n_p](jnod,son_type);
973 std::set<unsigned> boundaries;
983 if (boundaries.size()>1)
986 "boundaries.size()!=1 seems a bit strange..\n",
987 OOMPH_CURRENT_FUNCTION,
988 OOMPH_EXCEPTION_LOCATION);
992 if(boundaries.size() == 0)
994 std::ostringstream error_stream;
996 <<
"Periodic node is not on a boundary...\n" 998 << created_node_pt->
x(0) <<
" " 999 << created_node_pt->
x(1) <<
"\n";
1002 OOMPH_CURRENT_FUNCTION,
1003 OOMPH_EXCEPTION_LOCATION);
1009 construct_boundary_node(jnod,time_stepper_pt);
1012 make_periodic(neighbour_node_pt);
1014 new_node_pt.push_back(created_node_pt);
1017 for (
unsigned t=0;
t<ntstorage;
t++)
1025 father_el_pt->
get_x(
t,s,x_prev);
1027 for(
unsigned i=0;
i<2;
i++)
1029 created_node_pt->x(
t,
i) = x_prev[
i];
1035 for(std::set<unsigned>::iterator it = boundaries.begin();
1036 it != boundaries.end(); ++it)
1052 created_node_pt->set_coordinates_on_boundary(*it,zeta);
1063 node_pt(jnod) = created_node_pt;
1082 int father_bound=Father_bound[n_p](jnod,son_type);
1089 std::set<unsigned> boundaries;
1099 if (boundaries.size()>1)
1102 "boundaries.size()!=1 seems a bit strange..\n",
1103 OOMPH_CURRENT_FUNCTION,
1104 OOMPH_EXCEPTION_LOCATION);
1110 if(boundaries.size()> 0)
1113 created_node_pt = construct_boundary_node(jnod,time_stepper_pt);
1115 new_node_pt.push_back(created_node_pt);
1122 Vector<int> bound_cons(ncont_interpolated_values());
1123 father_el_pt->
get_bcs(father_bound,bound_cons);
1126 unsigned n_value = created_node_pt->
nvalue();
1127 for(
unsigned k=0;k<n_value;k++)
1129 if (bound_cons[k]) {created_node_pt->
pin(k);}
1135 dynamic_cast<SolidNode*
>(created_node_pt);
1136 if (solid_node_pt!=0)
1139 unsigned n_dim = created_node_pt->
ndim();
1144 if (father_solid_el_pt==0)
1147 "We have a SolidNode outside a refineable SolidElement\n";
1149 "during mesh refinement -- this doesn't make sense";
1152 OOMPH_CURRENT_FUNCTION,
1153 OOMPH_EXCEPTION_LOCATION);
1156 father_solid_el_pt->
1157 get_solid_bcs(father_bound,solid_bound_cons);
1160 for(
unsigned k=0;k<n_dim;k++)
1162 if (solid_bound_cons[k]) {solid_node_pt->
pin_position(k);}
1170 for(std::set<unsigned>::iterator it = boundaries.begin();
1171 it != boundaries.end(); ++it)
1196 created_node_pt = construct_node(jnod,time_stepper_pt);
1198 new_node_pt.push_back(created_node_pt);
1214 for (
unsigned t=0;
t<ntstorage;
t++)
1222 father_el_pt->
get_x(
t,s,x_prev);
1225 for(
unsigned i=0;
i<2;
i++)
1227 created_node_pt->
x(
t,
i) = x_prev[
i];
1232 for (
unsigned t=0;
t<ntstorage;
t++)
1239 unsigned n_value = created_node_pt->
nvalue();
1240 for(
unsigned k=0;k<n_value;k++)
1242 created_node_pt->
set_value(
t,k,prev_values[k]);
1275 if((!node_done) && (new_nodes_file.is_open()))
1277 new_nodes_file << node_pt(jnod)->x(0) <<
" " 1278 << node_pt(jnod)->x(1) << std::endl;
1293 if (father_m_el_pt!=0)
1307 "Failed to cast to MacroElementNodeUpdateElementBase*\n";
1309 "Strange -- if the father is a MacroElementNodeUpdateElement\n";
1310 error_message +=
"the son should be too....\n";
1313 OOMPH_CURRENT_FUNCTION,
1314 OOMPH_EXCEPTION_LOCATION);
1325 m_el_pt->set_node_update_info(geom_object_pt);
1328 #ifdef OOMPH_HAS_MPI 1331 tree_pt()->father_pt()->object_pt()->non_halo_proc_ID();
1346 if (aux_father_el_pt==0)
1349 "Failed to cast to ElementWithMovingNodes*\n";
1351 "Strange -- if the son is a ElementWithMovingNodes\n";
1352 error_message +=
"the father should be too....\n";
1355 OOMPH_CURRENT_FUNCTION,
1356 OOMPH_EXCEPTION_LOCATION);
1363 ->are_dresidual_dnodal_coordinates_always_evaluated_by_fd())
1366 enable_always_evaluate_dresidual_dnodal_coordinates_by_fd();
1375 ->is_fill_in_jacobian_from_geometric_data_bypassed())
1391 was_already_built=
true;
1405 outfile <<
"ZONE I=2,J=2, C=" << colour << std::endl;
1410 outfile << corner[0] <<
" " << corner[1] <<
" " 1416 outfile << corner[0] <<
" " << corner[1] <<
" " 1422 outfile << corner[0] <<
" " << corner[1] <<
" " 1428 outfile << corner[0] <<
" " << corner[1] <<
" " 1432 outfile <<
"TEXT CS = GRID, X = " << corner[0] <<
1433 ",Y = " << corner[1] <<
", HU = GRID, H = 0.01, AN = MIDCENTER, T =\"" 1434 <<
Number <<
"\"" << std::endl;
1446 if(output_stream.size() != 4)
1449 OOMPH_CURRENT_FUNCTION,
1450 OOMPH_EXCEPTION_LOCATION);
1454 using namespace QuadTreeNames;
1457 quad_hang_helper(-1,
S,*(output_stream[0]));
1458 quad_hang_helper(-1,
N,*(output_stream[1]));
1459 quad_hang_helper(-1,
W,*(output_stream[2]));
1460 quad_hang_helper(-1,
E,*(output_stream[3]));
1469 using namespace QuadTreeNames;
1471 std::ofstream dummy_hangfile;
1472 quad_hang_helper(value_id,
S,dummy_hangfile);
1473 quad_hang_helper(value_id,
N,dummy_hangfile);
1474 quad_hang_helper(value_id,
W,dummy_hangfile);
1475 quad_hang_helper(value_id,
E,dummy_hangfile);
1485 const int &my_edge, std::ofstream& output_hangfile)
1487 using namespace QuadTreeNames;
1492 int neigh_edge,diff_level;
1493 bool in_neighbouring_tree;
1497 neigh_pt=quadtree_pt()->
1498 gteq_edge_neighbour(my_edge, translate_s, s_lo_neigh,
1499 s_hi_neigh,neigh_edge,diff_level,in_neighbouring_tree);
1509 bool is_periodic =
false;
1510 if(in_neighbouring_tree)
1511 {is_periodic = tree_pt()->root_pt()->is_neighbour_periodic(my_edge);}
1525 int neigh_edge_of_neigh,diff_level_of_neigh;
1526 bool in_neighbouring_tree_of_neigh;
1531 neigh_of_neigh_pt = neigh_pt->
1532 gteq_edge_neighbour(neigh_edge, translate_s_in_neigh,
1533 s_lo_neigh_of_neigh,
1534 s_hi_neigh_of_neigh,
1535 neigh_edge_of_neigh,diff_level_of_neigh,
1536 in_neighbouring_tree_of_neigh);
1539 neigh_pt = neigh_of_neigh_pt;
1540 neigh_edge = neigh_edge_of_neigh;
1555 for(
unsigned i=0;
i<2;
i++)
1557 s_lo_frac[
i] = (s_lo_neigh[
i] - s_min)/(s_max - s_min);
1558 s_hi_frac[
i] = (s_hi_neigh[
i] - s_min)/(s_max - s_min);
1563 for(
unsigned i=0;
i<2;
i++)
1565 s_lo_neigh[
i] = s_lo_neigh_of_neigh[
i]
1566 + s_lo_frac[translate_s_in_neigh[
i]]*
1567 (s_hi_neigh_of_neigh[
i] - s_lo_neigh_of_neigh[
i]);
1568 s_hi_neigh[
i] = s_lo_neigh_of_neigh[
i]
1569 + s_hi_frac[translate_s_in_neigh[
i]]*
1570 (s_hi_neigh_of_neigh[
i] - s_lo_neigh_of_neigh[
i]);
1575 for(
unsigned i=0;
i<2;
i++)
1577 temp_translate[
i] = translate_s_in_neigh[translate_s[
i]];
1579 for(
unsigned i=0;
i<2;
i++) {translate_s[
i] = temp_translate[
i];}
1583 unsigned n_p = ninterpolating_node_1d(value_id);
1585 Node* local_node_pt=0;
1587 for(
unsigned i0=0;i0<n_p;i0++)
1598 local_one_d_fraction_of_interpolating_node(i0,0,value_id);
1599 s_fraction[1] = 1.0;
1600 local_node_pt = interpolating_node_pt(i0 + n_p*(n_p-1),value_id);
1605 local_one_d_fraction_of_interpolating_node(i0,0,value_id);
1606 s_fraction[1] = 0.0;
1607 local_node_pt = interpolating_node_pt(i0,value_id);
1611 s_fraction[0] = 1.0;
1613 local_one_d_fraction_of_interpolating_node(i0,1,value_id);
1614 local_node_pt = interpolating_node_pt(n_p-1 + n_p*i0,value_id);
1618 s_fraction[0] = 0.0;
1620 local_one_d_fraction_of_interpolating_node(i0,1,value_id);
1621 local_node_pt = interpolating_node_pt(n_p*i0,value_id);
1626 OOMPH_CURRENT_FUNCTION,
1627 OOMPH_EXCEPTION_LOCATION);
1632 for(
unsigned i=0;
i<2;
i++)
1634 s_in_neighb[
i] = s_lo_neigh[
i] + s_fraction[translate_s[
i]]*
1635 (s_hi_neigh[
i] - s_lo_neigh[
i]);
1643 if(0==neighbouring_node_pt)
1647 bool make_hanging_node =
false;
1653 make_hanging_node =
true;
1661 make_hanging_node =
true;
1666 if(make_hanging_node ==
true)
1681 unsigned n_neighbour;
1684 for(
unsigned n_edge=0;n_edge<n_p;n_edge++)
1689 n_neighbour = n_p*(n_p-1) + n_edge;
1693 n_neighbour = n_edge;
1697 n_neighbour = n_p*n_edge;
1701 n_neighbour = n_p*n_edge + (n_p-1);
1706 OOMPH_CURRENT_FUNCTION,
1707 OOMPH_EXCEPTION_LOCATION);
1727 if(output_hangfile.is_open())
1729 output_hangfile << local_node_pt->
x(0) <<
" " <<
1730 local_node_pt->
x(1) << std::endl;
1737 if (local_node_pt!=neighbouring_node_pt)
1739 std::ostringstream warning_stream;
1740 warning_stream <<
"SANITY CHECK in quad_hang_helper \n" 1741 <<
"Current node " << local_node_pt
1743 <<
"(" << local_node_pt->
x(0) <<
", " 1744 << local_node_pt->
x(1) <<
")" 1745 <<
" is not hanging and has " << std::endl
1746 <<
"Neighbour's node " << neighbouring_node_pt
1748 <<
"(" << neighbouring_node_pt->x(0) <<
", " 1749 << neighbouring_node_pt->x(1) <<
")" 1751 <<
"even though the two should be " 1752 <<
"identical" << std::endl;
1754 "RefineableQElement<2>::quad_hang_helper()",
1755 OOMPH_EXCEPTION_LOCATION);
1769 local_node_pt->
x(0)=x_in_neighb[0];
1770 local_node_pt->
x(1)=x_in_neighb[1];
1787 using namespace QuadTreeNames;
1790 unsigned n_p=nnode_1d();
1799 double max_error_val=0.0;
1802 edges[0] =
S; edges[1] =
N; edges[2] =
W; edges[3] =
E;
1805 for(
unsigned edge_counter=0;edge_counter<4;edge_counter++)
1809 int neigh_edge,diff_level;
1810 bool in_neighbouring_tree;
1816 s_lo_neigh,s_hi_neigh,
1817 neigh_edge,diff_level,
1818 in_neighbouring_tree);
1825 bool is_periodic=
false;
1826 if(in_neighbouring_tree)
1834 for(
unsigned i0=0;i0<n_p;i0++)
1837 Node* local_node_pt=0;
1839 switch(edge_counter)
1843 s_fraction[0] = local_one_d_fraction_of_node(i0,0);
1844 s_fraction[1] = 0.0;
1846 local_node_pt = node_pt(i0);
1851 s_fraction[0] = local_one_d_fraction_of_node(i0,0);
1852 s_fraction[1] = 1.0;
1854 local_node_pt = node_pt(i0 + n_p*(n_p-1));
1859 s_fraction[0] = 0.0;
1860 s_fraction[1] = local_one_d_fraction_of_node(i0,1);
1862 local_node_pt = node_pt(n_p*i0);
1867 s_fraction[0] = 1.0;
1868 s_fraction[1] = local_one_d_fraction_of_node(i0,1);
1870 local_node_pt = node_pt(n_p-1 + n_p*i0);
1877 for(
unsigned i=0;
i<2;
i++)
1880 s[
i] = -1.0 + 2.0*s_fraction[
i];
1882 s_in_neighb[
i] = s_lo_neigh[
i] + s_fraction[translate_s[
i]]*
1883 (s_hi_neigh[
i] - s_lo_neigh[
i]);
1887 for(
unsigned t=0;
t<n_time;
t++)
1894 if(is_periodic==
false)
1896 for(
int i=0;
i<2;
i++)
1899 double err = std::fabs(local_node_pt->
x(
t,
i) - x_in_neighb[
i]);
1905 << local_node_pt->
x(
t,
i)
1906 <<
" " << x_in_neighb[
i]<< std::endl;
1909 << local_node_pt->
x(1) << std::endl;
1914 if (err>max_error_x[
i]) {max_error_x[
i]=err;}
1923 get_interpolated_values(
t,s_in_neighb,values_in_neighb);
1927 get_interpolated_values(
t,
s,values);
1933 for(
unsigned ival=0;ival<num_val;ival++)
1935 double err=std::fabs(values[ival] - values_in_neighb[ival]);
1940 << local_node_pt->
x(1) <<
" \n# " 1941 <<
"erru (S)" << err <<
" " << ival <<
" " 1942 << get_node_number(local_node_pt) <<
" " 1944 <<
" " << values_in_neighb[ival] << std::endl;
1947 if (err>max_error_val) {max_error_val=err;}
1956 max_error=max_error_x[0];
1957 if (max_error_x[1]>max_error) max_error=max_error_x[1];
1958 if (max_error_val>max_error) max_error=max_error_val;
1962 oomph_info <<
"\n#------------------------------------ \n#Max error " ;
1964 <<
" " << max_error_x[1]
1965 <<
" " << max_error_val << std::endl;
1966 oomph_info <<
"#------------------------------------ \n " << std::endl;
2015 using namespace QuadTreeNames;
2018 unsigned n_dim = this->nodal_dimension();
2021 Vector<int> bound_cons1(n_dim), bound_cons2(n_dim);
2031 get_edge_solid_bcs(bound,solid_bound_cons);
2036 get_edge_solid_bcs(
S,bound_cons1);
2037 get_edge_solid_bcs(
E,bound_cons2);
2039 for(
unsigned k=0;k<n_dim;k++)
2040 {solid_bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
2045 get_edge_solid_bcs(
S,bound_cons1);
2046 get_edge_solid_bcs(
W,bound_cons2);
2048 for(
unsigned k=0;k<n_dim;k++)
2049 {solid_bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
2054 get_edge_solid_bcs(
N,bound_cons1);
2055 get_edge_solid_bcs(
W,bound_cons2);
2057 for(
unsigned k=0;k<n_dim;k++)
2058 {solid_bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
2063 get_edge_solid_bcs(
N,bound_cons1);
2064 get_edge_solid_bcs(
E,bound_cons2);
2066 for(
unsigned k=0;k<n_dim;k++)
2067 {solid_bound_cons[k]=(bound_cons1[k]||bound_cons2[k]);}
2072 OOMPH_CURRENT_FUNCTION,
2073 OOMPH_EXCEPTION_LOCATION);
2090 using namespace QuadTreeNames;
2093 unsigned n_p = nnode_1d();
2096 unsigned left_node, right_node;
2102 left_node = n_p*(n_p-1);
2103 right_node = n_p*n_p - 1;
2113 right_node = n_p*(n_p-1);
2118 right_node = n_p*n_p - 1;
2122 std::ostringstream error_stream;
2124 <<
"Wrong edge " << edge <<
" passed to get_solid_edge_bcs(..)" 2128 OOMPH_CURRENT_FUNCTION,
2129 OOMPH_EXCEPTION_LOCATION);
2137 if (left_node_pt==0)
2140 "Left node cannot be cast to SolidNode --> something is wrong",
2141 OOMPH_CURRENT_FUNCTION,
2142 OOMPH_EXCEPTION_LOCATION);
2144 if (right_node_pt==0)
2147 "Right node cannot be cast to SolidNode --> something is wrong",
2148 OOMPH_CURRENT_FUNCTION,
2149 OOMPH_EXCEPTION_LOCATION);
2155 unsigned n_dim = this->nodal_dimension();
2160 for(
unsigned k=0;k<n_dim;k++)
2162 solid_bound_cons[k] =
2163 left_node_pt ->position_is_pinned(k)*
void get_boundaries(const int &edge, std::set< unsigned > &boundaries) const
Determine set of (mesh) boundaries that the element edge/vertex lives on.
void get_x(const Vector< double > &s, Vector< double > &x) const
Global coordinates as function of local coordinates. Either via FE representation or via macro-elemen...
virtual unsigned ncont_interpolated_values() const =0
Number of continuously interpolated values. Note: We assume that they are located at the beginning of...
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
virtual Node * interpolating_node_pt(const unsigned &n, const int &value_id)
In mixed elements, different sets of nodes are used to interpolate different unknowns. This function returns the n-th node that interpolates the value_id-th unknown. Default implementation is that all variables use the positional nodes, i.e. isoparametric elements. Note that any overloaded versions of this function MUST provide a set of nodes for the position, which always has the value_id -1.
A policy class that serves to establish the common interfaces for elements that contain moving nodes...
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
virtual Node * get_node_at_local_coordinate(const Vector< double > &s) const
If there is a node at this local coordinate, return the pointer to the node.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
virtual void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Get all continously interpolated function values in this element as a Vector. Note: Vector sets is ow...
bool is_neighbour_periodic(const int &direction)
Return whether the neighbour in the particular direction is periodic.
bool boundary_coordinate_exists(const unsigned &i) const
Indicate whether the i-th boundary has an intrinsic coordinate.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
virtual Node * get_interpolating_node_at_local_coordinate(const Vector< double > &s, const int &value_id)
Return a pointer to the node that interpolates the value-id-th unknown at local coordinate s...
bool is_hanging() const
Test whether the node is geometrically hanging.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
void set_master_node_pt(const unsigned &i, Node *const &master_node_pt, const double &weight)
Set the pointer to the i-th master node and its weight.
void pin(const unsigned &i)
Pin the i-th stored variable.
virtual void interpolating_basis(const Vector< double > &s, Shape &psi, const int &value_id) const
Return the basis functions that are used to interpolate the value_id-th unknown. By default assume is...
unsigned Number
The unsigned.
virtual double s_min() const
Min value of local coordinate.
void add_node_pt(Node *const &node_pt)
Add a (pointer to a) node to the mesh.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
double & s_macro_ur(const unsigned &i)
Access fct to the i-th coordinate of the element's "upper right" vertex in the associated MacroElemen...
void pin_position(const unsigned &i)
Pin the nodal position.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
virtual unsigned ninterpolating_node(const int &value_id)
Return the number of nodes that are used to interpolate the value_id-th unknown. Default is to assume...
void start(const unsigned &i)
(Re-)start i-th timer
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
void get_bcs(int bound, Vector< int > &bound_cons) const
Determine Vector of boundary conditions along edge (or on vertex) bound (S/W/N/E/SW/SE/NW/NE): For va...
virtual double s_max() const
Max. value of local coordinate.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Vector< GeomObject * > & geom_object_pt()
Vector of (pointers to) geometric objects involved in node update function.
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
Class that contains data for hanging nodes.
virtual bool nodes_built()
Return true if all the nodes have been built, false if not.
void set_hanging_pt(HangInfo *const &hang_pt, const int &i)
Set the hanging data for the i-th value. (hang_pt=0 to make non-hanging)
double & s_macro_ll(const unsigned &i)
Access fct to the i-th coordinate of the element's "lower left" vertex in the associated MacroElement...
static const int OMEGA
Default value for an unassigned neighbour.
A Class for nodes that deform elastically (i.e. position is an unknown in the problem). The idea is that the Eulerian positions are stored in a Data object and the Lagrangian coordinates are stored in addition. The pointer that addresses the Eulerian positions is set to the pointer to Value in the Data object. Hence, SolidNode uses knowledge of the internal structure of Data and must be a friend of the Data class. In order to allow a mesh to deform via an elastic-style equation in deforming-domain problems, the positions are stored separately from the values, so that elastic problems may be combined with any other type of problem.
Base class for elements that allow MacroElement-based node update.
QuadTree * gteq_edge_neighbour(const int &direction, Vector< unsigned > &translate_s, Vector< double > &s_lo, Vector< double > &s_hi, int &edge, int &diff_level, bool &in_neighbouring_tree) const
Return pointer to greater or equal-sized edge neighbour in specified direction; also provide info reg...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
Refineable version of Solid quad elements.
Vector< std::string > colour
Tecplot colours.
void interpolated_zeta_on_edge(const unsigned &boundary, const int &edge, const Vector< double > &s, Vector< double > &zeta)
Return the value of the intrinsic boundary coordinate interpolated along the edge (S/W/N/E) ...
bool position_is_pinned(const unsigned &i)
Test whether the i-th coordinate is pinned, 0: false; 1: true.
int & method_for_shape_derivs()
Access to method (enumerated flag) for determination of shape derivs.
int son_type() const
Return son type.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
void enable_bypass_fill_in_jacobian_from_geometric_data()
Bypass the call to fill_in_jacobian_from_geometric_data.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
TreeRoot *& root_pt()
Return pointer to root of the tree.
MacroElement * Macro_elem_pt
Pointer to the element's macro element (NULL by default)
void setup_algebraic_node_update(Node *&node_pt, const Vector< double > &s_father, FiniteElement *father_el_pt) const
Set up node update info for (newly created) algebraic node: I.e. work out its node update information...