direct_product_mesh_wrapper.h
Go to the documentation of this file.
1 /*
2 This file is part of the Ristra Wonton project.
3 Please see the license file at the root of this repository, or at:
4  https://github.com/laristra/wonton/blob/master/LICENSE
5 */
6 
7 #ifndef WONTON_DIRECT_PRODUCT_MESH_WRAPPER_H_
8 #define WONTON_DIRECT_PRODUCT_MESH_WRAPPER_H_
9 
11 
12 #include <algorithm>
13 #include <array>
14 #include <vector>
15 
16 #include "wonton/support/wonton.h"
18 #include "wonton/support/Point.h"
19 
25 namespace Wonton {
26 
42 template<int D, class CoordSys=DefaultCoordSys>
44 
45  // TODO: Add a static assert to guarantee that the mesh and mesh wrapper are
46  // using the same coordinate system? (Same question for AR mesh and
47  // wrapper.)
48 
49  public:
50 
51  // ==========================================================================
52  // Constructors and destructors
53 
55  Direct_Product_Mesh_Wrapper() = delete;
56 
63 
67 
71 
74 
75  // ==========================================================================
76  // Accessors
77 
78  // Reference to underlying mesh
79  Direct_Product_Mesh<D, CoordSys> const & mesh() const;
80 
82  int space_dimension () const;
83 
85  bool distributed () const;
86 
88  int num_ghost_layers () const;
89 
99  void get_global_bounds(Point<D> *plo, Point<D> *phi) const;
100 
102  int num_axis_points(const int dim,
103  const Entity_type ptype = ALL) const;
104 
106  counting_iterator axis_point_begin(const int dim) const;
107 
109  counting_iterator axis_point_end(const int dim) const;
110 
112  int num_owned_nodes() const;
113 
115  int num_ghost_nodes() const;
116 
118  Entity_type node_get_type(const int id) const;
119 
121  Point<D> get_node_coordinates(const int pointid) const;
122 
124  double get_axis_point(const int dim, const int pointid) const;
125 
127  int num_axis_cells(const int dim,
128  const Entity_type ptype = ALL) const;
129 
131  int num_owned_cells() const;
132 
134  int num_ghost_cells() const;
135 
137  Entity_type cell_get_type(const int id) const;
138 
140  bool on_exterior_boundary(const Entity_kind entity, const int id) const;
141 
143  void cell_get_bounds(const int id, Point<D> *plo, Point<D> *phi) const;
144 
146  void cell_get_coordinates(const int id, std::vector<Point<D>> *ccoords) const;
147 
149  double cell_volume(const int id) const;
150 
152  void cell_centroid(const int id, Point<D> *ccen) const;
153 
155  counting_iterator begin(Entity_kind const entity,
156  Entity_type const etype = ALL) const;
157 
159  counting_iterator end(Entity_kind const entity,
160  Entity_type const etype = ALL) const;
161 
162  // ==========================================================================
163  // Index/ID conversions
164 
166  int indices_to_cellid(const std::array<int,D>& indices) const;
167 
169  std::array<int,D> cellid_to_indices(const int id) const;
170 
172  int indices_to_nodeid(const std::array<int,D>& indices) const;
173 
175  std::array<int,D> nodeid_to_indices(const int id) const;
176 
177 
178  // Adjacencies
179 
191  void cell_get_node_adj_cells(const int cellid, const Entity_type ptype,
192  std::vector<int> *adjcells) const;
193 
202  void node_get_cell_adj_nodes(const int nodeid, const Entity_type ptype,
203  std::vector<int> *adjnodes) const;
204 
205 
206 
207  private:
208 
209  // ==========================================================================
210  // Class data
211 
213  Direct_Product_Mesh<D,CoordSys> const & mesh_;
214 
215  // ==========================================================================
216  // Private methods
217 
230  void fill_dth_coord(
231  int const dim, std::array<int,D> lowindices, bool lowval,
232  typename std::vector<Point<D>>::iterator coords_begin,
233  typename std::vector<Point<D>>::iterator coords_end) const;
234 
244  void build_index_combinations(int dim,
245  std::array<int,D> indices,
246  std::array<std::array<int,2>,D> index_ranges,
247  std::vector<std::array<int,D>> *indices_list) const;
248 
249  }; // class Direct_Product_Mesh_Wrapper
250 
251 
252 // ============================================================================
253 // Constructors and destructors
254 
255 // ____________________________________________________________________________
256 // constructor
257 template<int D, class CoordSys>
260  mesh_(mesh) {
261 }
262 
263 // ____________________________________________________________________________
264 // destructor
265 template<int D, class CoordSys>
267 }
268 
269 
270 // ============================================================================
271 // Accessors
272 
273 // ____________________________________________________________________________
274 // Reference to underlying mesh
275 template<int D, class CoordSys>
278  return mesh_;
279 }
280 
281 // ____________________________________________________________________________
282 // Get dimensionality of the mesh.
283 template<int D, class CoordSys>
285  return mesh_.space_dimension();
286 }
287 
288 // ____________________________________________________________________________
289 // Is the mesh distributed?
290 template<int D, class CoordSys>
292  return mesh_.distributed();
293 }
294 
295 // ____________________________________________________________________________
296 // Number of ghost layers in each direction on each end
297 template<int D, class CoordSys>
299  return mesh_.num_ghost_layers();
300 }
301 
302 // ____________________________________________________________________________
303 // Get global mesh bounds.
304 template<int D, class CoordSys>
306  Point<D> *plo, Point<D> *phi) const {
307  assert(D == mesh_.space_dimension());
308  Point<D> & lo = *plo;
309  Point<D> & hi = *phi;
310  for (int d = 0; d < D; ++d) {
311  mesh_.get_global_coord_bounds(d, &(lo[d]), &(hi[d]));
312  }
313 }
314 
315 // ____________________________________________________________________________
316 // Get number of points along axis.
317 template<int D, class CoordSys>
319  const int dim, const Entity_type ptype) const {
320  assert(dim >= 0);
321  assert(dim < mesh_.space_dimension());
322  return mesh_.num_axis_points(dim, ptype);
323 }
324 
325 // ____________________________________________________________________________
326 // Get iterator for axis points (beginning of array).
327 template<int D, class CoordSys>
329  const int dim) const {
330  assert(dim >= 0);
331  assert(dim < mesh_.space_dimension());
332  int start_index = -mesh_.num_ghost_layers(); // could be 0
333  return make_counting_iterator(start_index);
334 }
335 
336 // ____________________________________________________________________________
337 // Get iterator for axis points (end of array).
338 template<int D, class CoordSys>
340  const int dim) const {
341  assert(dim >= 0);
342  assert(dim < mesh_.space_dimension());
344  mesh_.num_axis_points(dim, ALL));
345 }
346 
347 // ____________________________________________________________________________
348 // Get axis point value.
349 template<int D, class CoordSys>
351  const int dim, const int pointid) const {
352  assert(dim >= 0);
353  assert(dim < mesh_.space_dimension());
354  return mesh_.get_axis_point(dim, pointid);
355 }
356 
357 // ____________________________________________________________________________
358 // Get point coordinate
359 template<int D, class CoordSys>
361  const int pointid) const {
362  Point<D> pnt;
363  std::array<int,D> indices;
364  pointid_to_indices(pointid, &indices);
365  for (int d = 0; d < D; d++) pnt[d] = mesh_.get_axis_point(d, indices[d]);
366 }
367 
368 // ____________________________________________________________________________
369 // Get number of cells along axis.
370 template<int D, class CoordSys>
372  const int dim, const Entity_type ptype) const {
373  assert(dim >= 0);
374  assert(dim < mesh_.space_dimension());
375  return mesh_.num_axis_cells(dim, ptype);
376 }
377 
378 // ____________________________________________________________________________
379 // Get number of cells owned by this processing element.
380 template<int D, class CoordSys>
382  int count = 1;
383  for (int dim = 0; dim < mesh_.space_dimension(); ++dim) {
384  count *= mesh_.num_axis_cells(dim, PARALLEL_OWNED);
385  }
386  return count;
387 }
388 
389 // ____________________________________________________________________________
390 // Get number of ghost cells on this processing element.
391 template<int D, class CoordSys>
393  if (mesh_.distributed()) {
394  int num_all_cells = 1;
395  for (int dim = 0; dim < mesh_.space_dimension(); ++dim)
396  num_all_cells *= mesh_.num_axis_cells(dim, ALL);
397  return num_all_cells - num_owned_cells();
398  } else
399  return 0;
400 }
401 
402 // ____________________________________________________________________________
403 // Get lower and upper corners of cell bounding box
404 template<int D, class CoordSys>
406  const int id, Point<D> *plo, Point<D> *phi) const {
407  std::array<int,D> indices = cellid_to_indices(id);
408  // cell N is bounded by axis points N and N+1.
409  for (int d = 0; d < D; ++d) {
410  (*plo)[d] = mesh_.get_axis_point(d, indices[d]);
411  (*phi)[d] = mesh_.get_axis_point(d, indices[d]+1);
412  }
413 }
414 
415 // ____________________________________________________________________________
416 // Get number of nodes owned by this processing element.
417 template<int D, class CoordSys>
419  int count = 1;
420  for (int dim = 0; dim < mesh_.space_dimension(); ++dim)
421  count *= mesh_.num_axis_points(dim, PARALLEL_OWNED);
422  return count;
423 }
424 
425 // ____________________________________________________________________________
426 // Get number of ghost nodes on this processing element.
427 template<int D, class CoordSys>
429  if (mesh_.distributed()) {
430  int num_all_nodes = 1;
431  for (int dim = 0; dim < mesh_.space_dimension(); ++dim)
432  num_all_nodes *= mesh_.num_axis_points(dim, ALL);
433  return num_all_nodes - num_owned_nodes();
434  } else
435  return 0;
436 }
437 
438 // ____________________________________________________________________________
439 // Node type (PARALLEL_OWNED, PARALLEL_GHOST or BOUNDARY_GHOST)
440 template<int D, class CoordSys>
443  std::array<int, D> indices = nodeid_to_indices(id);
444 
445  // Order of precedence is BOUNDARY_GHOST, PARALLEL_GHOST,
446  // PARALLEL_OWNED i.e. if point is OWNED on one axis, PARALLEL_GHOST
447  // on another axis and BOUNDARY_GHOST along a third, the point will
448  // be labeled a BOUNDARY_GHOST
449  Entity_type etype = PARALLEL_OWNED;
450  for (int d = 0; d < D; d++) {
451  Entity_type dtype = mesh_.axis_point_type(d, indices[d]);
452  if (dtype == BOUNDARY_GHOST) {
453  etype = BOUNDARY_GHOST;
454  break; // game over; this takes highest precedence
455  } else if (dtype == PARALLEL_GHOST) {
456  etype = PARALLEL_GHOST;
457  }
458  }
459  return etype;
460 }
461 
462 // ____________________________________________________________________________
463 // Cell type (PARALLEL_OWNED, PARALLEL_GHOST or BOUNDARY_GHOST)
464 template<int D, class CoordSys>
467  std::array<int, D> indices = cellid_to_indices(id);
468 
469  // Order of precedence is BOUNDARY_GHOST, PARALLEL_GHOST,
470  // PARALLEL_OWNED i.e. if point is OWNED on one axis, PARALLEL_GHOST
471  // on another axis and BOUNDARY_GHOST along a third, the point will
472  // be labeled a BOUNDARY_GHOST
473  Entity_type etype = PARALLEL_OWNED;
474  for (int d = 0; d < D; d++) {
475  int lo = indices[d];
476  int hi = indices[d]+1;
477  Entity_type lotype = mesh_.axis_point_type(d, lo);
478  Entity_type hitype = mesh_.axis_point_type(d, hi);
479  if (lotype == BOUNDARY_GHOST || hitype == BOUNDARY_GHOST) {
480  etype = BOUNDARY_GHOST; // game over; this takes highest precedence
481  break;
482  } else if (lotype == PARALLEL_GHOST || hitype == PARALLEL_GHOST) {
483  etype = PARALLEL_GHOST;
484  }
485  }
486  return etype;
487 }
488 
489 // Is entity on the exterior (global not partition) boundary
490 template<int D, class CoordSys>
492  const Entity_kind entity, const int id) const {
493  switch (entity) {
494  case CELL: {
495  auto indices = cellid_to_indices(id);
496  for (int d = 0; d < D; d++)
497  if (mesh_.point_on_external_boundary(d, indices[d])) return true;
498  for (int d = 0; d < D; d++)
499  if (mesh_.point_on_external_boundary(d, indices[d]+1)) return true;
500  break;
501  }
502  case NODE: {
503  auto indices = nodeid_to_indices(id);
504  for (int d = 0; d < D; d++)
505  if (mesh_.point_on_external_boundary(d, indices[d])) return true;
506  break;
507  }
508  default: {}
509  }
510  return false;
511 }
512 
513 // ____________________________________________________________________________
514 // Recursively fill in the low or high coordinates of nodes of a cell
515 // or it's lower dimensional entities (faces/edges)
516 template<int D, class CoordSys>
518  int const dim, std::array<int,D> indices, bool lowval,
519  typename std::vector<Point<D>>::iterator coords_begin,
520  typename std::vector<Point<D>>::iterator coords_end) const {
521  int idx = lowval ? indices[dim] : indices[dim]+1; // low or high value
522  double val = mesh_.get_axis_point(dim, idx);
523  for (auto it = coords_begin; it != coords_end; it++) {
524  Point<D> &coord = *it;
525  coord[dim] = val;
526  }
527  if (dim == 0)
528  return;
529  else {
530  int ncoords = coords_end - coords_begin;
531  // Fill in the low coordinates in the next dimension for a sub-entity
532  fill_dth_coord(dim-1, indices, true,
533  coords_begin, coords_begin + ncoords/2);
534  // Fill in the high coordinates in the next dimension for a sub-entity
535  fill_dth_coord(dim-1, indices, false,
536  coords_begin + ncoords/2, coords_end);
537  }
538 }
539 
540 // ____________________________________________________________________________
541 // Get coordinates of cell nodes
542 template<int D, class CoordSys>
544  const int cellid, std::vector<Point<D>> *ccoords) const {
545 
546  int ncoords = 1;
547  for (int d = 0; d < D; d++) ncoords *= 2;
548 
549  ccoords->resize(ncoords);
550  std::array<int,D> indices = cellid_to_indices(cellid);
551 
552  // Recursively fill in the low and high plane coordinates of cell
553  // (true - low value, false - high value)
554  fill_dth_coord(D-1, indices, true,
555  ccoords->begin(), ccoords->begin() + ncoords/2);
556  fill_dth_coord(D-1, indices, false,
557  ccoords->begin() + ncoords/2, ccoords->end());
558 }
559 
560 
561 // ____________________________________________________________________________
562 // Get volume of cell accounting for coordinate system
563 template<int D, class CoordSys>
565  const int cellid) const {
566  Point<D> lo, hi;
567  cell_get_bounds(cellid, &lo, &hi);
568 
569  double moment0 = 1.0; // cartesian volume
570  for (int d = 0; d < D; d++)
571  moment0 *= (hi[d]-lo[d]);
572 
573  CoordSys::modify_volume(moment0, lo, hi);
574  return moment0;
575 }
576 
577 // ____________________________________________________________________________
578 // Get centroid of cell accounting for coordinate system
579 template<int D, class CoordSys>
581  const int cellid, Point<D> *ccen) const {
582  Point<D> lo, hi;
583  cell_get_bounds(cellid, &lo, &hi);
584 
585  double moment0 = 1.0; // cartesian volume
586  for (int d = 0; d < D; d++)
587  moment0 *= (hi[d]-lo[d]);
588 
589  Point<D> moment1 = 0.5*(lo+hi)*moment0;
590 
591  CoordSys::modify_volume(moment0, lo, hi);
592  CoordSys::modify_first_moments(moment1, lo, hi);
593  *ccen = moment1/moment0;
594 }
595 
596 // ____________________________________________________________________________
597 // Iterators on mesh entity - begin
598 template<int D, class CoordSys>
600  Entity_kind const entity, Entity_type const etype) const {
601  assert(entity == CELL || entity == NODE);
602  if (mesh_.distributed())
603  assert(etype == ALL); // Only ALL cells, nodes have a continuous numbering
604  return(make_counting_iterator(0));
605 }
606 
607 // ____________________________________________________________________________
608 // Iterator on mesh entity - end
609 template<int D, class CoordSys>
611  Entity_kind const entity, Entity_type const etype) const {
612  // Currently only valid for cells
613  assert(entity == CELL || entity == NODE);
614  if (mesh_.distributed())
615  assert(etype == ALL); // Only ALL cells, nodes have a continuous numbering
616  // Return iterator
617  int start_index = 0;
618  if (entity == CELL)
619  return(make_counting_iterator(start_index +
621  else if (entity == NODE)
622  return(make_counting_iterator(start_index +
624  else
625  return begin(entity, etype);
626 }
627 
628 // ============================================================================
629 // Index/ID conversions
630 
631 // ____________________________________________________________________________
632 // Convert from indices to Cell ID (sadly, under this scheme, the ID
633 // of an owned cell will depend on whether or not the mesh has a ghost
634 // layer) - Cell ID will always start from 0 even if the indices are
635 // say (-1,-1,-1)
636 template<int D, class CoordSys>
638  const std::array<int,D>& indices) const {
639  assert(D == mesh_.space_dimension());
640  int id = 0;
641  // Loop over all but the last dimension
642  for (int d = D-1; d > 0; --d) {
643  int idx = indices[d]+mesh_.num_ghost_layers();
644  int mult = num_axis_cells(d-1);
645  id += idx;
646  id *= mult;
647  }
648  // Handle the last dimension
649  id += indices[0]+mesh_.num_ghost_layers();
650  // Return
651  return id;
652 }
653 
654 // ____________________________________________________________________________
655 // Convert from Cell ID to indices
656 template<int D, class CoordSys>
658  const int id) const {
659  assert(D == mesh_.space_dimension());
660  std::array<int,D> indices;
661  int residual = id;
662  // Construct the denominators
663  std::array<int,D> denom;
664  denom[0] = 1;
665  for (int d = 1; d < D; ++d) {
666  denom[d] = denom[d-1] * num_axis_cells(d-1);
667  }
668  // Loop over all but the last dimension
669  for (int d = D-1; d > 0; --d) {
670  int index = residual / denom[d];
671  residual -= index * denom[d];
672  indices[d] = (int) index;
673  }
674  // Handle the last dimension
675  indices[0] = (int) residual;
676  // indices start at -NG where NG = number of ghost layers
677  for (int d = 0; d < D; ++d)
678  indices[d] -= mesh_.num_ghost_layers();
679  // Return
680  return indices;
681 }
682 
683 // ____________________________________________________________________________
684 // Convert from indices to Node ID (sadly, under this scheme, the ID
685 // of an owned node will depend on whether or not the mesh has a ghost
686 // layer). The first node ID will always be 0, even if it is a ghost
687 // node and its indices are (-1,-1,-1)
688 template<int D, class CoordSys>
690  const std::array<int,D>& indices) const {
691  assert(D == mesh_.space_dimension());
692  int id = 0;
693  // Loop over all but the last dimension
694  for (int d = D-1; d > 0; --d) {
695  int idx = indices[d]+mesh_.num_ghost_layers();
696  int mult = mesh_.num_axis_points(d-1);
697  id += idx;
698  id *= mult;
699  }
700  // Handle the last dimension
701  id += indices[0]+mesh_.num_ghost_layers();
702  // Return
703  return id;
704 }
705 
706 // ____________________________________________________________________________
707 // Convert from Node ID to indices
708 template<int D, class CoordSys>
710  const int id) const {
711  assert(D == mesh_.space_dimension());
712  std::array<int,D> indices;
713  int residual = id;
714  // Construct the denominators
715  std::array<int,D> denom;
716  denom[0] = 1;
717  for (int d = 1; d < D; ++d) {
718  denom[d] = denom[d-1] * mesh_.num_axis_points(d-1);
719  }
720  // Loop over all but the last dimension
721  for (int d = D-1; d > 0; --d) {
722  int index = residual / denom[d];
723  residual -= index * denom[d];
724  indices[d] = (int) index;
725  }
726  // Handle the last dimension
727  indices[0] = (int) residual;
728  // Indices start at -NG where NG is number of ghost layers
729  for (int d = 0; d < D; ++d)
730  indices[d] -= mesh_.num_ghost_layers();
731  // Return
732  return indices;
733 }
734 
735 // Recursively build combinations of indices from index ranges
736 template<int D, class CoordSys>
738  int dim,
739  std::array<int,D> indices,
740  std::array<std::array<int,2>,D> index_ranges,
741  std::vector<std::array<int,D>> *indices_list) const {
742  for (int i = index_ranges[dim][0]; i <= index_ranges[dim][1]; i++) {
743  indices[dim] = i; // The other indices are filled in already
744  if (dim == 0)
745  indices_list->push_back(indices);
746  else // recurse down to the build add lower dimensional indices
747  build_index_combinations(dim-1, indices, index_ranges, indices_list);
748  }
749 }
750 
751 // Get the list of cell IDs for all cells attached to a specific cell
752 // through its faces.
753 template<int D, class CoordSys>
755  const int cellid, const Entity_type ptype, std::vector<int> *adjcells) const {
756  std::array<int, D> indices = cellid_to_indices(cellid);
757 
758  std::array<std::array<int, 2>, D> index_ranges;
759  int num_ghost_layers = mesh_.num_ghost_layers();
760  for (int d = 0; d < D; d++) {
761  int num_points_all = mesh_.num_axis_points(d, Wonton::ALL);
762  index_ranges[d][0] = (indices[d]-1 >= -num_ghost_layers) ?
763  indices[d]-1 : indices[d];
764  index_ranges[d][1] = (indices[d]+1 < num_points_all-num_ghost_layers-1) ?
765  indices[d]+1 : indices[d];
766  }
767 
768  int nmax = 1;
769  for (int d = 0; d < D; d++) nmax *= 3;
770 
771  std::vector<std::array<int,D>> cell_indices;
772  cell_indices.reserve(nmax);
773  std::array<int, D> tmpindices {};
774  build_index_combinations(D-1, tmpindices, index_ranges, &cell_indices);
775 
776  for (auto const& inds : cell_indices) {
777  int id = indices_to_cellid(inds);
778  if (ptype == ALL || ptype == cell_get_type(id))
779  adjcells->push_back(id);
780  }
781 }
782 
783 // Get the list of node IDs for all nodes attached to all cells
784 // attached to a specific node.
785 template<int D, class CoordSys>
787  const int nodeid, const Entity_type ptype, std::vector<int> *adjnodes) const {
788  std::array<int, D> indices = nodeid_to_indices(nodeid);
789 
790  std::array<std::array<int, 2>, D> index_ranges;
791  int num_ghost_layers = mesh_.num_ghost_layers();
792  for (int d = 0; d < D; d++) {
793  int num_points_all = mesh_.num_axis_points(d, Wonton::ALL);
794  index_ranges[d][0] = (indices[d]-1 >= -num_ghost_layers) ?
795  indices[d]-1 : indices[d];
796  index_ranges[d][1] = (indices[d]+1 < num_points_all-num_ghost_layers) ?
797  indices[d]+1 : indices[d];
798  }
799 
800  int nmax = 1;
801  for (int d = 0; d < D; d++) nmax *= 3;
802 
803  std::vector<std::array<int,D>> node_indices;
804  node_indices.reserve(nmax);
805  std::array<int, D> tmpindices {};
806  build_index_combinations(D-1, tmpindices, index_ranges, &node_indices);
807 
808  for (auto const& inds : node_indices) {
809  int id = indices_to_nodeid(inds);
810  if (ptype == ALL || ptype == node_get_type(id))
811  adjnodes->push_back(id);
812  }
813 }
814 
815 } // namespace Wonton
816 
817 #endif // WONTON_DIRECT_PRODUCT_MESH_WRAPPER_H_
Definition: wonton.h:130
Definition: wonton.h:128
Direct_Product_Mesh< D, CoordSys > const & mesh() const
Definition: direct_product_mesh_wrapper.h:277
A wrapper that implements the prescribed interface for direct product meshes in Portage using the Dir...
Definition: direct_product_mesh_wrapper.h:43
int num_ghost_cells() const
Get number of ghost cells on this processing element.
Definition: direct_product_mesh_wrapper.h:392
Definition: wonton.h:129
double get_axis_point(const int dim, const int pointid) const
Get axis point value.
Definition: direct_product_mesh_wrapper.h:350
counting_iterator axis_point_end(const int dim) const
Get iterator for axis point (end of array).
Definition: direct_product_mesh_wrapper.h:339
int num_axis_cells(const int dim, const Entity_type ptype=ALL) const
Get number of cells along axis.
Definition: direct_product_mesh_wrapper.h:371
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31
std::vector< T > vector
Definition: wonton.h:285
int num_ghost_layers() const
Number of ghost layers in each direction at each end.
Definition: direct_product_mesh_wrapper.h:298
double cell_volume(const int id) const
Get cell volume.
Definition: direct_product_mesh_wrapper.h:564
Definition of the Direct_Product_Mesh class.
Entity_type
The parallel type of a given entity.
Definition: wonton.h:124
Definition: wonton.h:85
int num_ghost_nodes() const
Get number of ghost nodes on this processing element.
Definition: direct_product_mesh_wrapper.h:428
Entity_type cell_get_type(const int id) const
Cell type (PARALLEL_OWNED, PARALLEL_GHOST or BOUNDARY_GHOST)
Definition: direct_product_mesh_wrapper.h:466
std::array< int, D > cellid_to_indices(const int id) const
Convert from ID to indices of lo corner of cell.
Definition: direct_product_mesh_wrapper.h:657
boost::counting_iterator< int > counting_iterator
Definition: wonton.h:290
std::array< int, D > nodeid_to_indices(const int id) const
Convert from node ID to indices of node.
Definition: direct_product_mesh_wrapper.h:709
bool distributed() const
Is mesh distributed?
Definition: direct_product_mesh_wrapper.h:291
A basic, axis-aligned, logically-rectangular mesh.
Definition: direct_product_mesh.h:112
Definition: wonton.h:88
counting_iterator axis_point_begin(const int dim) const
Get iterator for axis point (beginning of array).
Definition: direct_product_mesh_wrapper.h:328
Represents a point in an N-dimensional space.
Definition: Point.h:50
int indices_to_nodeid(const std::array< int, D > &indices) const
Convert from indices of node to node ID.
Definition: direct_product_mesh_wrapper.h:689
void cell_get_node_adj_cells(const int cellid, const Entity_type ptype, std::vector< int > *adjcells) const
Get the list of cell IDs for all cells attached to a specific cell through its faces.
Definition: direct_product_mesh_wrapper.h:754
bool on_exterior_boundary(const Entity_kind entity, const int id) const
If entity is on exterior (global not partition) boundary.
Definition: direct_product_mesh_wrapper.h:491
counting_iterator make_counting_iterator(int const i)
Definition: wonton.h:291
counting_iterator begin(Entity_kind const entity, Entity_type const etype=ALL) const
Iterators on mesh entity - begin.
Definition: direct_product_mesh_wrapper.h:599
void cell_get_bounds(const int id, Point< D > *plo, Point< D > *phi) const
Get lower and upper corners of cell bounding box.
Definition: direct_product_mesh_wrapper.h:405
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
void cell_centroid(const int id, Point< D > *ccen) const
Get cell centroid.
Definition: direct_product_mesh_wrapper.h:580
void cell_get_coordinates(const int id, std::vector< Point< D >> *ccoords) const
Get coordinates of cell points.
Definition: direct_product_mesh_wrapper.h:543
Direct_Product_Mesh_Wrapper()=delete
Default constructor (disabled)
void get_global_bounds(Point< D > *plo, Point< D > *phi) const
Get global mesh bounds.
Definition: direct_product_mesh_wrapper.h:305
~Direct_Product_Mesh_Wrapper()
Destructor.
Definition: direct_product_mesh_wrapper.h:266
int indices_to_cellid(const std::array< int, D > &indices) const
Convert from indices of lo corner of cell to cell ID.
Definition: direct_product_mesh_wrapper.h:637
Point< D > get_node_coordinates(const int pointid) const
Get coordinates of node.
Definition: direct_product_mesh_wrapper.h:360
Entity_type node_get_type(const int id) const
Node type (PARALLEL_OWNED, PARALLEL_GHOST or BOUNDARY_GHOST)
Definition: direct_product_mesh_wrapper.h:442
int space_dimension() const
Get dimensionality of the mesh.
Definition: direct_product_mesh_wrapper.h:284
Definition: wonton.h:127
int num_owned_nodes() const
Get number of nodes owned by this processing element.
Definition: direct_product_mesh_wrapper.h:418
int num_owned_cells() const
Get number of cells owned by this processing element.
Definition: direct_product_mesh_wrapper.h:381
void node_get_cell_adj_nodes(const int nodeid, const Entity_type ptype, std::vector< int > *adjnodes) const
Get the list of node IDs for all nodes attached to all cells attached to a specific node...
Definition: direct_product_mesh_wrapper.h:786
Direct_Product_Mesh_Wrapper & operator=(Direct_Product_Mesh_Wrapper< D, CoordSys > const &)=delete
Assignment operator (disabled).
int num_axis_points(const int dim, const Entity_type ptype=ALL) const
Get number of points along axis.
Definition: direct_product_mesh_wrapper.h:318
counting_iterator end(Entity_kind const entity, Entity_type const etype=ALL) const
Iterator on mesh entity - end.
Definition: direct_product_mesh_wrapper.h:610