simple_mesh.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_SIMPLE_MESH_H_
8 #define WONTON_SIMPLE_MESH_H_
9 
10 #include <vector>
11 #include <memory>
12 #include <cassert>
13 
14 #include "wonton/support/wonton.h"
15 #include "wonton/support/Point.h"
16 #include "wonton/support/Matrix.h"
17 
23 namespace Wonton {
24 
47 class Simple_Mesh {
49  typedef int ID;
50 
51  public:
63 Simple_Mesh(double x0, double y0, double z0,
64  double x1, double y1, double z1,
65  int nx, int ny, int nz) :
66  nx_(nx), ny_(ny), nz_(nz),
67  x0_(x0), y0_(y0), z0_(z0),
68  x1_(x1), y1_(y1), z1_(z1) {
69  spacedim_ = 3;
70  num_cells_ = nx*ny*nz;
71  num_nodes_ = (nx+1)*(ny+1)*(nz+1);
72  num_faces_ = (nx_+1)*ny_*nz_ + nx_*(ny_+1)*nz_ + nx_*ny_*(nz_+1);
73 
74  nodes_per_face_ = 4;
75  nodes_per_cell_ = 8;
76  faces_per_cell_ = 6;
77  cells_per_node_aug_ = 9;
78 
79  // Construct the nodal coordinates from extents and number of nodes
80  build_node_coords_3d();
81 
82  // Build cell <--> node, cell <--> face, face --> node adjacencies
83  build_cfn_adjacencies_3d();
84 
85  // Build ownership information - no ghosts in Simple Mesh
86  nodeids_owned_.resize(num_nodes_);
87  for (int i(0); i < num_nodes_; ++i)
88  nodeids_owned_[i] = i;
89 
90  cellids_owned_.resize(num_cells_);
91  for (int i(0); i < num_cells_; ++i)
92  cellids_owned_[i] = i;
93 
94  faceids_owned_.resize(num_faces_);
95  for (int i(0); i < num_faces_; ++i)
96  faceids_owned_[i] = i;
97  }
98 
110  Simple_Mesh(double x0, double y0,
111  double x1, double y1,
112  int nx, int ny) :
113  nx_(nx), ny_(ny),
114  x0_(x0), y0_(y0),
115  x1_(x1), y1_(y1) {
116  spacedim_ = 2;
117  num_cells_ = nx*ny;
118  num_nodes_ = (nx+1)*(ny+1);
119  num_faces_ = (nx_+1)*ny_ + nx_*(ny_+1);
120 
121  nodes_per_face_ = 2;
122  nodes_per_cell_ = 4;
123  faces_per_cell_ = 4;
124  cells_per_node_aug_ = 5;
125 
126  // Construct the nodal coordinates from extents and number of nodes
127  build_node_coords_2d();
128 
129  // Build cell <--> node, cell <--> face, face --> node adjacencies
130  build_cfn_adjacencies_2d();
131 
132  // Build ownership information - no ghosts in Simple Mesh
133  nodeids_owned_.resize(num_nodes_);
134  for (int i(0); i < num_nodes_; ++i)
135  nodeids_owned_[i] = i;
136 
137  cellids_owned_.resize(num_cells_);
138  for (int i(0); i < num_cells_; ++i)
139  cellids_owned_[i] = i;
140 
141  faceids_owned_.resize(num_faces_);
142  for (int i(0); i < num_faces_; ++i)
143  faceids_owned_[i] = i;
144  }
145 
147  Simple_Mesh & operator=(const Simple_Mesh &) = delete;
148 
151 
153  inline int space_dimension() const {
154  return spacedim_;
155  }
156 
163  int num_entities(const Entity_kind kind,
164  const Entity_type type) const {
165  switch (kind) {
166  case Entity_kind::NODE:
167  switch (type) {
169  return nodeids_owned_.size();
171  // Simple_Mesh has no ghosts.
172  return 0;
173  case Entity_type::ALL:
174  // Simple_Mesh has no ghosts.
175  return nodeids_owned_.size();
176  default:
177  return 0;
178  }
179  case Entity_kind::CELL:
180  switch (type) {
182  return cellids_owned_.size();
184  // Simple_Mesh has no ghosts.
185  return 0;
186  case Entity_type::ALL:
187  // Simple_Mesh has no ghosts.
188  return cellids_owned_.size();
189  default:
190  return 0;
191  }
192  case Entity_kind::FACE:
193  switch (type) {
195  return faceids_owned_.size();
197  // Simple_Mesh has no ghosts.
198  return 0;
199  case Entity_type::ALL:
200  // Simple_Mesh has no ghosts.
201  return faceids_owned_.size();
202  default:
203  return 0;
204  }
205  default:
206  return 0;
207  }
208  }
209 
218  void cell_get_faces_and_dirs(const ID cellid,
219  std::vector<ID> *faces,
220  std::vector<int> *fdirs) const {
221  auto offset = faces_per_cell_*cellid;
222  faces->clear();
223  fdirs->clear();
224  for (int i(0); i < faces_per_cell_; ++i) {
225  faces->push_back(cell_to_face_[i+offset]);
226  fdirs->push_back(cell_face_dirs_[i+offset]);
227  }
228  }
229  // @TODO: replace with std::copy?
235  void cell_get_nodes(const ID cellid,
236  std::vector<ID> *nodes) const {
237  auto offset = nodes_per_cell_*cellid;
238  nodes->clear();
239  for (int i(0); i < nodes_per_cell_; ++i)
240  nodes->push_back(cell_to_node_[i+offset]);
241  }
247  void face_get_nodes(const ID faceid,
248  std::vector<ID> *nodes) const {
249  auto offset = nodes_per_face_*faceid;
250  nodes->clear();
251  for (int i(0); i < nodes_per_face_; ++i)
252  nodes->push_back(face_to_node_[i+offset]);
253  }
254 
260  void node_get_cells(const ID nodeid,
261  std::vector<ID> *cells) const {
262  auto offset = cells_per_node_aug_*nodeid;
263  cells->clear();
264  for (int i(0); i < node_to_cell_[offset]; ++i) {
265  cells->push_back(node_to_cell_[i+offset+1]);
266  }
267  }
268 
269  // General specification - specialization follows at bottom of file
279  template<int D>
280  void node_get_coordinates(const ID nodeid,
281  Point<D> *pp) const {
282  assert(D == space_dimension());
283  }
284 
293  template<int D>
294  void cell_get_coordinates(const ID cellid,
295  std::vector<Point<D>> *ccoords) const {
296  assert(D == space_dimension());
297 
298  std::vector<ID> node_indices;
299  cell_get_nodes(cellid , &node_indices);
300 
301  ccoords->clear();
302 
303  Point<D> node_coords;
304  for (int node_id: node_indices){
305  node_get_coordinates(node_id, &node_coords);
306  ccoords->push_back(node_coords);
307  }
308  }
309 
320  template<int D>
321  void transform(const Matrix &affine) {
322  assert(D == space_dimension());
323  assert(affine.rows() == D);
324  assert(affine.columns() == D+1);
325  for (int i=0; i<num_nodes_; i++) {
326  Point<D> node;
327  node_get_coordinates<D>(i, &node);
328  std::vector<double> nodex(D+1);
329  for (int j=0; j<D; j++) nodex[j] = node[j];
330  nodex[D] = 1.;
331  std::vector<double> newnodev;
332  newnodev = affine*nodex;
333  Point<D> newnode(newnodev);
334  node_set_coordinates<D>(i, &newnode);
335  }
336  }
337 
338  // General specification - specialization follows at bottom of file
352  template<int D>
353  void node_set_coordinates(const ID nodeid,
354  Point<D> *pp) {
355  assert(D == space_dimension());
356  }
357 
358  private:
363  void build_node_coords_3d() {
364  coordinates3d_.clear();
365 
366  double hx = (x1_ - x0_)/nx_;
367  double hy = (y1_ - y0_)/ny_;
368  double hz = (z1_ - z0_)/nz_;
369 
370  for (int iz(0); iz <= nz_; ++iz)
371  for (int iy(0); iy <= ny_; ++iy)
372  for (int ix(0); ix <= nx_; ++ix) {
373  coordinates3d_.emplace_back(x0_+ix*hx,
374  y0_+iy*hy,
375  z0_+iz*hz);
376  }
377  }
378 
379  /*
380  @brief Builds the cell-face-node adjacency information for 3D mesh.
381  */
382  void build_cfn_adjacencies_3d() {
383  // downward adjacencies
384  cell_to_node_.resize(nodes_per_cell_*num_cells_);
385  cell_to_face_.resize(faces_per_cell_*num_cells_);
386  cell_face_dirs_.resize(faces_per_cell_*num_cells_);
387  face_to_node_.resize(nodes_per_face_*num_faces_);
388  // upward adjacencies
389  node_to_cell_.resize(cells_per_node_aug_*num_nodes_);
390  face_to_cell_.resize(2*num_faces_, -1);
391 
392  // cell adjacencies
393  for (int iz(0); iz < nz_; ++iz)
394  for (int iy(0); iy < ny_; ++iy)
395  for (int ix(0); ix < nx_; ++ix) {
396  auto thisCell = cell_index_(ix, iy, iz);
397  auto cstart = nodes_per_cell_ * thisCell;
398  auto fstart = faces_per_cell_ * thisCell;
399 
400  /*
401  Node ordering in hex:
402  z
403  7-------6 ^ y
404  /| /| | /
405  / | / | | /
406  4--|----5 | |/
407  | 3----|--2 +-------> x
408  | / | /
409  0-------1
410  */
411  cell_to_node_[cstart ] = node_index_(ix, iy, iz);
412  cell_to_node_[cstart+1] = node_index_(ix+1, iy, iz);
413  cell_to_node_[cstart+2] = node_index_(ix+1, iy+1, iz);
414  cell_to_node_[cstart+3] = node_index_(ix, iy+1, iz);
415  cell_to_node_[cstart+4] = node_index_(ix, iy, iz+1);
416  cell_to_node_[cstart+5] = node_index_(ix+1, iy, iz+1);
417  cell_to_node_[cstart+6] = node_index_(ix+1, iy+1, iz+1);
418  cell_to_node_[cstart+7] = node_index_(ix, iy+1, iz+1);
419 
420  // loop over the 8 nodes attached to this cell, and assign
421  // this cell to its cell connectivity
422  // order shouldn't matter here
423  for (int iiz(iz); iiz <= iz+1; ++iiz)
424  for (int iiy(iy); iiy <= iy+1; ++iiy)
425  for (int iix(ix); iix <= ix+1; ++iix) {
426  auto thisNode = node_index_(iix, iiy, iiz);
427  auto cnstart = cells_per_node_aug_ * thisNode;
428  auto & c_at_n = node_to_cell_[cnstart];
429  node_to_cell_[cnstart+c_at_n+1] = thisCell;
430  c_at_n++;
431  }
432 
433  /*
434  Face ordering in hex:
435  z
436  +-------+ ^ y
437  /| /| | /
438  / | 5 2/ | | /
439  +--|----+ 1| |/
440  |3 +0---|--+ +-------> x
441  | / 4 | /
442  +-------+
443 
444  The "dirs" indicate whether or not the nodes are listed in
445  a ccw (dir=+1) or cw (dir=-1) orientation when look DOWN
446  the cell's OUTWARD normal at that face. Images of each
447  face are below when we construct the face adjacencies.
448  */
449  cell_to_face_[fstart ] = xzface_index_(ix, iy, iz); // front
450  cell_face_dirs_[fstart ] = 1;
451  cell_to_face_[fstart+1] = yzface_index_(ix+1, iy, iz); // right
452  cell_face_dirs_[fstart+1] = 1;
453  cell_to_face_[fstart+2] = xzface_index_(ix, iy+1, iz); // back
454  cell_face_dirs_[fstart+2] = -1;
455  cell_to_face_[fstart+3] = yzface_index_(ix, iy, iz); // left
456  cell_face_dirs_[fstart+3] = -1;
457  cell_to_face_[fstart+4] = xyface_index_(ix, iy, iz); // bottom
458  cell_face_dirs_[fstart+4] = -1;
459  cell_to_face_[fstart+5] = xyface_index_(ix, iy, iz+1); // top
460  cell_face_dirs_[fstart+5] = 1;
461 
462  // go over the 6 faces attached to this cell, and assign
463  // this cell to its cell connectivity
464  auto cfstart = 2*xzface_index_(ix, iy, iz) + 1; // +y side of front
465  face_to_cell_[cfstart] = thisCell;
466  cfstart = 2*yzface_index_(ix+1, iy, iz); // -x side of right
467  face_to_cell_[cfstart] = thisCell;
468  cfstart = 2*xzface_index_(ix, iy+1, iz); // -y side of back
469  face_to_cell_[cfstart] = thisCell;
470  cfstart = 2*yzface_index_(ix, iy, iz) + 1; // +x side of left
471  face_to_cell_[cfstart] = thisCell;
472  cfstart = 2*xyface_index_(ix, iy, iz) + 1; // +z side of bottom
473  face_to_cell_[cfstart] = thisCell;
474  cfstart = 2*xyface_index_(ix, iy, iz+1); // -z side of top
475  face_to_cell_[cfstart] = thisCell;
476  }
477 
478  // face adjacencies
479  /* xy faces
480  3-------2
481  / /
482  / /
483  0-------1
484  */
485  for (int iz(0); iz <= nz_; ++iz)
486  for (int iy(0); iy < ny_; ++iy)
487  for (int ix(0); ix < nx_; ++ix) {
488  auto thisFace = xyface_index_(ix, iy, iz);
489  auto nstart = nodes_per_face_ * thisFace;
490  face_to_node_[nstart ] = node_index_(ix, iy, iz);
491  face_to_node_[nstart+1] = node_index_(ix+1, iy, iz);
492  face_to_node_[nstart+2] = node_index_(ix+1, iy+1, iz);
493  face_to_node_[nstart+3] = node_index_(ix, iy+1, iz);
494  }
495  /* xz faces
496  3-------2
497  | |
498  | |
499  | |
500  0-------1
501  */
502  for (int iz(0); iz < nz_; ++iz)
503  for (int iy(0); iy <= ny_; ++iy)
504  for (int ix(0); ix < nx_; ++ix) {
505  auto thisFace = xzface_index_(ix, iy, iz);
506  auto nstart = nodes_per_face_ * thisFace;
507  face_to_node_[nstart ] = node_index_(ix, iy, iz);
508  face_to_node_[nstart+1] = node_index_(ix+1, iy, iz);
509  face_to_node_[nstart+2] = node_index_(ix+1, iy, iz+1);
510  face_to_node_[nstart+3] = node_index_(ix, iy, iz+1);
511  }
512  /* yz faces
513  2
514  /|
515  / |
516  3 |
517  | 1
518  | /
519  |/
520  0
521  */
522  for (int iz(0); iz < nz_; ++iz)
523  for (int iy(0); iy < ny_; ++iy)
524  for (int ix(0); ix <= nx_; ++ix) {
525  auto thisFace = yzface_index_(ix, iy, iz);
526  auto nstart = nodes_per_face_ * thisFace;
527  face_to_node_[nstart ] = node_index_(ix, iy, iz);
528  face_to_node_[nstart+1] = node_index_(ix, iy+1, iz);
529  face_to_node_[nstart+2] = node_index_(ix, iy+1, iz+1);
530  face_to_node_[nstart+3] = node_index_(ix, iy, iz+1);
531  }
532  }
533 
534 
539  void build_node_coords_2d() {
540  coordinates2d_.clear();
541 
542  double hx = (x1_ - x0_)/nx_;
543  double hy = (y1_ - y0_)/ny_;
544 
545  for (int iy(0); iy <= ny_; ++iy)
546  for (int ix(0); ix <= nx_; ++ix) {
547  coordinates2d_.emplace_back(x0_+ix*hx,
548  y0_+iy*hy);
549  }
550  }
551 
552  /*
553  @brief Builds the cell-face-node adjacency information for 2D mesh.
554  */
555  void build_cfn_adjacencies_2d() {
556  // downward adjacencies
557  cell_to_node_.resize(nodes_per_cell_*num_cells_);
558  cell_to_face_.resize(faces_per_cell_*num_cells_);
559  cell_face_dirs_.resize(faces_per_cell_*num_cells_);
560  face_to_node_.resize(nodes_per_face_*num_faces_);
561  // upward adjacencies
562  node_to_cell_.resize(cells_per_node_aug_*num_nodes_);
563  face_to_cell_.resize(2*num_faces_, -1);
564 
565  // cell adjacencies
566  for (int iy(0); iy < ny_; ++iy)
567  for (int ix(0); ix < nx_; ++ix) {
568  auto thisCell = cell_index_(ix, iy, 0);
569  auto cstart = nodes_per_cell_ * thisCell;
570  auto fstart = faces_per_cell_ * thisCell;
571 
572  /*
573  Node ordering in quad:
574  y
575  ^
576  3-------2 |
577  | | |
578  | | |
579  0-------1 +-------> x
580  */
581 
582  cell_to_node_[cstart ] = node_index_(ix, iy, 0);
583  cell_to_node_[cstart+1] = node_index_(ix+1, iy, 0);
584  cell_to_node_[cstart+2] = node_index_(ix+1, iy+1, 0);
585  cell_to_node_[cstart+3] = node_index_(ix, iy+1, 0);
586 
587 
588  // loop over the 4 nodes attached to this cell, and assign
589  // this cell to its cell connectivity
590  // order shouldn't matter here
591  for (int iiy(iy); iiy <= iy+1; ++iiy)
592  for (int iix(ix); iix <= ix+1; ++iix) {
593  auto thisNode = node_index_(iix, iiy, 0);
594  auto cnstart = cells_per_node_aug_ * thisNode;
595  auto & c_at_n = node_to_cell_[cnstart];
596  node_to_cell_[cnstart+c_at_n+1] = thisCell;
597  c_at_n++;
598  }
599 
600  /*
601  Face ordering in quad:
602  y
603  2 ^
604  +-------+ |
605  | | |
606  3 | | 1 |
607  | | |
608  +-------+ +-------> x
609  0
610 
611  The "dirs" indicate whether or not the nodes are listed in
612  a ccw (dir=+1) or cw (dir=-1) orientation when look DOWN
613  the cell's OUTWARD normal at that face. Images of each
614  face are below when we construct the face adjacencies.
615  */
616  cell_to_face_[fstart ] = xface_index_(ix, iy); // bottom
617  cell_face_dirs_[fstart ] = 1;
618  cell_to_face_[fstart+1] = yface_index_(ix+1, iy); // right
619  cell_face_dirs_[fstart+1] = 1;
620  cell_to_face_[fstart+2] = xface_index_(ix, iy+1); // up
621  cell_face_dirs_[fstart+2] = -1;
622  cell_to_face_[fstart+3] = yface_index_(ix, iy); // left
623  cell_face_dirs_[fstart+3] = -1;
624 
625 
626  // go over the 4 faces attached to this cell, and assign
627  // this cell to its cell connectivity
628  auto cfstart = 2*xface_index_(ix, iy); // +y side of bottom
629  face_to_cell_[cfstart] = thisCell;
630  cfstart = 2*xface_index_(ix, iy+1)+1; // -y side of up
631  face_to_cell_[cfstart] = thisCell;
632  cfstart = 2*yface_index_(ix+1, iy)+1; // -x side of right
633  face_to_cell_[cfstart] = thisCell;
634  cfstart = 2*yface_index_(ix, iy) ; // +x side of left
635  face_to_cell_[cfstart] = thisCell;
636 
637  }
638 
639  // face adjacencies
640 
641  for (int iy(0); iy <= ny_; ++iy)
642  for (int ix(0); ix < nx_; ++ix) {
643  auto thisFace = xface_index_(ix, iy);
644  auto nstart = nodes_per_face_ * thisFace;
645  face_to_node_[nstart ] = node_index_(ix, iy, 0);
646  face_to_node_[nstart+1] = node_index_(ix+1, iy, 0);
647  }
648 
649  for (int iy(0); iy < ny_; ++iy)
650  for (int ix(0); ix <= nx_; ++ix) {
651  auto thisFace = yface_index_(ix, iy);
652  auto nstart = nodes_per_face_ * thisFace;
653  face_to_node_[nstart ] = node_index_(ix, iy, 0);
654  face_to_node_[nstart+1] = node_index_(ix, iy+1, 0);
655  }
656 
657  }
658 
660  int spacedim_ ;
661 
663  int nx_, ny_, nz_;
664 
666  double x0_, y0_, z0_, x1_, y1_, z1_;
667 
669  std::vector<Point<3>> coordinates3d_;
670  std::vector<Point<2>> coordinates2d_;
671 
673  int nodes_per_face_ ;
674  int nodes_per_cell_ ;
675  int faces_per_cell_ ;
676  int cells_per_node_aug_ ; // 1 entry for the num cells actually attached
677 
679  int num_cells_;
680  int num_nodes_;
681  int num_faces_;
682 
684  std::vector<ID> cell_to_face_;
685  std::vector<int> cell_face_dirs_;
686  std::vector<ID> cell_to_node_;
687  std::vector<ID> face_to_node_;
688  std::vector<ID> face_to_cell_;
689  std::vector<ID> node_to_cell_;
690 
692  std::vector<ID> nodeids_owned_;
693  std::vector<ID> faceids_owned_;
694  std::vector<ID> cellids_owned_;
695 
697  ID node_index_(int i, int j, int k) const {
698  return i + j*(nx_+1) + k*(nx_+1)*(ny_+1);
699  }
700  ID cell_index_(int i, int j, int k) const {
701  return i + j*nx_ + k*nx_*ny_;
702  }
703 
704  ID xface_index_(int i, int j) const {
705  return i + j*nx_ ;
706  }
707  ID yface_index_(int i, int j) const {
708  return i + j*(nx_+1) + xface_index_(0, ny_+1);
709  }
710 
711  ID xyface_index_(int i, int j, int k) const {
712  return i + j*nx_ + k*nx_*ny_;
713  }
714  ID xzface_index_(int i, int j, int k) const {
715  return i + j*nx_ + k*nx_*(ny_+1) + xyface_index_(0, 0, nz_+1);
716  }
717  ID yzface_index_(int i, int j, int k) const {
718  return i + j*(nx_+1) + k*(nx_+1)*ny_ + xzface_index_(0, 0, nz_);
719  }
720 }; // class Simple_Mesh
721 
722 // Specializations
729 template<>
730 inline
731 void Simple_Mesh::node_get_coordinates<3>(const ID nodeid,
732  Point<3> *pp) const {
733  assert(spacedim_ == 3);
734  *pp = coordinates3d_[nodeid];
735 }
736 
737 template<>
738 inline
739 void Simple_Mesh::node_get_coordinates<2>(const ID nodeid,
740  Point<2> *pp) const {
741  assert(spacedim_ == 2);
742  *pp = coordinates2d_[nodeid];
743 }
744 
745 template<>
746 inline
747 void Simple_Mesh::node_set_coordinates<3>(const ID nodeid,
748  Point<3> *pp) {
749  assert(spacedim_ == 3);
750  coordinates3d_[nodeid] = *pp;
751 }
752 
753 template<>
754 inline
755 void Simple_Mesh::node_set_coordinates<2>(const ID nodeid,
756  Point<2> *pp) {
757  assert(spacedim_ == 2);
758  coordinates2d_[nodeid] = *pp;
759 }
760 
761 
762 } // namespace Wonton
763 
764 #endif // WONTON_SIMPLE_MESH_H_
Definition: wonton.h:130
Definition: wonton.h:128
Simple_Mesh & operator=(const Simple_Mesh &)=delete
Assignment operator (disabled).
int num_entities(const Entity_kind kind, const Entity_type type) const
Determine the number of a specific mesh entity.
Definition: simple_mesh.h:163
~Simple_Mesh()
Destructor.
Definition: simple_mesh.h:150
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
void node_get_cells(const ID nodeid, std::vector< ID > *cells) const
For a given node, get all the cells attached to this node.
Definition: simple_mesh.h:260
Definition: wonton.h:87
int space_dimension() const
Spatial dimension of the mesh.
Definition: simple_mesh.h:153
Entity_type
The parallel type of a given entity.
Definition: wonton.h:124
Definition: wonton.h:85
Definition: wonton.h:88
Represents a point in an N-dimensional space.
Definition: Point.h:50
void cell_get_faces_and_dirs(const ID cellid, std::vector< ID > *faces, std::vector< int > *fdirs) const
For a given cell, get the list of faces and the direction of their normals.
Definition: simple_mesh.h:218
Simple_Mesh(double x0, double y0, double x1, double y1, int nx, int ny)
Constructor for creating a serial, 2D Cartesian mesh.
Definition: simple_mesh.h:110
A very light-weight, serial, 2D/3D Cartesian mesh.
Definition: simple_mesh.h:47
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
Matrix class for Wonton.
void node_set_coordinates(const ID nodeid, Point< D > *pp)
Set the coordinates of a node.
Definition: simple_mesh.h:353
void cell_get_coordinates(const ID cellid, std::vector< Point< D >> *ccoords) const
Definition: simple_mesh.h:294
void face_get_nodes(const ID faceid, std::vector< ID > *nodes) const
For a given face, get the list of nodes.
Definition: simple_mesh.h:247
void node_get_coordinates(const ID nodeid, Point< D > *pp) const
Get the coordinates of a node.
Definition: simple_mesh.h:280
void transform(const Matrix &affine)
Perform an affine transform on the coordinates of the mesh.
Definition: simple_mesh.h:321
Definition: wonton.h:127
void cell_get_nodes(const ID cellid, std::vector< ID > *nodes) const
For a given cell, get the list of nodes.
Definition: simple_mesh.h:235
Simple_Mesh(double x0, double y0, double z0, double x1, double y1, double z1, int nx, int ny, int nz)
Constructor for creating a serial, 3D Cartesian mesh.
Definition: simple_mesh.h:63