8#include <kernel/geometry/conformal_mesh.hpp>
9#include <kernel/geometry/common_factories.hpp>
10#include <kernel/geometry/mesh_node.hpp>
11#include <kernel/geometry/intern/face_index_mapping.hpp>
21 template<
typename Mesh_>
25 template<
typename Coord_>
30 typedef Coord_ CoordType;
36 class RootMeshFactory :
40 typedef typename MeshType::VertexSetType VertexSetType;
46 RootMeshFactory(
int i,
int n) :
51 virtual void fill_vertex_set(VertexSetType& vertex_set)
override
53 vertex_set[0][0] = CoordType(_i ) / CoordType(_n);
54 vertex_set[1][0] = CoordType(_i+1) / CoordType(_n);
59 public Geometry::Factory<PartType>
62 typedef Geometry::Factory<PartType> BaseClass;
63 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
64 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
65 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
71 explicit Halo0Factory(
int k) :
76 virtual Index get_num_entities(
int dim)
override
78 return Index(dim == 0 ? 1 : 0);
81 virtual void fill_attribute_sets(AttributeSetContainer&)
override
85 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
89 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
91 target_set_holder.template get_target_set<0>()[0] =
Index(_k);
96 static std::unique_ptr<PartType> create_halo0(
int k)
98 Halo0Factory factory(k);
99 return factory.make_unique();
103 static Index create_unique(
int rank,
int nprocs, std::unique_ptr<MeshNodeType>& node, std::vector<int>& ranks)
105 MeshNodeType* nnode =
nullptr;
106 std::vector<Index> cranks, ctags;
107 Index level =
Index(create(rank, nprocs, nnode, cranks, ctags));
108 for(
auto it = cranks.begin(); it != cranks.end(); ++it)
109 ranks.push_back(
int(*it));
115 static int create(
int rank,
int nprocs, MeshNodeType*& node, std::vector<Index>& ranks, std::vector<Index>& ctags)
118 XASSERT((rank >= 0) && (rank < nprocs));
123 for(; n < nprocs; n *= 2, ++level) {}
124 XASSERTM(n == nprocs,
"number of processes must be a power of 2");
131 RootMeshFactory factory(ii, n);
132 node =
new MeshNodeType(factory.make_unique());
138 ranks.push_back(
Index(ii-1));
139 ctags.push_back(
Index(ii-1));
140 node->add_halo(
int(ranks.back()), create_halo0(0));
141 node->add_mesh_part(
"bnd:0",
nullptr);
145 node->add_mesh_part(
"bnd:0", create_halo0(0));
150 ranks.push_back(
Index(ii+1));
151 ctags.push_back(
Index(ii));
152 node->add_halo(
int(ranks.back()), create_halo0(1));
153 node->add_mesh_part(
"bnd:1",
nullptr);
157 node->add_mesh_part(
"bnd:1", create_halo0(1));
165 template<
typename Coord_>
166 class UnitCubePatchGenerator<ConformalMesh<Shape::Hypercube<2>, 2, Coord_>>
169 typedef Shape::Hypercube<2> ShapeType;
170 typedef Coord_ CoordType;
171 typedef ConformalMesh<ShapeType, 2, Coord_> MeshType;
172 typedef MeshPart<MeshType> PartType;
173 typedef RootMeshNode<MeshType> MeshNodeType;
176 class RootMeshFactory :
177 public Geometry::UnitCubeFactory<MeshType>
180 typedef typename MeshType::VertexSetType VertexSetType;
183 const int _i, _j, _n;
186 RootMeshFactory(
int i,
int j,
int n) :
191 virtual void fill_vertex_set(VertexSetType& vertex_set)
override
193 vertex_set[0][0] = CoordType(_i ) / CoordType(_n);
194 vertex_set[0][1] = CoordType(_j ) / CoordType(_n);
195 vertex_set[1][0] = CoordType(_i+1) / CoordType(_n);
196 vertex_set[1][1] = CoordType(_j ) / CoordType(_n);
197 vertex_set[2][0] = CoordType(_i ) / CoordType(_n);
198 vertex_set[2][1] = CoordType(_j+1) / CoordType(_n);
199 vertex_set[3][0] = CoordType(_i+1) / CoordType(_n);
200 vertex_set[3][1] = CoordType(_j+1) / CoordType(_n);
205 public Geometry::Factory<PartType>
208 typedef Geometry::Factory<PartType> BaseClass;
209 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
210 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
211 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
217 explicit Halo0Factory(
int k) :
222 virtual Index get_num_entities(
int dim)
override
224 return Index(dim == 0 ? 1 : 0);
227 virtual void fill_attribute_sets(AttributeSetContainer&)
override
231 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
235 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
237 target_set_holder.template get_target_set<0>()[0] =
Index(_k);
242 public Geometry::Factory<PartType>
245 typedef Geometry::Factory<PartType> BaseClass;
246 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
247 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
248 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
254 explicit Halo1Factory(
int k) :
259 virtual Index get_num_entities(
int dim)
override
261 return Index(dim == 0 ? 2 : (dim == 1 ? 1 : 0));
264 virtual void fill_attribute_sets(AttributeSetContainer&)
override
268 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
272 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
274 typedef Geometry::Intern::FaceIndexMapping<Shape::Quadrilateral, 1, 0> Fim;
275 target_set_holder.template get_target_set<0>()[0] =
Index(Fim::map(_k, 0));
276 target_set_holder.template get_target_set<0>()[1] =
Index(Fim::map(_k, 1));
277 target_set_holder.template get_target_set<1>()[0] =
Index(_k);
281 static std::unique_ptr<PartType> create_halo0(
int k)
283 Halo0Factory factory(k);
284 return factory.make_unique();
287 static std::unique_ptr<PartType> create_halo1(
int k)
289 Halo1Factory factory(k);
290 return factory.make_unique();
294 static Index create_unique(
int rank,
int nprocs, std::unique_ptr<MeshNodeType>& node, std::vector<int>& ranks)
296 MeshNodeType* nnode =
nullptr;
297 std::vector<Index> cranks, ctags;
298 Index level =
Index(create(rank, nprocs, nnode, cranks, ctags));
299 for(
auto it = cranks.begin(); it != cranks.end(); ++it)
300 ranks.push_back(
int(*it));
308 static Index create(
int rank,
int nprocs, std::unique_ptr<MeshNodeType>& node, std::vector<int>& ranks, std::vector<int>& tags)
310 MeshNodeType* nnode =
nullptr;
311 std::vector<Index> cranks, ctags;
312 int lvl = create(rank, nprocs, nnode, cranks, ctags);
313 node = std::unique_ptr<MeshNodeType>(nnode);
314 for(
auto it = cranks.begin(); it != cranks.end(); ++it)
315 ranks.push_back(
int(*it));
316 for(
auto it = ctags.begin(); it != ctags.end(); ++it)
317 tags.push_back(
int(*it));
322 static int create(
int rank,
int nprocs, MeshNodeType*& node, std::vector<Index>& ranks, std::vector<Index>& ctags)
325 XASSERT((rank >= 0) && (rank < nprocs));
330 for(; n*n < nprocs; n *= 2, ++level) {}
331 XASSERTM(n*n == nprocs,
"number of processes must be a power of 4");
334 const int ii(rank % n);
335 const int jj(rank / n);
339 const Index cto_x1 = cto_x0 +
Index((n-1)*(n-1));
340 const Index cto_h = cto_x1 +
Index((n-1)*(n-1));
345 RootMeshFactory factory(ii, jj, n);
346 node =
new MeshNodeType(factory.make_unique());
350 if((ii > 0) && (jj > 0))
352 ranks.push_back(
Index(n*(jj-1) + ii-1));
353 ctags.push_back(cto_x0 +
Index((n-1)*(jj-1) + ii-1));
354 node->add_halo(
int(ranks.back()), create_halo0(0));
357 if((ii+1 < n) && (jj > 0))
359 ranks.push_back(
Index(n*(jj-1) + ii+1));
360 ctags.push_back(cto_x1 +
Index((n-1)*(jj-1) + ii));
361 node->add_halo(
int(ranks.back()), create_halo0(1));
364 if((ii > 0) && (jj+1 < n))
366 ranks.push_back(
Index(n*(jj+1) + ii-1));
367 ctags.push_back(cto_x1 +
Index((n-1)*jj + ii-1));
368 node->add_halo(
int(ranks.back()), create_halo0(2));
371 if((ii+1 < n) && (jj+1 < n))
373 ranks.push_back(
Index(n*(jj+1) + ii+1));
374 ctags.push_back(cto_x0 +
Index((n-1)*jj + ii));
375 node->add_halo(
int(ranks.back()), create_halo0(3));
381 ranks.push_back(
Index(n*(jj-1) + ii));
382 ctags.push_back(cto_v +
Index(n*(jj-1) + ii));
383 node->add_halo(
int(ranks.back()), create_halo1(0));
384 node->add_mesh_part(
"bnd:0",
nullptr);
388 node->add_mesh_part(
"bnd:0", create_halo1(0));
393 ranks.push_back(
Index(n*(jj+1) + ii));
394 ctags.push_back(cto_v +
Index(n*jj + ii));
395 node->add_halo(
int(ranks.back()), create_halo1(1));
396 node->add_mesh_part(
"bnd:1",
nullptr);
400 node->add_mesh_part(
"bnd:1", create_halo1(1));
405 ranks.push_back(
Index(n*(jj) + ii-1));
406 ctags.push_back(cto_h +
Index((n-1)*jj + ii - 1));
407 node->add_halo(
int(ranks.back()), create_halo1(2));
408 node->add_mesh_part(
"bnd:2",
nullptr);
412 node->add_mesh_part(
"bnd:2", create_halo1(2));
417 ranks.push_back(
Index(n*(jj) + ii+1));
418 ctags.push_back(cto_h +
Index((n-1)*jj + ii));
419 node->add_halo(
int(ranks.back()), create_halo1(3));
420 node->add_mesh_part(
"bnd:3",
nullptr);
424 node->add_mesh_part(
"bnd:3", create_halo1(3));
433 template<
typename Coord_>
434 class UnitCubePatchGenerator<ConformalMesh<Shape::Hypercube<3>, 3, Coord_>>
437 typedef Shape::Hypercube<3> ShapeType;
438 typedef Coord_ CoordType;
439 typedef ConformalMesh<ShapeType, 3, Coord_> MeshType;
440 typedef MeshPart<MeshType> PartType;
441 typedef RootMeshNode<MeshType> MeshNodeType;
444 class RootMeshFactory :
445 public Geometry::UnitCubeFactory<MeshType>
448 typedef typename MeshType::VertexSetType VertexSetType;
451 const int _i, _j, _k, _n;
454 RootMeshFactory(
int i,
int j,
int k,
int n) :
455 _i(i), _j(j), _k(k), _n(n)
459 virtual void fill_vertex_set(VertexSetType& vertex_set)
override
461 vertex_set[0][0] = CoordType(_i ) / CoordType(_n);
462 vertex_set[0][1] = CoordType(_j ) / CoordType(_n);
463 vertex_set[0][2] = CoordType(_k ) / CoordType(_n);
465 vertex_set[1][0] = CoordType(_i+1) / CoordType(_n);
466 vertex_set[1][1] = CoordType(_j ) / CoordType(_n);
467 vertex_set[1][2] = CoordType(_k ) / CoordType(_n);
469 vertex_set[2][0] = CoordType(_i ) / CoordType(_n);
470 vertex_set[2][1] = CoordType(_j+1) / CoordType(_n);
471 vertex_set[2][2] = CoordType(_k ) / CoordType(_n);
473 vertex_set[3][0] = CoordType(_i+1) / CoordType(_n);
474 vertex_set[3][1] = CoordType(_j+1) / CoordType(_n);
475 vertex_set[3][2] = CoordType(_k ) / CoordType(_n);
477 vertex_set[4][0] = CoordType(_i ) / CoordType(_n);
478 vertex_set[4][1] = CoordType(_j ) / CoordType(_n);
479 vertex_set[4][2] = CoordType(_k+1) / CoordType(_n);
481 vertex_set[5][0] = CoordType(_i+1) / CoordType(_n);
482 vertex_set[5][1] = CoordType(_j ) / CoordType(_n);
483 vertex_set[5][2] = CoordType(_k+1) / CoordType(_n);
485 vertex_set[6][0] = CoordType(_i ) / CoordType(_n);
486 vertex_set[6][1] = CoordType(_j+1) / CoordType(_n);
487 vertex_set[6][2] = CoordType(_k+1) / CoordType(_n);
489 vertex_set[7][0] = CoordType(_i+1) / CoordType(_n);
490 vertex_set[7][1] = CoordType(_j+1) / CoordType(_n);
491 vertex_set[7][2] = CoordType(_k+1) / CoordType(_n);
496 public Geometry::Factory<PartType>
499 typedef Geometry::Factory<PartType> BaseClass;
500 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
501 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
502 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
508 explicit Halo0Factory(
int p) :
513 virtual Index get_num_entities(
int dim)
override
515 return Index(dim == 0 ? 1 : 0);
518 virtual void fill_attribute_sets(AttributeSetContainer&)
override
522 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
526 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
528 target_set_holder.template get_target_set<0>()[0] =
Index(_p);
533 public Geometry::Factory<PartType>
536 typedef Geometry::Factory<PartType> BaseClass;
537 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
538 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
539 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
545 explicit Halo1Factory(
int p) :
550 virtual Index get_num_entities(
int dim)
override
552 return Index(dim == 0 ? 2 : (dim == 1 ? 1 : 0));
555 virtual void fill_attribute_sets(AttributeSetContainer&)
override
559 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
563 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
565 typedef Geometry::Intern::FaceIndexMapping<ShapeType, 1, 0> Fim;
566 target_set_holder.template get_target_set<0>()[0] =
Index(Fim::map(_p, 0));
567 target_set_holder.template get_target_set<0>()[1] =
Index(Fim::map(_p, 1));
568 target_set_holder.template get_target_set<1>()[0] =
Index(_p);
573 public Geometry::Factory<PartType>
576 typedef Geometry::Factory<PartType> BaseClass;
577 typedef typename BaseClass::AttributeSetContainer AttributeSetContainer;
578 typedef typename BaseClass::IndexSetHolderType IndexSetHolderType;
579 typedef typename BaseClass::TargetSetHolderType TargetSetHolderType;
585 explicit Halo2Factory(
int p) :
590 virtual Index get_num_entities(
int dim)
override
592 return Index(dim == 0 ? 4 : (dim == 1 ? 4 : (dim == 2 ? 1 : 0)));
595 virtual void fill_attribute_sets(AttributeSetContainer&)
override
599 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
603 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
605 typedef Geometry::Intern::FaceIndexMapping<ShapeType, 2, 0> Fim0;
606 target_set_holder.template get_target_set<0>()[0] =
Index(Fim0::map(_p, 0));
607 target_set_holder.template get_target_set<0>()[1] =
Index(Fim0::map(_p, 1));
608 target_set_holder.template get_target_set<0>()[2] =
Index(Fim0::map(_p, 2));
609 target_set_holder.template get_target_set<0>()[3] =
Index(Fim0::map(_p, 3));
610 typedef Geometry::Intern::FaceIndexMapping<ShapeType, 2, 1> Fim1;
611 target_set_holder.template get_target_set<1>()[0] =
Index(Fim1::map(_p, 0));
612 target_set_holder.template get_target_set<1>()[1] =
Index(Fim1::map(_p, 1));
613 target_set_holder.template get_target_set<1>()[2] =
Index(Fim1::map(_p, 2));
614 target_set_holder.template get_target_set<1>()[3] =
Index(Fim1::map(_p, 3));
615 target_set_holder.template get_target_set<2>()[0] =
Index(_p);
619 static std::unique_ptr<PartType> create_halo0(
int k)
621 Halo0Factory factory(k);
622 return factory.make_unique();
625 static std::unique_ptr<PartType> create_halo1(
int k)
627 Halo1Factory factory(k);
628 return factory.make_unique();
631 static std::unique_ptr<PartType> create_halo2(
int k)
633 Halo2Factory factory(k);
634 return factory.make_unique();
639 static Index create_unique(
int rank,
int nprocs, std::unique_ptr<MeshNodeType>& node, std::vector<int>& ranks)
641 MeshNodeType* nnode =
nullptr;
642 std::vector<Index> cranks, ctags;
643 Index level =
Index(create(rank, nprocs, nnode, cranks, ctags));
644 for(
auto it = cranks.begin(); it != cranks.end(); ++it)
645 ranks.push_back(
int(*it));
651 static int create(
int rank,
int nprocs, MeshNodeType*& node, std::vector<Index>& ranks, std::vector<Index>& ctags)
654 XASSERT((rank >= 0) && (rank < nprocs));
659 for(; n*n*n < nprocs; n *= 2, ++level) {}
660 XASSERTM(n*n*n == nprocs,
"number of processes must be a power of 8");
663 const int ii(rank % n);
664 const int jj((rank / n) % n);
665 const int kk(rank / (n*n));
669 const Index cto_x1 = cto_x0 +
Index((n-1)*(n-1)*(n-1));
670 const Index cto_x2 = cto_x1 +
Index((n-1)*(n-1)*(n-1));
671 const Index cto_x3 = cto_x2 +
Index((n-1)*(n-1)*(n-1));
673 const Index cto_h0 = cto_x3 +
Index((n-1)*(n-1)*(n-1));
674 const Index cto_h1 = cto_h0 +
Index(n*(n-1)*(n-1));
676 const Index cto_v0 = cto_h1 +
Index(n*(n-1)*(n-1));
677 const Index cto_v1 = cto_v0 +
Index(n*(n-1)*(n-1));
679 const Index cto_z0 = cto_v1 +
Index(n*(n-1)*(n-1));
680 const Index cto_z1 = cto_z0 +
Index(n*(n-1)*(n-1));
682 const Index cto_f0 = cto_z1 +
Index(n*(n-1)*(n-1));
683 const Index cto_f1 = cto_f0 +
Index((n-1)*n*n);
684 const Index cto_f2 = cto_f1 +
Index((n-1)*n*n);
688 RootMeshFactory factory(ii, jj, kk, n);
689 node =
new MeshNodeType(factory.make_unique());
696 if((ii > 0) && (jj > 0) && (kk > 0))
698 ranks.push_back(
Index(n*n*(kk-1) + n*(jj-1) + ii-1));
699 ctags.push_back(cto_x0 +
Index((n-1)*(n-1)*(kk-1) + (n-1)*(jj-1) + ii-1));
700 node->add_halo(
int(ranks.back()), create_halo0(0));
703 if((ii+1 < n) && (jj > 0) && (kk > 0))
705 ranks.push_back(
Index(n*n*(kk-1) + n*(jj-1) + ii+1));
706 ctags.push_back(cto_x1 +
Index((n-1)*(n-1)*(kk-1) + (n-1)*(jj-1) + ii));
707 node->add_halo(
int(ranks.back()), create_halo0(1));
710 if((ii > 0) && (jj+1 < n) && (kk > 0))
712 ranks.push_back(
Index(n*n*(kk-1) + n*(jj+1) + ii-1));
713 ctags.push_back(cto_x2 +
Index((n-1)*(n-1)*(kk-1) + (n-1)*jj + ii-1));
714 node->add_halo(
int(ranks.back()), create_halo0(2));
717 if((ii+1 < n) && (jj+1 < n) && (kk > 0))
719 ranks.push_back(
Index(n*n*(kk-1) + n*(jj+1) + ii+1));
720 ctags.push_back(cto_x3 +
Index((n-1)*(n-1)*(kk-1) + (n-1)*jj + ii));
721 node->add_halo(
int(ranks.back()), create_halo0(3));
725 if((ii > 0) && (jj > 0) && (kk+1 < n))
727 ranks.push_back(
Index(n*n*(kk+1) + n*(jj-1) + ii-1));
728 ctags.push_back(cto_x3 +
Index((n-1)*(n-1)*(kk) + (n-1)*(jj-1) + ii-1));
729 node->add_halo(
int(ranks.back()), create_halo0(4));
732 if((ii+1 < n) && (jj > 0) && (kk+1 < n))
734 ranks.push_back(
Index(n*n*(kk+1) + n*(jj-1) + ii+1));
735 ctags.push_back(cto_x2 +
Index((n-1)*(n-1)*(kk) + (n-1)*(jj-1) + ii));
736 node->add_halo(
int(ranks.back()), create_halo0(5));
739 if((ii > 0) && (jj+1 < n) && (kk+1 < n))
741 ranks.push_back(
Index(n*n*(kk+1) + n*(jj+1) + ii-1));
742 ctags.push_back(cto_x1 +
Index((n-1)*(n-1)*(kk) + (n-1)*jj + ii-1));
743 node->add_halo(
int(ranks.back()), create_halo0(6));
746 if((ii+1 < n) && (jj+1 < n) && (kk+1 < n))
748 ranks.push_back(
Index(n*n*(kk+1) + n*(jj+1) + ii+1));
749 ctags.push_back(cto_x0 +
Index((n-1)*(n-1)*(kk) + (n-1)*jj + ii));
750 node->add_halo(
int(ranks.back()), create_halo0(7));
754 if((jj > 0) && (kk > 0))
756 ranks.push_back(
Index(n*n*(kk-1) + n*(jj-1) + ii));
757 ctags.push_back(cto_h0 +
Index((n-1)*n*(kk-1) + n*(jj-1) + ii));
758 node->add_halo(
int(ranks.back()), create_halo1(0));
761 if((jj + 1 < n) && (kk > 0))
763 ranks.push_back(
Index(n*n*(kk-1) + n*(jj+1) + ii));
764 ctags.push_back(cto_h1 +
Index((n-1)*n*(kk-1) + n*jj + ii));
765 node->add_halo(
int(ranks.back()), create_halo1(1));
768 if((jj > 0) && (kk + 1 < n))
770 ranks.push_back(
Index(n*n*(kk+1) + n*(jj-1) + ii));
771 ctags.push_back(cto_h1 +
Index((n-1)*n*(kk) + n*(jj-1) + ii));
772 node->add_halo(
int(ranks.back()), create_halo1(2));
775 if((jj + 1 < n) && (kk + 1 < n))
777 ranks.push_back(
Index(n*n*(kk+1) + n*(jj+1) + ii));
778 ctags.push_back(cto_h0 +
Index((n-1)*n*(kk) + n*jj + ii));
779 node->add_halo(
int(ranks.back()), create_halo1(3));
783 if((ii > 0) && (kk > 0))
785 ranks.push_back(
Index(n*n*(kk-1) + n*jj + ii-1));
786 ctags.push_back(cto_v0 +
Index((n-1)*n*(kk-1) + n*jj + ii-1));
787 node->add_halo(
int(ranks.back()), create_halo1(4));
790 if((ii + 1 < n) && (kk > 0))
792 ranks.push_back(
Index(n*n*(kk-1) + n*jj + ii+1));
793 ctags.push_back(cto_v1 +
Index((n-1)*n*(kk-1) + n*jj + ii));
794 node->add_halo(
int(ranks.back()), create_halo1(5));
797 if((ii > 0) && (kk + 1 < n))
799 ranks.push_back(
Index(n*n*(kk+1) + n*jj + ii-1));
800 ctags.push_back(cto_v1 +
Index((n-1)*n*(kk) + n*jj + ii-1));
801 node->add_halo(
int(ranks.back()), create_halo1(6));
804 if((ii + 1 < n) && (kk + 1 < n))
806 ranks.push_back(
Index(n*n*(kk+1) + n*jj + ii+1));
807 ctags.push_back(cto_v0 +
Index((n-1)*n*(kk) + n*jj + ii));
808 node->add_halo(
int(ranks.back()), create_halo1(7));
812 if((ii > 0) && (jj > 0))
814 ranks.push_back(
Index(n*n*kk + n*(jj-1) + ii-1));
815 ctags.push_back(cto_z0 +
Index((n-1)*(n-1)*(kk) + (n-1)*(jj-1) + ii-1));
816 node->add_halo(
int(ranks.back()), create_halo1(8));
819 if((ii + 1 < n) && (jj > 0))
821 ranks.push_back(
Index(n*n*kk + n*(jj-1) + ii+1));
822 ctags.push_back(cto_z1 +
Index((n-1)*(n-1)*(kk) + (n-1)*(jj-1) + ii));
823 node->add_halo(
int(ranks.back()), create_halo1(9));
826 if((ii > 0) && (jj + 1 < n))
828 ranks.push_back(
Index(n*n*kk + n*(jj+1) + ii-1));
829 ctags.push_back(cto_z1 +
Index((n-1)*(n-1)*(kk) + (n-1)*jj + ii-1));
830 node->add_halo(
int(ranks.back()), create_halo1(10));
833 if((ii + 1 < n) && (jj + 1 < n))
835 ranks.push_back(
Index(n*n*kk + n*(jj+1) + ii+1));
836 ctags.push_back(cto_z0 +
Index((n-1)*(n-1)*(kk) + (n-1)*jj + ii));
837 node->add_halo(
int(ranks.back()), create_halo1(11));
843 ranks.push_back(
Index(n*n*(kk-1) + n*jj + ii));
844 ctags.push_back(cto_f0 +
Index(n*n*(kk-1) + jj*n + ii));
845 node->add_halo(
int(ranks.back()), create_halo2(0));
846 node->add_mesh_part(
"bnd:0",
nullptr);
849 node->add_mesh_part(
"bnd:0", create_halo2(0));
853 ranks.push_back(
Index(n*n*(kk+1) + n*jj + ii));
854 ctags.push_back(cto_f0 +
Index(n*n*kk + jj*n + ii));
855 node->add_halo(
int(ranks.back()), create_halo2(1));
856 node->add_mesh_part(
"bnd:1",
nullptr);
859 node->add_mesh_part(
"bnd:1", create_halo2(1));
863 ranks.push_back(
Index(n*n*kk + n*(jj-1) + ii));
864 ctags.push_back(cto_f1 +
Index(n*n*kk + (jj-1)*n + ii));
865 node->add_halo(
int(ranks.back()), create_halo2(2));
866 node->add_mesh_part(
"bnd:2",
nullptr);
869 node->add_mesh_part(
"bnd:2", create_halo2(2));
873 ranks.push_back(
Index(n*n*kk + n*(jj+1) + ii));
874 ctags.push_back(cto_f1 +
Index(n*n*kk + jj*n + ii));
875 node->add_halo(
int(ranks.back()), create_halo2(3));
876 node->add_mesh_part(
"bnd:3",
nullptr);
879 node->add_mesh_part(
"bnd:3", create_halo2(3));
883 ranks.push_back(
Index(n*n*kk + n*jj + ii-1));
884 ctags.push_back(cto_f2 +
Index(n*n*kk + jj*n + ii-1));
885 node->add_halo(
int(ranks.back()), create_halo2(4));
886 node->add_mesh_part(
"bnd:4",
nullptr);
889 node->add_mesh_part(
"bnd:4", create_halo2(4));
893 ranks.push_back(
Index(n*n*kk + n*jj + ii+1));
894 ctags.push_back(cto_f2 +
Index(n*n*kk + jj*n + ii));
895 node->add_halo(
int(ranks.back()), create_halo2(5));
896 node->add_mesh_part(
"bnd:5",
nullptr);
899 node->add_mesh_part(
"bnd:5", create_halo2(5));
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Class template for partial meshes.
Root mesh node class template.
std::uint64_t Index
Index data type.
Hypercube shape tag struct template.