26 #ifndef OOMPH_GEOMPACK_MESH_TEMPLATE_CC
27 #define OOMPH_GEOMPACK_MESH_TEMPLATE_CC
41 template<
class ELEMENT>
43 TimeStepper* time_stepper_pt)
46 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2, 2);
49 unsigned nelem = Tmp_mesh_pt->nelement();
50 Element_pt.resize(nelem);
53 unsigned nnod = Tmp_mesh_pt->nnode();
57 unsigned nbound = Tmp_mesh_pt->nboundary();
58 set_nboundary(nbound);
61 for (
unsigned e = 0; e < nelem; e++)
63 Element_pt[e] =
new ELEMENT;
68 if (finite_element_pt(0)->nnode() != 4)
70 std::string error_message =
71 "GeompackQuadMesh can currently only deal with\n";
72 error_message +=
"four noded quads! \n";
73 error_message +=
"Generalisation to higher-order elements should be \n";
74 error_message +=
"straightforward but hasn't been done yet.\n";
75 error_message +=
"Do you want to volunteer? \n";
78 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
83 unsigned nnod_el = Tmp_mesh_pt->finite_element_pt(0)->nnode();
86 for (
unsigned e = 0; e < nelem; e++)
89 for (
unsigned j = 0; j < nnod_el; j++)
93 finite_element_pt(e)->construct_node(j, time_stepper_pt);
98 std::map<Node*, unsigned> global_number;
99 unsigned global_count = 0;
101 for (
unsigned e = 0; e < nelem; e++)
104 for (
unsigned j = 0; j < nnod_el; j++)
107 Node* scaffold_node_pt = Tmp_mesh_pt->finite_element_pt(e)->node_pt(j);
111 unsigned j_global = global_number[scaffold_node_pt];
120 global_number[scaffold_node_pt] = global_count;
126 Node_pt[global_count - 1] = finite_element_pt(e)->node_pt(j);
129 Node_pt[global_count - 1]->x(0) = scaffold_node_pt->x(0);
130 Node_pt[global_count - 1]->x(1) = scaffold_node_pt->x(1);
135 std::set<unsigned>* boundaries_pt;
136 scaffold_node_pt->get_boundaries_pt(boundaries_pt);
140 if (boundaries_pt != 0)
143 this->convert_to_boundary_node(Node_pt[global_count - 1]);
145 for (std::set<unsigned>::iterator it = boundaries_pt->begin();
146 it != boundaries_pt->end();
149 add_boundary_node(*it, Node_pt[global_count - 1]);
157 delete finite_element_pt(e)->node_pt(j);
162 finite_element_pt(e)->node_pt(j) = Node_pt[j_global - 1];
void build_from_scaffold(TimeStepper *time_stepper_pt)
Build mesh from scaffold.
////////////////////////////////////////////////////////////////////// //////////////////////////////...