flat_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 FLAT_MESH_WRAPPER_H_
8 #define FLAT_MESH_WRAPPER_H_
9 
10 #include <cassert>
11 #include <algorithm>
12 #include <numeric>
13 #include <array>
14 #include <limits>
15 #include <map>
16 #include <set>
17 #include <vector>
18 
20 #include "wonton/support/wonton.h"
21 #include "wonton/support/Point.h"
22 
23 namespace Wonton {
24 
25 using namespace Wonton;
35 template <class T=double>
36 class Flat_Mesh_Wrapper : public AuxMeshTopology<Flat_Mesh_Wrapper<>> {
37  public:
38 
40  Flat_Mesh_Wrapper() = default;
41 
43  Flat_Mesh_Wrapper & operator=(Flat_Mesh_Wrapper const &) = delete;
44 
46  ~Flat_Mesh_Wrapper() = default;
47 
48  template<class Mesh_Wrapper>
49  void initialize(Mesh_Wrapper& input)
50  {
51 
52  dim_ = input.space_dimension();
53 
54  numOwnedCells_ = input.num_owned_cells();
55  int numCells = numOwnedCells_ + input.num_ghost_cells();
56 
57  numOwnedNodes_ = input.num_owned_nodes();
58  int numNodes = numOwnedNodes_ + input.num_ghost_nodes();
59 
60  int numFaces = -1;
61  if (dim_ == 3)
62  {
63  numOwnedFaces_ = input.num_owned_faces();
64  numFaces = numOwnedFaces_ + input.num_ghost_faces();
65  }
66 
67  // start clean
68  reset_and_reserve(numCells, numFaces, numNodes);
69 
70 
72  // local copies we always need independent of dimension
74 
75  // cell global ids, cell node counts, cell node listt
76  for (int c = 0; c < numCells; c++)
77  {
78  cellGlobalIds_.push_back(input.get_global_id(c, Entity_kind::CELL));
79 
80  std::vector<int> cellNodes;
81  input.cell_get_nodes(c, &cellNodes);
82  cellNodeCounts_.push_back(cellNodes.size());
83  cellToNodeList_.insert(cellToNodeList_.end(),
84  cellNodes.begin(), cellNodes.end());
85  }
86 
87  // node global ids
88  for (int n = 0; n < numNodes; ++n) {
89 
90  nodeGlobalIds_.push_back(input.get_global_id(n, Entity_kind::NODE));
91  }
92 
93 
95  // local copies that are only required in 2D
97 
98  if (dim_ ==2)
99  {
100  // node coordinates
101  for (int n=0; n<numNodes; ++n) {
102  Wonton::Point<2> nodeCoord;
103  input.node_get_coordinates(n, &nodeCoord);
104  for (int j=0; j<2; ++j)
105  nodeCoords_.push_back(nodeCoord[j]);
106  }
107  }
108 
109 
111  // local copies that are only required in 3D
113 
114  if (dim_ == 3)
115  {
116 
117  // cell face counts, cell face lists, cell face directions
118  for (int c=0; c<numCells; ++c)
119  {
120  std::vector<int> cellFaces, cfDirs;
121  input.cell_get_faces_and_dirs(c, &cellFaces, &cfDirs);
122  cellFaceCounts_.push_back(cellFaces.size());
123  cellToFaceList_.insert(cellToFaceList_.end(),
124  cellFaces.begin(), cellFaces.end());
125  int const nb_cell_faces = cellFaces.size();
126  for (int j = 0; j < nb_cell_faces; ++j)
127  cellToFaceDirs_.push_back(cfDirs[j] >= 0);
128  }
129 
130  // face global ids, face node counts, face node lists
131  for (int f=0; f<numFaces; ++f)
132  {
133  faceGlobalIds_.push_back(input.get_global_id(f, Entity_kind::FACE));
134  std::vector<int> faceNodes;
135  input.face_get_nodes(f, &faceNodes);
136  faceNodeCounts_.push_back(faceNodes.size());
137  faceToNodeList_.insert(faceToNodeList_.end(),
138  faceNodes.begin(), faceNodes.end());
139  }
140 
141  // node coordinates
142  for (int n=0; n<numNodes; ++n) {
143  Wonton::Point<3> nodeCoord;
144  input.node_get_coordinates(n, &nodeCoord);
145  for (int j=0; j<3; ++j)
146  nodeCoords_.push_back(nodeCoord[j]);
147  }
148 
149  }
150 
151  // Complete the mesh. This step computes offsets and the inverse maps.
152  // We only need the compute_offsets routines before doing distribute, but
153  // it is possible (as in the tests) that someone will want to use a pre-
154  // distribution flat mesh wrapper as a complete mesh, instead of the
155  // underlying mesh, which would make more sense, so we will do this here
156  // although it could be easily removed by adding 3 compute_offsets
157  finish_init();
158 
159  }
160 
162  void finish_init()
163  {
164  // Create all index maps
165  make_index_maps();
166 
167  // Redo AuxMeshTopology info
169  }
170 
171  // Create complete topologies for the various mesh entities.This topology is
172  // defined by cells, faces and nodes. This is true in both dimensions 2 and 3
173  // but obviously what is meant by these changes with dimension.
174  // These topologies include the maps: cellToFace and faceToNode
175  // and the skip map: cellToNode.
176  // We also create the single inverse map going from nodeToCell.
177  // This routine also computes offsets, which turn counts into partial sums so
178  // that the relevant topologies, e.g. cell face indices, can be extracted from
179  // the corresponding complete lists
180  // Since faces are unique between cells, we also need to assign a direction to
181  // each face in a cell
183 
184  if (dim_ == 2)
185  {
186  // In 2D, we need to construct faces and their connectivity since the
187  // boundary representation is just vertices around cells. A face in 2D is
188  // and edge, and edges aren't specified, so we need to create them. Faces
189  // also need to have directions and we need to make sure those are created
190  // as well.
191  // In 2D we are given the skip topology cellToNode, and we need to construct
192  // the adjacent topologies cellToFace and faceToNode.
193 
194  compute_offsets(cellNodeCounts_, &cellNodeOffsets_);
195 
196  // Clear and reserve
197  cellToFaceList_.clear();
198  cellToFaceList_.reserve(cellNodeCounts_.size());
199 
200  cellToFaceDirs_.clear();
201  cellToFaceDirs_.reserve(cellNodeCounts_.size());
202 
203  faceToNodeList_.clear();
204  faceToNodeList_.reserve(cellToNodeList_.size()); // slight underestimate
205 
206  // in 2D we directly specify the cell to node map. In order to complete
207  // the topology we need to construct faces on the fly. Each face is
208  // defined by an (vertex, next_vertex) pair. There are as many faces(edges)
209  // as vertices.
210 
211  // a temporary map that takes an edge node pair (v, next_v) and maps it to
212  // a face id
213  std::map<std::pair<int, int>, int> nodePairToFaceTmp;
214 
215  // new face/edge counter
216  int facecount = 0;
217  int const nb_cell_node_counts = cellNodeCounts_.size();
218 
219  for (int c = 0; c < nb_cell_node_counts; ++c) {
220  int offset = cellNodeOffsets_[c];
221  int count = cellNodeCounts_[c];
222  for (int i=0; i<count; ++i) {
223  int n0 = cellToNodeList_[offset+i];
224  int n1 = cellToNodeList_[offset+((i+1)%count)];
225  // put nodes in canonical order
226  int p0 = std::min(n0, n1);
227  int p1 = std::max(n0, n1);
228  auto npair = std::make_pair(p0, p1);
229  auto it = nodePairToFaceTmp.find(npair);
230  int face;
231  if (it == nodePairToFaceTmp.end()) {
232  // new face
233  face = facecount;
234  nodePairToFaceTmp.insert(std::make_pair(npair, face));
235  faceToNodeList_.emplace_back(p0);
236  faceToNodeList_.emplace_back(p1);
237  ++facecount;
238  }
239  else {
240  // existing face
241  face = it->second;
242  }
243  cellToFaceList_.emplace_back(face);
244  cellToFaceDirs_.push_back(n0 == p0);
245  } // for i
246 
247  if (c == numOwnedCells_ - 1) numOwnedFaces_ = facecount;
248 
249  } // for c
250  }
251  else if (dim_ == 3)
252  {
253  // In 3D, we are given the adjacent topologies cellToFace and faceToNode
254  // and we only need to compute the skip topology cellToNode
255 
256  compute_offsets(faceNodeCounts_, &faceNodeOffsets_);
257  compute_offsets(cellFaceCounts_, &cellFaceOffsets_);
258 
259  // Compute cell-to-node adjacency lists (3D only)
260  cellNodeCounts_.clear();
261  cellNodeCounts_.reserve(cellFaceCounts_.size());
262 
263  cellToNodeList_.clear();
264  cellToNodeList_.reserve(cellFaceCounts_.size() * 4);
265  int const nb_cell_face_counts = cellFaceCounts_.size();
266 
267  for (int c = 0; c < nb_cell_face_counts; ++c) {
268  std::vector<int> cellfaces, dummy;
269  cell_get_faces_and_dirs(c, &cellfaces, &dummy);
270  std::set<int> cellnodes;
271 
272  for (auto const& f : cellfaces) {
273  std::vector<int> facenodes;
274  face_get_nodes(f, &facenodes);
275  cellnodes.insert(facenodes.begin(), facenodes.end());
276  }
277 
278  cellNodeCounts_.emplace_back(cellnodes.size());
279  cellToNodeList_.insert(cellToNodeList_.end(),
280  cellnodes.begin(), cellnodes.end());
281  }
282  compute_offsets(cellNodeCounts_, &cellNodeOffsets_);
283  }
284 
285  // Compute inverse node-to-cell adjacency lists
286  int numNodes = nodeCoords_.size()/dim_;
287  std::vector<std::set<int>> nodeToCellTmp(numNodes);
288  int const nb_cell_node_counts = cellNodeCounts_.size();
289 
290  for (int c = 0; c < nb_cell_node_counts; ++c) {
291  int offset = cellNodeOffsets_[c];
292  int count = cellNodeCounts_[c];
293  for (int i=0; i<count; ++i) {
294  int n = cellToNodeList_[offset+i];
295  nodeToCellTmp[n].insert(c);
296  }
297  }
298 
299  nodeCellCounts_.clear();
300  nodeCellCounts_.reserve(numNodes);
301 
302  nodeToCellList_.clear();
303  nodeToCellList_.reserve(cellToNodeList_.size());
304 
305  for (int n=0; n<numNodes; ++n) {
306  const std::set<int>& nodes = nodeToCellTmp[n];
307  nodeCellCounts_.emplace_back(nodes.size());
308  nodeToCellList_.insert(nodeToCellList_.end(), nodes.begin(), nodes.end());
309  }
310 
311  compute_offsets(nodeCellCounts_, &nodeCellOffsets_);
312 
313  } // make_index_maps
314 
316  void compute_offsets(const std::vector<int>& counts,
317  std::vector<int>* offsets) {
318  offsets->resize(counts.size());
319  if (not counts.empty()) {
320  (*offsets)[0] = 0;
321  std::partial_sum(counts.begin(), counts.end()-1, offsets->begin()+1);
322  }
323  }
324 
326  int num_owned_cells() const {
327  return numOwnedCells_;
328  }
329 
331  int num_ghost_cells() const {
332  return (cellNodeCounts_.size() - numOwnedCells_);
333  }
334 
336  int num_owned_nodes() const {
337  return numOwnedNodes_;
338  }
339 
341  int num_ghost_nodes() const {
342  return (nodeCoords_.size()/dim_ - numOwnedNodes_);
343  }
344 
346  int num_owned_faces() const {
347  return numOwnedFaces_;
348  }
349 
351  int num_ghost_faces() const {
352  if (dim_ == 2) {
353  return (faceToNodeList_.size() / 2 - numOwnedFaces_);
354  }
355  else {
356  return (faceNodeCounts_.size() - numOwnedFaces_);
357  }
358  }
359 
361  template <int D>
362  void node_get_coordinates(int const nodeid, Point<D>* pp) const {
363  assert(D == dim_);
364  for (int j=0; j<dim_; j++)
365  (*pp)[j] = nodeCoords_[nodeid*dim_+j];
366  }
367 
369  Wonton::Entity_type cell_get_type(int const cellid) const {
370  return (cellid < numOwnedCells_ ? PARALLEL_OWNED : PARALLEL_GHOST);
371  }
372 
374  Wonton::Entity_type node_get_type(int const nodeid) const {
375  return (nodeid < numOwnedNodes_ ? PARALLEL_OWNED : PARALLEL_GHOST);
376  }
377 
380  Wonton::Element_type cell_get_element_type(int const cellid) const {
381  // FIXME
382  return (dim_ == 2 ? POLYGON : POLYHEDRON);
383  }
384 
386  void cell_get_faces_and_dirs(int const cellid, std::vector<int> *cfaces,
387  std::vector<int> *cfdirs) const {
388  int offset, count;
389  if (dim_ == 2)
390  {
391  offset = cellNodeOffsets_[cellid];
392  count = cellNodeCounts_[cellid];
393  }
394  else
395  {
396  offset = cellFaceOffsets_[cellid];
397  count = cellFaceCounts_[cellid];
398  }
399  cfaces->assign(&cellToFaceList_[offset],
400  &cellToFaceList_[offset+count]);
401  cfdirs->clear();
402  for (int j=0; j<count; ++j)
403  cfdirs->push_back(cellToFaceDirs_[offset + j] ? 1 : -1);
404  }
405 
407  void cell_get_nodes(int const cellid, std::vector<int> *nodes) const {
408  int offset = cellNodeOffsets_[cellid];
409  int count = cellNodeCounts_[cellid];
410  nodes->assign(&cellToNodeList_[offset],
411  &cellToNodeList_[offset+count]);
412  }
413 
415  void face_get_nodes(int const faceid, std::vector<int> *fnodes) const {
416  int offset, count;
417  if (dim_ == 2)
418  {
419  offset = 2 * faceid;
420  count = 2;
421  }
422  else
423  {
424  offset = faceNodeOffsets_[faceid];
425  count = faceNodeCounts_[faceid];
426  }
427  fnodes->assign(&faceToNodeList_[offset],
428  &faceToNodeList_[offset+count]);
429  }
430 
432  void node_get_cells(int const nodeid, Entity_type const ptype,
433  std::vector<int> *cells) const {
434  int offset = nodeCellOffsets_[nodeid];
435  int count = nodeCellCounts_[nodeid];
436  if (ptype == Entity_type::ALL)
437  cells->assign(&nodeToCellList_[offset],
438  &nodeToCellList_[offset+count]);
439  else {
440  cells->clear();
441  cells->reserve(count);
442  for (int i = 0; i < count; i++) {
443  int c = nodeToCellList_[offset+i];
444  if (cell_get_type(c) == ptype)
445  cells->push_back(c);
446  }
447  }
448  }
449 
451  template<int D>
452  void cell_get_coordinates(int const cellid,
453  std::vector<Wonton::Point<D>> *pplist) const {
454 
455  assert(D == dim_);
456  std::vector<int> nodes;
457  cell_get_nodes(cellid, &nodes);
458  int cellNumNodes = nodes.size();
459  pplist->resize(cellNumNodes);
460  for (int i=0; i<cellNumNodes; ++i)
461  node_get_coordinates(nodes[i], &((*pplist)[i]));
462  }
463 
464 
466  std::vector<T>& get_coords() { return nodeCoords_; }
467 
470  std::vector<int>& get_cell_to_node_list() { return cellToNodeList_; }
471 
472  void set_cell_to_node_list(std::vector<int>& cellToNodeList)
473  { cellToNodeList_ = cellToNodeList; }
474 
476  std::vector<int>& get_cell_node_counts() { return cellNodeCounts_; }
477 
478  void set_cell_node_counts(std::vector<int>& cellNodeCounts)
479  { cellNodeCounts_ = cellNodeCounts; }
480 
482  std::vector<int>& get_cell_node_offsets() { return cellNodeOffsets_; }
483 
486  std::vector<int>& get_cell_to_face_list() { return cellToFaceList_; }
487 
488  void set_cell_to_face_list(std::vector<int>& cellToFaceList)
489  { cellToFaceList_ = cellToFaceList; }
490 
492  std::vector<bool>& get_cell_to_face_dirs() { return cellToFaceDirs_; }
493 
494  void set_cell_to_face_dirs(std::vector<bool>& cellToFaceDirs)
495  { cellToFaceDirs_ = cellToFaceDirs; }
496 
498  std::vector<int>& get_cell_face_counts() { return cellFaceCounts_; }
499 
500  void set_cell_face_counts(std::vector<int>& cellFaceCounts)
501  { cellFaceCounts_ = cellFaceCounts; }
502 
504  std::vector<int>& get_cell_face_offsets() { return cellFaceOffsets_; }
505 
508  std::vector<int>& get_face_to_node_list() { return faceToNodeList_; }
509 
510  void set_face_to_node_list(std::vector<int>& faceToNodeList)
511  { faceToNodeList_ = faceToNodeList; }
512 
514  std::vector<int>& get_face_node_counts() { return faceNodeCounts_; }
515 
516  void set_face_node_counts(std::vector<int>& faceNodeCounts)
517  { faceNodeCounts_ = faceNodeCounts; }
518 
520  std::vector<int>& get_face_node_offsets() { return faceNodeOffsets_; }
521 
524  std::vector<int>& get_node_to_cell_list() { return nodeToCellList_; }
525 
527  std::vector<int>& get_node_cell_counts() { return nodeCellCounts_; }
528 
530  std::vector<int>& get_node_cell_offsets() { return nodeCellOffsets_; }
531 
532 
534  std::vector<GID_t>& get_global_cell_ids() { return cellGlobalIds_; }
535 
537  std::vector<GID_t>& get_global_node_ids() { return nodeGlobalIds_; }
538 
540  std::vector<GID_t>& get_global_face_ids() { return faceGlobalIds_; }
541 
542  void set_node_global_ids(std::vector<GID_t>& nodeGlobalIds)
543  { nodeGlobalIds_ = nodeGlobalIds; }
544 
546  void set_num_owned_cells(int numOwnedCells)
547  { numOwnedCells_ = numOwnedCells; }
548 
550  void set_num_owned_faces(int numOwnedFaces)
551  { numOwnedFaces_ = numOwnedFaces; }
552 
554  void set_num_owned_nodes(int numOwnedNodes)
555  { numOwnedNodes_ = numOwnedNodes; }
556 
558  int space_dimension() const { return dim_; }
559 
561  GID_t get_global_id(int ent, Entity_kind onwhat) const {
562  switch (onwhat) {
563  case Entity_kind::NODE: return nodeGlobalIds_[ent];
564  case Entity_kind::FACE: return faceGlobalIds_[ent];
565  case Entity_kind::CELL: return cellGlobalIds_[ent];
566  default: return -1;
567  }
568  }
569 
570 private:
571 
572  int dim_;
573  int numOwnedCells_;
574  int numOwnedFaces_;
575  int numOwnedNodes_;
576 
577  std::vector<T> nodeCoords_;
578  std::vector<int> cellToNodeList_;
579  std::vector<int> cellNodeCounts_;
580  std::vector<int> cellNodeOffsets_;
581  std::vector<int> cellToFaceList_;
582  std::vector<bool> cellToFaceDirs_; // unused in 2D (identical
583  // to cellNodeCounts_)
584  std::vector<int> cellFaceCounts_; // unused in 2D (identical
585  // to cellNodeOffsets_)
586  std::vector<int> cellFaceOffsets_;
587  std::vector<int> faceToNodeList_;
588  std::vector<int> faceNodeCounts_; // unused in 2D (always 2)
589  std::vector<int> faceNodeOffsets_; // unused in 2D (can be computed)
590  std::vector<int> nodeToCellList_;
591  std::vector<int> nodeCellCounts_;
592  std::vector<int> nodeCellOffsets_;
593 
594  std::vector<GID_t> cellGlobalIds_;
595  std::vector<GID_t> faceGlobalIds_;
596  std::vector<GID_t> nodeGlobalIds_;
597 
598 
599  void reset_and_reserve(int numCells, int numFaces, int numNodes){
600 
601  nodeCoords_.clear();
602  nodeCoords_.reserve(numNodes*dim_);
603 
604  cellNodeCounts_.clear();
605  cellNodeCounts_.reserve(numCells);
606 
607  cellToNodeList_.clear();
608  cellToNodeList_.reserve(numCells*(dim_+1));
609 
610  cellGlobalIds_.clear();
611  cellGlobalIds_.reserve(numCells);
612 
613  nodeGlobalIds_.clear();
614  nodeGlobalIds_.reserve(numNodes);
615 
616  faceNodeCounts_.clear();
617  faceToNodeList_.clear();
618  faceGlobalIds_.clear();
619 
620  cellFaceCounts_.clear();
621  cellToFaceList_.clear();
622  cellToFaceDirs_.clear();
623 
624  // reserve (dim_+1) nodes per cell (lower bound)
625  if (dim_ == 3)
626  {
627  // reserve know sizes
628  faceGlobalIds_.reserve(numFaces);
629  faceNodeCounts_.reserve(numFaces);
630  cellFaceCounts_.reserve(numCells);
631 
632  // reserve lower bounds for sizes
633  faceToNodeList_.reserve(numFaces*dim_);
634  cellToFaceList_.reserve(numCells*(dim_+1));
635  cellToFaceDirs_.reserve(numCells*(dim_+1));
636  }
637  }
638 
639 }; // class Flat_Mesh_Wrapper
640 
641 } // end namespace Wonton
642 
643 #endif // FLAT_MESH_WRAPPER_H_
void set_num_owned_nodes(int numOwnedNodes)
set the number of owned nodes
Definition: flat_mesh_wrapper.h:554
Definition: wonton.h:157
Definition: wonton.h:130
Definition: wonton.h:128
std::vector< GID_t > & get_global_cell_ids()
get global cell ids
Definition: flat_mesh_wrapper.h:534
GID_t get_global_id(int ent, Entity_kind onwhat) const
Get global ID of entities.
Definition: flat_mesh_wrapper.h:561
void cell_get_faces_and_dirs(int const cellid, std::vector< int > *cfaces, std::vector< int > *cfdirs) const
Get cell faces and the directions in which they are used.
Definition: flat_mesh_wrapper.h:386
int num_owned_cells() const
Number of owned cells in the mesh.
Definition: flat_mesh_wrapper.h:326
void set_node_global_ids(std::vector< GID_t > &nodeGlobalIds)
Definition: flat_mesh_wrapper.h:542
std::vector< int > & get_cell_node_counts()
get/set cell node counts
Definition: flat_mesh_wrapper.h:476
void cell_get_nodes(int const cellid, std::vector< int > *nodes) const
Get list of nodes for a cell.
Definition: flat_mesh_wrapper.h:407
void set_cell_node_counts(std::vector< int > &cellNodeCounts)
Definition: flat_mesh_wrapper.h:478
std::vector< int > & get_node_cell_counts()
get node cell counts
Definition: flat_mesh_wrapper.h:527
void finish_init()
Finish mesh initialization, after initialize or MPI distribute.
Definition: flat_mesh_wrapper.h:162
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31
Definition: wonton.h:162
std::vector< T > vector
Definition: wonton.h:285
Definition: wonton.h:87
Flat_Mesh_Wrapper & operator=(Flat_Mesh_Wrapper const &)=delete
Assignment operator (disabled) - don&#39;t know how to implement (RVG)
void make_index_maps()
Definition: flat_mesh_wrapper.h:182
Entity_type
The parallel type of a given entity.
Definition: wonton.h:124
void set_face_to_node_list(std::vector< int > &faceToNodeList)
Definition: flat_mesh_wrapper.h:510
std::vector< bool > & get_cell_to_face_dirs()
get/set cell to face dirs
Definition: flat_mesh_wrapper.h:492
Wonton::Element_type cell_get_element_type(int const cellid) const
Definition: flat_mesh_wrapper.h:380
Definition: wonton.h:85
~Flat_Mesh_Wrapper()=default
Empty destructor.
int num_ghost_nodes() const
Number of ghost nodes in the mesh.
Definition: flat_mesh_wrapper.h:341
std::vector< int > & get_node_cell_offsets()
get node cell offsets
Definition: flat_mesh_wrapper.h:530
void set_cell_to_face_dirs(std::vector< bool > &cellToFaceDirs)
Definition: flat_mesh_wrapper.h:494
std::vector< int > & get_face_to_node_list()
Definition: flat_mesh_wrapper.h:508
int num_ghost_faces() const
Number of ghost faces in the mesh.
Definition: flat_mesh_wrapper.h:351
int num_owned_faces() const
Number of owned faces in the mesh.
Definition: flat_mesh_wrapper.h:346
void set_cell_to_node_list(std::vector< int > &cellToNodeList)
Definition: flat_mesh_wrapper.h:472
std::vector< int > & get_cell_to_node_list()
Definition: flat_mesh_wrapper.h:470
void node_get_cells(int const nodeid, Entity_type const ptype, std::vector< int > *cells) const
Get list of cells for a node.
Definition: flat_mesh_wrapper.h:432
Definition: wonton.h:88
void set_num_owned_cells(int numOwnedCells)
set the number of owned cells
Definition: flat_mesh_wrapper.h:546
std::vector< int > & get_cell_node_offsets()
get cell node offsets
Definition: flat_mesh_wrapper.h:482
int num_owned_nodes() const
Number of owned nodes in the mesh.
Definition: flat_mesh_wrapper.h:336
Represents a point in an N-dimensional space.
Definition: Point.h:50
void node_get_coordinates(int const nodeid, Point< D > *pp) const
Coords of a node.
Definition: flat_mesh_wrapper.h:362
Wonton::Entity_type node_get_type(int const nodeid) const
Get the type of the node - PARALLEL_OWNED or PARALLEL_GHOST.
Definition: flat_mesh_wrapper.h:374
std::vector< int > & get_cell_face_offsets()
get cell face offsets
Definition: flat_mesh_wrapper.h:504
Wonton::Entity_type cell_get_type(int const cellid) const
Get the type of the cell - PARALLEL_OWNED or PARALLEL_GHOST.
Definition: flat_mesh_wrapper.h:369
Flat_Mesh_Wrapper()=default
Constructor.
std::vector< int > & get_node_to_cell_list()
Definition: flat_mesh_wrapper.h:524
Flat_Mesh_Wrapper implements mesh methods.
Definition: flat_mesh_wrapper.h:36
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
void compute_offsets(const std::vector< int > &counts, std::vector< int > *offsets)
Compute offsets from counts.
Definition: flat_mesh_wrapper.h:316
void build_aux_entities()
Definition: AuxMeshTopology.h:1331
int64_t GID_t
Definition: wonton.h:76
void cell_get_coordinates(int const cellid, std::vector< Wonton::Point< D >> *pplist) const
Coords of nodes of a cell.
Definition: flat_mesh_wrapper.h:452
int num_ghost_cells() const
Number of ghost cells in the mesh.
Definition: flat_mesh_wrapper.h:331
int space_dimension() const
get spatial dimension
Definition: flat_mesh_wrapper.h:558
std::vector< int > & get_face_node_offsets()
get face node offsets
Definition: flat_mesh_wrapper.h:520
void initialize(Mesh_Wrapper &input)
Definition: flat_mesh_wrapper.h:49
Element_type
Element (cell topology) type.
Definition: wonton.h:153
void set_num_owned_faces(int numOwnedFaces)
set the number of owned cells
Definition: flat_mesh_wrapper.h:550
std::vector< GID_t > & get_global_face_ids()
get global face ids
Definition: flat_mesh_wrapper.h:540
std::vector< T > & get_coords()
get coordinates
Definition: flat_mesh_wrapper.h:466
void set_cell_face_counts(std::vector< int > &cellFaceCounts)
Definition: flat_mesh_wrapper.h:500
void set_face_node_counts(std::vector< int > &faceNodeCounts)
Definition: flat_mesh_wrapper.h:516
void face_get_nodes(int const faceid, std::vector< int > *fnodes) const
Get nodes of a face.
Definition: flat_mesh_wrapper.h:415
Definition: wonton.h:127
std::vector< GID_t > & get_global_node_ids()
get global node ids
Definition: flat_mesh_wrapper.h:537
std::vector< int > & get_cell_face_counts()
get/set cell face counts
Definition: flat_mesh_wrapper.h:498
std::vector< int > & get_face_node_counts()
get/set face node counts
Definition: flat_mesh_wrapper.h:514
void set_cell_to_face_list(std::vector< int > &cellToFaceList)
Definition: flat_mesh_wrapper.h:488
std::vector< int > & get_cell_to_face_list()
Definition: flat_mesh_wrapper.h:486