37#ifndef OPM_GEOMETRY_HEADER
38#define OPM_GEOMETRY_HEADER
43#include <opm/grid/utility/platform_dependent/disable_warnings.h>
45#include <dune/common/version.hh>
46#include <dune/geometry/referenceelements.hh>
47#include <dune/grid/common/geometry.hh>
49#include <dune/geometry/type.hh>
51#include <opm/grid/cpgrid/EntityRep.hpp>
52#include <opm/grid/cpgrid/DefaultGeometryPolicy.hpp>
53#include <opm/grid/cpgrid/OrientedEntityTable.hpp>
54#include <opm/grid/common/Volumes.hpp>
55#include <opm/grid/utility/platform_dependent/reenable_warnings.h>
56#include <opm/grid/utility/SparseTable.hpp>
58#include <opm/common/ErrorMacros.hpp>
73 template <
int mydim,
int cdim>
85 static_assert(cdim == 3,
"");
88 enum { dimension = 3 };
90 enum { mydimension = 0};
92 enum { coorddimension = cdim };
94 enum { dimensionworld = 3 };
105 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
149 return Dune::GeometryTypes::cube(mydimension);
161 static_cast<void>(cor);
188 JacobianInverseTransposed
216 GlobalCoordinate pos_;
227 static_assert(cdim == 3,
"");
230 enum { dimension = 3 };
232 enum { mydimension = 2 };
234 enum { coorddimension = cdim };
236 enum { dimensionworld = 3 };
247 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
260 : pos_(pos), vol_(vol)
266 : pos_(0.0), vol_(0.0)
273 OPM_THROW(std::runtime_error,
"Geometry::global() meaningless on singular geometry.");
279 OPM_THROW(std::runtime_error,
"Geometry::local() meaningless on singular geometry.");
292 return Dune::GeometryTypes::none(mydimension);
324 const FieldMatrix<ctype, mydimension, coorddimension>&
327 OPM_THROW(std::runtime_error,
"Meaningless to call jacobianTransposed() on singular geometries.");
331 const FieldMatrix<ctype, coorddimension, mydimension>&
334 OPM_THROW(std::runtime_error,
"Meaningless to call jacobianInverseTransposed() on singular geometries.");
341 return jacobianTransposed({}).transposed();
348 return jacobianInverseTransposed({}).transposed();
358 GlobalCoordinate pos_;
370 static_assert(cdim == 3,
"");
373 enum { dimension = 3 };
375 enum { mydimension = 3 };
377 enum { coorddimension = cdim };
379 enum { dimensionworld = 3 };
390 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
398 typedef Dune::Impl::FieldMatrixHelper< double > MatrixHelperType;
411 const int* corner_indices)
412 : pos_(pos), vol_(vol),
413 allcorners_(allcorners_ptr), cor_idx_(corner_indices)
415 assert(allcorners_ && corner_indices);
429 : pos_(pos), vol_(vol)
435 : pos_(0.0), vol_(0.0), allcorners_(0), cor_idx_(0)
446 static_assert(mydimension == 3,
"");
447 static_assert(coorddimension == 3,
"");
450 uvw[0] -= local_coord;
452 const int pat[8][3] = { { 0, 0, 0 },
461 for (
int i = 0; i < 8; ++i) {
464 for (
int j = 0; j < 3; ++j) {
465 factor *= uvw[pat[i][j]][j];
467 corner_contrib *= factor;
468 xyz += corner_contrib;
477 static_assert(mydimension == 3,
"");
478 static_assert(coorddimension == 3,
"");
481 const ctype epsilon = 1e-12;
482 auto refElement = Dune::ReferenceElements<ctype, 3>::cube();
490 MatrixHelperType::template xTRightInvA<3, 3>(JT, z, dx );
492 }
while (dx.two_norm2() > epsilon*epsilon);
503 return MatrixHelperType::template sqrtDetAAT<3, 3>(Jt);
510 return Dune::GeometryTypes::cube(mydimension);
523 assert(allcorners_ && cor_idx_);
524 return (allcorners_->data())[cor_idx_[cor]].center();
533 void set_volume(ctype
volume) {
549 const JacobianTransposed
552 static_assert(mydimension == 3,
"");
553 static_assert(coorddimension == 3,
"");
557 uvw[0] -= local_coord;
559 const int pat[8][3] = { { 0, 0, 0 },
568 for (
int i = 0; i < 8; ++i) {
569 for (
int deriv = 0; deriv < 3; ++deriv) {
572 for (
int j = 0; j < 3; ++j) {
573 factor *= (j != deriv) ? uvw[pat[i][j]][j]
574 : (pat[i][j] == 0 ? -1.0 : 1.0);
577 corner_contrib *= factor;
578 Jt[deriv] += corner_contrib;
585 const JacobianInverseTransposed
597 return jacobianTransposed(local_coord).transposed();
604 return jacobianInverseTransposed(local_coord).transposed();
630 void refine(
const std::array<int,3>& cells_per_dim,
632 std::vector<std::array<int,8>>& refined_cell_to_point,
640 *(all_geom.
geomVector(std::integral_constant<int,3>()));
642 *(all_geom.
geomVector(std::integral_constant<int,1>()));
644 *(all_geom.
geomVector(std::integral_constant<int,0>()));
652 refined_corners.resize((cells_per_dim[0] + 1) *(cells_per_dim[1] + 1) * (cells_per_dim[2] + 1));
658 for (
int j = 0; j < cells_per_dim[1] + 1; ++j) {
659 for (
int i = 0; i < cells_per_dim[0] + 1; ++i) {
660 for (
int k = 0; k < cells_per_dim[2] + 1; ++k) {
662 int refined_corner_idx =
663 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k;
666 double(i)/cells_per_dim[0], double(j)/cells_per_dim[1], double(k)/cells_per_dim[2] };
668 refined_corners[refined_corner_idx] =
Geometry<0, 3>(this->global(local_refined_corner));
676 const int refined_faces_size =
677 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
678 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
679 + (cells_per_dim[0]*(cells_per_dim[1]+1)*cells_per_dim[2]);
680 refined_faces.resize(refined_faces_size);
681 refined_face_tags.resize(refined_faces_size);
682 refined_face_normals.resize(refined_faces_size);
719 for (
int constant_direction = 0; constant_direction < 3; ++constant_direction){
724 std::array<int,3> cells_per_dim_mixed = {
725 cells_per_dim[(2+constant_direction)%3],
726 cells_per_dim[(1+constant_direction)%3],
727 cells_per_dim[constant_direction % 3] };
728 for (
int l = 0; l < cells_per_dim_mixed[0] + 1; ++l) {
729 for (
int m = 0; m < cells_per_dim_mixed[1]; ++m) {
730 for (
int n = 0; n < cells_per_dim_mixed[2]; ++n) {
732 auto [face_type, idx, face4corners,
733 neighboring_cells_of_one_face, local_refined_face_centroid] =
734 getIndicesFace(l, m, n, constant_direction, cells_per_dim);
736 mutable_face_tags[idx]= face_type;
738 refined_face_to_point.
appendRow(face4corners.begin(), face4corners.end());
740 refined_face_to_cell.
appendRow(neighboring_cells_of_one_face.begin(),
741 neighboring_cells_of_one_face.end());
747 refined_corners[face4corners[0]].center() - global(local_refined_face_centroid);
749 refined_corners[face4corners[1]].center() - global(local_refined_face_centroid);
750 mutable_face_normals[idx] = {
751 (face_vector0[1]*face_vector1[2]) - (face_vector0[2]*face_vector1[1]),
752 (face_vector0[2]*face_vector1[0]) - (face_vector0[0]*face_vector1[2]),
753 (face_vector0[0]*face_vector1[1]) - (face_vector0[1]*face_vector1[0])};
754 mutable_face_normals[idx] /= mutable_face_normals[idx].two_norm();
755 if (face_type ==
J_FACE) {
756 mutable_face_normals[idx] *= -1;
760 std::vector<std::array<int,2>> refined_face_to_edges = {
761 { face4corners[0], face4corners[1]},
762 { face4corners[0], face4corners[2]},
763 { face4corners[1], face4corners[3]},
764 { face4corners[2], face4corners[3]}};
767 double refined_face_area = 0.0;
768 for (
int edge = 0; edge < 4; ++edge) {
772 refined_corners[refined_face_to_edges[edge][0]].center(),
773 refined_corners[refined_face_to_edges[edge][1]].center(),
774 global(local_refined_face_centroid)};
775 refined_face_area += std::fabs(
area(trian_corners));
780 refined_faces[idx] =
Geometry<2,cdim>(this->global(local_refined_face_centroid),
797 refined_cells.resize(cells_per_dim[0] * cells_per_dim[1] * cells_per_dim[2]);
800 refined_cell_to_point.resize(cells_per_dim[0] * cells_per_dim[1] * cells_per_dim[2]);
829 double sum_all_refined_cell_volumes = 0.0;
842 for (
int k = 0; k < cells_per_dim[2]; ++k) {
843 for (
int j = 0; j < cells_per_dim[1]; ++j) {
844 for (
int i = 0; i < cells_per_dim[0]; ++i) {
846 int refined_cell_idx = (k*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) +i;
850 (.5 + i)/cells_per_dim[0], (.5 + j)/cells_per_dim[1], (.5 + k)/cells_per_dim[2]};
853 double refined_cell_volume = 0.0;
856 std::array<int,8> cell8corners_indices = {
857 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k,
858 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k,
859 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k,
860 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k,
861 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k+1,
862 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k+1,
863 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k+1,
864 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k+1
867 refined_cell_to_point[refined_cell_idx] = cell8corners_indices;
871 std::vector<int> hexa_to_face = {
873 (k*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) + i,
875 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
876 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
877 + (j*cells_per_dim[0]*cells_per_dim[2]) + (i*cells_per_dim[2]) + k,
879 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
880 + (i*cells_per_dim[1]*cells_per_dim[2]) + (k*cells_per_dim[1]) + j,
882 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
883 + ((i+1)*cells_per_dim[1]*cells_per_dim[2]) + (k*cells_per_dim[1]) + j,
885 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1)) +
886 ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
887 + ((j+1)*cells_per_dim[0]*cells_per_dim[2]) + (i*cells_per_dim[2]) + k,
889 ((k+1)*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) + i};
899 std::vector<cpgrid::EntityRep<1>> faces_of_one_cell = {
900 { hexa_to_face[0],
false}, {hexa_to_face[1],
false},
901 { hexa_to_face[2],
false}, {hexa_to_face[3],
true},
902 { hexa_to_face[4],
true}, {hexa_to_face[5],
true} };
903 refined_cell_to_face.
appendRow(faces_of_one_cell.begin(), faces_of_one_cell.end());
907 std::vector<Geometry<0,3>::GlobalCoordinate> hexa_face_centroids;
908 for (
auto& idx : hexa_to_face) {
909 hexa_face_centroids.push_back(refined_faces[idx].center());
923 std::vector<std::array<int,4>> cell_face4corners;
924 cell_face4corners.reserve(6);
925 for (
int face = 0; face < 6; ++face) {
926 cell_face4corners.push_back({ refined_face_to_point[hexa_to_face[face]][0],
927 refined_face_to_point[hexa_to_face[face]][1],
928 refined_face_to_point[hexa_to_face[face]][2],
929 refined_face_to_point[hexa_to_face[face]][3]});
933 std::vector<std::vector<std::array<int,2>>> tetra_edge_indices;
934 tetra_edge_indices.reserve(6);
935 for (
auto& face_indices : cell_face4corners)
937 std::vector<std::array<int,2>> face4edges_indices = {
938 { face_indices[0], face_indices[1]},
939 { face_indices[0], face_indices[2]},
940 { face_indices[1], face_indices[3]},
941 { face_indices[2], face_indices[3]} };
942 tetra_edge_indices.push_back(face4edges_indices);
948 for (
int face = 0; face < 6; ++face) {
949 for (
int edge = 0; edge < 4; ++edge) {
953 refined_corners[tetra_edge_indices[face][edge][0]].center(),
954 refined_corners[tetra_edge_indices[face][edge][1]].center(),
955 hexa_face_centroids[face],
957 this->global(local_refined_cell_center)};
963 sum_all_refined_cell_volumes += refined_cell_volume;
966 int* indices_storage_ptr = refined_cell_to_point[refined_cell_idx].data();
968 refined_cells[refined_cell_idx] =
971 all_geom.
geomVector(std::integral_constant<int,3>()),
972 indices_storage_ptr);
979 if (std::fabs(sum_all_refined_cell_volumes - this->
volume())
982 for(
auto& cell: refined_cells){
983 cell.vol_ *= correction;
990 GlobalCoordinate pos_;
992 std::shared_ptr<const EntityVariable<Geometry<0, 3>,3>> allcorners_;
1008 const std::tuple<
enum face_tag, int,
1009 std::array<int, 4>, std::vector<cpgrid::EntityRep<0>>,
1011 getIndicesFace(
int l,
int m,
int n,
int constant_direction,
const std::array<int, 3>& cells_per_dim)
const
1014 std::vector<cpgrid::EntityRep<0>> neighboring_cells_of_one_face;
1015 switch(constant_direction) {
1020 neighboring_cells_of_one_face.push_back({((l-1)*cells_per_dim[0]*cells_per_dim[1])
1021 + (m*cells_per_dim[0]) + n,
true});
1023 if (l != cells_per_dim[2]) {
1024 neighboring_cells_of_one_face.push_back({ (l*cells_per_dim[0]*cells_per_dim[1])
1025 + (m*cells_per_dim[0]) + n,
false});
1027 return {
face_tag::K_FACE, (l*cells_per_dim[0]*cells_per_dim[1]) + (m*cells_per_dim[0]) + n,
1028 {(m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1029 (m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l,
1030 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1031 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l},
1032 neighboring_cells_of_one_face,
1033 {(.5 + n)/cells_per_dim[0], (.5 + m)/cells_per_dim[1], double(l)/cells_per_dim[2]}};
1038 neighboring_cells_of_one_face.push_back({(m*cells_per_dim[0]*cells_per_dim[1])
1039 + (n*cells_per_dim[0]) +l-1,
true});
1041 if (l != cells_per_dim[0]) {
1042 neighboring_cells_of_one_face.push_back({ (m*cells_per_dim[0]*cells_per_dim[1])
1043 + (n*cells_per_dim[0]) + l,
false});
1045 return {
face_tag::I_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
1046 + (l*cells_per_dim[1]*cells_per_dim[2]) + (m*cells_per_dim[1]) + n,
1047 {(n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1048 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1049 (n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1,
1050 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1},
1051 neighboring_cells_of_one_face,
1052 { double(l)/cells_per_dim[0], (.5 + n)/cells_per_dim[1], (.5 + m)/cells_per_dim[2]}};
1057 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1058 + ((l-1)*cells_per_dim[0]) +m,
true});
1060 if (l != cells_per_dim[1]) {
1061 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1062 + (l*cells_per_dim[0]) + m,
false});
1064 return {
face_tag::J_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2] +1))
1065 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
1066 + (l*cells_per_dim[0]*cells_per_dim[2]) + (m*cells_per_dim[2]) + n,
1067 {(l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n,
1068 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n,
1069 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n+1,
1070 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n+1},
1071 neighboring_cells_of_one_face,
1072 {(.5 + m)/cells_per_dim[0],
double(l)/cells_per_dim[1], (.5 + n)/cells_per_dim[2]}};
1075 OPM_THROW(std::logic_error,
"Unhandled dimension. This should never happen!");
1081 template<
int mydim,
int cdim >
1082 auto referenceElement(
const cpgrid::Geometry<mydim,cdim>& geo) ->
decltype(referenceElement<double,mydim>(geo.type()))
1084 return referenceElement<double,mydim>(geo.type());
Definition DefaultGeometryPolicy.hpp:53
const EntityVariable< cpgrid::Geometry< 3 - codim, 3 >, codim > & geomVector() const
Definition DefaultGeometryPolicy.hpp:86
Represents an entity of a given codim, with positive or negative orientation.
Definition EntityRep.hpp:99
Base class for EntityVariable and SignedEntityVariable.
Definition EntityRep.hpp:219
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:267
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:102
bool affine() const
The mapping implemented by this geometry is constant, therefore affine.
Definition Geometry.hpp:210
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:105
JacobianInverse jacobianInverse(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:204
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:100
Jacobian jacobian(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:197
double integrationElement(const LocalCoordinate &) const
Returns 1 for the vertex geometry.
Definition Geometry.hpp:141
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition Geometry.hpp:111
Geometry(const GlobalCoordinate &pos)
Construct from vertex position.
Definition Geometry.hpp:116
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:107
JacobianTransposed jacobianTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:180
GeometryType type() const
Using the cube type for vertices.
Definition Geometry.hpp:147
ctype volume() const
Volume of vertex is arbitrarily set to 1.
Definition Geometry.hpp:167
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:109
GlobalCoordinate corner(int cor) const
Returns the single corner: the vertex itself.
Definition Geometry.hpp:159
int corners() const
A vertex is defined by a single corner.
Definition Geometry.hpp:153
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition Geometry.hpp:173
Geometry()
Default constructor, giving a non-valid geometry.
Definition Geometry.hpp:122
const GlobalCoordinate & global(const LocalCoordinate &) const
Returns the position of the vertex.
Definition Geometry.hpp:128
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:189
LocalCoordinate local(const GlobalCoordinate &) const
Meaningless for the vertex geometry.
Definition Geometry.hpp:134
double ctype
Coordinate element type.
Definition Geometry.hpp:97
JacobianInverse jacobianInverse(const LocalCoordinate &) const
The inverse of the jacobian.
Definition Geometry.hpp:346
const FieldMatrix< ctype, mydimension, coorddimension > & jacobianTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:325
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition Geometry.hpp:318
int corners() const
The number of corners of this convex polytope.
Definition Geometry.hpp:297
LocalCoordinate local(const GlobalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:277
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:247
bool affine() const
Since integrationElement() is constant, returns true.
Definition Geometry.hpp:352
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:242
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition Geometry.hpp:253
ctype volume() const
Volume (area, actually) of intersection.
Definition Geometry.hpp:312
const FieldMatrix< ctype, coorddimension, mydimension > & jacobianInverseTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:332
GeometryType type() const
We use the singular type (None) for intersections.
Definition Geometry.hpp:290
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:251
double integrationElement(const LocalCoordinate &) const
For the singular geometry, we return a constant integration element equal to the volume.
Definition Geometry.hpp:284
Geometry()
Default constructor, giving a non-valid geometry.
Definition Geometry.hpp:265
const GlobalCoordinate & global(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:271
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:249
Geometry(const GlobalCoordinate &pos, ctype vol)
Construct from centroid and volume (1- and 0-moments).
Definition Geometry.hpp:258
double ctype
Coordinate element type.
Definition Geometry.hpp:239
Jacobian jacobian(const LocalCoordinate &) const
The jacobian.
Definition Geometry.hpp:339
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:244
GlobalCoordinate corner(int) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:303
const JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local_coord) const
Inverse of Jacobian transposed.
Definition Geometry.hpp:586
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition Geometry.hpp:396
bool affine() const
The mapping implemented by this geometry is not generally affine.
Definition Geometry.hpp:608
double ctype
Coordinate element type.
Definition Geometry.hpp:382
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:387
GlobalCoordinate corner(int cor) const
Get the cor-th of 8 corners of the hexahedral base cell.
Definition Geometry.hpp:521
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:394
Geometry(const GlobalCoordinate &pos, ctype vol, std::shared_ptr< const EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > > allcorners_ptr, const int *corner_indices)
Construct from center, volume (1- and 0-moments) and corners.
Definition Geometry.hpp:408
GeometryType type() const
Using the cube type for all entities now (cells and vertices), but we use the singular type for inter...
Definition Geometry.hpp:508
double integrationElement(const LocalCoordinate &local_coord) const
Equal to \sqrt{\det{J^T J}} where J is the Jacobian.
Definition Geometry.hpp:500
const JacobianTransposed jacobianTransposed(const LocalCoordinate &local_coord) const
Jacobian transposed.
Definition Geometry.hpp:550
GlobalCoordinate global(const LocalCoordinate &local_coord) const
Provide a trilinear mapping.
Definition Geometry.hpp:444
Geometry()
Default constructor, giving a non-valid geometry.
Definition Geometry.hpp:434
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:392
LocalCoordinate local(const GlobalCoordinate &y) const
Mapping from the cell to the reference domain.
Definition Geometry.hpp:475
int corners() const
The number of corners of this convex polytope.
Definition Geometry.hpp:515
ctype volume() const
Cell volume.
Definition Geometry.hpp:528
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition Geometry.hpp:538
Jacobian jacobian(const LocalCoordinate &local_coord) const
The jacobian.
Definition Geometry.hpp:595
Geometry(const GlobalCoordinate &pos, ctype vol)
Construct from centroid and volume (1- and 0-moments).
Definition Geometry.hpp:427
void refine(const std::array< int, 3 > &cells_per_dim, DefaultGeometryPolicy &all_geom, std::vector< std::array< int, 8 > > &refined_cell_to_point, cpgrid::OrientedEntityTable< 0, 1 > &refined_cell_to_face, Opm::SparseTable< int > &refined_face_to_point, cpgrid::OrientedEntityTable< 1, 0 > &refined_face_to_cell, cpgrid::EntityVariable< enum face_tag, 1 > &refined_face_tags, cpgrid::SignedEntityVariable< PointType, 1 > &refined_face_normals) const
Definition Geometry.hpp:630
Dune::FieldVector< double, 3 > PointType
Refine a single cell with regular intervals.
Definition Geometry.hpp:629
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:385
JacobianInverse jacobianInverse(const LocalCoordinate &local_coord) const
The inverse of the jacobian.
Definition Geometry.hpp:602
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:390
This class encapsulates geometry for vertices, intersections, and cells.
Definition Geometry.hpp:75
Represents the topological relationships between sets of entities, for example cells and faces.
Definition OrientedEntityTable.hpp:139
void appendRow(DataIter row_beg, DataIter row_end)
Appends a row to the table.
Definition SparseTable.hpp:108
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:302
A SparseTable stores a table with rows of varying size as efficiently as possible.
Definition SparseTable.hpp:55
void appendRow(DataIter row_beg, DataIter row_end)
Appends a row to the table.
Definition SparseTable.hpp:108
Copyright 2019 Equinor AS.
Definition CartesianIndexMapper.hpp:10
T area(const Point< T, 2 > *c)
Computes the area of a 2-dimensional triangle.
Definition Volumes.hpp:118
T volume(const Point< T, 3 > *c)
Computes the volume of a 3D simplex (embedded i 3D space).
Definition Volumes.hpp:137
T simplex_volume(const Point< T, Dim > *a)
Computes the volume of a simplex consisting of (Dim+1) vertices embedded in Euclidean space of dimens...
Definition Volumes.hpp:104
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
@ I_FACE
Connection topologically normal to J-K plane.
Definition preprocess.h:67