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);
420 : pos_(0.0), vol_(0.0), allcorners_(0), cor_idx_(0)
431 static_assert(mydimension == 3,
"");
432 static_assert(coorddimension == 3,
"");
435 uvw[0] -= local_coord;
437 const int pat[8][3] = { { 0, 0, 0 },
446 for (
int i = 0; i < 8; ++i) {
449 for (
int j = 0; j < 3; ++j) {
450 factor *= uvw[pat[i][j]][j];
452 corner_contrib *= factor;
453 xyz += corner_contrib;
462 static_assert(mydimension == 3,
"");
463 static_assert(coorddimension == 3,
"");
466 const ctype epsilon = 1e-12;
467 auto refElement = Dune::ReferenceElements<ctype, 3>::cube();
475 MatrixHelperType::template xTRightInvA<3, 3>(JT, z, dx );
477 }
while (dx.two_norm2() > epsilon*epsilon);
488 return MatrixHelperType::template sqrtDetAAT<3, 3>(Jt);
495 return Dune::GeometryTypes::cube(mydimension);
508 assert(allcorners_ && cor_idx_);
509 return (allcorners_->data())[cor_idx_[cor]].center();
518 void set_volume(ctype
volume) {
534 const JacobianTransposed
537 static_assert(mydimension == 3,
"");
538 static_assert(coorddimension == 3,
"");
542 uvw[0] -= local_coord;
544 const int pat[8][3] = { { 0, 0, 0 },
553 for (
int i = 0; i < 8; ++i) {
554 for (
int deriv = 0; deriv < 3; ++deriv) {
557 for (
int j = 0; j < 3; ++j) {
558 factor *= (j != deriv) ? uvw[pat[i][j]][j]
559 : (pat[i][j] == 0 ? -1.0 : 1.0);
562 corner_contrib *= factor;
563 Jt[deriv] += corner_contrib;
570 const JacobianInverseTransposed
582 return jacobianTransposed(local_coord).transposed();
589 return jacobianInverseTransposed(local_coord).transposed();
619 std::vector<std::array<int,8>>& refined_cell_to_point,
625 const std::array<int,3>& patch_dim,
626 const std::vector<double>& widthsX,
627 const std::vector<double>& lengthsY,
628 const std::vector<double>& heightsZ)
const
631 *(all_geom.
geomVector(std::integral_constant<int,3>()));
633 *(all_geom.
geomVector(std::integral_constant<int,1>()));
635 *(all_geom.
geomVector(std::integral_constant<int,0>()));
645 const std::array<int,3>& refined_dim = { cells_per_dim[0]*patch_dim[0],
646 cells_per_dim[1]*patch_dim[1],
647 cells_per_dim[2]*patch_dim[2]};
648 refined_corners.resize((refined_dim[0] + 1)*(refined_dim[1] + 1)*(refined_dim[2] + 1));
655 assert(
static_cast<int>(widthsX.size()) == patch_dim[0]);
656 assert(
static_cast<int>(lengthsY.size()) == patch_dim[1]);
657 assert(
static_cast<int>(heightsZ.size()) == patch_dim[2]);
658 const auto localCoordNumerator = [](
const std::vector<double>& vec,
int sumLimit,
double multiplier) {
660 assert(!vec.empty());
661 assert(sumLimit <
static_cast<int>(vec.size()));
662 lcn += multiplier*vec[sumLimit];
663 for (
int m = 0; m < sumLimit; ++m) {
670 const double sumWidths = std::accumulate(widthsX.begin(), widthsX.end(),
double(0));
672 const double sumLengths = std::accumulate(lengthsY.begin(), lengthsY.end(),
double(0));
674 const double sumHeights = std::accumulate(heightsZ.begin(), heightsZ.end(),
double(0));
677 for (
int j = 0; j < refined_dim[1] +1; ++j) {
679 for (
int i = 0; i < refined_dim[0] +1; ++i) {
681 for (
int k = 0; k < refined_dim[2] +1; ++k) {
685 int refined_corner_idx =
686 (j*(refined_dim[0]+1)*(refined_dim[2]+1)) + (i*(refined_dim[2]+1)) + k;
689 if ( i == refined_dim[0]) {
692 local_x = localCoordNumerator(widthsX, i/cells_per_dim[0],
double((i % cells_per_dim[0])) / cells_per_dim[0]);
694 if ( j == refined_dim[1]) {
695 local_y = sumLengths;
697 local_y = localCoordNumerator(lengthsY, j/cells_per_dim[1],
double((j % cells_per_dim[1])) / cells_per_dim[1]);
699 if ( k == refined_dim[2]) {
700 local_z = sumHeights;
702 local_z = localCoordNumerator(heightsZ, k/cells_per_dim[2],
double((k % cells_per_dim[2])) /cells_per_dim[2]);
705 const LocalCoordinate& local_refined_corner = { local_x/sumWidths, local_y/sumLengths, local_z/sumHeights };
706 assert(local_x/sumWidths <= 1.);
707 assert(local_y/sumLengths <= 1.);
708 assert(local_z/sumHeights <= 1.);
711 refined_corners[refined_corner_idx] =
Geometry<0, 3>(this->global(local_refined_corner));
719 const int refined_faces_size =
720 (refined_dim[0]*refined_dim[1]*(refined_dim[2]+1))
721 + ((refined_dim[0]+1)*refined_dim[1]*refined_dim[2])
722 + (refined_dim[0]*(refined_dim[1]+1)*refined_dim[2]);
723 refined_faces.resize(refined_faces_size);
724 refined_face_tags.resize(refined_faces_size);
725 refined_face_normals.resize(refined_faces_size);
762 for (
int constant_direction = 0; constant_direction < 3; ++constant_direction){
767 std::array<int,3> refined_dim_mixed = {
768 refined_dim[(2+constant_direction)%3],
769 refined_dim[(1+constant_direction)%3],
770 refined_dim[constant_direction % 3] };
771 for (
int l = 0; l < refined_dim_mixed[0] + 1; ++l) {
772 for (
int m = 0; m < refined_dim_mixed[1]; ++m) {
773 for (
int n = 0; n < refined_dim_mixed[2]; ++n) {
775 auto [
face_tag, idx, face_to_point, face_to_cell, wrong_local_centroid] =
776 getIndicesFace(l, m, n, constant_direction, refined_dim);
780 refined_face_to_point.
appendRow(face_to_point.begin(), face_to_point.end());
782 refined_face_to_cell.
appendRow(face_to_cell.begin(), face_to_cell.end());
785 for (
int corn = 0; corn < 4; ++corn){
786 face_center += refined_corners[face_to_point[corn]].center();
793 GlobalCoordinate face_vector0 = refined_corners[face_to_point[0]].center() - face_center;
794 GlobalCoordinate face_vector1 = refined_corners[face_to_point[1]].center() - face_center;
795 mutable_face_normals[idx] = {
796 (face_vector0[1]*face_vector1[2]) - (face_vector0[2]*face_vector1[1]),
797 (face_vector0[2]*face_vector1[0]) - (face_vector0[0]*face_vector1[2]),
798 (face_vector0[0]*face_vector1[1]) - (face_vector0[1]*face_vector1[0])};
799 mutable_face_normals[idx] /= mutable_face_normals[idx].two_norm();
801 mutable_face_normals[idx] *= -1;
805 std::vector<std::array<int,2>> refined_face_to_edges = {
806 { face_to_point[0], face_to_point[1] },
807 { face_to_point[0], face_to_point[2] },
808 { face_to_point[1], face_to_point[3] },
809 { face_to_point[2], face_to_point[3] }
813 double refined_face_area = 0.0;
814 for (
int edge = 0; edge < 4; ++edge) {
818 refined_corners[refined_face_to_edges[edge][0]].center(),
819 refined_corners[refined_face_to_edges[edge][1]].center(),
821 refined_face_area += std::fabs(
area(trian_corners));
842 refined_cells.resize(refined_dim[0] * refined_dim[1] * refined_dim[2]);
845 refined_cell_to_point.resize(refined_dim[0] * refined_dim[1] * refined_dim[2]);
874 double sum_all_refined_cell_volumes = 0.0;
887 for (
int k = 0; k < refined_dim[2]; ++k) {
888 for (
int j = 0; j < refined_dim[1]; ++j) {
889 for (
int i = 0; i < refined_dim[0]; ++i) {
891 int refined_cell_idx = (k*refined_dim[0]*refined_dim[1]) + (j*refined_dim[0]) +i;
894 double refined_cell_volume = 0.0;
897 std::array<int,8> cell_to_point = {
898 (j*(refined_dim[0]+1)*(refined_dim[2]+1)) + (i*(refined_dim[2]+1)) +k,
899 (j*(refined_dim[0]+1)*(refined_dim[2]+1)) + ((i+1)*(refined_dim[2]+1)) +k,
900 ((j+1)*(refined_dim[0]+1)*(refined_dim[2]+1)) + (i*(refined_dim[2]+1)) +k,
901 ((j+1)*(refined_dim[0]+1)*(refined_dim[2]+1)) + ((i+1)*(refined_dim[2]+1)) +k,
902 (j*(refined_dim[0]+1)*(refined_dim[2]+1)) + (i*(refined_dim[2]+1)) +k+1,
903 (j*(refined_dim[0]+1)*(refined_dim[2]+1)) + ((i+1)*(refined_dim[2]+1)) +k+1,
904 ((j+1)*(refined_dim[0]+1)*(refined_dim[2]+1)) + (i*(refined_dim[2]+1)) +k+1,
905 ((j+1)*(refined_dim[0]+1)*(refined_dim[2]+1)) + ((i+1)*(refined_dim[2]+1)) +k+1
908 refined_cell_to_point[refined_cell_idx] = cell_to_point;
912 for (
int corn = 0; corn < 8; ++corn) {
913 refined_cell_center += refined_corners[cell_to_point[corn]].center();
915 refined_cell_center /= 8.;
919 std::vector<int> hexa_to_face = {
921 (k*refined_dim[0]*refined_dim[1]) + (j*refined_dim[0]) + i,
923 (refined_dim[0]*refined_dim[1]*(refined_dim[2]+1))
924 + ((refined_dim[0]+1)*refined_dim[1]*refined_dim[2])
925 + (j*refined_dim[0]*refined_dim[2]) + (i*refined_dim[2]) + k,
927 (refined_dim[0]*refined_dim[1]*(refined_dim[2]+1))
928 + (i*refined_dim[1]*refined_dim[2]) + (k*refined_dim[1]) + j,
930 (refined_dim[0]*refined_dim[1]*(refined_dim[2]+1))
931 + ((i+1)*refined_dim[1]*refined_dim[2]) + (k*refined_dim[1]) + j,
933 (refined_dim[0]*refined_dim[1]*(refined_dim[2]+1)) +
934 ((refined_dim[0]+1)*refined_dim[1]*refined_dim[2])
935 + ((j+1)*refined_dim[0]*refined_dim[2]) + (i*refined_dim[2]) + k,
937 ((k+1)*refined_dim[0]*refined_dim[1]) + (j*refined_dim[0]) + i};
947 std::vector<cpgrid::EntityRep<1>> cell_to_face = {
948 { hexa_to_face[0],
false}, {hexa_to_face[1],
false},
949 { hexa_to_face[2],
false}, {hexa_to_face[3],
true},
950 { hexa_to_face[4],
true}, {hexa_to_face[5],
true} };
951 refined_cell_to_face.
appendRow(cell_to_face.begin(), cell_to_face.end());
955 std::vector<Geometry<0,3>::GlobalCoordinate> hexa_face_centroids;
956 for (
auto& idx : hexa_to_face) {
957 hexa_face_centroids.push_back(refined_faces[idx].center());
971 std::vector<std::array<int,4>> cell_face4corners;
972 cell_face4corners.reserve(6);
973 for (
int face = 0; face < 6; ++face) {
974 cell_face4corners.push_back({
975 refined_face_to_point[hexa_to_face[face]][0],
976 refined_face_to_point[hexa_to_face[face]][1],
977 refined_face_to_point[hexa_to_face[face]][2],
978 refined_face_to_point[hexa_to_face[face]][3] });
982 std::vector<std::vector<std::array<int,2>>> tetra_edge_indices;
983 tetra_edge_indices.reserve(6);
984 for (
auto& face_indices : cell_face4corners)
986 std::vector<std::array<int,2>> face4edges_indices = {
987 { face_indices[0], face_indices[1]},
988 { face_indices[0], face_indices[2]},
989 { face_indices[1], face_indices[3]},
990 { face_indices[2], face_indices[3]} };
991 tetra_edge_indices.push_back(face4edges_indices);
997 for (
int face = 0; face < 6; ++face) {
998 for (
int edge = 0; edge < 4; ++edge) {
1002 refined_corners[tetra_edge_indices[face][edge][0]].center(),
1003 refined_corners[tetra_edge_indices[face][edge][1]].center(),
1004 hexa_face_centroids[face],
1005 refined_cell_center };
1011 sum_all_refined_cell_volumes += refined_cell_volume;
1014 int* indices_storage_ptr = refined_cell_to_point[refined_cell_idx].data();
1016 refined_cells[refined_cell_idx] =
1018 refined_cell_volume,
1019 all_geom.
geomVector(std::integral_constant<int,3>()),
1020 indices_storage_ptr);
1027 if (std::fabs(sum_all_refined_cell_volumes - this->
volume())
1030 for(
auto& cell: refined_cells){
1031 cell.vol_ *= correction;
1038 GlobalCoordinate pos_;
1040 std::shared_ptr<const EntityVariable<Geometry<0, 3>,3>> allcorners_;
1041 const int* cor_idx_;
1056 const std::tuple<
enum face_tag, int,
1057 std::array<int, 4>, std::vector<cpgrid::EntityRep<0>>,
1059 getIndicesFace(
int l,
int m,
int n,
int constant_direction,
const std::array<int, 3>& cells_per_dim)
const
1062 std::vector<cpgrid::EntityRep<0>> neighboring_cells_of_one_face;
1063 switch(constant_direction) {
1068 neighboring_cells_of_one_face.push_back({((l-1)*cells_per_dim[0]*cells_per_dim[1])
1069 + (m*cells_per_dim[0]) + n,
true});
1071 if (l != cells_per_dim[2]) {
1072 neighboring_cells_of_one_face.push_back({ (l*cells_per_dim[0]*cells_per_dim[1])
1073 + (m*cells_per_dim[0]) + n,
false});
1075 return {
face_tag::K_FACE, (l*cells_per_dim[0]*cells_per_dim[1]) + (m*cells_per_dim[0]) + n,
1076 {(m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1077 (m*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l,
1078 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (n*(cells_per_dim[2]+1)) +l,
1079 ((m+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((n+1)*(cells_per_dim[2]+1)) +l},
1080 neighboring_cells_of_one_face,
1081 {(.5 + n)/cells_per_dim[0], (.5 + m)/cells_per_dim[1], double(l)/cells_per_dim[2]}};
1086 neighboring_cells_of_one_face.push_back({(m*cells_per_dim[0]*cells_per_dim[1])
1087 + (n*cells_per_dim[0]) +l-1,
true});
1089 if (l != cells_per_dim[0]) {
1090 neighboring_cells_of_one_face.push_back({ (m*cells_per_dim[0]*cells_per_dim[1])
1091 + (n*cells_per_dim[0]) + l,
false});
1093 return {
face_tag::I_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2]+1))
1094 + (l*cells_per_dim[1]*cells_per_dim[2]) + (m*cells_per_dim[1]) + n,
1095 {(n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1096 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m,
1097 (n*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1,
1098 ((n+1)*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (l*(cells_per_dim[2]+1)) +m+1},
1099 neighboring_cells_of_one_face,
1100 { double(l)/cells_per_dim[0], (.5 + n)/cells_per_dim[1], (.5 + m)/cells_per_dim[2]}};
1105 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1106 + ((l-1)*cells_per_dim[0]) +m,
true});
1108 if (l != cells_per_dim[1]) {
1109 neighboring_cells_of_one_face.push_back({(n*cells_per_dim[0]*cells_per_dim[1])
1110 + (l*cells_per_dim[0]) + m,
false});
1112 return {
face_tag::J_FACE, (cells_per_dim[0]*cells_per_dim[1]*(cells_per_dim[2] +1))
1113 + ((cells_per_dim[0]+1)*cells_per_dim[1]*cells_per_dim[2])
1114 + (l*cells_per_dim[0]*cells_per_dim[2]) + (m*cells_per_dim[2]) + n,
1115 {(l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n,
1116 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n,
1117 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + (m*(cells_per_dim[2]+1)) +n+1,
1118 (l*(cells_per_dim[0]+1)*(cells_per_dim[2]+1)) + ((m+1)*(cells_per_dim[2]+1)) +n+1},
1119 neighboring_cells_of_one_face,
1120 {(.5 + m)/cells_per_dim[0],
double(l)/cells_per_dim[1], (.5 + n)/cells_per_dim[2]}};
1123 OPM_THROW(std::logic_error,
"Unhandled dimension. This should never happen!");
1129 template<
int mydim,
int cdim >
1130 auto referenceElement(
const cpgrid::Geometry<mydim,cdim>& geo) ->
decltype(referenceElement<double,mydim>(geo.type()))
1132 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 PartitionTypeIndicator.hpp:47
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:272
double ctype
Coordinate element type.
Definition Geometry.hpp:97
bool affine() const
The mapping implemented by this geometry is constant, therefore affine.
Definition Geometry.hpp:210
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition Geometry.hpp:111
JacobianInverse jacobianInverse(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:204
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 > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:107
Geometry(const GlobalCoordinate &pos)
Construct from vertex position.
Definition Geometry.hpp:116
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:100
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:102
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:109
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, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:105
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
JacobianInverse jacobianInverse(const LocalCoordinate &) const
The inverse of the jacobian.
Definition Geometry.hpp:346
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:251
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:242
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 > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:249
bool affine() const
Since integrationElement() is constant, returns true.
Definition Geometry.hpp:352
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:244
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
double integrationElement(const LocalCoordinate &) const
For the singular geometry, we return a constant integration element equal to the volume.
Definition Geometry.hpp:284
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:247
Geometry()
Default constructor, giving a non-valid geometry.
Definition Geometry.hpp:265
double ctype
Coordinate element type.
Definition Geometry.hpp:239
const GlobalCoordinate & global(const LocalCoordinate &) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:271
Geometry(const GlobalCoordinate &pos, ctype vol)
Construct from centroid and volume (1- and 0-moments).
Definition Geometry.hpp:258
Jacobian jacobian(const LocalCoordinate &) const
The jacobian.
Definition Geometry.hpp:339
GlobalCoordinate corner(int) const
This method is meaningless for singular geometries.
Definition Geometry.hpp:303
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Type of transposed Jacobian matrix.
Definition Geometry.hpp:394
const JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local_coord) const
Inverse of Jacobian transposed.
Definition Geometry.hpp:571
double ctype
Coordinate element type.
Definition Geometry.hpp:382
FieldVector< ctype, mydimension > LocalCoordinate
Domain type of.
Definition Geometry.hpp:385
bool affine() const
The mapping implemented by this geometry is not generally affine.
Definition Geometry.hpp:593
GlobalCoordinate corner(int cor) const
Get the cor-th of 8 corners of the hexahedral base cell.
Definition Geometry.hpp:506
FieldVector< ctype, coorddimension > GlobalCoordinate
Range type of.
Definition Geometry.hpp:387
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:493
void refineCellifiedPatch(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 std::array< int, 3 > &patch_dim, const std::vector< double > &widthsX, const std::vector< double > &lengthsY, const std::vector< double > &heightsZ) const
Definition Geometry.hpp:617
double integrationElement(const LocalCoordinate &local_coord) const
Equal to \sqrt{\det{J^T J}} where J is the Jacobian.
Definition Geometry.hpp:485
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Type of the inverse of the transposed Jacobian matrix.
Definition Geometry.hpp:396
const JacobianTransposed jacobianTransposed(const LocalCoordinate &local_coord) const
Jacobian transposed.
Definition Geometry.hpp:535
GlobalCoordinate global(const LocalCoordinate &local_coord) const
Provide a trilinear mapping.
Definition Geometry.hpp:429
Geometry()
Default constructor, giving a non-valid geometry.
Definition Geometry.hpp:419
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type of Jacobian matrix.
Definition Geometry.hpp:390
LocalCoordinate local(const GlobalCoordinate &y) const
Mapping from the cell to the reference domain.
Definition Geometry.hpp:460
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverse
Type of inverse of Jacobian matrix.
Definition Geometry.hpp:392
int corners() const
The number of corners of this convex polytope.
Definition Geometry.hpp:500
ctype volume() const
Cell volume.
Definition Geometry.hpp:513
const GlobalCoordinate & center() const
Returns the centroid of the geometry.
Definition Geometry.hpp:523
Jacobian jacobian(const LocalCoordinate &local_coord) const
The jacobian.
Definition Geometry.hpp:580
JacobianInverse jacobianInverse(const LocalCoordinate &local_coord) const
The inverse of the jacobian.
Definition Geometry.hpp:587
Dune::FieldVector< double, 3 > PointType
Refine a single cell considering different widths, lengths, and heights.
Definition Geometry.hpp:616
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:307
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