26 Range tris = ents.subset_by_type(MBTRI);
27 for (Range::iterator tit = tris.begin(); tit != tris.end(); tit++) {
30 CHKERR m_field.
get_moab().get_connectivity(*tit, conn, number_nodes,
false);
31 double coords[3 * number_nodes];
34 for (
int nn = 0; nn < 3; nn++) {
35 prism_nodes[nn] = conn[nn];
43 &prism_nodes[3 + nn], 1,
49 std::swap(prism_nodes[1], prism_nodes[2]);
50 std::swap(prism_nodes[4], prism_nodes[5]);
53 std::swap(prism_nodes[0], prism_nodes[3]);
54 std::swap(prism_nodes[1], prism_nodes[4]);
55 std::swap(prism_nodes[2], prism_nodes[5]);
62 CHKERR m_field.
get_moab().create_element(MBPRISM, prism_nodes, 6, prism);
64 CHKERR m_field.
get_moab().get_adjacencies(&prism, 1, 1,
true, edges,
65 moab::Interface::UNION);
67 CHKERR m_field.
get_moab().get_adjacencies(&prism, 1, 2,
true, faces,
68 moab::Interface::UNION);
70 for (
int ee = 0; ee <= 2; ee++) {
85 if (number_nodes > 3) {
89 for (
int ee = 0; ee <= 2; ee++) {
94 CHKERR m_field.
get_moab().convert_entities(meshset,
true,
false,
false);
97 int number_nodes_f4 = 0;
98 CHKERR m_field.
get_moab().get_connectivity(f4, conn_f4, number_nodes_f4,
100 if (number_nodes_f4 != number_nodes) {
102 "data inconsistency");
117 refined_entities_ptr =
119 if (!prisms.empty()) {
120 int dim = m_field.
get_moab().dimension_from_handle(prisms[0]);
121 for (
int dd = 0;
dd <= dim;
dd++) {
124 moab::Interface::UNION);
125 Range::iterator eit = ents.begin();
126 for (; eit != ents.end(); eit++) {
127 std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
128 refined_entities_ptr->insert(boost::shared_ptr<RefEntity>(
130 *(
const_cast<RefEntity *
>(p_ent.first->get())->getBitRefLevelPtr()) |=
133 std::ostringstream ss;
134 ss << *(p_ent.first);
135 PetscSynchronizedPrintf(comm,
"%s\n", ss.str().c_str());
144 const Range &prisms,
bool from_down,
Range &out_prisms,
int verb) {
148 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
162 const Range &prisms,
const double director3[],
const double director4[]) {
165 Range nodes_f3, nodes_f4;
166 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
167 for (
int ff = 3; ff <= 4; ff++) {
171 int number_nodes = 0;
172 CHKERR m_field.
get_moab().get_connectivity(face, conn, number_nodes,
175 nodes_f3.insert(&conn[0], &conn[number_nodes]);
177 nodes_f4.insert(&conn[0], &conn[number_nodes]);
182 for (Range::iterator nit = nodes_f3.begin(); nit != nodes_f3.end(); nit++) {
184 cblas_daxpy(3, 1, director3, 1, coords, 1);
187 for (Range::iterator nit = nodes_f4.begin(); nit != nodes_f4.end(); nit++) {
189 cblas_daxpy(3, 1, director4, 1, coords, 1);
196 const Range &prisms,
double thickness3,
double thickness4) {
200 auto add_normal = [&](std::map<EntityHandle, std::array<double, 3>> &nodes,
205 CHKERR m_field.
get_moab().get_connectivity(face, conn, number_nodes,
false);
206 std::array<double, 9> coords;
207 CHKERR m_field.
get_moab().get_coords(conn, number_nodes, coords.data());
208 std::array<double, 3> normal;
210 double a = sqrt(normal[0] * normal[0] + normal[1] * normal[1] +
211 normal[2] * normal[2]);
212 for (
auto d : {0, 1, 2})
214 for (
auto n : {0, 1, 2}) {
216 for (
auto d : {0, 1, 2})
217 nodes.at(conn[
n])[
d] += normal[
d];
220 std::pair<
EntityHandle, std::array<double, 3>>(conn[
n], normal));
226 auto apply_map = [&](
auto &nodes,
double t) {
228 for (
auto &
m : nodes) {
229 std::array<double, 3> coords;
231 auto &normal =
m.second;
232 double a = sqrt(normal[0] * normal[0] + normal[1] * normal[1] +
233 normal[2] * normal[2]);
234 for (
auto d : {0, 1, 2})
235 coords[
d] += (normal[
d] /
a) *
t;
241 map<EntityHandle, std::array<double, 3>> nodes_f3, nodes_f4;
242 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
243 for (
int ff = 3; ff <= 4; ff++) {
247 CHKERR add_normal(nodes_f3, face);
249 CHKERR add_normal(nodes_f4, face);
253 CHKERR apply_map(nodes_f3, thickness3);
254 CHKERR apply_map(nodes_f4, thickness4);
264 CHKERR m_field.
get_moab().get_adjacencies(prisms, 1,
true, prisms_edges,
265 moab::Interface::UNION);
267 CHKERR m_field.
get_moab().get_adjacencies(prisms, 2,
true, prisms_faces,
268 moab::Interface::UNION);
271 CHKERR m_field.
get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
273 edges = intersect(edges, prisms_edges);
274 if (!edges.empty()) {
276 CHKERR m_field.
get_moab().get_adjacencies(edges, 2,
false, edges_faces,
277 moab::Interface::UNION);
278 edges_faces = intersect(edges_faces, prisms_faces.subset_by_type(MBQUAD));
291 CHKERR m_field.
get_moab().get_adjacencies(prisms, 2,
true, prisms_tris,
292 moab::Interface::UNION);
293 prisms_tris = prisms_tris.subset_by_type(MBTRI);
296 CHKERR m_field.
get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
298 tris = intersect(tris, prisms_tris);
301 CHKERR m_field.
get_moab().get_adjacencies(tris, 3,
false, tris_ents,
302 moab::Interface::UNION);
303 tris_ents = intersect(tris_ents, prisms);