My Project
CpGrid.hpp
1 //===========================================================================
2 //
3 // File: CpGrid.hpp
4 //
5 // Created: Fri May 29 20:26:36 2009
6 //
7 // Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8 // B�rd Skaflestad <bard.skaflestad@sintef.no>
9 //
10 // $Date$
11 //
12 // $Revision$
13 //
14 //===========================================================================
15 
16 /*
17  Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18  Copyright 2009, 2010, 2014 Statoil ASA.
19  Copyright 2014, 2015 Dr. Blatt - HPC-Simulartion-Software & Services
20  Copyright 2015 NTNU
21 
22  This file is part of The Open Porous Media project (OPM).
23 
24  OPM is free software: you can redistribute it and/or modify
25  it under the terms of the GNU General Public License as published by
26  the Free Software Foundation, either version 3 of the License, or
27  (at your option) any later version.
28 
29  OPM is distributed in the hope that it will be useful,
30  but WITHOUT ANY WARRANTY; without even the implied warranty of
31  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32  GNU General Public License for more details.
33 
34  You should have received a copy of the GNU General Public License
35  along with OPM. If not, see <http://www.gnu.org/licenses/>.
36 */
37 
38 #ifndef OPM_CPGRID_HEADER
39 #define OPM_CPGRID_HEADER
40 
41 #include <string>
42 #include <map>
43 #include <array>
44 #include <unordered_set>
45 #include <opm/grid/utility/ErrorMacros.hpp>
46 
47 // Warning suppression for Dune includes.
48 #include <opm/grid/utility/platform_dependent/disable_warnings.h>
49 
50 #include <dune/common/version.hh>
51 
52 #if HAVE_MPI
53 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
54 #include <dune/common/parallel/variablesizecommunicator.hh>
55 #else
56 #include <opm/grid/utility/VariableSizeCommunicator.hpp>
57 #endif
58 #endif
59 
60 #include <dune/grid/common/capabilities.hh>
61 #include <dune/grid/common/grid.hh>
62 #include <dune/grid/common/gridenums.hh>
63 
64 #include <opm/grid/utility/platform_dependent/reenable_warnings.h>
65 
66 #include "cpgrid/Intersection.hpp"
67 #include "cpgrid/Entity.hpp"
68 #include "cpgrid/Geometry.hpp"
69 #include "cpgrid/Iterators.hpp"
70 #include "cpgrid/Indexsets.hpp"
71 #include "cpgrid/DefaultGeometryPolicy.hpp"
72 #include "common/GridEnums.hpp"
73 #include "common/Volumes.hpp"
75 
76 #include <opm/grid/utility/OpmParserIncludes.hpp>
77 
78 #include <iostream>
79 #if ! HAVE_MPI
80 #include <list>
81 #endif
82 
83 namespace Dune
84 {
85 
86  class CpGrid;
87 
88  namespace cpgrid
89  {
90  class CpGridData;
91  }
92 
94  //
95  // CpGridTraits
96  //
98 
99  struct CpGridTraits
100  {
102  typedef CpGrid Grid;
103 
112 
115 
118  template <int cd>
119  struct Codim
120  {
123  typedef cpgrid::Geometry<3-cd, 3> Geometry;
124  //typedef Dune::Geometry<3-cd, 3, CpGrid, cpgrid::Geometry> Geometry;
126  typedef cpgrid::Geometry<3-cd, 3> LocalGeometry;
127  //typedef Dune::Geometry<3-cd, 3, CpGrid, cpgrid::Geometry> LocalGeometry;
130 
133 
136 
139 
142 
145  template <PartitionIteratorType pitype>
146  struct Partition
147  {
152  };
153  };
154 
157  template <PartitionIteratorType pitype>
158  struct Partition
159  {
161  typedef Dune::GridView<DefaultLevelGridViewTraits<CpGrid> > LevelGridView;
163  typedef Dune::GridView<DefaultLeafGridViewTraits<CpGrid> > LeafGridView;
164 
165  };
166 
168  typedef Dune::GridView<DefaultLevelGridViewTraits<CpGrid> > LevelGridView;
170  typedef Dune::GridView<DefaultLeafGridViewTraits<CpGrid> > LeafGridView;
171 
180 
182 
183  typedef Dune::MPIHelper::MPICommunicator MPICommunicator;
184  typedef Dune::CollectiveCommunication<MPICommunicator> CollectiveCommunication;
185  };
186 
188  //
189  // CpGridFamily
190  //
192 
194  {
195  typedef CpGridTraits Traits;
196  };
197 
199  //
200  // CpGrid
201  //
203 
205  class CpGrid
206  : public GridDefaultImplementation<3, 3, double, CpGridFamily >
207  {
208  friend class cpgrid::CpGridData;
209  template<int dim>
210  friend cpgrid::Entity<dim> createEntity(const CpGrid&,int,bool);
211 
212  public:
213 
214  // --- Typedefs ---
215 
216 
219 
220 
221  // --- Methods ---
222 
223 
225  CpGrid();
226 
227  CpGrid(MPIHelper::MPICommunicator comm);
228 
230 
231  void readSintefLegacyFormat(const std::string& grid_prefix);
235 
236 
240  void writeSintefLegacyFormat(const std::string& grid_prefix) const;
241 
242 
243 #if HAVE_ECL_INPUT
262  std::vector<std::size_t> processEclipseFormat(const Opm::EclipseGrid* ecl_grid,
263  Opm::EclipseState* ecl_state,
264  bool periodic_extension, bool turn_normals, bool clip_z,
265  bool pinchActive);
266 
286  std::vector<std::size_t> processEclipseFormat(const Opm::EclipseGrid* ecl_grid,
287  Opm::EclipseState* ecl_state,
288  bool periodic_extension, bool turn_normals = false, bool clip_z = false);
289 
290 #endif
291 
295  void processEclipseFormat(const grdecl& input_data, bool remove_ij_boundary, bool turn_normals = false);
296 
298 
304 
305  void createCartesian(const std::array<int, 3>& dims,
309  const std::array<double, 3>& cellsize);
310 
314  const std::array<int, 3>& logicalCartesianSize() const
315  {
316  return current_view_data_->logical_cartesian_size_;
317  }
318 
326  const std::vector<int>& globalCell() const
327  {
328  return current_view_data_->global_cell_;
329  }
330 
338  void getIJK(const int c, std::array<int,3>& ijk) const
339  {
340  current_view_data_->getIJK(c, ijk);
341  }
343 
347  bool uniqueBoundaryIds() const
348  {
349  return current_view_data_->uniqueBoundaryIds();
350  }
351 
354  void setUniqueBoundaryIds(bool uids)
355  {
356  current_view_data_->setUniqueBoundaryIds(uids);
357  }
358 
359  // --- Dune interface below ---
360 
362  // \@{
367  std::string name() const
368  {
369  return "CpGrid";
370  }
371 
372 
375  int maxLevel() const
376  {
377  return 0;
378  }
379 
380 
382  template<int codim>
383  typename Traits::template Codim<codim>::LevelIterator lbegin (int level) const
384  {
385  if (level<0 || level>maxLevel())
386  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
387  return cpgrid::Iterator<codim, All_Partition>(*current_view_data_, 0, true);
388  }
389 
390 
392  template<int codim>
393  typename Traits::template Codim<codim>::LevelIterator lend (int level) const
394  {
395  if (level<0 || level>maxLevel())
396  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
397  return cpgrid::Iterator<codim,All_Partition>(*current_view_data_, size(codim), true );
398 
399  }
400 
401 
403  template<int codim, PartitionIteratorType PiType>
404  typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lbegin (int level) const
405  {
406  if (level<0 || level>maxLevel())
407  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
408  return cpgrid::Iterator<codim,PiType>(*current_view_data_, 0, true );
409  }
410 
411 
413  template<int codim, PartitionIteratorType PiType>
414  typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lend (int level) const
415  {
416  if (level<0 || level>maxLevel())
417  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
418  return cpgrid::Iterator<codim,PiType>(*current_view_data_, size(codim), true);
419  }
420 
421 
423  template<int codim>
424  typename Traits::template Codim<codim>::LeafIterator leafbegin() const
425  {
426  return cpgrid::Iterator<codim, All_Partition>(*current_view_data_, 0, true);
427  }
428 
429 
431  template<int codim>
432  typename Traits::template Codim<codim>::LeafIterator leafend() const
433  {
434  return cpgrid::Iterator<codim, All_Partition>(*current_view_data_, size(codim), true);
435  }
436 
437 
439  template<int codim, PartitionIteratorType PiType>
440  typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafbegin() const
441  {
442  return cpgrid::Iterator<codim, PiType>(*current_view_data_, 0, true);
443  }
444 
445 
447  template<int codim, PartitionIteratorType PiType>
448  typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafend() const
449  {
450  return cpgrid::Iterator<codim, PiType>(*current_view_data_, size(codim), true);
451  }
452 
453 
455  int size (int level, int codim) const
456  {
457  if (level<0 || level>maxLevel())
458  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
459  return size(codim);
460  }
461 
462 
464  int size (int codim) const
465  {
466  return current_view_data_->size(codim);
467  }
468 
469 
471  int size (int level, GeometryType type) const
472  {
473  if (level<0 || level>maxLevel())
474  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
475  return size(type);
476  }
477 
478 
480  int size (GeometryType type) const
481  {
482  return current_view_data_->size(type);
483  }
484 
485 
487  const Traits::GlobalIdSet& globalIdSet() const
488  {
489  return global_id_set_;
490  }
491 
492 
494  const Traits::LocalIdSet& localIdSet() const
495  {
496  return global_id_set_;
497  }
498 
499 
501  const Traits::LevelIndexSet& levelIndexSet(int level) const
502  {
503  if (level<0 || level>maxLevel())
504  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
505  return *current_view_data_->index_set_;
506  }
507 
508 
510  const Traits::LeafIndexSet& leafIndexSet() const
511  {
512  return *current_view_data_->index_set_;
513  }
514 
515 
517  void globalRefine (int)
518  {
519  std::cout << "Warning: Global refinement not implemented, yet." << std::endl;
520  }
521 
522  const std::vector< Dune :: GeometryType >& geomTypes( const int codim ) const
523  {
524  return leafIndexSet().geomTypes( codim );
525  }
526 
528  template <int codim>
530  {
531  return cpgrid::Entity<codim>( *seed );
532  }
533 
534  /* No refinement implemented. GridDefaultImplementation's methods will be used.
535 
545 
546  bool mark(int refCount, const typename Traits::template Codim<0>::EntityPointer & e)
547  {
548  return hostgrid_->mark(refCount, getHostEntity<0>(*e));
549  }
550 
554 
555  int getMark(const typename Traits::template Codim<0>::EntityPointer & e) const
556  {
557  return hostgrid_->getMark(getHostEntity<0>(*e));
558  }
559 
561  bool preAdapt() {
562  return hostgrid_->preAdapt();
563  }
564 
565 
567  bool adapt()
568  {
569  return hostgrid_->adapt();
570  }
571 
573  void postAdapt() {
574  return hostgrid_->postAdapt();
575  }
576 
577  end of refinement section */
578 
580  unsigned int overlapSize(int) const {
581  return 1;
582  }
583 
584 
586  unsigned int ghostSize(int) const {
587  return 0;
588  }
589 
590 
592  unsigned int overlapSize(int, int) const {
593  return 1;
594  }
595 
596 
598  unsigned int ghostSize(int, int) const {
599  return 0;
600  }
601 
603  unsigned int numBoundarySegments() const
604  {
605  if( uniqueBoundaryIds() )
606  {
607  return current_view_data_->unique_boundary_ids_.size();
608  }
609  else
610  {
611  unsigned int numBndSegs = 0;
612  const int num_faces = numFaces();
613  for (int i = 0; i < num_faces; ++i) {
614  cpgrid::EntityRep<1> face(i, true);
615  if (current_view_data_->face_to_cell_[face].size() == 1) {
616  ++numBndSegs;
617  }
618  }
619  return numBndSegs;
620  }
621  }
622 
623 
624  // loadbalance is not part of the grid interface therefore we skip it.
625 
631  bool loadBalance(int overlapLayers=1, bool useZoltan=true)
632  {
633  using std::get;
634  return get<0>(scatterGrid(defaultTransEdgeWgt, false, nullptr, false, nullptr, true, overlapLayers, useZoltan ));
635  }
636 
637  // loadbalance is not part of the grid interface therefore we skip it.
638 
658  std::pair<bool, std::vector<std::pair<std::string,bool> > >
659  loadBalance(const std::vector<cpgrid::OpmWellType> * wells,
660  const double* transmissibilities = nullptr,
661  int overlapLayers=1, bool useZoltan=true)
662  {
663  return scatterGrid(defaultTransEdgeWgt, false, wells, false, transmissibilities, false, overlapLayers, useZoltan);
664  }
665 
666  // loadbalance is not part of the grid interface therefore we skip it.
667 
691  std::pair<bool, std::vector<std::pair<std::string,bool> > >
692  loadBalance(EdgeWeightMethod method, const std::vector<cpgrid::OpmWellType> * wells,
693  const double* transmissibilities = nullptr, bool ownersFirst=false,
694  bool addCornerCells=false, int overlapLayers=1,
695  bool useZoltan = true)
696  {
697  return scatterGrid(method, ownersFirst, wells, false, transmissibilities, addCornerCells, overlapLayers, useZoltan);
698  }
699 
719  template<class DataHandle>
720  std::pair<bool, std::vector<std::pair<std::string,bool> > >
721  loadBalance(DataHandle& data,
722  const std::vector<cpgrid::OpmWellType> * wells,
723  const double* transmissibilities = nullptr,
724  int overlapLayers=1, bool useZoltan = true)
725  {
726  auto ret = loadBalance(wells, transmissibilities, overlapLayers, useZoltan);
727  using std::get;
728  if (get<0>(ret))
729  {
730  scatterData(data);
731  }
732  return ret;
733  }
734 
763  template<class DataHandle>
764  std::pair<bool, std::vector<std::pair<std::string,bool> > >
765  loadBalance(DataHandle& data, EdgeWeightMethod method,
766  const std::vector<cpgrid::OpmWellType> * wells,
767  bool serialPartitioning,
768  const double* transmissibilities = nullptr, bool ownersFirst=false,
769  bool addCornerCells=false, int overlapLayers=1, bool useZoltan = true,
770  double zoltanImbalanceTol = 1.1,
771  bool allowDistributedWells = false)
772  {
773  auto ret = scatterGrid(method, ownersFirst, wells, serialPartitioning, transmissibilities,
774  addCornerCells, overlapLayers, useZoltan, zoltanImbalanceTol, allowDistributedWells);
775  using std::get;
776  if (get<0>(ret))
777  {
778  scatterData(data);
779  }
780  return ret;
781  }
782 
799  template<class DataHandle>
800  std::pair<bool, std::vector<std::pair<std::string,bool> > >
801  loadBalance(DataHandle& data, const std::vector<int>& parts,
802  const std::vector<cpgrid::OpmWellType> * wells,
803  bool ownersFirst=false,
804  bool addCornerCells=false, int overlapLayers=1)
805  {
806  using std::get;
807  auto ret = scatterGrid(defaultTransEdgeWgt, ownersFirst, wells,
808  /* serialPartitioning = */ false,
809  /* transmissibilities = */ {},
810  addCornerCells, overlapLayers, /* useZoltan =*/ false,
811  /* zoltanImbalanceTol (ignored) = */ 0.0,
812  /* allowDistributedWells = */ true, parts);
813  using std::get;
814  if (get<0>(ret))
815  {
816  scatterData(data);
817  }
818  return ret;
819  }
828  template<class DataHandle>
829  bool loadBalance(DataHandle& data,
830 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
831  decltype(data.fixedSize(0,0)) overlapLayers=1, bool useZoltan = true)
832 #else
833  decltype(data.fixedsize(0,0)) overlapLayers=1, bool useZoltan = true)
834 #endif
835  {
836  // decltype usage needed to tell the compiler not to use this function if first
837  // argument is std::vector but rather loadbalance by parts
838  bool ret = loadBalance(overlapLayers, useZoltan);
839  if (ret)
840  {
841  scatterData(data);
842  }
843  return ret;
844  }
845 
857  bool loadBalance(const std::vector<int>& parts, bool ownersFirst=false,
858  bool addCornerCells=false, int overlapLayers=1)
859  {
860  using std::get;
861  return get<0>(scatterGrid(defaultTransEdgeWgt, ownersFirst, /* wells = */ {},
862  /* serialPartitioning = */ false,
863  /* trabsmissibilities = */ {},
864  addCornerCells, overlapLayers, /* useZoltan =*/ false,
865  /* zoltanImbalanceTol (ignored) = */ 0.0,
866  /* allowDistributedWells = */ true, parts));
867  }
868 
881  template<class DataHandle>
882  bool loadBalance(DataHandle& data, const std::vector<int>& parts, bool ownersFirst=false,
883  bool addCornerCells=false, int overlapLayers=1)
884  {
885  bool ret = loadBalance(parts, ownersFirst, addCornerCells, overlapLayers);
886  if (ret)
887  {
888  scatterData(data);
889  }
890  return ret;
891  }
892 
900  template<class DataHandle>
901  void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir, int /*level*/) const
902  {
903  communicate(data, iftype, dir);
904  }
905 
913  template<class DataHandle>
914  void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir) const
915  {
916  current_view_data_->communicate(data, iftype, dir);
917  }
918 
920  const CollectiveCommunication& comm () const
921  {
922  return current_view_data_->ccobj_;
923  }
925 
926  // ------------ End of Dune interface, start of simplified interface --------------
927 
933 
934  // enum { dimension = 3 }; // already defined
935 
936  typedef Dune::FieldVector<double, 3> Vector;
937 
938 
939  const std::vector<double>& zcornData() const {
940  return data_->zcornData();
941  }
942 
943 
944  // Topology
946  int numCells() const
947  {
948  return current_view_data_->cell_to_face_.size();
949  }
951  int numFaces() const
952  {
953  return current_view_data_->face_to_cell_.size();
954  }
956  int numVertices() const
957  {
958  return current_view_data_->geomVector<3>().size();
959  }
966  int numCellFaces(int cell) const
967  {
968  return current_view_data_->cell_to_face_[cpgrid::EntityRep<0>(cell, true)].size();
969  }
974  int cellFace(int cell, int local_index) const
975  {
976  return current_view_data_->cell_to_face_[cpgrid::EntityRep<0>(cell, true)][local_index].index();
977  }
978 
982  {
983  return current_view_data_->cell_to_face_[cpgrid::EntityRep<0>(cell, true)];
984  }
995  int faceCell(int face, int local_index) const
996  {
997  // In the parallel case we store non-existent cells for faces along
998  // the front region. Theses marked with index std::numeric_limits<int>::max(),
999  // orientation might be arbitrary, though.
1001  = current_view_data_->face_to_cell_[cpgrid::EntityRep<1>(face, true)];
1002  bool a = (local_index == 0);
1003  bool b = r[0].orientation();
1004  bool use_first = a ? b : !b;
1005  // The number of valid cells.
1006  int r_size = r.size();
1007  // In the case of only one valid cell, this is the index of it.
1008  int index = 0;
1009  if(r[0].index()==std::numeric_limits<int>::max()){
1010  assert(r_size==2);
1011  --r_size;
1012  index=1;
1013  }
1014  if(r.size()>1 && r[1].index()==std::numeric_limits<int>::max())
1015  {
1016  assert(r_size==2);
1017  --r_size;
1018  }
1019  if (r_size == 2) {
1020  return use_first ? r[0].index() : r[1].index();
1021  } else {
1022  return use_first ? r[index].index() : -1;
1023  }
1024  }
1031  int numCellFaces() const
1032  {
1033  return current_view_data_->cell_to_face_.dataSize();
1034  }
1035  int numFaceVertices(int face) const
1036  {
1037  return current_view_data_->face_to_point_[face].size();
1038  }
1043  int faceVertex(int face, int local_index) const
1044  {
1045  return current_view_data_->face_to_point_[face][local_index];
1046  }
1049  double cellCenterDepth(int cell_index) const
1050  {
1051  // Here cell center depth is computed as a raw average of cell corner depths.
1052  // This generally gives slightly different results than using the cell centroid.
1053  double zz = 0.0;
1054  const int nv = current_view_data_->cell_to_point_[cell_index].size();
1055  const int nd = 3;
1056  for (int i=0; i<nv; ++i) {
1057  zz += vertexPosition(current_view_data_->cell_to_point_[cell_index][i])[nd-1];
1058  }
1059  return zz/nv;
1060  }
1061 
1062  const Vector faceCenterEcl(int cell_index, int face) const
1063  {
1064  // This method is an alternative to the method faceCentroid(...).
1065  // The face center is computed as a raw average of cell corners.
1066  // For faulted cells this gives different results then average of face nodes
1067  // that seems to agree more with eclipse.
1068  // This assumes the cell nodes are ordered
1069  // 6---7
1070  // | T |
1071  // 4---5
1072  // 2---3
1073  // | B |
1074  // 0---1
1075 
1076  // this follows the DUNE reference cube
1077  static const int faceVxMap[ 6 ][ 4 ] = { {0, 2, 4, 6}, // face 0
1078  {1, 3, 5, 7}, // face 1
1079  {0, 1, 4, 5}, // face 2
1080  {2, 3, 6, 7}, // face 3
1081  {0, 1, 2, 3}, // face 4
1082  {4, 5, 6, 7} // face 5
1083  };
1084 
1085 
1086  assert (current_view_data_->cell_to_point_[cell_index].size() == 8);
1087  Vector center(0.0);
1088  for( int i=0; i<4; ++i )
1089  {
1090  center += vertexPosition(current_view_data_->cell_to_point_[cell_index][ faceVxMap[ face ][ i ] ]);
1091  }
1092 
1093  for (int i=0; i<3; ++i) {
1094  center[i] /= 4;
1095  }
1096  return center;
1097 
1098  }
1099 
1100  const Vector faceAreaNormalEcl(int face) const
1101  {
1102  // same implementation as ResInsight
1103  const int nd = Vector::dimension;
1104  const int nv = numFaceVertices(face);
1105  switch (nv)
1106  {
1107  case 0:
1108  case 1:
1109  case 2:
1110  {
1111  return Vector(0.0);
1112  }
1113  break;
1114  case 3:
1115  {
1116  Vector a = vertexPosition(current_view_data_->face_to_point_[face][0]) - vertexPosition(current_view_data_->face_to_point_[face][2]);
1117  Vector b = vertexPosition(current_view_data_->face_to_point_[face][1]) - vertexPosition(current_view_data_->face_to_point_[face][2]);
1118  Vector areaNormal = cross(a,b);
1119  for (int i=0; i<nd; ++i) {
1120  areaNormal[i] /= 2;
1121  }
1122  return areaNormal;
1123  }
1124  break;
1125  case 4:
1126  {
1127  Vector a = vertexPosition(current_view_data_->face_to_point_[face][0]) - vertexPosition(current_view_data_->face_to_point_[face][2]);
1128  Vector b = vertexPosition(current_view_data_->face_to_point_[face][1]) - vertexPosition(current_view_data_->face_to_point_[face][3]);
1129  Vector areaNormal = cross(a,b);
1130  areaNormal *= 0.5;
1131  return areaNormal;
1132  }
1133  break;
1134  default:
1135  {
1136  int h = (nv - 1)/2;
1137  int k = (nv % 2) ? 0 : nv - 1;
1138 
1139  Vector areaNormal(0.0);
1140  // First quads
1141  for (int i = 1; i < h; ++i)
1142  {
1143  Vector a = vertexPosition(current_view_data_->face_to_point_[face][2*i]) - vertexPosition(current_view_data_->face_to_point_[face][0]);
1144  Vector b = vertexPosition(current_view_data_->face_to_point_[face][2*i+1]) - vertexPosition(current_view_data_->face_to_point_[face][2*i-1]);
1145  areaNormal += cross(a,b);
1146  }
1147 
1148  // Last triangle or quad
1149  Vector a = vertexPosition(current_view_data_->face_to_point_[face][2*h]) - vertexPosition(current_view_data_->face_to_point_[face][0]);
1150  Vector b = vertexPosition(current_view_data_->face_to_point_[face][k]) - vertexPosition(current_view_data_->face_to_point_[face][2*h-1]);
1151  areaNormal += cross(a,b);
1152 
1153  areaNormal *= 0.5;
1154 
1155  return areaNormal;
1156  }
1157 
1158  }
1159  }
1160 
1161  // Geometry
1165  const Vector& vertexPosition(int vertex) const
1166  {
1167  return current_view_data_->geomVector<3>()[cpgrid::EntityRep<3>(vertex, true)].center();
1168  }
1171  double faceArea(int face) const
1172  {
1173  return current_view_data_->geomVector<1>()[cpgrid::EntityRep<1>(face, true)].volume();
1174  }
1177  const Vector& faceCentroid(int face) const
1178  {
1179  return current_view_data_->geomVector<1>()[cpgrid::EntityRep<1>(face, true)].center();
1180  }
1184  const Vector& faceNormal(int face) const
1185  {
1186  return current_view_data_->face_normals_.get(face);
1187  }
1190  double cellVolume(int cell) const
1191  {
1192  return current_view_data_->geomVector<0>()[cpgrid::EntityRep<0>(cell, true)].volume();
1193  }
1196  const Vector& cellCentroid(int cell) const
1197  {
1198  return current_view_data_->geomVector<0>()[cpgrid::EntityRep<0>(cell, true)].center();
1199  }
1200 
1203  template<int codim>
1205  : public RandomAccessIteratorFacade<CentroidIterator<codim>,
1206  FieldVector<double, 3>,
1207  const FieldVector<double, 3>&, int>
1208  {
1209  public:
1211  typedef typename std::vector<cpgrid::Geometry<3-codim, 3> >::const_iterator
1216  : iter_(iter)
1217  {}
1218 
1219  const FieldVector<double, 3>& dereference() const
1220  {
1221  return iter_->center();
1222  }
1223  void increment()
1224  {
1225  ++iter_;
1226  }
1227  const FieldVector<double, 3>& elementAt(int n)
1228  {
1229  return iter_[n]->center();
1230  }
1231  void advance(int n)
1232  {
1233  iter_+=n;
1234  }
1235  void decrement()
1236  {
1237  --iter_;
1238  }
1239  int distanceTo(const CentroidIterator& o)
1240  {
1241  return o-iter_;
1242  }
1243  bool equals(const CentroidIterator& o) const
1244  {
1245  return o==iter_;
1246  }
1247  private:
1249  GeometryIterator iter_;
1250  };
1251 
1254  {
1255  return CentroidIterator<0>(current_view_data_->geomVector<0>().begin());
1256  }
1257 
1260  {
1261  return CentroidIterator<1>(current_view_data_->geomVector<1>().begin());
1262  }
1263 
1264  // Extra
1265  int boundaryId(int face) const
1266  {
1267  // Note that this relies on the following implementation detail:
1268  // The grid is always construct such that the faces where
1269  // orientation() returns true are oriented along the positive IJK
1270  // direction. Oriented means that the first cell attached to face
1271  // has the lower index.
1272  int ret = 0;
1273  cpgrid::EntityRep<1> f(face, true);
1274  if (current_view_data_->face_to_cell_[f].size() == 1) {
1275  if (current_view_data_->uniqueBoundaryIds()) {
1276  // Use the unique boundary ids.
1277  ret = current_view_data_->unique_boundary_ids_[f];
1278  } else {
1279  // Use the face tag based ids, i.e. 1-6 for i-, i+, j-, j+, k-, k+.
1280  const bool normal_is_in =
1281  !(current_view_data_->face_to_cell_[f][0].orientation());
1282  enum face_tag tag = current_view_data_->face_tag_[f];
1283  switch (tag) {
1284  case I_FACE:
1285  // LEFT : RIGHT
1286  ret = normal_is_in ? 1 : 2; // min(I) : max(I)
1287  break;
1288  case J_FACE:
1289  // BACK : FRONT
1290  ret = normal_is_in ? 3 : 4; // min(J) : max(J)
1291  break;
1292  case K_FACE:
1293  // Note: TOP at min(K) as 'z' measures *depth*.
1294  // TOP : BOTTOM
1295  ret = normal_is_in ? 5 : 6; // min(K) : max(K)
1296  break;
1297  case NNC_FACE:
1298  // This should not be possible, as NNC "faces" always
1299  // have two cell neighbours.
1300  OPM_THROW(std::logic_error, "NNC face at boundary. This should never happen!");
1301  }
1302  }
1303  }
1304  return ret;
1305  }
1306 
1313  template<class Cell2FacesRowIterator>
1314  int
1315  faceTag(const Cell2FacesRowIterator& cell_face) const
1316  {
1317  // Note that this relies on the following implementation detail:
1318  // The grid is always constructed such that the interior faces constructed
1319  // with orientation set to true are
1320  // oriented along the positive IJK direction. Oriented means that
1321  // the first cell attached to face has the lower index.
1322  // For faces along the boundary (only one cell, always attached at index 0)
1323  // the orientation has to be determined by the orientation of the cell.
1324  // If it is true then in UnstructuredGrid it would be stored at index 0,
1325  // otherwise at index 1.
1326  const int cell = cell_face.getCellIndex();
1327  const int face = *cell_face;
1328  assert (0 <= cell); assert (cell < numCells());
1329  assert (0 <= face); assert (face < numFaces());
1330 
1332 
1333  const cpgrid::EntityRep<1> f(face, true);
1334  const F2C& f2c = current_view_data_->face_to_cell_[f];
1335  const face_tag tag = current_view_data_->face_tag_[f];
1336 
1337  assert ((f2c.size() == 1) || (f2c.size() == 2));
1338 
1339  int inside_cell = 0;
1340 
1341  if ( f2c.size() == 2 ) // Two cells => interior
1342  {
1343  if ( f2c[1].index() == cell )
1344  {
1345  inside_cell = 1;
1346  }
1347  }
1348  const bool normal_is_in = ! f2c[inside_cell].orientation();
1349 
1350  switch (tag) {
1351  case I_FACE:
1352  // LEFT : RIGHT
1353  return normal_is_in ? 0 : 1; // min(I) : max(I)
1354  case J_FACE:
1355  // BACK : FRONT
1356  return normal_is_in ? 2 : 3; // min(J) : max(J)
1357  case K_FACE:
1358  // Note: TOP at min(K) as 'z' measures *depth*.
1359  // TOP : BOTTOM
1360  return normal_is_in ? 4 : 5; // min(K) : max(K)
1361  case NNC_FACE:
1362  // For nnc faces we return the otherwise unused value -1.
1363  return -1;
1364  default:
1365  OPM_THROW(std::logic_error, "Unhandled face tag. This should never happen!");
1366  }
1367  }
1368 
1370 
1371  // ------------ End of simplified interface --------------
1372 
1373  //------------- methods not in the DUNE grid interface.
1374 
1379 
1380  template<class DataHandle>
1390  void scatterData(DataHandle& handle) const
1391  {
1392 #if HAVE_MPI
1393  if(!distributed_data_)
1394  OPM_THROW(std::runtime_error, "Moving Data only allowed with a load balanced grid!");
1395  distributed_data_->scatterData(handle, data_.get(), distributed_data_.get(), cellScatterGatherInterface(),
1397 #else
1398  // Suppress warnings for unused argument.
1399  (void) handle;
1400 #endif
1401  }
1402 
1409  template<class DataHandle>
1410  void gatherData(DataHandle& handle) const
1411  {
1412 #if HAVE_MPI
1413  if(!distributed_data_)
1414  OPM_THROW(std::runtime_error, "Moving Data only allowed with a load balance grid!");
1415  distributed_data_->gatherData(handle, data_.get(), distributed_data_.get());
1416 #else
1417  // Suppress warnings for unused argument.
1418  (void) handle;
1419 #endif
1420  }
1421 #if HAVE_MPI
1422 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
1424  using InterfaceMap = VariableSizeCommunicator<>::InterfaceMap;
1425 #else
1427  using InterfaceMap = Opm::VariableSizeCommunicator<>::InterfaceMap;
1428 #endif
1429 #else
1430  // bogus definition for the non parallel type. VariableSizeCommunicator not
1431  // availabe
1432 
1434  typedef std::map<int, std::list<int> > InterfaceMap;
1435 #endif
1436 
1466  {
1467  return *cell_scatter_gather_interfaces_;
1468  }
1469 
1473  {
1474  return *point_scatter_gather_interfaces_;
1475  }
1476 
1479  {
1480  current_view_data_=data_.get();
1481  }
1482 
1485  {
1486  if (! distributed_data_)
1487  OPM_THROW(std::logic_error, "No distributed view available in grid");
1488  current_view_data_=distributed_data_.get();
1489  }
1491 
1492 #if HAVE_MPI
1494  typedef cpgrid::CpGridData::ParallelIndexSet ParallelIndexSet;
1496  typedef cpgrid::CpGridData::RemoteIndices RemoteIndices;
1497 
1499  using CommunicationType = cpgrid::CpGridData::CommunicationType;
1500 
1504  const CommunicationType& cellCommunication() const
1505  {
1506  return current_view_data_->cellCommunication();
1507  }
1508 
1509  ParallelIndexSet& getCellIndexSet()
1510  {
1511  return current_view_data_->cellIndexSet();
1512  }
1513 
1514  RemoteIndices& getCellRemoteIndices()
1515  {
1516  return current_view_data_->cellRemoteIndices();
1517  }
1518 
1519  const ParallelIndexSet& getCellIndexSet() const
1520  {
1521  return current_view_data_->cellIndexSet();
1522  }
1523 
1524  const RemoteIndices& getCellRemoteIndices() const
1525  {
1526  return current_view_data_->cellRemoteIndices();
1527  }
1528 
1529 #endif
1530 
1531  private:
1557  std::pair<bool, std::vector<std::pair<std::string,bool> > >
1558  scatterGrid(EdgeWeightMethod method,
1559  bool ownersFirst,
1560  const std::vector<cpgrid::OpmWellType> * wells,
1561  bool serialPartitioning,
1562  const double* transmissibilities,
1563  bool addCornerCells,
1564  int overlapLayers,
1565  bool useZoltan = true,
1566  double zoltanImbalanceTol = 1.1,
1567  bool allowDistributedWells = true,
1568  const std::vector<int>& input_cell_part = {});
1569 
1574  std::shared_ptr<cpgrid::CpGridData> data_;
1576  cpgrid::CpGridData* current_view_data_;
1578  std::shared_ptr<cpgrid::CpGridData> distributed_data_;
1584  std::shared_ptr<InterfaceMap> cell_scatter_gather_interfaces_;
1585  /*
1586  * @brief Interface for scattering and gathering point data.
1587  *
1588  * @warning Will only update owner cells
1589  */
1590  std::shared_ptr<InterfaceMap> point_scatter_gather_interfaces_;
1594  cpgrid::GlobalIdSet global_id_set_;
1595  }; // end Class CpGrid
1596 
1597 
1598 
1599  namespace Capabilities
1600  {
1602  template <>
1603  struct hasEntity<CpGrid, 0>
1604  {
1605  static const bool v = true;
1606  };
1607 
1609  template <>
1610  struct hasEntity<CpGrid, 3>
1611  {
1612  static const bool v = true;
1613  };
1614 
1615  template<>
1616  struct canCommunicate<CpGrid,0>
1617  {
1618  static const bool v = true;
1619  };
1620 
1621  template<>
1622  struct canCommunicate<CpGrid,3>
1623  {
1624  static const bool v = true;
1625  };
1626 
1628  template <>
1629  struct hasBackupRestoreFacilities<CpGrid>
1630  {
1631  static const bool v = false;
1632  };
1633 
1634  }
1635 
1636 
1637  template<int dim>
1638  cpgrid::Entity<dim> createEntity(const CpGrid& grid,int index,bool orientation)
1639  {
1640  return cpgrid::Entity<dim>(*grid.current_view_data_, index, orientation);
1641  }
1642 
1643 } // namespace Dune
1644 
1645 #include <opm/grid/cpgrid/PersistentContainer.hpp>
1646 #include <opm/grid/cpgrid/CartesianIndexMapper.hpp>
1647 #endif // OPM_CPGRID_HEADER
An iterator over the centroids of the geometry of the entities.
Definition: CpGrid.hpp:1208
CentroidIterator(GeometryIterator iter)
Constructs a new iterator from an iterator over the geometries.
Definition: CpGrid.hpp:1215
std::vector< cpgrid::Geometry< 3-codim, 3 > >::const_iterator GeometryIterator
The type of the iterator over the codim geometries.
Definition: CpGrid.hpp:1212
[ provides Dune::Grid ]
Definition: CpGrid.hpp:207
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, const std::vector< int > &parts, const std::vector< cpgrid::OpmWellType > *wells, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:801
std::string name() const
Get the grid name.
Definition: CpGrid.hpp:367
void switchToGlobalView()
Switch to the global view.
Definition: CpGrid.hpp:1478
const Vector & faceNormal(int face) const
Get the unit normal of a face.
Definition: CpGrid.hpp:1184
void readSintefLegacyFormat(const std::string &grid_prefix)
Read the Sintef legacy grid format ('topogeom').
Definition: CpGrid.cpp:506
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: CpGrid.hpp:404
const InterfaceMap & pointScatterGatherInterface() const
Get an interface for gathering/scattering data attached to points with communication.
Definition: CpGrid.hpp:1472
unsigned int numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: CpGrid.hpp:603
CpGridFamily GridFamily
Family typedef, why is this not defined by Grid<>?
Definition: CpGrid.hpp:218
void gatherData(DataHandle &handle) const
Moves data from the distributed view to the global (all data on process) view.
Definition: CpGrid.hpp:1410
void globalRefine(int)
global refinement
Definition: CpGrid.hpp:517
const std::array< int, 3 > & logicalCartesianSize() const
The logical cartesian size of the global grid.
Definition: CpGrid.hpp:314
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: CpGrid.hpp:480
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: CpGrid.hpp:393
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: CpGrid.hpp:383
int faceTag(const Cell2FacesRowIterator &cell_face) const
Get the cartesian tag associated with a face tag.
Definition: CpGrid.hpp:1315
void setUniqueBoundaryIds(bool uids)
Set whether we want to have unique boundary ids.
Definition: CpGrid.hpp:354
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: CpGrid.hpp:424
void processEclipseFormat(const grdecl &input_data, bool remove_ij_boundary, bool turn_normals=false)
Read the Eclipse grid format ('grdecl').
Definition: CpGrid.cpp:551
unsigned int overlapSize(int) const
Size of the overlap on the leaf level.
Definition: CpGrid.hpp:580
const Vector & vertexPosition(int vertex) const
Get the Position of a vertex.
Definition: CpGrid.hpp:1165
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: CpGrid.hpp:494
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: CpGrid.hpp:487
int numCellFaces() const
Get the sum of all faces attached to all cells.
Definition: CpGrid.hpp:1031
int maxLevel() const
Return maximum level defined in this grid.
Definition: CpGrid.hpp:375
const cpgrid::OrientedEntityTable< 0, 1 >::row_type cellFaceRow(int cell) const
Get a list of indices identifying all faces of a cell.
Definition: CpGrid.hpp:981
double faceArea(int face) const
Get the area of a face.
Definition: CpGrid.hpp:1171
const Vector & faceCentroid(int face) const
Get the coordinates of the center of a face.
Definition: CpGrid.hpp:1177
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, EdgeWeightMethod method, const std::vector< cpgrid::OpmWellType > *wells, bool serialPartitioning, const double *transmissibilities=nullptr, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1, bool useZoltan=true, double zoltanImbalanceTol=1.1, bool allowDistributedWells=false)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:765
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(const std::vector< cpgrid::OpmWellType > *wells, const double *transmissibilities=nullptr, int overlapLayers=1, bool useZoltan=true)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:659
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: CpGrid.hpp:455
cpgrid::Entity< codim > entity(const cpgrid::EntityPointer< codim > &seed) const
given an EntitySeed (or EntityPointer) return an entity object
Definition: CpGrid.hpp:529
int faceVertex(int face, int local_index) const
Get the index identifying a vertex of a face.
Definition: CpGrid.hpp:1043
bool loadBalance(int overlapLayers=1, bool useZoltan=true)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:631
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: CpGrid.hpp:448
bool loadBalance(DataHandle &data, decltype(data.fixedsize(0, 0)) overlapLayers=1, bool useZoltan=true)
Distributes this grid and data over the available nodes in a distributed machine.
Definition: CpGrid.hpp:829
unsigned int ghostSize(int, int) const
Size of the ghost cell layer on a given level.
Definition: CpGrid.hpp:598
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(EdgeWeightMethod method, const std::vector< cpgrid::OpmWellType > *wells, const double *transmissibilities=nullptr, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1, bool useZoltan=true)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:692
int numVertices() const
Get The number of vertices.
Definition: CpGrid.hpp:956
void getIJK(const int c, std::array< int, 3 > &ijk) const
Extract Cartesian index triplet (i,j,k) of an active cell.
Definition: CpGrid.hpp:338
int cellFace(int cell, int local_index) const
Get a specific face of a cell.
Definition: CpGrid.hpp:974
bool uniqueBoundaryIds() const
Is the grid currently using unique boundary ids?
Definition: CpGrid.hpp:347
const CollectiveCommunication & comm() const
Get the collective communication object.
Definition: CpGrid.hpp:920
void createCartesian(const std::array< int, 3 > &dims, const std::array< double, 3 > &cellsize)
Create a cartesian grid.
Definition: CpGrid.cpp:448
const Vector & cellCentroid(int cell) const
Get the coordinates of the center of a cell.
Definition: CpGrid.hpp:1196
int faceCell(int face, int local_index) const
Get the index identifying a cell attached to a face.
Definition: CpGrid.hpp:995
int numCellFaces(int cell) const
Get the number of faces of a cell.
Definition: CpGrid.hpp:966
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: CpGrid.hpp:432
unsigned int overlapSize(int, int) const
Size of the overlap on a given level.
Definition: CpGrid.hpp:592
void writeSintefLegacyFormat(const std::string &grid_prefix) const
Write the Sintef legacy grid format ('topogeom').
Definition: CpGrid.cpp:516
unsigned int ghostSize(int) const
Size of the ghost cell layer on the leaf level.
Definition: CpGrid.hpp:586
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: CpGrid.hpp:414
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir) const
The new communication interface.
Definition: CpGrid.hpp:914
CpGrid()
Default constructor.
Definition: CpGrid.cpp:119
CentroidIterator< 0 > beginCellCentroids() const
Get an iterator over the cell centroids positioned at the first one.
Definition: CpGrid.hpp:1253
const InterfaceMap & cellScatterGatherInterface() const
Get an interface for gathering/scattering data attached to cells with communication.
Definition: CpGrid.hpp:1465
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: CpGrid.hpp:501
void switchToDistributedView()
Switch to the distributed view.
Definition: CpGrid.hpp:1484
CentroidIterator< 1 > beginFaceCentroids() const
Get an iterator over the face centroids positioned at the first one.
Definition: CpGrid.hpp:1259
bool loadBalance(DataHandle &data, const std::vector< int > &parts, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid and data over the available nodes in a distributed machine.
Definition: CpGrid.hpp:882
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: CpGrid.hpp:440
int numCells() const
Get the number of cells.
Definition: CpGrid.hpp:946
bool loadBalance(const std::vector< int > &parts, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:857
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: CpGrid.hpp:471
int numFaces() const
Get the number of faces.
Definition: CpGrid.hpp:951
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, const std::vector< cpgrid::OpmWellType > *wells, const double *transmissibilities=nullptr, int overlapLayers=1, bool useZoltan=true)
Distributes this grid and data over the available nodes in a distributed machine.
Definition: CpGrid.hpp:721
double cellCenterDepth(int cell_index) const
Get vertical position of cell center ("zcorn" average).
Definition: CpGrid.hpp:1049
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int) const
The new communication interface.
Definition: CpGrid.hpp:901
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: CpGrid.hpp:510
int size(int codim) const
number of leaf entities per codim in this process
Definition: CpGrid.hpp:464
double cellVolume(int cell) const
Get the volume of the cell.
Definition: CpGrid.hpp:1190
void scatterData(DataHandle &handle) const
Moves data from the global (all data on process) view to the distributed view.
Definition: CpGrid.hpp:1390
const std::vector< int > & globalCell() const
Retrieve mapping from internal ("compressed") active grid cells to external ("uncompressed") cells.
Definition: CpGrid.hpp:326
std::map< int, std::list< int > > InterfaceMap
The type of the map describing communication interfaces.
Definition: CpGrid.hpp:1434
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:123
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir)
communicate objects for all codims on a given level
Definition: CpGridData.hpp:602
bool uniqueBoundaryIds() const
Is the grid currently using unique boundary ids?
Definition: CpGridData.hpp:252
int size(int codim) const
number of leaf entities per codim in this process
Definition: CpGridData.cpp:145
void getIJK(int c, std::array< int, 3 > &ijk) const
Extract Cartesian index triplet (i,j,k) of an active cell.
Definition: CpGridData.hpp:238
void setUniqueBoundaryIds(bool uids)
Set whether we want to have unique boundary ids.
Definition: CpGridData.hpp:259
Represents an entity of a given codim, with positive or negative orientation.
Definition: EntityRep.hpp:98
Definition: Entity.hpp:70
This class encapsulates geometry for both vertices, intersections and cells.
Definition: Geometry.hpp:68
The global id set for Dune.
Definition: Indexsets.hpp:325
Only needs to provide interface for doing nothing.
Definition: Iterators.hpp:89
Definition: Indexsets.hpp:54
Definition: Intersection.hpp:291
Definition: Intersection.hpp:68
Iterator intended to be used as LeafIterator and LevelIterator (no difference due to no adaptivity) f...
Definition: Iterators.hpp:56
A class used as a row type for OrientedEntityTable.
Definition: OrientedEntityTable.hpp:55
int size() const
Returns the number of rows in the table.
Definition: SparseTable.hpp:121
int dataSize() const
Returns the number of data elements.
Definition: SparseTable.hpp:141
int size() const
Returns the number of rows in the table.
Definition: SparseTable.hpp:121
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10
EdgeWeightMethod
enum for choosing Methods for weighting graph-edges correspoding to cell interfaces in Zoltan's graph...
Definition: GridEnums.hpp:34
@ defaultTransEdgeWgt
Use the transmissibilities as edge weights.
Definition: GridEnums.hpp:38
FieldVector< T, 3 > cross(const FieldVector< T, 3 > &a, const FieldVector< T, 3 > &b)
Definition: Volumes.hpp:58
Low-level corner-point processing routines and supporting data structures.
face_tag
Connection taxonomy.
Definition: preprocess.h:66
@ K_FACE
Connection topologically normal to I-J plane.
Definition: preprocess.h:69
@ J_FACE
Connection topologically normal to I-K plane.
Definition: preprocess.h:68
@ NNC_FACE
Arbitrary non-neighbouring connection.
Definition: preprocess.h:70
@ I_FACE
Connection topologically normal to J-K plane.
Definition: preprocess.h:67
Definition: CpGrid.hpp:194
Traits associated with a specific grid partition type.
Definition: CpGrid.hpp:147
cpgrid::Iterator< cd, pitype > LevelIterator
The type of the iterator over the level entities of this codim on this partition.
Definition: CpGrid.hpp:149
cpgrid::Iterator< cd, pitype > LeafIterator
The type of the iterator over the leaf entities of this codim on this partition.
Definition: CpGrid.hpp:151
Traits associated with a specific codim.
Definition: CpGrid.hpp:120
cpgrid::Entity< cd > Entity
The type of the entity.
Definition: CpGrid.hpp:129
cpgrid::Geometry< 3-cd, 3 > Geometry
The type of the geometry associated with the entity.
Definition: CpGrid.hpp:123
cpgrid::Geometry< 3-cd, 3 > LocalGeometry
The type of the local geometry associated with the entity.
Definition: CpGrid.hpp:126
cpgrid::Iterator< cd, All_Partition > LeafIterator
The type of the iterator over all leaf entities of this codim.
Definition: CpGrid.hpp:135
cpgrid::Iterator< cd, All_Partition > LevelIterator
The type of the iterator over all level entities of this codim.
Definition: CpGrid.hpp:132
cpgrid::EntityPointer< cd > EntitySeed
The type of the entity pointer for entities of this codim.
Definition: CpGrid.hpp:141
cpgrid::EntityPointer< cd > EntityPointer
The type of the entity pointer for entities of this codim.
Definition: CpGrid.hpp:138
Traits associated with a specific grid partition type.
Definition: CpGrid.hpp:159
Dune::GridView< DefaultLeafGridViewTraits< CpGrid > > LeafGridView
The type of the leaf grid view associated with this partition type.
Definition: CpGrid.hpp:163
Dune::GridView< DefaultLevelGridViewTraits< CpGrid > > LevelGridView
The type of the level grid view associated with this partition type.
Definition: CpGrid.hpp:161
Definition: CpGrid.hpp:100
cpgrid::IndexSet LevelIndexSet
The type of the level index set.
Definition: CpGrid.hpp:173
cpgrid::IntersectionIterator LeafIntersectionIterator
The type of the intersection iterator at the leafs of the grid.
Definition: CpGrid.hpp:109
Dune::GridView< DefaultLeafGridViewTraits< CpGrid > > LeafGridView
The type of the leaf grid view associated with this partition type.
Definition: CpGrid.hpp:170
Dune::GridView< DefaultLevelGridViewTraits< CpGrid > > LevelGridView
The type of the level grid view associated with this partition type.
Definition: CpGrid.hpp:168
cpgrid::GlobalIdSet GlobalIdSet
The type of the global id set.
Definition: CpGrid.hpp:177
cpgrid::IntersectionIterator LevelIntersectionIterator
The type of the intersection iterator at the levels of the grid.
Definition: CpGrid.hpp:111
cpgrid::IndexSet LeafIndexSet
The type of the leaf index set.
Definition: CpGrid.hpp:175
GlobalIdSet LocalIdSet
The type of the local id set.
Definition: CpGrid.hpp:179
Dune::MPIHelper::MPICommunicator MPICommunicator
The type of the collective communication.
Definition: CpGrid.hpp:183
cpgrid::HierarchicIterator HierarchicIterator
The type of the hierarchic iterator.
Definition: CpGrid.hpp:114
cpgrid::Intersection LevelIntersection
The type of the intersection at the levels of the grid.
Definition: CpGrid.hpp:107
cpgrid::Intersection LeafIntersection
The type of the intersection at the leafs of the grid.
Definition: CpGrid.hpp:105
CpGrid Grid
The type that implements the grid.
Definition: CpGrid.hpp:102
Raw corner-point specification of a particular geological model.
Definition: preprocess.h:56