60 template<
class TPo
intType>
170 Line2D3(
typename PointType::Pointer pFirstPoint,
171 typename PointType::Pointer pSecondPoint,
172 typename PointType::Pointer pThirdPoint )
181 :
BaseType( rThisPoints, &msGeometryData )
190 ) :
BaseType( GeometryId, rThisPoints, &msGeometryData )
197 const std::string& rGeometryName,
199 ) :
BaseType(rGeometryName, rThisPoints, &msGeometryData)
272 template<
class TOtherPo
intType>
294 return typename BaseType::Pointer(
new Line2D3( NewGeometryId, rThisPoints ) );
308 auto p_geometry =
typename BaseType::Pointer(
new Line2D3( NewGeometryId, rGeometry.
Points() ) );
309 p_geometry->SetData(rGeometry.
GetData());
326 if(rResult.size() != 3)
327 rResult.
resize( 3,
false );
399 const double Tolerance = std::numeric_limits<double>::epsilon()
404 if ( std::abs( rResult[0] ) <= (1.0 + Tolerance) ) {
426 X(0,
i) = r_node.X();
427 X(1,
i) = r_node.Y();
428 X(2,
i) = r_node.Z();
431 static constexpr
double MaxNormPointLocalCoordinates = 300.0;
432 static constexpr std::size_t MaxIteratioNumberPointLocalCoordinates = 500;
433 static constexpr
double MaxTolerancePointLocalCoordinates = 1.0e-8;
439 if (rResult.
size() != 3)
442 double delta_xi = 0.0;
447 for (
IndexType k = 0;
k < MaxIteratioNumberPointLocalCoordinates;
k++ ) {
448 noalias(current_global_coords) = zero_array;
451 noalias( current_global_coords ) = rPoint - current_global_coords;
454 Matrix shape_functions_gradients;
462 invJ(0, 0) = 1.0/
J( 0, 0 );
464 delta_xi = invJ(0, 0) *
res[0];
466 rResult[0] += delta_xi;
468 if ( delta_xi > MaxNormPointLocalCoordinates ) {
469 KRATOS_WARNING_IF(
"Line2D3",
k > 0) <<
"detJ =\t" <<
J( 0, 0 ) <<
" DeltaX =\t" << delta_xi <<
" stopping calculation. Iteration:\t" <<
k << std::endl;
473 if ( delta_xi < MaxTolerancePointLocalCoordinates )
502 const ShapeFunctionsGradientsType shape_functions_gradients = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
505 if (rResult.size() != number_of_integration_points) {
511 for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
518 rResult[pnt](0, 0) += r_node.X() * shape_functions_gradients[pnt](
i, 0);
519 rResult[pnt](1, 0) += r_node.Y() * shape_functions_gradients[pnt](
i, 0);
551 Matrix shape_functions_values = CalculateShapeFunctionsIntegrationPointsValues( ThisMethod );
553 if ( rResult.size() != number_of_integration_points ) {
559 for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt ) {
566 rResult[pnt](0, 0) += (r_node.X() - rDeltaPosition(
i,0)) * shape_functions_gradients[pnt](
i, 0);
567 rResult[pnt](1, 0) += (r_node.Y() - rDeltaPosition(
i,1)) * shape_functions_gradients[pnt](
i, 0);
594 rResult.
resize(2, 1,
false);
599 Matrix shape_function_gradient_in_integration_point = shape_functions_gradients( IntegrationPointIndex );
603 ShapeFunctionsValuesInIntegrationPoint =
row( CalculateShapeFunctionsIntegrationPointsValues( ThisMethod ), IntegrationPointIndex );
609 rResult(0, 0) += r_node.X() * shape_function_gradient_in_integration_point(
i, 0);
610 rResult(1, 0) += r_node.Y() * shape_function_gradient_in_integration_point(
i, 0);
631 rResult.
resize( 2, 1,
false );
635 Matrix shape_functions_gradients;
642 rResult(0, 0) += r_node.X() * shape_functions_gradients(
i, 0);
643 rResult(1, 0) += r_node.Y() * shape_functions_gradients(
i, 0);
659 if( rResult.size() != number_of_integration_points)
660 rResult.
resize( number_of_integration_points,
false );
663 for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
664 this->
Jacobian( J, pnt, ThisMethod);
665 rResult[pnt] = std::sqrt(std::pow(
J(0,0), 2) + std::pow(
J(1,0), 2));
681 this->
Jacobian( J, IntegrationPointIndex, ThisMethod);
682 return std::sqrt(std::pow(
J(0,0), 2) + std::pow(
J(1,0), 2));
696 return std::sqrt(std::pow(
J(0,0), 2) + std::pow(
J(1,0), 2));
737 if(rResult.size() != 3) {
741 rResult[0] = 0.5 * (rCoordinates[0] - 1.0) * rCoordinates[0];
742 rResult[1] = 0.5 * (rCoordinates[0] + 1.0) * rCoordinates[0];
743 rResult[2] = 1.0 - rCoordinates[0] * rCoordinates[0];
762 switch ( ShapeFunctionIndex )
765 return( 0.5*( rPoint[0] - 1.0 )*rPoint[0] );
767 return( 0.5*( rPoint[0] + 1.0 )*rPoint[0] );
769 return( 1.0 -rPoint[0]*rPoint[0] );
771 KRATOS_ERROR <<
"Wrong index of shape function!" << *
this << std::endl;
787 std::string
Info()
const override
789 return "1 dimensional line with 3 nodes in 2D space";
800 rOStream <<
"1 dimensional line with 3 nodes in 2D space";
815 std::cout << std::endl;
821 rOStream <<
" Jacobian\t : " << jacobian;
833 = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
834 const int integration_points_number
838 for (
int pnt = 0; pnt < integration_points_number; pnt++ )
840 Result[pnt] = localGradients[pnt];
854 = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
855 const int integration_points_number
859 for (
int pnt = 0; pnt < integration_points_number; pnt++ )
861 Result[pnt] = localGradients[pnt];
879 if(rResult.size1() != 3 || rResult.size2() != 1) {
880 rResult.
resize( 3, 1,
false );
884 rResult( 0, 0 ) = rPoint[0] - 0.5;
885 rResult( 1, 0 ) = rPoint[0] + 0.5;
886 rResult( 2, 0 ) = -rPoint[0] * 2.0;
897 if(rResult.size1() != 3 || rResult.size2() != 1)
899 rResult.
resize( 3, 1,
false );
902 rResult( 0, 0 ) = -1.0;
903 rResult( 1, 0 ) = 1.0;
904 rResult( 2, 0 ) = 0.0;
918 if(rResult.size1() != 3 || rResult.size2() != 1)
920 rResult.
resize( 3, 1,
false );
924 rResult( 0, 0 ) = rPoint[0] - 0.5;
925 rResult( 1, 0 ) = rPoint[0] + 0.5;
926 rResult( 2, 0 ) = -rPoint[0] * 2.0;
993 void save(
Serializer& rSerializer )
const override
1019 Matrix N( integration_points_number, 3 );
1021 for (
int it_gp = 0; it_gp < integration_points_number; it_gp++ )
1024 N( it_gp, 0 ) = 0.5 * (
e - 1 ) *
e;
1025 N( it_gp, 2 ) = 1.0 -
e *
e;
1026 N( it_gp, 1 ) = 0.5 * ( 1 +
e ) *
e;
1038 std::fill( DN_De.begin(), DN_De.end(),
Matrix( 3, 1 ) );
1043 DN_De[it_gp]( 0, 0 ) =
e - 0.5;
1044 DN_De[it_gp]( 2, 0 ) = -2.0 *
e;
1045 DN_De[it_gp]( 1, 0 ) =
e + 0.5;
1054 Quadrature<LineGaussLegendreIntegrationPoints1, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1055 Quadrature<LineGaussLegendreIntegrationPoints2, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1056 Quadrature<LineGaussLegendreIntegrationPoints3, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1057 Quadrature<LineGaussLegendreIntegrationPoints4, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1058 Quadrature<LineGaussLegendreIntegrationPoints5, 1, IntegrationPoint<3> >::GenerateIntegrationPoints()
1061 return integration_points;
1074 return shape_functions_values;
1087 return shape_functions_local_gradients;
1104 template<
class TOtherPo
intType>
friend class Line2D3;
1128 template<
class TPo
intType>
1133 template<
class TPo
intType>
1138 rOStream << std::endl;
1146 template<
class TPo
intType>
1147 const GeometryData Line2D3<TPointType>::msGeometryData(
1150 Line2D3<TPointType>::AllIntegrationPoints(),
1151 Line2D3<TPointType>::AllShapeFunctionsValues(),
1152 AllShapeFunctionsLocalGradients() );
1154 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
IntegrationMethod DefaultIntegrationMethod() const
Definition: geometry_data.h:425
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
SizeType size() const
Definition: geometry.h:518
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
std::size_t SizeType
Definition: geometry.h:144
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
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
Short class definition.
Definition: integration_point.h:52
static double ComputeDomainSize(const TGeometryType &rGeometry)
This method calculates and returns the domain size of the geometry from any geometry in a generic man...
Definition: integration_utilities.h:63
static GeometryData::IntegrationMethod GetIntegrationMethodForExactMassMatrixEvaluation(const Geometry< TPointType > &rGeometry)
This method returns the integration order for the exact mass matrix evaluation.
Definition: integration_utilities.h:42
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
An three node 2D line geometry with quadratic shape functions.
Definition: line_2d_3.h:63
Line2D3(Line2D3 const &rOther)
Definition: line_2d_3.h:211
double DomainSize() const override
Definition: line_2d_3.h:383
BaseType::NormalType NormalType
Definition: line_2d_3.h:149
std::string Info() const override
Definition: line_2d_3.h:787
Line2D3 & operator=(const Line2D3 &rOther)
Definition: line_2d_3.h:258
Line2D3(const PointType &FirstPoint, const PointType &SecondPoint, const PointType &ThirdPoint)
Definition: line_2d_3.h:160
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: line_2d_3.h:895
double Area() const override
Definition: line_2d_3.h:367
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: line_2d_3.h:123
Line2D3(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: line_2d_3.h:187
double Length() const override
Definition: line_2d_3.h:350
void PrintData(std::ostream &rOStream) const override
Definition: line_2d_3.h:811
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod)
Definition: line_2d_3.h:829
BaseType::JacobiansType JacobiansType
Definition: line_2d_3.h:139
GeometryData::IntegrationMethod IntegrationMethod
Definition: line_2d_3.h:77
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: line_2d_3.h:303
SizeType FacesNumber() const override
Definition: line_2d_3.h:715
BaseType::SizeType SizeType
Definition: line_2d_3.h:99
SizeType EdgesNumber() const override
Definition: line_2d_3.h:706
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: line_2d_3.h:234
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: line_2d_3.h:117
Geometry< TPointType > BaseType
Geometry as base class.
Definition: line_2d_3.h:70
BaseType::IntegrationPointType IntegrationPointType
Definition: line_2d_3.h:110
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: line_2d_3.h:321
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_3.h:875
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: line_2d_3.h:133
Line2D3(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: line_2d_3.h:196
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: line_2d_3.h:289
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: line_2d_3.h:145
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Returns whether given arbitrary point is inside the Geometry and the respective local point for the g...
Definition: line_2d_3.h:396
BaseType::IndexType IndexType
Definition: line_2d_3.h:92
KRATOS_CLASS_POINTER_DEFINITION(Line2D3)
Pointer definition of Line2D3.
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: line_2d_3.h:850
BaseType::GeometriesArrayType GeometriesArrayType
Definition: line_2d_3.h:82
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: line_2d_3.h:417
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &rDeltaPosition) const override
Definition: line_2d_3.h:544
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: line_2d_3.h:128
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_2d_3.h:499
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
This method gives value of given shape function evaluated in given point.
Definition: line_2d_3.h:757
~Line2D3() override
Destructor. Do nothing!!!
Definition: line_2d_3.h:232
Line2D3(Line2D3< TOtherPointType > const &rOther)
Definition: line_2d_3.h:226
double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const override
Determinant of jacobian in given point. This method calculate determinant of jacobian matrix in given...
Definition: line_2d_3.h:692
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: line_2d_3.h:239
Line2D3(const PointsArrayType &rThisPoints)
Definition: line_2d_3.h:180
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
This method gives all non-zero shape functions values evaluated at the rCoordinates provided.
Definition: line_2d_3.h:732
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_2d_3.h:591
TPointType PointType
Definition: line_2d_3.h:86
Line2D3(typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint, typename PointType::Pointer pThirdPoint)
Definition: line_2d_3.h:170
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_3.h:628
friend class Line2D3
Definition: line_2d_3.h:1104
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, CoordinatesArrayType &rPoint)
Definition: line_2d_3.h:916
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Determinant of jacobians for given integration method.
Definition: line_2d_3.h:656
Line2D3 & operator=(Line2D3< TOtherPointType > const &rOther)
Definition: line_2d_3.h:273
double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Determinant of jacobian in specific integration point of given integration method....
Definition: line_2d_3.h:678
void PrintInfo(std::ostream &rOStream) const override
Definition: line_2d_3.h:798
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: line_2d_3.h:154
BaseType::PointsArrayType PointsArrayType
Definition: line_2d_3.h:104
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
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
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE void resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
#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
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
const GeometryData Line2D3< TPointType >::msGeometryData & msGeometryDimension(), Line2D3< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
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
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
res
Definition: generate_convection_diffusion_explicit_element.py:211
DN
Definition: generate_convection_diffusion_explicit_element.py:98
def load(f)
Definition: ode_solve.py:307
int k
Definition: quadrature.py:595
float temp
Definition: rotating_cone.py:85
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31