19#ifndef OPM_GRID_REFINEMENT_LEAFGRIDASSEMBLER_HEADER_INCLUDED
20#define OPM_GRID_REFINEMENT_LEAFGRIDASSEMBLER_HEADER_INCLUDED
27#include <opm/common/utility/SparseTable.hpp>
29#include <dune/common/fvector.hh>
30#include <dune/common/parallel/mpihelper.hh>
135 const std::vector<BlockRefinement>& requests,
136 const std::array<int,3>& parentDims,
140 Dune::MPIHelper::MPICommunicator comm);
144 std::shared_ptr<Dune::cpgrid::CpGridData>
build();
153 std::array<int,3> factors;
154 std::array<AxisSubdivision,3> subs;
155 std::array<AxisPositions,3> pos;
159 std::map<int, std::vector<int>> childrenOfParent;
161 std::vector<int> cornerEquiv;
163 std::vector<int> cornerToLeaf;
165 std::vector<int> cellToLeaf;
166 std::vector<int> faceToLeaf;
173 std::vector<int> points;
174 Dune::FieldVector<double,3> normal;
175 Dune::FieldVector<double,3> center;
183 std::vector<int> computeParentBoxOf()
const;
184 std::vector<int> computeCompressed0()
const;
185 std::vector<int> computeBoxOfCell()
const;
188 void collectBoxData();
189 void buildCornerPool();
190 void buildLeafCells();
191 void refuseThrowsLeavingBoxes()
const;
192 void findDroppedFaces();
193 void findFaultedSides();
194 void buildLeafFaces();
195 void buildSyntheticFaces();
196 void buildLeafTopology();
197 void computeCellData();
198 void buildParallelStructures();
199 void recordLeafMetadata();
203 bool nested(
int b)
const;
205 int boxOfParentGridCell(
int b,
int cell)
const;
207 int leafOfParentGridCell(
int b,
int cell)
const;
209 std::array<int,3> parentGridIJK(
int b,
int cell)
const;
211 int nestedNeighborOf(
int b,
int parent,
int axis,
int side)
const;
213 int outsideNeighborOf(
int parent,
int axis,
int side)
const;
218 int childAcross(
int b,
const std::array<int,3>& lattice,
int axis,
int side,
219 int nb,
int neighbor)
const;
222 const std::vector<BoxData>& boxes()
const {
return boxes_; }
223 const std::vector<std::vector<int>>& nestedBoxOf()
const {
return nestedBoxOf_; }
224 const std::vector<SourceRef>& leafCells()
const {
return leafCells_; }
225 const std::vector<int>& leafIdxOfCell0()
const {
return leafIdxOfCell0_; }
226 const std::vector<std::vector<int>>& leafIdxOfLevelCell()
const {
return leafIdxOfLevelCell_; }
227 const std::vector<std::tuple<int, std::vector<int>>>& level0ToChildren()
const {
return level0ToChildren_; }
228 int numLeafCells()
const {
return numLeafCells_; }
229 const std::vector<bool>& faceDropped()
const {
return faceDropped_; }
230 const std::set<std::tuple<int,int,int>>& faultedSides()
const {
return faultedSides_; }
231 const std::map<std::tuple<int,int,int>, CellRange>& acrossRange()
const {
return acrossRange_; }
232 const std::vector<SourceRef>& leafFaces()
const {
return leafFaces_; }
233 const std::vector<int>& mosaicOutside()
const {
return mosaicOutside_; }
234 const std::vector<std::map<int,int>>& refinedCartToCell()
const {
return refinedCartToCell_; }
235 int numSourceFaces()
const {
return numSourceFaces_; }
236 const std::vector<SyntheticFace>& syntheticFaces()
const {
return syntheticFaces_; }
237 int numLeafFaces()
const {
return numLeafFaces_; }
238 int numLeafCorners()
const {
return numLeafCorners_; }
241 const std::vector<std::shared_ptr<Dune::cpgrid::CpGridData>>& storage_;
242 const std::vector<BlockRefinement>& requests_;
243 const std::array<int,3> parentDims_;
244 const double*
const coord_;
245 const double*
const zcorn_;
246 const int*
const actnum_;
247 const Dune::MPIHelper::MPICommunicator comm_;
252 const std::array<int,3> dims0_;
253 const int numCells0_;
254 const int numCorners0_;
256 const std::vector<int> parentBoxOf_;
258 const std::vector<int> compressed0_;
260 const std::vector<int> boxOfCell_;
261 const std::vector<std::array<int,8>>& cellToPoint0_;
263 const Opm::SparseTable<int>& faceToPoint0_;
266 const int numFaces0_;
269 std::vector<BoxData> boxes_;
272 std::vector<std::vector<int>> nestedBoxOf_;
275 std::shared_ptr<Dune::cpgrid::CpGridData> leaf_;
278 std::vector<std::array<int,2>> leafCornerOrigin_;
279 int numLeafCorners_{0};
282 std::vector<SourceRef> leafCells_;
283 std::vector<int> leafIdxOfCell0_;
284 std::vector<std::vector<int>> leafIdxOfLevelCell_;
289 std::vector<std::tuple<int, std::vector<int>>> level0ToChildren_;
290 int numLeafCells_{0};
291 std::map<int, std::vector<std::tuple<int, std::vector<int>>>> nestedParentToChildren_;
294 std::vector<bool> faceDropped_;
298 mutable std::map<std::tuple<int,int,int>,
int> verifiedNeighbor_;
302 std::set<std::tuple<int,int,int>> faultedSides_;
307 std::map<std::tuple<int,int,int>, CellRange> acrossRange_;
310 std::vector<SourceRef> leafFaces_;
314 std::vector<int> mosaicOutside_;
315 std::vector<std::map<int,int>> refinedCartToCell_;
316 int numSourceFaces_{0};
319 std::vector<SyntheticFace> syntheticFaces_;
320 int numLeafFaces_{0};
323 std::vector<int> leafGlobalCell_;
324 std::vector<std::array<int,2>> leafChildToParent_;
325 std::vector<int> leafCartesianIndexInParentCell_;
326 std::vector<std::array<int,2>> leafToLevel_;
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:144
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:316
Definition: LeafGridAssembler.hpp:114
LeafGridAssembler(const std::vector< std::shared_ptr< Dune::cpgrid::CpGridData > > &storage, const std::vector< BlockRefinement > &requests, const std::array< int, 3 > &parentDims, const double *coord, const double *zcorn, const int *actnum, Dune::MPIHelper::MPICommunicator comm)
std::shared_ptr< Dune::cpgrid::CpGridData > build()
The namespace Dune is the main namespace for all Dune code.
Definition: common/CartesianIndexMapper.hpp:10
T area(const Point< T, 2 > *c)
Definition: Volumes.hpp:119
std::array< int, 3 > refinedDims(const BlockRefinement &request)
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.hpp:26
face_tag
Definition: preprocess.h:66
Definition: LeafGridAssembler.hpp:119
int index
Definition: LeafGridAssembler.hpp:121
int grid
Definition: LeafGridAssembler.hpp:120
double b(const Dune::FieldVector< ct, dimworld > &, double)
Definition: transportproblem2.hh:25