41 unsigned numElementsUp,
43 double cellRearrangementThreshold,
48 assert(numElementsAcross > 1);
49 assert(numElementsAcross%2 == 0);
51 assert(numElementsUp > 0);
52 assert(cellRearrangementThreshold > 0.0);
53 assert(t2Threshold > 0.0);
55 std::vector<Node<2>*> nodes;
56 std::vector<VertexElement<2,2>*> elements;
58 unsigned node_index = 0;
59 unsigned node_indices[6];
60 unsigned element_index;
63 for (
unsigned j=0; j<=2*numElementsUp+1; j++)
65 if (isFlatBottom && (j==1))
68 for (
unsigned i=0; i<=numElementsAcross-1; i++)
71 nodes.push_back(p_node);
81 for (
unsigned i=0; i<=numElementsAcross-1; i++)
83 double x_coord = ((j%4 == 0)||(j%4 == 3)) ? i+0.5 : i;
84 double y_coord = (1.5*j - 0.5*(j%2))*0.5/sqrt(3.0);
85 bool is_boundary_node = (j==0 || j==1 || j==2*numElementsUp || j==2*numElementsUp+1) ?
true :
false;
87 Node<2>* p_node =
new Node<2>(node_index, is_boundary_node , x_coord, y_coord);
88 nodes.push_back(p_node);
98 for (
unsigned j=0; j<numElementsUp; j++)
100 for (
unsigned i=0; i<numElementsAcross; i++)
102 element_index = j*numElementsAcross + i;
104 node_indices[0] = 2*j*numElementsAcross + i + 1*(j%2==1);
105 node_indices[1] = node_indices[0] + numElementsAcross + 1*(j%2==0);
106 node_indices[2] = node_indices[0] + 2*numElementsAcross + 1*(j%2==0);
107 node_indices[3] = node_indices[0] + 3*numElementsAcross;
108 node_indices[4] = node_indices[0] + 2*numElementsAcross - 1*(j%2==1);
109 node_indices[5] = node_indices[0] + numElementsAcross - 1*(j%2==1);
111 if (i==numElementsAcross-1)
113 node_indices[0] -= numElementsAcross*(j%2==1);
114 node_indices[1] -= numElementsAcross;
115 node_indices[2] -= numElementsAcross;
116 node_indices[3] -= numElementsAcross*(j%2==1);
119 std::vector<Node<2>*> element_nodes;
120 for (
unsigned k=0; k<6; k++)
122 element_nodes.push_back(nodes[node_indices[k]]);
125 elements.push_back(p_element);
132 for (
unsigned i=0; i<numElementsAcross; i++)
134 nodes[i]->SetPoint(nodes[i+numElementsAcross]->GetPoint());
137 mpMesh = boost::make_shared<Cylindrical2dVertexMesh>(numElementsAcross, nodes, elements, cellRearrangementThreshold, t2Threshold);