27 #include "utilities/geometry_utilities.h"
195 typename PointType::Pointer pPoint2,
196 typename PointType::Pointer pPoint3,
197 typename PointType::Pointer pPoint4 )
208 :
BaseType(ThisPoints, &msGeometryData)
217 ) :
BaseType(GeometryId, rThisPoints, &msGeometryData)
224 const std::string& rGeometryName,
226 ) :
BaseType( rGeometryName, rThisPoints, &msGeometryData )
306 template<
class TOtherPo
intType>
327 return typename BaseType::Pointer(
new Tetrahedra3D4(rThisPoints));
341 return typename BaseType::Pointer(
new Tetrahedra3D4( NewGeometryId, rThisPoints ) );
354 p_geometry->SetData(rGeometry.
GetData());
369 auto p_geometry =
typename BaseType::Pointer(
new Tetrahedra3D4( NewGeometryId, rGeometry.
Points() ) );
370 p_geometry->SetData(rGeometry.
GetData());
387 if(rResult.size() != 4)
389 std::fill(rResult.
begin(), rResult.
end(), 1.00 / 4.00);
414 constexpr
double factor = 2.0396489026555;
452 const double onesixth = 1.0/6.0;
455 const CoordinatesArrayType& rP1 = this->
Points()[1].Coordinates();
456 const CoordinatesArrayType& rP2 = this->
Points()[2].Coordinates();
457 const CoordinatesArrayType& rP3 = this->
Points()[3].Coordinates();
459 const double x10 = rP1[0] - rP0[0];
460 const double y10 = rP1[1] - rP0[1];
461 const double z10 = rP1[2] - rP0[2];
463 const double x20 = rP2[0] - rP0[0];
464 const double y20 = rP2[1] - rP0[1];
465 const double z20 = rP2[2] - rP0[2];
467 const double x30 = rP3[0] - rP0[0];
468 const double y30 = rP3[1] - rP0[1];
469 const double z30 = rP3[2] - rP0[2];
471 const double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
472 return detJ*onesixth;
494 const double sa = (
a[0]*
a[0])+(
a[1]*
a[1])+(
a[2]*
a[2]);
495 const double sb = (
b[0]*
b[0])+(
b[1]*
b[1])+(
b[2]*
b[2]);
496 const double sc = (
c[0]*
c[0])+(
c[1]*
c[1])+(
c[2]*
c[2]);
497 const double sd = (
d[0]*
d[0])+(
d[1]*
d[1])+(
d[2]*
d[2]);
498 const double se = (
e[0]*
e[0])+(
e[1]*
e[1])+(
e[2]*
e[2]);
499 const double sf = (
f[0]*
f[0])+(
f[1]*
f[1])+(
f[2]*
f[2]);
501 return CalculateMinEdgeLength(sa, sb, sc,
sd, se, sf);
520 const double sa = (
a[0]*
a[0])+(
a[1]*
a[1])+(
a[2]*
a[2]);
521 const double sb = (
b[0]*
b[0])+(
b[1]*
b[1])+(
b[2]*
b[2]);
522 const double sc = (
c[0]*
c[0])+(
c[1]*
c[1])+(
c[2]*
c[2]);
523 const double sd = (
d[0]*
d[0])+(
d[1]*
d[1])+(
d[2]*
d[2]);
524 const double se = (
e[0]*
e[0])+(
e[1]*
e[1])+(
e[2]*
e[2]);
525 const double sf = (
f[0]*
f[0])+(
f[1]*
f[1])+(
f[2]*
f[2]);
527 return CalculateMaxEdgeLength(sa, sb, sc,
sd, se, sf);
538 return CalculateAvgEdgeLength(
557 const CoordinatesArrayType& rP0 = this->
Points()[0].Coordinates();
558 const CoordinatesArrayType& rP1 = this->
Points()[1].Coordinates();
559 const CoordinatesArrayType& rP2 = this->
Points()[2].Coordinates();
560 const CoordinatesArrayType& rP3 = this->
Points()[3].Coordinates();
562 const double aDot = rP0[0] * rP0[0] + rP0[1] * rP0[1] + rP0[2] * rP0[2];
563 const double bDot = rP1[0] * rP1[0] + rP1[1] * rP1[1] + rP1[2] * rP1[2];
564 const double cDot = rP2[0] * rP2[0] + rP2[1] * rP2[1] + rP2[2] * rP2[2];
565 const double dDot = rP3[0] * rP3[0] + rP3[1] * rP3[1] + rP3[2] * rP3[2];
568 const double s10 = aDot - dDot;
569 const double x10 = rP0[0] - rP3[0];
570 const double y10 = rP0[1] - rP3[1];
571 const double z10 = rP0[2] - rP3[2];
573 const double s20 = bDot - dDot;
574 const double x20 = rP1[0] - rP3[0];
575 const double y20 = rP1[1] - rP3[1];
576 const double z20 = rP1[2] - rP3[2];
578 const double s30 = cDot - dDot;
579 const double x30 = rP2[0] - rP3[0];
580 const double y30 = rP2[1] - rP3[1];
581 const double z30 = rP2[2] - rP3[2];
583 const double detJMX = s10 * y20 * z30 + y10 * z20 * s30 + z10 * s20 * y30 - s30 * y20 * z10 - y30 * z20 * s10 - z30 * s20 * y10;
584 const double detJMY = s10 * x20 * z30 + x10 * z20 * s30 + z10 * s20 * x30 - s30 * x20 * z10 - x30 * z20 * s10 - z30 * s20 * x10;
585 const double detJMZ = s10 * x20 * y30 + x10 * y20 * s30 + y10 * s20 * x30 - s30 * x20 * y10 - x30 * y20 * s10 - y30 * s20 * x10;
586 const double detJAL = x10 * y20 * z30 + y10 * z20 * x30 + z10 * x20 * y30 - x30 * y20 * z10 - y30 * z20 * x10 - z30 * x20 * y10;
588 return std::sqrt( (detJMX*detJMX + detJMY*detJMY + detJMZ*detJMZ)) / (2*std::abs(detJAL));
602 const CoordinatesArrayType& rP1 = this->
Points()[1].Coordinates();
603 const CoordinatesArrayType& rP2 = this->
Points()[2].Coordinates();
604 const CoordinatesArrayType& rP3 = this->
Points()[3].Coordinates();
613 const double n012 = std::sqrt(c012[0]*c012[0] + c012[1]*c012[1] + c012[2]*c012[2]);
614 const double n013 = std::sqrt(c013[0]*c013[0] + c013[1]*c013[1] + c013[2]*c013[2]);
615 const double n023 = std::sqrt(c023[0]*c023[0] + c023[1]*c023[1] + c023[2]*c023[2]);
616 const double n123 = std::sqrt(c123[0]*c123[0] + c123[1]*c123[1] + c123[2]*c123[2]);
619 const double x10 = rP0[0] - rP3[0];
620 const double y10 = rP0[1] - rP3[1];
621 const double z10 = rP0[2] - rP3[2];
623 const double x20 = rP1[0] - rP3[0];
624 const double y20 = rP1[1] - rP3[1];
625 const double z20 = rP1[2] - rP3[2];
627 const double x30 = rP2[0] - rP3[0];
628 const double y30 = rP2[1] - rP3[1];
629 const double z30 = rP2[2] - rP3[2];
631 const double detJAL = x10 * y20 * z30 + y10 * z20 * x30 + z10 * x20 * y30 - x30 * y20 * z10 - y30 * z20 * x10 - z30 * x20 * y10;
633 return std::abs(detJAL) / (n012 + n013 + n023 + n123);
649 constexpr
double normFactor = 3.0;
665 constexpr
double normFactor = 4.89897982161;
674 const double sa = (
a[0]*
a[0])+(
a[1]*
a[1])+(
a[2]*
a[2]);
675 const double sb = (
b[0]*
b[0])+(
b[1]*
b[1])+(
b[2]*
b[2]);
676 const double sc = (
c[0]*
c[0])+(
c[1]*
c[1])+(
c[2]*
c[2]);
677 const double sd = (
d[0]*
d[0])+(
d[1]*
d[1])+(
d[2]*
d[2]);
678 const double se = (
e[0]*
e[0])+(
e[1]*
e[1])+(
e[2]*
e[2]);
679 const double sf = (
f[0]*
f[0])+(
f[1]*
f[1])+(
f[2]*
f[2]);
681 return normFactor *
Inradius() / CalculateMaxEdgeLength(sa,sb,sc,
sd,se,sf);
702 const double sa = (
a[0]*
a[0])+(
a[1]*
a[1])+(
a[2]*
a[2]);
703 const double sb = (
b[0]*
b[0])+(
b[1]*
b[1])+(
b[2]*
b[2]);
704 const double sc = (
c[0]*
c[0])+(
c[1]*
c[1])+(
c[2]*
c[2]);
705 const double sd = (
d[0]*
d[0])+(
d[1]*
d[1])+(
d[2]*
d[2]);
706 const double se = (
e[0]*
e[0])+(
e[1]*
e[1])+(
e[2]*
e[2]);
707 const double sf = (
f[0]*
f[0])+(
f[1]*
f[1])+(
f[2]*
f[2]);
709 return CalculateMinEdgeLength(sa,sb,sc,
sd,se,sf) / CalculateMaxEdgeLength(sa,sb,sc,
sd,se,sf);
722 KRATOS_ERROR <<
"Method 'RegularityQuality' is not yet implemented for Tetrahedra3D4" << std::endl;
736 KRATOS_ERROR <<
"Method 'VolumeToSurfaceAreaQuality' is not yet implemented for Tetrahedra3D4" << std::endl;
750 constexpr
double normFactor = 12.0;
759 const double sa = (
a[0]*
a[0]) + (
a[1]*
a[1]) + (
a[2]*
a[2]);
760 const double sb = (
b[0]*
b[0]) + (
b[1]*
b[1]) + (
b[2]*
b[2]);
761 const double sc = (
c[0]*
c[0]) + (
c[1]*
c[1]) + (
c[2]*
c[2]);
762 const double sd = (
d[0]*
d[0]) + (
d[1]*
d[1]) + (
d[2]*
d[2]);
763 const double se = (
e[0]*
e[0]) + (
e[1]*
e[1]) + (
e[2]*
e[2]);
764 const double sf = (
f[0]*
f[0]) + (
f[1]*
f[1]) + (
f[2]*
f[2]);
766 const double vol =
Volume();
768 return std::abs(normFactor * std::pow(9 * vol * vol, 1.0 / 3.0) / (sa + sb + sc +
sd + se + sf)) * (vol < 0 ? -1 : 1);
781 constexpr
double normFactor = 6.0 * 1.41421356237309504880;
798 constexpr
double normFactor = 6.0 * 1.41421356237309504880;
807 const double sa = (
a[0]*
a[0])+(
a[1]*
a[1])+(
a[2]*
a[2]);
808 const double sb = (
b[0]*
b[0])+(
b[1]*
b[1])+(
b[2]*
b[2]);
809 const double sc = (
c[0]*
c[0])+(
c[1]*
c[1])+(
c[2]*
c[2]);
810 const double sd = (
d[0]*
d[0])+(
d[1]*
d[1])+(
d[2]*
d[2]);
811 const double se = (
e[0]*
e[0])+(
e[1]*
e[1])+(
e[2]*
e[2]);
812 const double sf = (
f[0]*
f[0])+(
f[1]*
f[1])+(
f[2]*
f[2]);
814 return normFactor *
Volume() / std::pow(std::sqrt(1.0/6.0 * (sa + sb + sc +
sd + se + sf)), 3.0);
825 Vector dihedral_angles(6);
827 double min_dihedral_angle = 1000.0;
828 for (
unsigned int i = 0;
i < 6;
i++) {
829 if (dihedral_angles[
i]<min_dihedral_angle) min_dihedral_angle=dihedral_angles[
i];
831 return min_dihedral_angle;
841 Vector dihedral_angles(6);
843 double max_dihedral_angle = -1000.0;
844 for (
unsigned int i = 0;
i < 6;
i++) {
845 if (dihedral_angles[
i] > max_dihedral_angle) max_dihedral_angle = dihedral_angles[
i];
847 return max_dihedral_angle;
861 double min_solid_angle = 1000.0;
862 for (
unsigned int i = 0;
i < 4;
i++) {
863 if (solid_angles[
i]<min_solid_angle) min_solid_angle = solid_angles[
i];
865 return min_solid_angle;
877 if(rSolidAngles.size() != 4)
878 rSolidAngles.
resize(4,
false);
880 Vector dihedral_angles(6);
883 rSolidAngles[0] = dihedral_angles[0] + dihedral_angles[1] + dihedral_angles[2] -
Globals::Pi;
884 rSolidAngles[1] = dihedral_angles[0] + dihedral_angles[3] + dihedral_angles[4] -
Globals::Pi;
885 rSolidAngles[2] = dihedral_angles[2] + dihedral_angles[4] + dihedral_angles[5] -
Globals::Pi;
886 rSolidAngles[3] = dihedral_angles[1] + dihedral_angles[3] + dihedral_angles[5] -
Globals::Pi;
897 if(rDihedralAngles.size() != 6)
898 rDihedralAngles.
resize(6,
false);
901 for (
unsigned int i = 0;
i < 4;
i++) {
903 for (
unsigned int j = 0;
j < 3;
j++)
904 coords(
i,
j) = xyz[
j];
909 const int node0[] = {0, 0, 0, 1, 1, 2};
910 const int node1[] = {1, 3, 2, 3, 2, 3};
911 const int node2a[] = {2, 1, 1, 0, 0, 0};
912 const int node2b[] = {3, 2, 3, 2, 3, 1};
917 for (
unsigned int i = 0;
i < 6;
i++) {
919 for (
unsigned int j = 0;
j < 3; ++
j) {
920 edge1[
j] = coords(node1[
i],
j) - coords(node0[
i],
j) ;
921 edge2a[
j] = coords(node2a[
i],
j) - coords(node0[
i],
j) ;
922 edge2b[
j] = coords(node2b[
i],
j) - coords(node0[
i],
j) ;
927 normal1 /= std::sqrt(normal1[0]*normal1[0] + normal1[1]*normal1[1] + normal1[2]*normal1[2]);
928 normal2 /= std::sqrt(normal2[0]*normal2[0] + normal2[1]*normal2[1] + normal2[2]*normal2[2]);
931 const double angle_cos = ( normal1[0]*normal2[0] + normal1[1]*normal2[1] + normal1[2]*normal2[2] );
932 rDihedralAngles[
i] = std::acos(angle_cos);
943 if(rResult.size1()!= 4 || rResult.size2()!= 3)
944 rResult.
resize(4, 3,
false);
987 const double Tolerance = std::numeric_limits<double>::epsilon()
992 if( rResult[0] >= 0.0-Tolerance ) {
993 if( rResult[1] >= 0.0-Tolerance ) {
994 if( rResult[2] >= 0.0-Tolerance ) {
995 if( (rResult[0] + rResult[1] + rResult[2]) <= (1.0+Tolerance)) {
1164 switch( ShapeFunctionIndex )
1167 return( 1.0-(rPoint[0]+rPoint[1]+rPoint[2]) );
1169 return( rPoint[0] );
1171 return( rPoint[1] );
1173 return( rPoint[2] );
1175 KRATOS_ERROR <<
"Wrong index of shape function!" << *
this << std::endl;
1195 if(rResult.size() != 4) rResult.
resize(4,
false);
1196 rResult[0] = 1.0-(rCoordinates[0]+rCoordinates[1]+rCoordinates[2]);
1197 rResult[1] = rCoordinates[0] ;
1198 rResult[2] = rCoordinates[1] ;
1199 rResult[3] = rCoordinates[2] ;
1214 if(rResult.size1() != this->PointsNumber() || rResult.size2() != this->LocalSpaceDimension())
1217 CalculateShapeFunctionsLocalGradients(rResult, rPoint);
1241 const unsigned int integration_points_number =
1243 KRATOS_ERROR_IF(integration_points_number == 0) <<
"This integration method is not supported" << *
this << std::endl;
1246 const double x10 = this->
Points()[1].X() - this->
Points()[0].X();
1247 const double y10 = this->
Points()[1].Y() - this->
Points()[0].Y();
1248 const double z10 = this->
Points()[1].Z() - this->
Points()[0].Z();
1250 const double x20 = this->
Points()[2].X() - this->
Points()[0].X();
1251 const double y20 = this->
Points()[2].Y() - this->
Points()[0].Y();
1252 const double z20 = this->
Points()[2].Z() - this->
Points()[0].Z();
1254 const double x30 = this->
Points()[3].X() - this->
Points()[0].X();
1255 const double y30 = this->
Points()[3].Y() - this->
Points()[0].Y();
1256 const double z30 = this->
Points()[3].Z() - this->
Points()[0].Z();
1258 const double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
1260 DN_DX(0,0) = -y20 * z30 + y30 * z20 + y10 * z30 - z10 * y30 - y10 * z20 + z10 * y20;
1261 DN_DX(0,1) = -z20 * x30 + x20 * z30 - x10 * z30 + z10 * x30 + x10 * z20 - z10 * x20;
1262 DN_DX(0,2) = -x20 * y30 + y20 * x30 + x10 * y30 - y10 * x30 - x10 * y20 + y10 * x20;
1263 DN_DX(1,0) = y20 * z30 - y30 * z20;
1264 DN_DX(1,1) = z20 * x30 - x20 * z30;
1265 DN_DX(1,2) = x20 * y30 - y20 * x30;
1266 DN_DX(2,0) = -y10 * z30 + z10 * y30;
1267 DN_DX(2,1) = x10 * z30 - z10 * x30;
1268 DN_DX(2,2) = -x10 * y30 + y10 * x30;
1269 DN_DX(3,0) = y10 * z20 - z10 * y20;
1270 DN_DX(3,1) = -x10 * z20 + z10 * x20;
1271 DN_DX(3,2) = x10 * y20 - y10 * x20;
1274 if(rResult.size() != integration_points_number) {
1275 rResult.
resize(integration_points_number,
false);
1278 for(
unsigned int i=0;
i<integration_points_number;
i++)
1285 ,
Vector& determinants_of_jacobian
1288 const unsigned int integration_points_number =
1290 KRATOS_ERROR_IF(integration_points_number == 0) <<
"This integration method is not supported" << *
this << std::endl;
1293 const double x10 = this->
Points()[1].X() - this->
Points()[0].X();
1294 const double y10 = this->
Points()[1].Y() - this->
Points()[0].Y();
1295 const double z10 = this->
Points()[1].Z() - this->
Points()[0].Z();
1297 const double x20 = this->
Points()[2].X() - this->
Points()[0].X();
1298 const double y20 = this->
Points()[2].Y() - this->
Points()[0].Y();
1299 const double z20 = this->
Points()[2].Z() - this->
Points()[0].Z();
1301 const double x30 = this->
Points()[3].X() - this->
Points()[0].X();
1302 const double y30 = this->
Points()[3].Y() - this->
Points()[0].Y();
1303 const double z30 = this->
Points()[3].Z() - this->
Points()[0].Z();
1305 const double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
1307 DN_DX(0,0) = -y20 * z30 + y30 * z20 + y10 * z30 - z10 * y30 - y10 * z20 + z10 * y20;
1308 DN_DX(0,1) = -z20 * x30 + x20 * z30 - x10 * z30 + z10 * x30 + x10 * z20 - z10 * x20;
1309 DN_DX(0,2) = -x20 * y30 + y20 * x30 + x10 * y30 - y10 * x30 - x10 * y20 + y10 * x20;
1310 DN_DX(1,0) = y20 * z30 - y30 * z20;
1311 DN_DX(1,1) = z20 * x30 - x20 * z30;
1312 DN_DX(1,2) = x20 * y30 - y20 * x30;
1313 DN_DX(2,0) = -y10 * z30 + z10 * y30;
1314 DN_DX(2,1) = x10 * z30 - z10 * x30;
1315 DN_DX(2,2) = -x10 * y30 + y10 * x30;
1316 DN_DX(3,0) = y10 * z20 - z10 * y20;
1317 DN_DX(3,1) = -x10 * z20 + z10 * x20;
1318 DN_DX(3,2) = x10 * y20 - y10 * x20;
1322 if(determinants_of_jacobian.size() != integration_points_number )
1323 determinants_of_jacobian.
resize(integration_points_number,
false);
1325 for(
unsigned int i=0;
i<integration_points_number;
i++)
1326 determinants_of_jacobian[
i] = detJ;
1331 if(rResult.size() != integration_points_number) {
1332 rResult.
resize(integration_points_number,
false);
1334 for(
unsigned int i=0;
i<integration_points_number;
i++)
1346 if ( rResult.size() != this->PointsNumber() )
1372 for (
auto& face : faces) {
1373 if (face.HasIntersection(rThisGeometry)) {
1384 std::vector<BaseType> intersections;
1387 intersections.push_back(rThisGeometry);
1388 for (
unsigned int i = 0;
i < 4; ++
i) {
1389 std::vector<BaseType> inside;
1390 for (
unsigned int j = 0;
j < intersections.size(); ++
j) {
1393 intersections = inside;
1395 return bool (intersections.size() > 0);
1414 return IsInside(rLowPoint,local_coordinates);
1420 std::vector<BaseType>& inside)
const
1425 int positive = 0, negative = 0,
zero = 0;
1444 for (
i = 0;
i < 4; ++
i) {
1448 pos[positive++] =
i;
1449 else if (
C[
i] < 0.00)
1450 neg[negative++] =
i;
1457 if (negative == 0) {
1462 if (positive == 0) {
1464 inside.push_back(tetra);
1468 double w0,
w1, invCDiff;
1472 if (positive == 3) {
1474 for (
i = 0;
i < positive; ++
i) {
1475 invCDiff = 1.00/(
C[pos[
i]] -
C[neg[0]]);
1476 w0 = -
C[neg[0]]*invCDiff;
1477 w1 = +
C[pos[
i]]*invCDiff;
1478 V[pos[
i]] = w0*tetra[pos[
i]].Coordinates() +
w1*tetra[neg[0]].Coordinates();
1481 }
else if (positive == 2) {
1482 if (negative == 2) {
1484 for (
i = 0;
i < positive; ++
i) {
1485 invCDiff = (1.00)/(
C[pos[
i]] -
C[neg[0]]);
1486 w0 = -
C[neg[0]]*invCDiff;
1487 w1 = +
C[pos[
i]]*invCDiff;
1488 intp[
i] = w0*tetra[pos[
i]].Coordinates() +
w1*tetra[neg[0]].Coordinates();
1490 for (
i = 0;
i < negative; ++
i) {
1491 invCDiff = (1.00)/(
C[pos[
i]] -
C[neg[1]]);
1492 w0 = -
C[neg[1]]*invCDiff;
1493 w1 = +
C[pos[
i]]*invCDiff;
1494 intp[
i+2] = w0*tetra[pos[
i]].Coordinates() +
w1*tetra[neg[1]].Coordinates();
1497 V[pos[0]] = intp[2];
1498 V[pos[1]] = intp[1];
1499 inside.push_back(tetra);
1502 for (
i = 0;
i < positive; ++
i) {
1503 invCDiff = (1.00)/(
C[pos[
i]] -
C[neg[0]]);
1504 w0 = -
C[neg[0]]*invCDiff;
1505 w1 = +
C[pos[
i]]*invCDiff;
1506 V[pos[
i]] = w0*tetra[pos[
i]].Coordinates() +
w1*tetra[neg[0]].Coordinates();
1510 }
else if (positive == 1) {
1511 if (negative == 3) {
1513 for (
i = 0;
i < negative; ++
i) {
1514 invCDiff = (1.00)/(
C[pos[0]] -
C[neg[
i]]);
1515 w0 = -
C[neg[
i]]*invCDiff;
1516 w1 = +
C[pos[0]]*invCDiff;
1517 intp[
i] = w0*tetra[pos[0]] +
w1*tetra[neg[
i]];
1520 V[pos[0]] = intp[0];
1521 inside.push_back(tetra);
1522 }
else if (negative == 2) {
1524 for (
i = 0;
i < negative; ++
i) {
1525 invCDiff = (1.00)/(
C[pos[0]] -
C[neg[
i]]);
1526 w0 = -
C[neg[
i]]*invCDiff;
1527 w1 = +
C[pos[0]]*invCDiff;
1528 intp[
i] = w0*tetra[pos[0]] +
w1*tetra[neg[
i]];
1531 V[pos[0]] = intp[0];
1532 inside.push_back(tetra);
1535 invCDiff = (1.00)/(
C[pos[0]] -
C[neg[0]]);
1536 w0 = -
C[neg[0]]*invCDiff;
1537 w1 = +
C[pos[0]]*invCDiff;
1538 V[pos[0]] = w0*tetra[pos[0]] +
w1*tetra[neg[0]];
1559 const double det =
inner_prod(edge10, plane[3].mNormal);
1562 for (
unsigned int i = 0;
i < 4; ++
i) {
1563 plane[
i].mNormal = -plane[
i].mNormal;
1567 for (
unsigned int i = 0;
i < 4; ++
i) {
1568 plane[
i].mConstant =
inner_prod(geom_1[
i].Coordinates(), plane[
i].mNormal);
1590 const double Tolerance = std::numeric_limits<double>::epsilon()
1594 const Point point(rPointGlobalCoordinates);
1598 if (this->
IsInside(rPointGlobalCoordinates, aux_coordinates, Tolerance)) {
1603 std::array<double, 4> distances;
1608 const auto min = std::min_element(distances.begin(), distances.end());
1625 return "3 dimensional tetrahedra with four nodes in 3D space";
1637 rOStream <<
"3 dimensional tetrahedra with four nodes in 3D space";
1653 std::cout << std::endl;
1659 rOStream <<
" Jacobian in the origin\t : " << jacobian;
1684 void save(
Serializer& rSerializer)
const override
1712 rResult(0,0) = -1.0;
1713 rResult(0,1) = -1.0;
1714 rResult(0,2) = -1.0;
1735 static Matrix CalculateShapeFunctionsIntegrationPointsValues(
1739 AllIntegrationPoints();
1742 const int integration_points_number = integration_points.size();
1744 const int points_number = 4;
1746 Matrix shape_function_values(integration_points_number, points_number );
1748 for(
int pnt = 0; pnt < integration_points_number; pnt++)
1750 shape_function_values(pnt,0) = ( 1.0
1751 -integration_points[pnt].X()
1752 -integration_points[pnt].Y()
1753 -integration_points[pnt].Z() );
1754 shape_function_values(pnt,1) = integration_points[pnt].X();
1755 shape_function_values(pnt,2) = integration_points[pnt].Y();
1756 shape_function_values(pnt,3) = integration_points[pnt].Z();
1758 return shape_function_values;
1771 CalculateShapeFunctionsIntegrationPointsLocalGradients(
1775 AllIntegrationPoints();
1778 const int integration_points_number = integration_points.size();
1782 for(
int pnt=0; pnt<integration_points_number; pnt++ )
1797 d_shape_f_values[pnt] = result;
1799 return d_shape_f_values;
1807 Quadrature<TetrahedronGaussLegendreIntegrationPoints1,
1808 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1809 Quadrature<TetrahedronGaussLegendreIntegrationPoints2,
1810 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1811 Quadrature<TetrahedronGaussLegendreIntegrationPoints3,
1812 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1813 Quadrature<TetrahedronGaussLegendreIntegrationPoints4,
1814 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1815 Quadrature<TetrahedronGaussLegendreIntegrationPoints5,
1816 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1819 return integration_points;
1827 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1829 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1831 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1833 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1835 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1839 return shape_functions_values;
1843 AllShapeFunctionsLocalGradients()
1848 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1850 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1852 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1854 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1856 Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1860 return shape_functions_local_gradients;
1875 inline double CalculateMinEdgeLength(
double sa,
double sb,
double sc,
double sd,
double se,
double sf)
const {
1876 return std::sqrt(
std::min({sa, sb, sc,
sd, se, sf}));
1891 inline double CalculateMaxEdgeLength(
double sa,
double sb,
double sc,
double sd,
double se,
double sf)
const {
1892 return std::sqrt(
std::max({sa, sb, sc,
sd, se, sf}));
1907 inline double CalculateAvgEdgeLength(
double a,
double b,
double c,
double d,
double e,
double f)
const {
1908 return (
a +
b +
c +
d +
e +
f) * 1.0/6.0;
1923 inline double CalculateCircumradius(
double a,
double b,
double c,
double d,
double e,
double f)
const {
1924 KRATOS_ERROR <<
"Circumradius function hasn't been implemented yet" << std::endl;
1940 inline double CalculateInradius(
double a,
double b,
double c,
double d,
double e,
double f)
const {
1941 KRATOS_ERROR <<
"Inradius function hasn't been implemented yet" << std::endl;
1978 rOStream << std::endl;
1985 template<
class TPo
intType>
const
1986 GeometryData Tetrahedra3D4<TPointType>::msGeometryData(
1989 Tetrahedra3D4<TPointType>::AllIntegrationPoints(),
1990 Tetrahedra3D4<TPointType>::AllShapeFunctionsValues(),
1991 AllShapeFunctionsLocalGradients()
1994 template<
class TPo
intType>
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
SizeType IntegrationPointsNumber() const
Definition: geometry_data.h:430
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
void push_back(PointPointerType x)
Definition: geometry.h:548
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
SizeType LocalSpaceDimension() const
Definition: geometry.h:1300
std::size_t SizeType
Definition: geometry.h:144
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
const PointsArrayType & Points() const
Definition: geometry.h:1768
bool AllPointsAreValid() const
Checks if the geometry points are valid Checks if the geometry points are valid from the pointer valu...
Definition: geometry.h:4093
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
LumpingMethods
This defines the different methods to compute the lumping methods.
Definition: geometry.h:109
JacobiansType & Jacobian(JacobiansType &rResult) const
Definition: geometry.h:2901
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
static TGeometryType::CoordinatesArrayType & PointLocalCoordinatesPlanarFaceTetrahedra(const TGeometryType &rGeometry, typename TGeometryType::CoordinatesArrayType &rResult, const typename TGeometryType::CoordinatesArrayType &rPoint)
Returns the local coordinates of a given arbitrary point for a given linear tetrahedra.
Definition: geometry_utilities.h:67
static double PointDistanceToTriangle3D(const Point &rTrianglePoint1, const Point &rTrianglePoint2, const Point &rTrianglePoint3, const Point &rPoint)
This function calculates the distance of a 3D point to a 3D triangle.
Definition: geometry_utilities.cpp:172
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
void swap(Matrix &Other)
Definition: amatrix_interface.h:289
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
iterator end()
Definition: amatrix_interface.h:243
iterator begin()
Definition: amatrix_interface.h:241
An two node 3D line geometry with linear shape functions.
Definition: line_3d_2.h:64
Various mathematical utilitiy functions.
Definition: math_utils.h:62
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
static void UnitCrossProduct(T1 &c, const T2 &a, const T3 &b)
Performs the unitary cross product of the two input vectors a,b.
Definition: math_utils.h:831
double DistanceTo(const array_1d< double, 3 > &p)
Calcula la distancia del punto al plano.
Definition: plane.h:81
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
A four node tetrahedra geometry with linear shape functions.
Definition: tetrahedra_3d_4.h:59
Tetrahedra3D4 & operator=(const Tetrahedra3D4 &rOther)
Definition: tetrahedra_3d_4.h:289
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: tetrahedra_3d_4.h:1161
double AverageEdgeLength() const override
Definition: tetrahedra_3d_4.h:537
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: tetrahedra_3d_4.h:1033
BaseType::Pointer Create(const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_4.h:349
Geometry< TPointType > BaseType
Definition: tetrahedra_3d_4.h:68
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: tetrahedra_3d_4.h:269
ShapeFunctionsSecondDerivativesType & ShapeFunctionsSecondDerivatives(ShapeFunctionsSecondDerivativesType &rResult, const CoordinatesArrayType &rPoint) const override
Definition: tetrahedra_3d_4.h:1344
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: tetrahedra_3d_4.h:1020
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, Vector &determinants_of_jacobian, IntegrationMethod ThisMethod) const override
Definition: tetrahedra_3d_4.h:1283
double MinSolidAngle() const override
Definition: tetrahedra_3d_4.h:858
double Inradius() const override
Definition: tetrahedra_3d_4.h:596
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_4.h:364
BaseType::Pointer Create(PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_4.h:323
KRATOS_CLASS_POINTER_DEFINITION(Tetrahedra3D4)
Triangle3D3< TPointType > FaceType
Definition: tetrahedra_3d_4.h:74
double MinDihedralAngle() const override
Definition: tetrahedra_3d_4.h:824
Tetrahedra3D4(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: tetrahedra_3d_4.h:214
double MaxEdgeLength() const override
Definition: tetrahedra_3d_4.h:512
double MinEdgeLength() const override
Definition: tetrahedra_3d_4.h:486
GeometryData::IntegrationMethod IntegrationMethod
Definition: tetrahedra_3d_4.h:84
double CalculateDistance(const CoordinatesArrayType &rPointGlobalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Computes the distance between an point in global coordinates and the closest point of this geometry....
Definition: tetrahedra_3d_4.h:1588
void NumberNodesInFaces(DenseVector< unsigned int > &NumberNodesInFaces) const override
Definition: tetrahedra_3d_4.h:1107
void SplitAndDecompose(const BaseType &tetra, Plane &plane, std::vector< BaseType > &inside) const
Definition: tetrahedra_3d_4.h:1418
double VolumeToSurfaceAreaQuality() const override
Definition: tetrahedra_3d_4.h:735
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: tetrahedra_3d_4.h:131
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: tetrahedra_3d_4.h:145
double VolumeToEdgeLengthQuality() const override
Definition: tetrahedra_3d_4.h:749
double Length() const override
Definition: tetrahedra_3d_4.h:412
double InradiusToLongestEdgeQuality() const override
Definition: tetrahedra_3d_4.h:664
double MaxDihedralAngle() const override
Definition: tetrahedra_3d_4.h:840
double Area() const override
Definition: tetrahedra_3d_4.h:432
TPointType PointType
Definition: tetrahedra_3d_4.h:95
Tetrahedra3D4(Tetrahedra3D4 const &rOther)
Definition: tetrahedra_3d_4.h:240
Tetrahedra3D4(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: tetrahedra_3d_4.h:223
BaseType::IndexType IndexType
Definition: tetrahedra_3d_4.h:102
BaseType::GeometriesArrayType GeometriesArrayType
Definition: tetrahedra_3d_4.h:90
void ComputeSolidAngles(Vector &rSolidAngles) const override
Definition: tetrahedra_3d_4.h:875
double VolumeToAverageEdgeLength() const override
Definition: tetrahedra_3d_4.h:780
BaseType::IntegrationPointType IntegrationPointType
Definition: tetrahedra_3d_4.h:123
BaseType::JacobiansType JacobiansType
Definition: tetrahedra_3d_4.h:159
~Tetrahedra3D4() override
Destructor. Does nothing!!!
Definition: tetrahedra_3d_4.h:263
double RegularityQuality() const override
Definition: tetrahedra_3d_4.h:721
double Volume() const override
Definition: tetrahedra_3d_4.h:450
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
It creates a new geometry pointer.
Definition: tetrahedra_3d_4.h:336
void ComputeDihedralAngles(Vector &rDihedralAngles) const override
Definition: tetrahedra_3d_4.h:895
Tetrahedra3D4(Tetrahedra3D4< TOtherPointType > const &rOther)
Definition: tetrahedra_3d_4.h:257
void PrintData(std::ostream &rOStream) const override
Definition: tetrahedra_3d_4.h:1649
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: tetrahedra_3d_4.h:184
double InradiusToCircumradiusQuality() const override
Quality functions.
Definition: tetrahedra_3d_4.h:648
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: tetrahedra_3d_4.h:265
BaseType::ShapeFunctionsSecondDerivativesType ShapeFunctionsSecondDerivativesType
Definition: tetrahedra_3d_4.h:174
Matrix MatrixType
Definition: tetrahedra_3d_4.h:189
void NodesInFaces(DenseMatrix< unsigned int > &NodesInFaces) const override
Definition: tetrahedra_3d_4.h:1119
BaseType::PointsArrayType PointsArrayType
Definition: tetrahedra_3d_4.h:116
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: tetrahedra_3d_4.h:166
BaseType::SizeType SizeType
Definition: tetrahedra_3d_4.h:110
double VolumeToRMSEdgeLength() const override
Definition: tetrahedra_3d_4.h:797
void PrintInfo(std::ostream &rOStream) const override
Definition: tetrahedra_3d_4.h:1635
Vector & LumpingFactors(Vector &rResult, const typename BaseType::LumpingMethods LumpingMethod=BaseType::LumpingMethods::ROW_SUM) const override
Lumping factors for the calculation of the lumped mass matrix.
Definition: tetrahedra_3d_4.h:382
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: tetrahedra_3d_4.h:941
friend class Tetrahedra3D4
Definition: tetrahedra_3d_4.h:1950
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: tetrahedra_3d_4.h:1193
bool HasIntersection(const Point &rLowPoint, const Point &rHighPoint) const override
Definition: tetrahedra_3d_4.h:1399
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: tetrahedra_3d_4.h:138
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: tetrahedra_3d_4.h:1212
std::string Info() const override
Definition: tetrahedra_3d_4.h:1623
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, IntegrationMethod ThisMethod) const override
Definition: tetrahedra_3d_4.h:1237
double ShortestToLongestEdgeQuality() const override
Definition: tetrahedra_3d_4.h:694
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: tetrahedra_3d_4.h:1070
void GetPlanes(array_1d< Plane, 4 > &plane) const
Definition: tetrahedra_3d_4.h:1545
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: tetrahedra_3d_4.h:968
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: tetrahedra_3d_4.h:152
GeometriesArrayType GenerateFaces() const override
Returns all faces of the current geometry.
Definition: tetrahedra_3d_4.h:1083
double Circumradius() const override
Definition: tetrahedra_3d_4.h:552
double DomainSize() const override
This method calculate and return length, area or volume of this geometry depending to it's dimension.
Definition: tetrahedra_3d_4.h:475
Line3D2< TPointType > EdgeType
Definition: tetrahedra_3d_4.h:73
Tetrahedra3D4(const PointsArrayType &ThisPoints)
Definition: tetrahedra_3d_4.h:207
bool HasIntersection(const BaseType &rThisGeometry) const override
Test if this geometry intersects with other geometry.
Definition: tetrahedra_3d_4.h:1367
Tetrahedra3D4 & operator=(Tetrahedra3D4< TOtherPointType > const &rOther)
Definition: tetrahedra_3d_4.h:307
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Definition: tetrahedra_3d_4.h:984
Tetrahedra3D4(typename PointType::Pointer pPoint1, typename PointType::Pointer pPoint2, typename PointType::Pointer pPoint3, typename PointType::Pointer pPoint4)
Definition: tetrahedra_3d_4.h:194
BaseType::NormalType NormalType
Definition: tetrahedra_3d_4.h:179
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
Short class definition.
Definition: array_1d.h:61
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
sd
Definition: GenerateWind.py:148
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
const GeometryData Tetrahedra3D4< TPointType >::msGeometryData & msGeometryDimension(), Tetrahedra3D4< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
f
Definition: generate_convection_diffusion_explicit_element.py:112
V
Definition: generate_droplet_dynamics.py:256
w1
Definition: generate_frictional_mortar_condition.py:94
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
p
Definition: sensitivityMatrix.py:52
integer i
Definition: TensorModule.f:17
zero
Definition: test_pureconvectionsolver_benchmarking.py:94
e
Definition: run_cpp_mpi_tests.py:31
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254