26 #ifndef OOMPH_BACKWARD_STEP_MESH_TEMPLATE_CC
27 #define OOMPH_BACKWARD_STEP_MESH_TEMPLATE_CC
43 template<
class ELEMENT>
46 const unsigned& nx_cut_out,
47 const unsigned& ny_cut_out,
52 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
55 std::map<Node*, bool> keep;
58 Vector<FiniteElement*> el_retained_pt;
59 Vector<FiniteElement*> el_killed_pt;
60 for (
unsigned i = 0; i < nx; i++)
62 for (
unsigned j = 0; j < ny; j++)
64 FiniteElement* el_pt = this->finite_element_pt(i + nx * j);
65 if ((i > (nx_cut_out - 1)) && (j < ny_cut_out))
67 el_killed_pt.push_back(el_pt);
71 el_retained_pt.push_back(el_pt);
72 unsigned nnod_el = el_pt->nnode();
73 for (
unsigned jj = 0; jj < nnod_el; jj++)
75 keep[el_pt->node_pt(jj)] =
true;
84 std::map<Node*, std::set<unsigned>> boundaries;
85 unsigned nnod = this->nnode();
86 for (
unsigned j = 0; j < nnod; j++)
88 std::set<unsigned>* aux_pt = 0;
89 this->node_pt(j)->get_boundaries_pt(aux_pt);
92 boundaries[this->node_pt(j)] = (*aux_pt);
97 this->remove_boundary_nodes();
100 this->set_nboundary(6);
103 Vector<Node*> node_backup_pt(this->Node_pt);
104 this->Node_pt.clear();
105 for (
unsigned j = 0; j < nnod; j++)
107 Node* nod_pt = node_backup_pt[j];
110 this->Node_pt.push_back(nod_pt);
111 std::set<unsigned> aux = boundaries[nod_pt];
112 for (std::set<unsigned>::iterator it = boundaries[nod_pt].begin();
113 it != boundaries[nod_pt].end();
118 this->add_boundary_node(b, nod_pt);
123 delete node_backup_pt[j];
128 unsigned i = nx_cut_out - 1;
129 for (
unsigned j = 0; j < ny_cut_out; j++)
131 FiniteElement* el_pt = this->finite_element_pt(i + nx * j);
132 unsigned nnod_1d = el_pt->nnode_1d();
133 for (
unsigned jj = 0; jj < nnod_1d; jj++)
135 unsigned jnod = (nnod_1d - 1) + jj * nnod_1d;
136 if (!(el_pt->node_pt(jnod)->is_on_boundary()))
138 Node* nod_pt = el_pt->node_pt(jnod);
139 this->convert_to_boundary_node(nod_pt);
141 this->add_boundary_node(1, el_pt->node_pt(jnod));
146 unsigned j = ny_cut_out;
147 for (
unsigned i = nx_cut_out; i < nx; i++)
149 FiniteElement* el_pt = this->finite_element_pt(i + nx * j);
150 unsigned nnod_1d = el_pt->nnode_1d();
151 for (
unsigned jj = 0; jj < nnod_1d; jj++)
154 if (!(el_pt->node_pt(jnod)->is_on_boundary()))
156 Node* nod_pt = el_pt->node_pt(jnod);
157 this->convert_to_boundary_node(nod_pt);
159 this->add_boundary_node(2, el_pt->node_pt(jnod));
165 this->Element_pt.clear();
166 unsigned n_retained = el_retained_pt.size();
167 for (
unsigned e = 0; e < n_retained; e++)
169 this->Element_pt.push_back(el_retained_pt[e]);
171 unsigned n_killed = el_killed_pt.size();
172 for (
unsigned e = 0; e < n_killed; e++)
174 delete el_killed_pt[e];
179 this->setup_boundary_element_info();
void build_mesh(const unsigned &nx, const unsigned &ny, const unsigned &nx_cut_out, const unsigned &ny_cut_out, const double &lx, const double &ly)
Actual build function.
////////////////////////////////////////////////////////////////////// //////////////////////////////...