16 #if !defined(KRATOS_BREP_CURVE_ON_SURFACE_3D_H_INCLUDED )
17 #define KRATOS_BREP_CURVE_ON_SURFACE_3D_H_INCLUDED
41 template<
class TContainerPo
intType,
class TContainerPo
intEmbeddedType = TContainerPo
intType>
43 :
public Geometry<typename TContainerPointType::value_type>
53 typedef typename TContainerPointType::value_type
PointType;
85 typename NurbsSurfaceType::Pointer pSurface,
86 typename NurbsCurveType::Pointer pCurve,
87 bool SameCurveDirection =
true)
93 , mSameCurveDirection(SameCurveDirection)
99 typename NurbsSurfaceType::Pointer pSurface,
100 typename NurbsCurveType::Pointer pCurve,
102 bool SameCurveDirection =
true)
107 , mCurveNurbsInterval(CurveNurbsInterval)
108 , mSameCurveDirection(SameCurveDirection)
115 bool SameCurveDirection =
true)
117 , mpCurveOnSurface(pNurbsCurveOnSurface)
119 , mSameCurveDirection(SameCurveDirection)
127 bool SameCurveDirection =
true)
129 , mpCurveOnSurface(pNurbsCurveOnSurface)
130 , mCurveNurbsInterval(CurveNurbsInterval)
131 , mSameCurveDirection(SameCurveDirection)
140 :
BaseType(ThisPoints, &msGeometryData)
147 , mpCurveOnSurface(rOther.mpCurveOnSurface)
148 , mCurveNurbsInterval(rOther.mCurveNurbsInterval)
149 , mSameCurveDirection(rOther.mSameCurveDirection)
154 template<
class TOtherContainerPo
intType,
class TOtherContainerPo
intEmbeddedType>
158 , mpCurveOnSurface(rOther.mpCurveOnSurface)
159 , mCurveNurbsInterval(rOther.mCurveNurbsInterval)
160 , mSameCurveDirection(rOther.mSameCurveDirection)
175 mpCurveOnSurface = rOther.mpCurveOnSurface;
176 mCurveNurbsInterval = rOther.mCurveNurbsInterval;
177 mSameCurveDirection = rOther.mSameCurveDirection;
182 template<
class TOtherContainerPo
intType,
class TOtherContainerPo
intEmbeddedType>
186 mpCurveOnSurface = rOther.mpCurveOnSurface;
187 mCurveNurbsInterval = rOther.mCurveNurbsInterval;
188 mSameCurveDirection = rOther.mSameCurveDirection;
215 const auto& const_this = *
this;
216 return std::const_pointer_cast<GeometryType>(
217 const_this.pGetGeometryPart(
Index));
234 return mpCurveOnSurface;
237 << this->
Id() << std::endl;
260 if (rVariable == PARAMETER_2D_COORDINATES) {
261 mpCurveOnSurface->Calculate(rVariable, rOutput);
272 return mpCurveOnSurface->PolynomialDegree(LocalDirectionIndex);
284 return mCurveNurbsInterval;
295 return mSameCurveDirection;
301 return mpCurveOnSurface;
307 return mpCurveOnSurface;
313 return mpCurveOnSurface->PointsNumberInDirection(DirectionIndex);
327 mpCurveOnSurface->SpansLocalSpace(rSpans,
328 mCurveNurbsInterval.
GetT0(), mCurveNurbsInterval.
GetT1());
343 const double Tolerance = std::numeric_limits<double>::epsilon()
346 const double min_parameter = mCurveNurbsInterval.
MinParameter();
347 if (rPointLocalCoordinates[0] < min_parameter) {
349 }
else if (std::abs(rPointLocalCoordinates[0] - min_parameter) < Tolerance) {
353 const double max_parameter = mCurveNurbsInterval.
MaxParameter();
354 if (rPointLocalCoordinates[0] > max_parameter) {
356 }
else if (std::abs(rPointLocalCoordinates[0] - max_parameter) < Tolerance) {
378 const double Tolerance = std::numeric_limits<double>::epsilon()
381 const double min_parameter = mCurveNurbsInterval.
MinParameter();
382 if (rPointLocalCoordinates[0] < min_parameter) {
383 rClosestPointLocalCoordinates[0] = min_parameter;
385 }
else if (std::abs(rPointLocalCoordinates[0] - min_parameter) < Tolerance) {
386 rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
390 const double max_parameter = mCurveNurbsInterval.
MaxParameter();
391 if (rPointLocalCoordinates[0] > max_parameter) {
392 rClosestPointLocalCoordinates[0] = min_parameter;
394 }
else if (std::abs(rPointLocalCoordinates[0] - max_parameter) < Tolerance) {
395 rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
399 rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
418 const double Tolerance = std::numeric_limits<double>::epsilon()
424 rProjectedPointLocalCoordinates,
425 rPointGlobalCoordinates,
426 point_global_coordinates,
438 return mpCurveOnSurface->Center();
453 return mpCurveOnSurface->GlobalCoordinates(rResult, rLocalCoordinates);
470 std::vector<CoordinatesArrayType>& rGlobalSpaceDerivatives,
472 const SizeType DerivativeOrder)
const override
474 return mpCurveOnSurface->GlobalSpaceDerivatives(rGlobalSpaceDerivatives, rLocalCoordinates, DerivativeOrder);
488 const double Tolerance = std::numeric_limits<double>::epsilon()
491 KRATOS_ERROR <<
"IsInside is not yet implemented within the BrepCurveOnSurface";
506 for (
IndexType i = 0;
i < integration_points.size(); ++
i) {
507 const double determinant_jacobian = mpCurveOnSurface->DeterminantOfJacobian(integration_points[
i]);
508 length += integration_points[
i].Weight() * determinant_jacobian;
520 return mpCurveOnSurface->GetDefaultIntegrationInfo();
534 std::vector<double> spans;
538 rIntegrationPoints, spans, rIntegrationInfo);
558 IndexType NumberOfShapeFunctionDerivatives,
562 mpCurveOnSurface->CreateQuadraturePointGeometries(
563 rResultGeometries, NumberOfShapeFunctionDerivatives, rIntegrationPoints, rIntegrationInfo);
566 rResultGeometries(
i)->SetGeometryParent(
this);
578 return mpCurveOnSurface->ShapeFunctionsValues(rResult, rCoordinates);
585 return mpCurveOnSurface->ShapeFunctionsLocalGradients(rResult, rCoordinates);
607 std::string
Info()
const override
609 return "Brep face curve";
615 rOStream <<
"Brep face curve";
622 std::cout << std::endl;
623 rOStream <<
" Brep face curve : " << std::endl;
646 bool mSameCurveDirection;
654 void save(
Serializer& rSerializer )
const override
657 rSerializer.
save(
"CurveOnSurface", mpCurveOnSurface);
658 rSerializer.
save(
"NurbsInterval", mCurveNurbsInterval);
659 rSerializer.
save(
"SameCurveDirection", mSameCurveDirection);
665 rSerializer.
load(
"CurveOnSurface", mpCurveOnSurface);
666 rSerializer.
load(
"NurbsInterval", mCurveNurbsInterval);
667 rSerializer.
load(
"SameCurveDirection", mSameCurveDirection);
677 template<
class TContainerPo
intType,
class TContainerPo
intEmbeddedType = TContainerPo
intType>
inline std::istream&
operator >> (
678 std::istream& rIStream,
682 template<
class TContainerPo
intType,
class TContainerPo
intEmbeddedType = TContainerPo
intType>
inline std::ostream&
operator << (
683 std::ostream& rOStream,
687 rOStream << std::endl;
696 template<
class TContainerPo
intType,
class TContainerPo
intEmbeddedType>
const
697 GeometryData BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType>::msGeometryData(
702 template<
class TContainerPo
intType,
class TContainerPo
intEmbeddedType>
The BrepCurveOnSurface acts as topology for curves on surfaces.
Definition: brep_curve_on_surface.h:44
BaseType::IndexType IndexType
Definition: brep_curve_on_surface.h:70
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: brep_curve_on_surface.h:574
KRATOS_CLASS_POINTER_DEFINITION(BrepCurveOnSurface)
virtual int ClosestPointLocalToLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, CoordinatesArrayType &rClosestPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Calculates the closes point projection This method calculates the closest point projection of a point...
Definition: brep_curve_on_surface.h:375
BaseType::SizeType SizeType
Definition: brep_curve_on_surface.h:71
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: brep_curve_on_surface.h:613
~BrepCurveOnSurface() override=default
Destructor.
void CreateQuadraturePointGeometries(GeometriesArrayType &rResultGeometries, IndexType NumberOfShapeFunctionDerivatives, const IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo) override
Definition: brep_curve_on_surface.h:556
BaseType::GeometriesArrayType GeometriesArrayType
Definition: brep_curve_on_surface.h:68
const NurbsCurveOnSurfacePointerType pGetCurveOnSurface() const
Returns the const NurbsCurveOnSurface::Pointer of this brep.
Definition: brep_curve_on_surface.h:305
SizeType PolynomialDegree(IndexType LocalDirectionIndex) const override
Return polynomial degree of the nurbs curve on surface.
Definition: brep_curve_on_surface.h:270
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: brep_curve_on_surface.h:597
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: brep_curve_on_surface.h:619
int IsInsideLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Checks if given point in local space coordinates of this geometry is inside the geometry boundaries.
Definition: brep_curve_on_surface.h:341
BrepCurveOnSurface(const PointsArrayType &ThisPoints)
Definition: brep_curve_on_surface.h:139
BrepCurveOnSurface & operator=(BrepCurveOnSurface< TOtherContainerPointType, TOtherContainerPointEmbeddedType > const &rOther)
Assignment operator for geometries with different point type.
Definition: brep_curve_on_surface.h:183
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: brep_curve_on_surface.h:74
Geometry< typename TContainerPointType::value_type > BaseType
Definition: brep_curve_on_surface.h:55
BrepCurveOnSurface(BrepCurveOnSurface const &rOther)
Copy constructor.
Definition: brep_curve_on_surface.h:145
NurbsCurveOnSurfaceType::Pointer NurbsCurveOnSurfacePointerType
Definition: brep_curve_on_surface.h:66
Geometry< typename TContainerPointType::value_type > GeometryType
Definition: brep_curve_on_surface.h:56
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: brep_curve_on_surface.h:581
BrepCurveOnSurface(NurbsCurveOnSurfacePointerType pNurbsCurveOnSurface, bool SameCurveDirection=true)
constructor for untrimmed surface with curve on surface
Definition: brep_curve_on_surface.h:113
BrepCurveOnSurface & operator=(const BrepCurveOnSurface &rOther)
Assignment operator.
Definition: brep_curve_on_surface.h:172
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: brep_curve_on_surface.h:592
GeometryData::IntegrationMethod IntegrationMethod
Definition: brep_curve_on_surface.h:59
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Definition: brep_curve_on_surface.h:485
void SpansLocalSpace(std::vector< double > &rSpans, IndexType DirectionIndex=0) const override
Definition: brep_curve_on_surface.h:325
BrepCurveOnSurface(typename NurbsSurfaceType::Pointer pSurface, typename NurbsCurveType::Pointer pCurve, NurbsInterval CurveNurbsInterval, bool SameCurveDirection=true)
constructor for trimmed surface
Definition: brep_curve_on_surface.h:98
bool HasGeometryPart(const IndexType Index) const override
This function is used to check if the index is either GeometryType::BACKGROUND_GEOMETRY_INDEX or CURV...
Definition: brep_curve_on_surface.h:246
BrepCurveOnSurface(NurbsCurveOnSurfacePointerType pNurbsCurveOnSurface, NurbsInterval CurveNurbsInterval, bool SameCurveDirection=true)
constructor for trimmed surface with curve on surface
Definition: brep_curve_on_surface.h:124
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: brep_curve_on_surface.h:75
const GeometryPointer pGetGeometryPart(const IndexType Index) const override
This function returns the pointer of the geometry which is corresponding to the index....
Definition: brep_curve_on_surface.h:228
BrepCurveOnSurface(typename NurbsSurfaceType::Pointer pSurface, typename NurbsCurveType::Pointer pCurve, bool SameCurveDirection=true)
constructor for untrimmed surface
Definition: brep_curve_on_surface.h:84
NurbsCurveOnSurfacePointerType pGetCurveOnSurface()
Returns the NurbsCurveOnSurface::Pointer of this brep.
Definition: brep_curve_on_surface.h:299
static constexpr IndexType CURVE_ON_SURFACE_INDEX
Definition: brep_curve_on_surface.h:77
std::string Info() const override
Turn back information as a string.
Definition: brep_curve_on_surface.h:607
BrepCurveOnSurface(BrepCurveOnSurface< TOtherContainerPointType, TOtherContainerPointEmbeddedType > const &rOther)
Copy constructor from a geometry with different point type.
Definition: brep_curve_on_surface.h:155
BaseType::Pointer Create(PointsArrayType const &ThisPoints) const override
Definition: brep_curve_on_surface.h:196
NurbsCurveOnSurfaceGeometry< 3, TContainerPointEmbeddedType, TContainerPointType > NurbsCurveOnSurfaceType
Definition: brep_curve_on_surface.h:64
IntegrationInfo GetDefaultIntegrationInfo() const override
Provides the default integration dependent on the polynomial degree.
Definition: brep_curve_on_surface.h:518
NurbsCurveGeometry< 2, TContainerPointEmbeddedType > NurbsCurveType
Definition: brep_curve_on_surface.h:62
TContainerPointType::value_type PointType
Definition: brep_curve_on_surface.h:53
void CreateIntegrationPoints(IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo) const override
Definition: brep_curve_on_surface.h:530
BrepCurveOnSurface()
Definition: brep_curve_on_surface.h:135
double Length() const override
Computes the length of a nurbs curve.
Definition: brep_curve_on_surface.h:499
GeometryType::Pointer GeometryPointer
Definition: brep_curve_on_surface.h:57
void Calculate(const Variable< array_1d< double, 3 >> &rVariable, array_1d< double, 3 > &rOutput) const override
Calculate with array_1d<double, 3>
Definition: brep_curve_on_surface.h:255
NurbsSurfaceGeometry< 3, TContainerPointType > NurbsSurfaceType
Definition: brep_curve_on_surface.h:61
void GlobalSpaceDerivatives(std::vector< CoordinatesArrayType > &rGlobalSpaceDerivatives, const CoordinatesArrayType &rLocalCoordinates, const SizeType DerivativeOrder) const override
This method maps from local space to global/working space and computes the number of derivatives at t...
Definition: brep_curve_on_surface.h:469
NurbsInterval DomainInterval() const
Definition: brep_curve_on_surface.h:282
SizeType PointsNumberInDirection(IndexType DirectionIndex) const override
Returns number of points of NurbsCurveOnSurface.
Definition: brep_curve_on_surface.h:311
GeometryPointer pGetGeometryPart(const IndexType Index) override
This function returns the pointer of the geometry which is corresponding to the index....
Definition: brep_curve_on_surface.h:213
bool HasSameCurveDirection()
Definition: brep_curve_on_surface.h:293
BaseType::PointsArrayType PointsArrayType
Definition: brep_curve_on_surface.h:73
CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rLocalCoordinates) const override
Definition: brep_curve_on_surface.h:448
Point Center() const override
Provides the center of the underlying curve on surface.
Definition: brep_curve_on_surface.h:436
int ProjectionPointGlobalToLocalSpace(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rProjectedPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Projects a point onto the geometry Projects a certain point on the geometry, or finds the closest poi...
Definition: brep_curve_on_surface.h:415
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
@ Kratos_Brep_Curve_On_Surface
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
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
std::size_t SizeType
Definition: geometry.h:144
std::size_t IndexType
Definition: geometry.h:137
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
static constexpr IndexType BACKGROUND_GEOMETRY_INDEX
Definition: geometry.h:220
Integration information for the creation of integration points.
Definition: integration_info.h:35
static void CreateIntegrationPoints1D(IntegrationPointsArrayType &rIntegrationPoints, const std::vector< double > &rSpansLocalSpace, const IntegrationInfo &rIntegrationInfo)
Definition: integration_point_utilities.cpp:18
Definition: nurbs_curve_geometry.h:33
Definition: nurbs_curve_on_surface_geometry.h:36
Class for optimized use of intervals.
Definition: nurbs_interval.h:36
double MaxParameter() const
Definition: nurbs_interval.h:85
double GetT1() const
Definition: nurbs_interval.h:70
double GetT0() const
Definition: nurbs_interval.h:60
double MinParameter() const
Definition: nurbs_interval.h:80
Definition: nurbs_surface_geometry.h:38
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
size_type size() const
Definition: pointer_vector.h:255
static bool NewtonRaphsonCurve(CoordinatesArrayType &rProjectedPointLocalCoordinates, const CoordinatesArrayType &rPointGlobalCoordinatesCoordinates, CoordinatesArrayType &rProjectedPointGlobalCoordinates, const Geometry< TPointType > &rGeometry, const int MaxIterations=20, const double Accuracy=1e-6)
Definition: projection_nurbs_geometry_utilities.h:51
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
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
static double max(double a, double b)
Definition: GeometryFunctions.h:79
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
shared_ptr< C > make_shared(Args &&...args)
Definition: smart_pointers.h:40
def load(f)
Definition: ode_solve.py:307
integer i
Definition: TensorModule.f:17