36#ifndef OPM_GEOMETRY_HEADER
37#define OPM_GEOMETRY_HEADER
42#include <opm/grid/utility/platform_dependent/disable_warnings.h>
44#include <dune/common/version.hh>
45#include <dune/geometry/referenceelements.hh>
46#include <dune/grid/common/geometry.hh>
48#include <dune/geometry/type.hh>
50#include <opm/grid/cpgrid/EntityRep.hpp>
51#include <opm/grid/cpgrid/DefaultGeometryPolicy.hpp>
52#include <opm/grid/cpgrid/OrientedEntityTable.hpp>
53#include <opm/grid/common/Volumes.hpp>
54#include <opm/grid/utility/platform_dependent/reenable_warnings.h>
55#include <opm/grid/utility/SparseTable.hpp>
57#include <opm/common/ErrorMacros.hpp>
72 template <
int mydim,
int cdim>
84 static_assert(cdim == 3,
"");
87 enum { dimension = 3 };
89 enum { mydimension = 0};
91 enum { coorddimension = cdim };
93 enum { dimensionworld = 3 };
104 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
148 return Dune::GeometryTypes::cube(mydimension);
160 static_cast<void>(cor);
187 JacobianInverseTransposed
215 GlobalCoordinate pos_;
226 static_assert(cdim == 3,
"");
229 enum { dimension = 3 };
231 enum { mydimension = 2 };
233 enum { coorddimension = cdim };
235 enum { dimensionworld = 3 };
246 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
259 : pos_(pos), vol_(vol)
265 : pos_(0.0), vol_(0.0)
272 OPM_THROW(std::runtime_error,
"Geometry::global() meaningless on singular geometry.");
278 OPM_THROW(std::runtime_error,
"Geometry::local() meaningless on singular geometry.");
291 return Dune::GeometryTypes::none(mydimension);
323 const FieldMatrix<ctype, mydimension, coorddimension>&
326 OPM_THROW(std::runtime_error,
"Meaningless to call jacobianTransposed() on singular geometries.");
330 const FieldMatrix<ctype, coorddimension, mydimension>&
333 OPM_THROW(std::runtime_error,
"Meaningless to call jacobianInverseTransposed() on singular geometries.");
340 return jacobianTransposed({}).transposed();
347 return jacobianInverseTransposed({}).transposed();
357 GlobalCoordinate pos_;
369 static_assert(cdim == 3,
"");
372 enum { dimension = 3 };
374 enum { mydimension = 3 };
376 enum { coorddimension = cdim };
378 enum { dimensionworld = 3 };
389 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
397 typedef Dune::Impl::FieldMatrixHelper< double > MatrixHelperType;
410 const int* corner_indices)
411 : pos_(pos), vol_(vol), allcorners_(allcorners.data()), cor_idx_(corner_indices)
413 assert(allcorners_ && corner_indices);
427 : pos_(pos), vol_(vol)
433 : pos_(0.0), vol_(0.0), allcorners_(0), cor_idx_(0)
444 static_assert(mydimension == 3,
"");
445 static_assert(coorddimension == 3,
"");
448 uvw[0] -= local_coord;
450 const int pat[8][3] = { { 0, 0, 0 },
459 for (
int i = 0; i < 8; ++i) {
462 for (
int j = 0; j < 3; ++j) {
463 factor *= uvw[pat[i][j]][j];
465 corner_contrib *= factor;
466 xyz += corner_contrib;
475 static_assert(mydimension == 3,
"");
476 static_assert(coorddimension == 3,
"");
479 const ctype epsilon = 1e-12;
480 auto refElement = Dune::ReferenceElements<ctype, 3>::cube();
488 MatrixHelperType::template xTRightInvA<3, 3>(JT, z, dx );
490 }
while (dx.two_norm2() > epsilon*epsilon);
501 return MatrixHelperType::template sqrtDetAAT<3, 3>(Jt);
508 return Dune::GeometryTypes::cube(mydimension);
521 assert(allcorners_ && cor_idx_);
522 return allcorners_[cor_idx_[cor]].center();
531 void set_volume(ctype
volume) {
547 const JacobianTransposed
550 static_assert(mydimension == 3,
"");
551 static_assert(coorddimension == 3,
"");
555 uvw[0] -= local_coord;
557 const int pat[8][3] = { { 0, 0, 0 },
566 for (
int i = 0; i < 8; ++i) {
567 for (
int deriv = 0; deriv < 3; ++deriv) {
570 for (
int j = 0; j < 3; ++j) {
571 factor *= (j != deriv) ? uvw[pat[i][j]][j]
572 : (pat[i][j] == 0 ? -1.0 : 1.0);
575 corner_contrib *= factor;
576 Jt[deriv] += corner_contrib;
583 const JacobianInverseTransposed
595 return jacobianTransposed(local_coord).transposed();
602 return jacobianInverseTransposed(local_coord).transposed();
628 void refine(
const std::array<int,3>& cells_per_dim,
630 std::vector<std::array<int,8>>& refined_cell_to_point,
638 all_geom.
geomVector(std::integral_constant<int,3>());
640 all_geom.
geomVector(std::integral_constant<int,1>());
642 all_geom.
geomVector(std::integral_constant<int,0>());
650 refined_corners.resize((cells_per_dim[0] + 1) *(cells_per_dim[1] + 1) * (cells_per_dim[2] + 1));
656 for (
int j = 0; j < cells_per_dim[1] + 1; ++j) {
657 for (
int i = 0; i < cells_per_dim[0] + 1; ++i) {
658 for (
int k = 0; k < cells_per_dim[2] + 1; ++k) {
660 int refined_corner_idx =
661 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k;
664 double(i)/cells_per_dim[0], double(j)/cells_per_dim[1], double(k)/cells_per_dim[2] };
666 refined_corners[refined_corner_idx] =
Geometry<0, 3>(this->global(local_refined_corner));
674 const int refined_faces_size =
675 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
676 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
677 + (cells_per_dim[0]*(cells_per_dim[1]+1)*cells_per_dim[2]);
678 refined_faces.resize(refined_faces_size);
679 refined_face_tags.resize(refined_faces_size);
680 refined_face_normals.resize(refined_faces_size);
717 for (
int constant_direction = 0; constant_direction < 3; ++constant_direction){
722 std::array<int,3> cells_per_dim_mixed = {
723 cells_per_dim[(2+constant_direction)%3],
724 cells_per_dim[(1+constant_direction)%3],
725 cells_per_dim[constant_direction % 3] };
726 for (
int l = 0; l < cells_per_dim_mixed[0] + 1; ++l) {
727 for (
int m = 0; m < cells_per_dim_mixed[1]; ++m) {
728 for (
int n = 0; n < cells_per_dim_mixed[2]; ++n) {
730 auto [face_type, idx, face4corners,
731 neighboring_cells_of_one_face, local_refined_face_centroid] =
732 getIndicesFace(l, m, n, constant_direction, cells_per_dim);
734 mutable_face_tags[idx]= face_type;
736 refined_face_to_point.
appendRow(face4corners.begin(), face4corners.end());
738 refined_face_to_cell.
appendRow(neighboring_cells_of_one_face.begin(),
739 neighboring_cells_of_one_face.end());
745 refined_corners[face4corners[0]].center() - global(local_refined_face_centroid);
747 refined_corners[face4corners[1]].center() - global(local_refined_face_centroid);
748 mutable_face_normals[idx] = {
749 (face_vector0[1]*face_vector1[2]) - (face_vector0[2]*face_vector1[1]),
750 (face_vector0[2]*face_vector1[0]) - (face_vector0[0]*face_vector1[2]),
751 (face_vector0[0]*face_vector1[1]) - (face_vector0[1]*face_vector1[0])};
752 mutable_face_normals[idx] /= mutable_face_normals[idx].two_norm();
753 if (face_type ==
J_FACE) {
754 mutable_face_normals[idx] *= -1;
758 std::vector<std::array<int,2>> refined_face_to_edges = {
759 { face4corners[0], face4corners[1]},
760 { face4corners[0], face4corners[2]},
761 { face4corners[1], face4corners[3]},
762 { face4corners[2], face4corners[3]}};
765 double refined_face_area = 0.0;
766 for (
int edge = 0; edge < 4; ++edge) {
770 refined_corners[refined_face_to_edges[edge][0]].center(),
771 refined_corners[refined_face_to_edges[edge][1]].center(),
772 global(local_refined_face_centroid)};
773 refined_face_area += std::fabs(
area(trian_corners));
778 refined_faces[idx] =
Geometry<2,cdim>(this->global(local_refined_face_centroid),
795 refined_cells.resize(cells_per_dim[0] * cells_per_dim[1] * cells_per_dim[2]);
798 refined_cell_to_point.resize(cells_per_dim[0] * cells_per_dim[1] * cells_per_dim[2]);
827 double sum_all_refined_cell_volumes = 0.0;
840 for (
int k = 0; k < cells_per_dim[2]; ++k) {
841 for (
int j = 0; j < cells_per_dim[1]; ++j) {
842 for (
int i = 0; i < cells_per_dim[0]; ++i) {
844 int refined_cell_idx = (k*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) +i;
848 (.5 + i)/cells_per_dim[0], (.5 + j)/cells_per_dim[1], (.5 + k)/cells_per_dim[2]};
851 double refined_cell_volume = 0.0;
854 std::array<int,8> cell8corners_indices = {
855 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k,
856 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k,
857 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k,
858 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k,
859 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k+1,
860 (j*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k+1,
861 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (i*(cells_per_dim[2]+1)) +k+1,
862 ((j+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((i+1)*(cells_per_dim[2]+1)) +k+1
865 refined_cell_to_point[refined_cell_idx] = cell8corners_indices;
869 std::vector<int> hexa_to_face = {
871 (k*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) + i,
873 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
874 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
875 + (j*cells_per_dim[0]*cells_per_dim[2]) + (i*cells_per_dim[2]) + k,
877 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
878 + (i*cells_per_dim[1]*cells_per_dim[2]) + (k*cells_per_dim[1]) + j,
880 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
881 + ((i+1)*cells_per_dim[1]*cells_per_dim[2]) + (k*cells_per_dim[1]) + j,
883 (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1)) +
884 ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
885 + ((j+1)*cells_per_dim[0]*cells_per_dim[2]) + (i*cells_per_dim[2]) + k,
887 ((k+1)*cells_per_dim[0]*cells_per_dim[1]) + (j*cells_per_dim[0]) + i};
897 std::vector<cpgrid::EntityRep<1>> faces_of_one_cell = {
898 { hexa_to_face[0],
false}, {hexa_to_face[1],
false},
899 { hexa_to_face[2],
false}, {hexa_to_face[3],
true},
900 { hexa_to_face[4],
true}, {hexa_to_face[5],
true} };
901 refined_cell_to_face.
appendRow(faces_of_one_cell.begin(), faces_of_one_cell.end());
905 std::vector<Geometry<0,3>::GlobalCoordinate> hexa_face_centroids;
906 for (
auto& idx : hexa_to_face) {
907 hexa_face_centroids.push_back(refined_faces[idx].center());
921 std::vector<std::array<int,4>> cell_face4corners;
922 cell_face4corners.reserve(6);
923 for (
int face = 0; face < 6; ++face) {
924 cell_face4corners.push_back({ refined_face_to_point[hexa_to_face[face]][0],
925 refined_face_to_point[hexa_to_face[face]][1],
926 refined_face_to_point[hexa_to_face[face]][2],
927 refined_face_to_point[hexa_to_face[face]][3]});
931 std::vector<std::vector<std::array<int,2>>> tetra_edge_indices;
932 tetra_edge_indices.reserve(6);
933 for (
auto& face_indices : cell_face4corners)
935 std::vector<std::array<int,2>> face4edges_indices = {
936 { face_indices[0], face_indices[1]},
937 { face_indices[0], face_indices[2]},
938 { face_indices[1], face_indices[3]},
939 { face_indices[2], face_indices[3]} };
940 tetra_edge_indices.push_back(face4edges_indices);
946 for (
int face = 0; face < 6; ++face) {
947 for (
int edge = 0; edge < 4; ++edge) {
951 refined_corners[tetra_edge_indices[face][edge][0]].center(),
952 refined_corners[tetra_edge_indices[face][edge][1]].center(),
953 hexa_face_centroids[face],
955 this->global(local_refined_cell_center)};
961 sum_all_refined_cell_volumes += refined_cell_volume;
964 int* indices_storage_ptr = refined_cell_to_point[refined_cell_idx].data();
966 refined_cells[refined_cell_idx] =
969 all_geom.
geomVector(std::integral_constant<int,3>()),
970 indices_storage_ptr);
977 if (std::fabs(sum_all_refined_cell_volumes - this->
volume())
980 for(
auto& cell: refined_cells){
981 cell.vol_ *= correction;
988 GlobalCoordinate pos_;
1006 const std::tuple<
enum face_tag, int,
1007 std::array<int, 4>, std::vector<cpgrid::EntityRep<0>>,
1009 getIndicesFace(
int l,
int m,
int n,
int constant_direction,
const std::array<int, 3>& cells_per_dim)
const
1012 std::vector<cpgrid::EntityRep<0>> neighboring_cells_of_one_face;
1013 switch(constant_direction) {
1018 neighboring_cells_of_one_face.push_back({((l-1)*cells_per_dim[0]*cells_per_dim[1])
1019 + (m*cells_per_dim[0]) + n,
true});
1021 if (l != cells_per_dim[2]) {
1022 neighboring_cells_of_one_face.push_back({ (l*cells_per_dim[0]*cells_per_dim[1])
1023 + (m*cells_per_dim[0]) + n,
false});
1025 return {
face_tag::K_FACE, (l*cells_per_dim[0]*cells_per_dim[1]) + (m*cells_per_dim[0]) + n,
1026 {(m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1027 (m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l,
1028 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1029 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l},
1030 neighboring_cells_of_one_face,
1031 {(.5 + n)/cells_per_dim[0], (.5 + m)/cells_per_dim[1], double(l)/cells_per_dim[2]}};
1036 neighboring_cells_of_one_face.push_back({(m*cells_per_dim[0]*cells_per_dim[1])
1037 + (n*cells_per_dim[0]) +l-1,
true});
1039 if (l != cells_per_dim[0]) {
1040 neighboring_cells_of_one_face.push_back({ (m*cells_per_dim[0]*cells_per_dim[1])
1041 + (n*cells_per_dim[0]) + l,
false});
1043 return {
face_tag::I_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
1044 + (l*cells_per_dim[1]*cells_per_dim[2]) + (m*cells_per_dim[1]) + n,
1045 {(n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1046 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1047 (n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1,
1048 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1},
1049 neighboring_cells_of_one_face,
1050 { double(l)/cells_per_dim[0], (.5 + n)/cells_per_dim[1], (.5 + m)/cells_per_dim[2]}};
1055 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1056 + ((l-1)*cells_per_dim[0]) +m,
true});
1058 if (l != cells_per_dim[1]) {
1059 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1060 + (l*cells_per_dim[0]) + m,
false});
1062 return {
face_tag::J_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2] +1))
1063 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
1064 + (l*cells_per_dim[0]*cells_per_dim[2]) + (m*cells_per_dim[2]) + n,
1065 {(l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n,
1066 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n,
1067 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n+1,
1068 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n+1},
1069 neighboring_cells_of_one_face,
1070 {(.5 + m)/cells_per_dim[0],
double(l)/cells_per_dim[1], (.5 + n)/cells_per_dim[2]}};
1073 OPM_THROW(std::logic_error,
"Unhandled dimension. This should never happen!");
1079 template<
int mydim,
int cdim >
1080 auto referenceElement(
const cpgrid::Geometry<mydim,cdim>& geo) ->
decltype(referenceElement<double,mydim>(geo.type()))
1082 return referenceElement<double,mydim>(geo.type());
Definition: DefaultGeometryPolicy.hpp:53
const EntityVariable< cpgrid::Geometry< 3 - codim, 3 >, codim > & geomVector() const
Definition: DefaultGeometryPolicy.hpp:81
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:101
bool affine() const
The mapping implemented by this geometry is constant, therefore affine.
Definition: Geometry.hpp:209
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition: Geometry.hpp:104
JacobianInverse jacobianInverse(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:203
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition: Geometry.hpp:99
Jacobian jacobian(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:196
double integrationElement(const LocalCoordinate &) const
Returns 1 for the vertex geometry.
Definition: Geometry.hpp:140
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition: Geometry.hpp:110
Geometry(const GlobalCoordinate &pos)
Construct from vertex position.
Definition: Geometry.hpp:115
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition: Geometry.hpp:106
JacobianTransposed jacobianTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:179
GeometryType type() const
Using the cube type for vertices.
Definition: Geometry.hpp:146
ctype volume() const
Volume of vertex is arbitrarily set to 1.
Definition: Geometry.hpp:166
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition: Geometry.hpp:108
GlobalCoordinate corner(int cor) const
Returns the single corner: the vertex itself.
Definition: Geometry.hpp:158
int corners() const
A vertex is defined by a single corner.
Definition: Geometry.hpp:152
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition: Geometry.hpp:172
Geometry()
Default constructor, giving a non-valid geometry.
Definition: Geometry.hpp:121
const GlobalCoordinate & global(const LocalCoordinate &) const
Returns the position of the vertex.
Definition: Geometry.hpp:127
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:188
LocalCoordinate local(const GlobalCoordinate &) const
Meaningless for the vertex geometry.
Definition: Geometry.hpp:133
double ctype
Coordinate element type.
Definition: Geometry.hpp:96
Specialization for 2 dimensional geometries, that is intersections (since codim 1 entities are not in...
Definition: Geometry.hpp:225
JacobianInverse jacobianInverse(const LocalCoordinate &) const
The inverse of the jacobian.
Definition: Geometry.hpp:345
const FieldMatrix< ctype, mydimension, coorddimension > & jacobianTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:324
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition: Geometry.hpp:317
int corners() const
The number of corners of this convex polytope.
Definition: Geometry.hpp:296
LocalCoordinate local(const GlobalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:276
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition: Geometry.hpp:246
bool affine() const
Since integrationElement() is constant, returns true.
Definition: Geometry.hpp:351
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition: Geometry.hpp:241
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition: Geometry.hpp:252
ctype volume() const
Volume (area, actually) of intersection.
Definition: Geometry.hpp:311
const FieldMatrix< ctype, coorddimension, mydimension > & jacobianInverseTransposed(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:331
GeometryType type() const
We use the singular type (None) for intersections.
Definition: Geometry.hpp:289
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition: Geometry.hpp:250
double integrationElement(const LocalCoordinate &) const
For the singular geometry, we return a constant integration element equal to the volume.
Definition: Geometry.hpp:283
Geometry()
Default constructor, giving a non-valid geometry.
Definition: Geometry.hpp:264
const GlobalCoordinate & global(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:270
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition: Geometry.hpp:248
Geometry(const GlobalCoordinate &pos, ctype vol)
Construct from centroid and volume (1- and 0-moments).
Definition: Geometry.hpp:257
double ctype
Coordinate element type.
Definition: Geometry.hpp:238
Jacobian jacobian(const LocalCoordinate &) const
The jacobian.
Definition: Geometry.hpp:338
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition: Geometry.hpp:243
GlobalCoordinate corner(int) const
This method is meaningless for singular geometries.
Definition: Geometry.hpp:302
Specialization for 3-dimensional geometries, i.e. cells.
Definition: Geometry.hpp:368
const JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local_coord) const
Inverse of Jacobian transposed.
Definition: Geometry.hpp:584
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition: Geometry.hpp:395
bool affine() const
The mapping implemented by this geometry is not generally affine.
Definition: Geometry.hpp:606
double ctype
Coordinate element type.
Definition: Geometry.hpp:381
Geometry(const GlobalCoordinate &pos, ctype vol, const EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > &allcorners, const int *corner_indices)
Construct from center, volume (1- and 0-moments) and corners.
Definition: Geometry.hpp:407
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition: Geometry.hpp:386
GlobalCoordinate corner(int cor) const
Get the cor-th of 8 corners of the hexahedral base cell.
Definition: Geometry.hpp:519
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition: Geometry.hpp:393
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:506
double integrationElement(const LocalCoordinate &local_coord) const
Equal to \sqrt{\det{J^T J}} where J is the Jacobian.
Definition: Geometry.hpp:498
const JacobianTransposed jacobianTransposed(const LocalCoordinate &local_coord) const
Jacobian transposed.
Definition: Geometry.hpp:548
GlobalCoordinate global(const LocalCoordinate &local_coord) const
Provide a trilinear mapping.
Definition: Geometry.hpp:442
Geometry()
Default constructor, giving a non-valid geometry.
Definition: Geometry.hpp:432
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition: Geometry.hpp:391
LocalCoordinate local(const GlobalCoordinate &y) const
Mapping from the cell to the reference domain.
Definition: Geometry.hpp:473
int corners() const
The number of corners of this convex polytope.
Definition: Geometry.hpp:513
ctype volume() const
Cell volume.
Definition: Geometry.hpp:526
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition: Geometry.hpp:536
Jacobian jacobian(const LocalCoordinate &local_coord) const
The jacobian.
Definition: Geometry.hpp:593
Geometry(const GlobalCoordinate &pos, ctype vol)
Construct from centroid and volume (1- and 0-moments).
Definition: Geometry.hpp:425
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:628
Dune::FieldVector< double, 3 > PointType
Refine a single cell with regular intervals.
Definition: Geometry.hpp:627
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition: Geometry.hpp:384
JacobianInverse jacobianInverse(const LocalCoordinate &local_coord) const
The inverse of the jacobian.
Definition: Geometry.hpp:600
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition: Geometry.hpp:389
This class encapsulates geometry for vertices, intersections, and cells.
Definition: Geometry.hpp:74
void appendRow(DataIter row_beg, DataIter row_end)
Appends a row to the table.
Definition: SparseTable.hpp:108
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