KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
nurbs_curve_geometry.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Thomas Oberbichler
11 //
12 // Ported from the ANurbs library (https://github.com/oberbichler/ANurbs)
13 //
14 
15 #if !defined(KRATOS_NURBS_CURVE_GEOMETRY_H_INCLUDED )
16 #define KRATOS_NURBS_CURVE_GEOMETRY_H_INCLUDED
17 
18 // Project includes
19 #include "geometries/geometry.h"
22 
24 
26 
28 
29 namespace Kratos {
30 
31 template <int TWorkingSpaceDimension, class TContainerPointType>
32 class NurbsCurveGeometry : public Geometry<typename TContainerPointType::value_type>
33 {
34 public:
37 
38  typedef typename TContainerPointType::value_type NodeType;
39 
42 
43  typedef typename BaseType::IndexType IndexType;
44  typedef typename BaseType::SizeType SizeType;
45 
50 
51  // using base class functionalities.
53  using BaseType::pGetPoint;
54  using BaseType::GetPoint;
55 
58 
62 
65  const PointsArrayType& rThisPoints,
67  const Vector& rKnots)
68  : BaseType(rThisPoints, &msGeometryData)
69  , mPolynomialDegree(PolynomialDegree)
70  , mKnots(rKnots)
71  {
72  CheckAndFitKnotVectors();
73  }
74 
77  const PointsArrayType& rThisPoints,
79  const Vector& rKnots,
80  const Vector& rWeights)
81  : BaseType(rThisPoints, &msGeometryData)
82  , mPolynomialDegree(PolynomialDegree)
83  , mKnots(rKnots)
84  , mWeights(rWeights)
85  {
86  CheckAndFitKnotVectors();
87 
88  KRATOS_ERROR_IF(rWeights.size() != rThisPoints.size())
89  << "Number of control points and weights do not match!" << std::endl;
90  }
91 
92  explicit NurbsCurveGeometry(const PointsArrayType& ThisPoints)
93  : BaseType(ThisPoints, &msGeometryData)
94  {
95  }
96 
99  : BaseType(rOther)
100  , mPolynomialDegree(rOther.mPolynomialDegree)
101  , mKnots(rOther.mKnots)
102  , mWeights(rOther.mWeights)
103  {
104  }
105 
107  template<class TOtherContainerPointType> NurbsCurveGeometry(
109  : BaseType(rOther, &msGeometryData)
110  , mPolynomialDegree(rOther.mPolynomialDegree)
111  , mKnots(rOther.mKnots)
112  , mWeights(rOther.mWeights)
113  {
114  }
115 
117  ~NurbsCurveGeometry() override = default;
118 
122 
125  {
126  BaseType::operator=(rOther);
127  mPolynomialDegree = rOther.mPolynomialDegree;
128  mKnots = rOther.mKnots;
129  mWeights = rOther.mWeights;
130  return *this;
131  }
132 
134  template<class TOtherContainerPointType>
137  {
138  BaseType::operator=(rOther);
139  mPolynomialDegree = rOther.mPolynomialDegree;
140  mKnots = rOther.mKnots;
141  mWeights = rOther.mWeights;
142  return *this;
143  }
144 
148 
149  typename BaseType::Pointer Create(
150  PointsArrayType const& ThisPoints) const override
151  {
152  return Kratos::make_shared<NurbsCurveGeometry>(ThisPoints);
153  }
154 
158 
160  SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const override
161  {
162  if (LocalDirectionIndex == 0) {
163  return this->PointsNumber();
164  }
165  KRATOS_ERROR << "Possible direction index in NurbsCurveGeometry is 0. Given direction index: "
166  << LocalDirectionIndex << std::endl;
167  }
168 
172 
174  SizeType PolynomialDegree(IndexType LocalDirectionIndex) const override
175  {
176  KRATOS_DEBUG_ERROR_IF(LocalDirectionIndex != 0)
177  << "Trying to access polynomial degree in direction " << LocalDirectionIndex
178  << " from NurbsCurveGeometry #" << this->Id() << ". However, nurbs curves have only one direction."
179  << std::endl;
180 
181  return mPolynomialDegree;
182  }
183 
187 
188  /*
189  * @brief Knot vector is defined to have a multiplicity of p
190  * at the beginning and end (NOT: p + 1).
191  * @return knot vector.
192  */
193  const Vector& Knots() const
194  {
195  return mKnots;
196  }
197 
198  /*
199  * @brief The number of knots within the knot vector.
200  * @return the size of the knot vector.
201  */
203  {
204  return mKnots.size();
205  }
206 
207  /*
208  * @brief The number of nonzero control points for one point in the curve
209  * is given by p+1.
210  * @return the number of nonzero control points.
211  */
213  {
214  return mPolynomialDegree + 1;
215  }
216 
217  /*
218  * @brief Checks if shape functions are rational or not.
219  * @return true if NURBS,
220  * false if B-Splines only (all weights are considered as 1.0)
221  */
222  bool IsRational() const
223  {
224  return mWeights.size() != 0;
225  }
226 
227  /*
228  * @brief Provides weights vector. All values are 1.0 for B-Splines,
229  * for NURBS those can be unequal 1.0.
230  * Has size 0 if B-Spline.
231  * @return weights vector.
232  */
233  const Vector& Weights() const
234  {
235  return mWeights;
236  }
237 
238  /* @brief Provides the natural boundaries of the NURBS/B-Spline curve.
239  * @return domain interval.
240  */
242  {
243  return NurbsInterval(mKnots[mPolynomialDegree - 1], mKnots[NumberOfKnots() - mPolynomialDegree]);
244  }
245 
246  /*
247  * @brief Provides all knot intervals within one curve.
248  * @return vector of domain intervals.
249  */
250  std::vector<NurbsInterval> KnotSpanIntervals() const
251  {
252  const IndexType first_span = mPolynomialDegree - 1;
253  const IndexType last_span = NumberOfKnots() - mPolynomialDegree - 1;
254 
255  const IndexType number_of_spans = last_span - first_span + 1;
256 
257  std::vector<NurbsInterval> result(number_of_spans);
258 
259  for (IndexType i = 0; i < number_of_spans; i++) {
260  const double t0 = mKnots[first_span + i];
261  const double t1 = mKnots[first_span + i + 1];
262 
263  result[i] = NurbsInterval(t0, t1);
264  }
265 
266  return result;
267  }
268 
270  SizeType NumberOfKnotSpans(IndexType DirectionIndex = 0) const
271  {
272  SizeType knot_span_counter = 0;
273  for (IndexType i = 0; i < mKnots.size() - 1; i++) {
274  if (std::abs(mKnots[i] - mKnots[i + 1]) > 1e-6) {
275  knot_span_counter++;
276  }
277  }
278  return knot_span_counter;
279  }
280 
281  /* @brief Provides knot spans of this nurbs curve.
282  * @param resulting vector of span intervals.
283  * @param index of chosen direction, for curves always 0.
284  */
285  void SpansLocalSpace(std::vector<double>& rSpans, IndexType DirectionIndex = 0) const override
286  {
287  rSpans.resize(this->NumberOfKnotSpans(DirectionIndex) + 1);
288 
289  rSpans[0] = mKnots[0];
290 
291  IndexType counter = 1;
292  for (IndexType i = 0; i < mKnots.size() - 1; i++) {
293  if (std::abs(mKnots[i] - mKnots[i + 1]) > 1e-6) {
294  rSpans[counter] = mKnots[i + 1];
295  counter++;
296  }
297  }
298  }
299 
303 
304  /* @brief checks and returns if local coordinate rPointLocalCoordinates[0]
305  * is inside the local/parameter space.
306  * @return inside -> 1
307  * outside -> 0
308  */
310  const CoordinatesArrayType& rPointLocalCoordinates,
311  const double Tolerance = std::numeric_limits<double>::epsilon()
312  ) const override
313  {
314  const double min_parameter =
315  std::min(mKnots[mPolynomialDegree - 1],
316  mKnots[NumberOfKnots() - mPolynomialDegree]);
317  if (rPointLocalCoordinates[0] < min_parameter) {
318  return 0;
319  }
320 
321  const double max_parameter =
322  std::max(mKnots[mPolynomialDegree - 1],
323  mKnots[NumberOfKnots() - mPolynomialDegree]);
324  if (rPointLocalCoordinates[0] > max_parameter) {
325  return 0;
326  }
327 
328  return 1;
329  }
330 
334 
335  /* @brief Makes a check if the provided paramater rPointLocalCoordinates[0]
336  * is inside the curve, or on the boundary or if it lays outside.
337  * If it is outside, it is set to the boundary which is closer to it.
338  * @return if rPointLocalCoordinates[0] was before the projection:
339  * outside -> 0
340  * inside -> 1
341  * on boundary -> 2 - meaning that it is equal to start or end point.
342  */
344  const CoordinatesArrayType& rPointLocalCoordinates,
345  CoordinatesArrayType& rClosestPointLocalCoordinates,
346  const double Tolerance = std::numeric_limits<double>::epsilon()
347  ) const override
348  {
349  const double min_parameter = std::min(mKnots[mPolynomialDegree - 1], mKnots[NumberOfKnots() - mPolynomialDegree]);
350  if (rPointLocalCoordinates[0] < min_parameter) {
351  rClosestPointLocalCoordinates[0] = min_parameter;
352  return 0;
353  } else if (rPointLocalCoordinates[0] == min_parameter) {
354  rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
355  return 2;
356  }
357 
358  const double max_parameter = std::max(mKnots[mPolynomialDegree - 1], mKnots[NumberOfKnots() - mPolynomialDegree]);
359  if (rPointLocalCoordinates[0] > max_parameter) {
360  rClosestPointLocalCoordinates[0] = max_parameter;
361  return 0;
362  } else if (rPointLocalCoordinates[0] == max_parameter) {
363  rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
364  return 2;
365  }
366 
367  rClosestPointLocalCoordinates[0] = rPointLocalCoordinates[0];
368  return 1;
369  }
370 
374 
375  /* @brief Makes projection of rPointGlobalCoordinates to
376  * the closest point on the curve, with
377  * local coordinates rProjectedPointLocalCoordinates.
378  *
379  * @param Tolerance is the breaking criteria.
380  * @return 1 -> projection succeeded
381  * 0 -> projection failed
382  */
384  const CoordinatesArrayType& rPointGlobalCoordinates,
385  CoordinatesArrayType& rProjectedPointLocalCoordinates,
386  const double Tolerance = std::numeric_limits<double>::epsilon()
387  ) const override
388  {
389  CoordinatesArrayType point_global_coordinates;
390 
392  rProjectedPointLocalCoordinates,
393  rPointGlobalCoordinates,
394  point_global_coordinates,
395  *this,
396  20, Tolerance);
397  }
398 
402 
404  double Length() const override
405  {
406  IntegrationPointsArrayType integration_points;
407  IntegrationInfo integration_info = GetDefaultIntegrationInfo();
408  CreateIntegrationPoints(integration_points, integration_info);
409 
410  double length = 0.0;
411  for (IndexType i = 0; i < integration_points.size(); ++i) {
412  double determinant_jacobian = this->DeterminantOfJacobian(integration_points[i]);
413  length += integration_points[i].Weight() * determinant_jacobian;
414  }
415  return length;
416  }
417 
421 
424  Matrix& rResult,
425  const CoordinatesArrayType& rCoordinates) const override
426  {
427  const SizeType working_space_dimension = this->WorkingSpaceDimension();
428  if (rResult.size1() != working_space_dimension || rResult.size2() != 1) {
429  rResult.resize(working_space_dimension, 1, false);
430  }
431  rResult.clear();
432 
434  NurbsCurveShapeFunction shape_function_container(mPolynomialDegree, 1);
435  if (IsRational()) {
436  shape_function_container.ComputeNurbsShapeFunctionValues(mKnots, mWeights, rCoordinates[0]);
437  }
438  else {
439  shape_function_container.ComputeBSplineShapeFunctionValues(mKnots, rCoordinates[0]);
440  }
441 
443  for (IndexType i = 0; i < shape_function_container.NumberOfNonzeroControlPoints(); i++) {
444  const IndexType index = shape_function_container.GetFirstNonzeroControlPoint() + i;
445 
446  const array_1d<double, 3>& r_coordinates = (*this)[index].Coordinates();
447  for (IndexType k = 0; k < working_space_dimension; ++k) {
448  rResult(k, 0) += r_coordinates[k] * shape_function_container(i, 1);
449  }
450  }
451  return rResult;
452  }
453 
457 
460  {
461  return IntegrationInfo(1,
462  mPolynomialDegree + 1,
464  }
465 
469 
470  /* Creates integration points according to its the polynomial degrees.
471  * @param result integration points.
472  */
474  IntegrationPointsArrayType& rIntegrationPoints,
475  IntegrationInfo& rIntegrationInfo) const override
476  {
477  std::vector<double> spans;
478  SpansLocalSpace(spans);
479 
481  rIntegrationPoints, spans, rIntegrationInfo);
482  }
483 
487 
488  /* @brief creates a list of quadrature point geometries
489  * from a list of integration points.
490  *
491  * @param rResultGeometries list of quadrature point geometries.
492  * @param rIntegrationPoints list of provided integration points.
493  * @param NumberOfShapeFunctionDerivatives the number of evaluated
494  * derivatives of shape functions at the quadrature point geometries.
495  *
496  * @see quadrature_point_geometry.h
497  */
499  GeometriesArrayType& rResultGeometries,
500  IndexType NumberOfShapeFunctionDerivatives,
501  const IntegrationPointsArrayType& rIntegrationPoints,
502  IntegrationInfo& rIntegrationInfo) override
503  {
504  // shape function container.
505  NurbsCurveShapeFunction shape_function_container(
506  mPolynomialDegree, NumberOfShapeFunctionDerivatives);
507 
508  // Resize containers.
509  if (rResultGeometries.size() != rIntegrationPoints.size())
510  rResultGeometries.resize(rIntegrationPoints.size());
511 
512  auto default_method = this->GetDefaultIntegrationMethod();
513  SizeType num_nonzero_cps = shape_function_container.NumberOfNonzeroControlPoints();
514 
515  Matrix N(1, num_nonzero_cps);
516  DenseVector<Matrix> shape_function_derivatives(NumberOfShapeFunctionDerivatives - 1);
517  for (IndexType i = 0; i < NumberOfShapeFunctionDerivatives - 1; i++) {
518  shape_function_derivatives[i].resize(num_nonzero_cps, 1);
519  }
520 
521  for (IndexType i = 0; i < rIntegrationPoints.size(); ++i)
522  {
523  if (IsRational()) {
524  shape_function_container.ComputeNurbsShapeFunctionValues(
525  mKnots, mWeights, rIntegrationPoints[i][0]);
526  }
527  else {
528  shape_function_container.ComputeBSplineShapeFunctionValues(
529  mKnots, rIntegrationPoints[i][0]);
530  }
531 
533  PointsArrayType nonzero_control_points(num_nonzero_cps);
534  auto first_cp_index = shape_function_container.GetFirstNonzeroControlPoint();
535  for (IndexType j = 0; j < num_nonzero_cps; j++) {
536  nonzero_control_points(j) = pGetPoint(first_cp_index + j);
537  }
538 
540  for (IndexType j = 0; j < num_nonzero_cps; j++) {
541  N(0, j) = shape_function_container(j, 0);
542  }
543 
545  if (NumberOfShapeFunctionDerivatives > 0) {
546  for (IndexType n = 0; n < NumberOfShapeFunctionDerivatives - 1; n++) {
547  for (IndexType j = 0; j < num_nonzero_cps; j++) {
548  shape_function_derivatives[n](j, 0) = shape_function_container(j, n + 1);
549  }
550  }
551  }
552 
554  default_method, rIntegrationPoints[i],
555  N, shape_function_derivatives);
556 
558  this->WorkingSpaceDimension(), 1, data_container, nonzero_control_points);
559  }
560  }
561 
565 
566  /*
567  * @brief This method maps from dimension space to working space.
568  * From Piegl and Tiller, The NURBS Book, Algorithm A3.1/ A4.1
569  * @param rResult array_1d<double, 3> with the coordinates in working space
570  * @param LocalCoordinates The local coordinates in dimension space
571  * @return array_1d<double, 3> with the coordinates in working space
572  * @see PointLocalCoordinates
573  */
575  CoordinatesArrayType& rResult,
576  const CoordinatesArrayType& rLocalCoordinates
577  ) const override
578  {
579  NurbsCurveShapeFunction shape_function_container(mPolynomialDegree, 0);
580 
581  if (IsRational()) {
582  shape_function_container.ComputeNurbsShapeFunctionValues(mKnots, mWeights, rLocalCoordinates[0]);
583  }
584  else {
585  shape_function_container.ComputeBSplineShapeFunctionValues(mKnots, rLocalCoordinates[0]);
586  }
587 
588  noalias(rResult) = ZeroVector(3);
589  for (IndexType i = 0; i < shape_function_container.NumberOfNonzeroControlPoints(); i++) {
590  const IndexType index = shape_function_container.GetFirstNonzeroControlPoint() + i;
591 
592  rResult += (*this)[index] * shape_function_container(i, 0);
593  }
594  return rResult;
595  }
596 
607  std::vector<CoordinatesArrayType>& rGlobalSpaceDerivatives,
608  const CoordinatesArrayType& rLocalCoordinates,
609  const SizeType DerivativeOrder) const override
610  {
611  NurbsCurveShapeFunction shape_function_container(mPolynomialDegree, DerivativeOrder);
612 
613  if (this->IsRational()) {
614  shape_function_container.ComputeNurbsShapeFunctionValues(mKnots, mWeights, rLocalCoordinates[0]);
615  }
616  else {
617  shape_function_container.ComputeBSplineShapeFunctionValues(mKnots, rLocalCoordinates[0]);
618  }
619 
620  if (rGlobalSpaceDerivatives.size() != DerivativeOrder + 1) {
621  rGlobalSpaceDerivatives.resize(DerivativeOrder + 1);
622  }
623 
624 
625  for (IndexType order = 0; order < shape_function_container.NumberOfShapeFunctionRows(); order++) {
626  IndexType index_0 = shape_function_container.GetFirstNonzeroControlPoint();
627  rGlobalSpaceDerivatives[order] = (*this)[index_0] * shape_function_container(0, order);
628  for (IndexType u = 1; u < shape_function_container.NumberOfNonzeroControlPoints(); u++) {
629  IndexType index = shape_function_container.GetFirstNonzeroControlPoint() + u;
630 
631  rGlobalSpaceDerivatives[order] += (*this)[index] * shape_function_container(u, order);
632  }
633  }
634  }
635 
639 
640  /*
641  * @brief This function computes the shape functions at a certain point.
642  * From Piegl and Tiller, The NURBS Book, Algorithm A3.1/ A4.1
643  * @param rResult the given Vector, which will be overwritten by the solution
644  * @param rCoordinates the given local coordinates, with the coordinates u and v.
645  * @return vector of the shape functions at rCoordinates
646  */
648  Vector &rResult,
649  const CoordinatesArrayType& rCoordinates) const override
650  {
651  NurbsCurveShapeFunction shape_function_container(mPolynomialDegree, 0);
652 
653  if (IsRational()) {
654  shape_function_container.ComputeNurbsShapeFunctionValues(mKnots, mWeights, rCoordinates[0]);
655  }
656  else {
657  shape_function_container.ComputeBSplineShapeFunctionValues(mKnots, rCoordinates[0]);
658  }
659 
660  if (rResult.size() != shape_function_container.NumberOfNonzeroControlPoints())
661  rResult.resize(shape_function_container.NumberOfNonzeroControlPoints());
662 
663  for (IndexType i = 0; i < shape_function_container.NumberOfNonzeroControlPoints(); i++) {
664  rResult[i] = shape_function_container(i, 0);
665  }
666 
667  return rResult;
668  }
669 
670  /*
671  * @brief This function computes the first derivatives at a certain point.
672  * From Piegl and Tiller, The NURBS Book, Algorithm A3.2/ A4.2
673  * @param rResult the given Matrix which will be overwritten by the solution
674  * @param rCoordinates the given local coordinates, with the coordinates u and v.
675  * @return matrix of derivatives at rCoordinates.
676  * (0,i): dN/du, (1,i): dN/dv
677  */
679  Matrix& rResult,
680  const CoordinatesArrayType& rCoordinates) const override
681  {
682  NurbsCurveShapeFunction shape_function_container(mPolynomialDegree, 1);
683 
684  if (IsRational()) {
685  shape_function_container.ComputeNurbsShapeFunctionValues(mKnots, mWeights, rCoordinates[0]);
686  }
687  else {
688  shape_function_container.ComputeBSplineShapeFunctionValues(mKnots, rCoordinates[0]);
689  }
690 
691  if (rResult.size1() != 1
692  && rResult.size2() != shape_function_container.NumberOfNonzeroControlPoints())
693  rResult.resize(1, shape_function_container.NumberOfNonzeroControlPoints());
694 
695  for (IndexType i = 0; i < shape_function_container.NumberOfNonzeroControlPoints(); i++) {
696  rResult(0, i) = shape_function_container(i, 1);
697  }
698 
699  return rResult;
700  }
701 
705 
707  {
709  }
710 
712  {
714  }
715 
719 
721  std::string Info() const override
722  {
723  return std::to_string(TWorkingSpaceDimension) + " dimensional nurbs curve.";
724  }
725 
727  void PrintInfo(std::ostream& rOStream) const override
728  {
729  rOStream << TWorkingSpaceDimension << " dimensional nurbs curve.";
730  }
731 
733  void PrintData(std::ostream& rOStream) const override
734  {
735  }
736 
738 private:
741 
742  static const GeometryData msGeometryData;
743 
744  static const GeometryDimension msGeometryDimension;
745 
749 
750  SizeType mPolynomialDegree;
751  Vector mKnots;
752  Vector mWeights;
753 
757 
758 
759  /*
760  * @brief Checks if the knot vector is coinciding with the number of
761  * control points and the polynomial degree. If the knot vector
762  * has a multiplicity of p+1 in the beginning, it is reduced to p.
763  */
764  void CheckAndFitKnotVectors()
765  {
766  SizeType num_control_points = this->size();
767 
768  if (mKnots.size() != NurbsUtilities::GetNumberOfKnots(mPolynomialDegree, num_control_points)) {
769  if ((mKnots.size() - 2) == NurbsUtilities::GetNumberOfKnots(mPolynomialDegree, num_control_points)) {
770  Vector Knots = ZeroVector(mKnots.size() - 2);
771  for (SizeType i = 0; i < mKnots.size() - 2; ++i) {
772  Knots[i] = mKnots[i + 1];
773  }
774  mKnots = Knots;
775  } else {
777  << "Number of controls points, polynomial degree and number of knots do not match! " << std::endl
778  << " P: " << mPolynomialDegree << ", size of knot vector: " << mKnots.size()
779  << ", number of control points: " << num_control_points << "." << std::endl
780  << "Following condition must be achieved: Knots.size() = (ControlPoints.size() + PolynomialDegree - 1)."
781  << std::endl;
782  }
783  }
784  }
785 
789 
790  friend class Serializer;
791 
792  void save(Serializer& rSerializer) const override
793  {
795  rSerializer.save("PolynomialDegree", mPolynomialDegree);
796  rSerializer.save("Knots", mKnots);
797  rSerializer.save("Weights", mWeights);
798  }
799 
800  void load(Serializer& rSerializer) override
801  {
803  rSerializer.load("PolynomialDegree", mPolynomialDegree);
804  rSerializer.load("Knots", mKnots);
805  rSerializer.load("Weights", mWeights);
806  }
807 
808  NurbsCurveGeometry() : BaseType(PointsArrayType(), &msGeometryData) {};
809 
811 
812 }; // class NurbsCurveGeometry
813 
814 template<int TWorkingSpaceDimension, class TContainerPointType>
815 const GeometryData NurbsCurveGeometry<TWorkingSpaceDimension, TContainerPointType>::msGeometryData(
818  {}, {}, {});
819 
820 template<int TWorkingSpaceDimension, class TContainerPointType>
821 const GeometryDimension NurbsCurveGeometry<TWorkingSpaceDimension, TContainerPointType>::msGeometryDimension(TWorkingSpaceDimension, 1);
822 
823 } // namespace Kratos
824 
825 #endif // KRATOS_NURBS_CURVE_GEOMETRY_H_INCLUDED defined
static GeometryPointerType CreateQuadraturePoint(SizeType WorkingSpaceDimension, SizeType LocalSpaceDimension, GeometryShapeFunctionContainer< GeometryData::IntegrationMethod > &rShapeFunctionContainer, PointsArrayType rPoints, GeometryType *pGeometryParent)
Definition: quadrature_points_utility.h:159
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
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
SizeType size() const
Definition: geometry.h:518
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
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
std::size_t IndexType
Definition: geometry.h:137
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
Vector & DeterminantOfJacobian(Vector &rResult) const
Definition: geometry.h:3154
virtual void CreateQuadraturePointGeometries(GeometriesArrayType &rResultGeometries, IndexType NumberOfShapeFunctionDerivatives, const IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo)
Definition: geometry.h:2331
IntegrationMethod GetDefaultIntegrationMethod() const
Definition: geometry.h:2004
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
Definition: geometry_shape_function_container.h:60
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
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void clear()
Definition: amatrix_interface.h:284
Definition: nurbs_curve_geometry.h:33
BaseType::IndexType IndexType
Definition: nurbs_curve_geometry.h:43
void CreateQuadraturePointGeometries(GeometriesArrayType &rResultGeometries, IndexType NumberOfShapeFunctionDerivatives, const IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo) override
Definition: nurbs_curve_geometry.h:498
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: nurbs_curve_geometry.h:647
NurbsCurveGeometry< TWorkingSpaceDimension, TContainerPointType > GeometryType
Definition: nurbs_curve_geometry.h:41
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: nurbs_curve_geometry.h:733
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: nurbs_curve_geometry.h:309
const Vector & Knots() const
Definition: nurbs_curve_geometry.h:193
NurbsCurveGeometry & operator=(const NurbsCurveGeometry &rOther)
Assignment operator.
Definition: nurbs_curve_geometry.h:124
NurbsCurveGeometry(const PointsArrayType &rThisPoints, const SizeType PolynomialDegree, const Vector &rKnots, const Vector &rWeights)
Conctructor for NURBS curves.
Definition: nurbs_curve_geometry.h:76
void SpansLocalSpace(std::vector< double > &rSpans, IndexType DirectionIndex=0) const override
Definition: nurbs_curve_geometry.h:285
TContainerPointType::value_type NodeType
Definition: nurbs_curve_geometry.h:38
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: nurbs_curve_geometry.h:46
bool IsRational() const
Definition: nurbs_curve_geometry.h:222
SizeType PolynomialDegree(IndexType LocalDirectionIndex) const override
Return polynomial degree of the curve.
Definition: nurbs_curve_geometry.h:174
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: nurbs_curve_geometry.h:711
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: nurbs_curve_geometry.h:678
std::string Info() const override
Turn back information as a string.
Definition: nurbs_curve_geometry.h:721
SizeType NumberOfKnotSpans(IndexType DirectionIndex=0) const
Returns the number of spans.
Definition: nurbs_curve_geometry.h:270
Geometry< NodeType > BaseType
Definition: nurbs_curve_geometry.h:40
BaseType::GeometriesArrayType GeometriesArrayType
Definition: nurbs_curve_geometry.h:48
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
NurbsCurveGeometry(const PointsArrayType &rThisPoints, const SizeType PolynomialDegree, const Vector &rKnots)
Conctructor for B-Spline curves.
Definition: nurbs_curve_geometry.h:64
NurbsCurveGeometry(NurbsCurveGeometry< TWorkingSpaceDimension, TOtherContainerPointType > const &rOther)
Copy constructor from a geometry with different point type.
Definition: nurbs_curve_geometry.h:107
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: nurbs_curve_geometry.h:49
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nurbs_curve_geometry.h:727
double Length() const override
Computes the length of a nurbs curve.
Definition: nurbs_curve_geometry.h:404
const Vector & Weights() const
Definition: nurbs_curve_geometry.h:233
SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const override
Returns number of points per direction.
Definition: nurbs_curve_geometry.h:160
~NurbsCurveGeometry() override=default
Destructor.
BaseType::PointsArrayType PointsArrayType
Definition: nurbs_curve_geometry.h:47
IntegrationInfo GetDefaultIntegrationInfo() const override
Provides the default integration dependent on the polynomial degree.
Definition: nurbs_curve_geometry.h:459
void GlobalSpaceDerivatives(std::vector< CoordinatesArrayType > &rGlobalSpaceDerivatives, const CoordinatesArrayType &rLocalCoordinates, const SizeType DerivativeOrder) const override
This method maps from dimension space to working space and computes the number of derivatives at the ...
Definition: nurbs_curve_geometry.h:606
std::vector< NurbsInterval > KnotSpanIntervals() const
Definition: nurbs_curve_geometry.h:250
NurbsCurveGeometry(const PointsArrayType &ThisPoints)
Definition: nurbs_curve_geometry.h:92
SizeType NumberOfKnots() const
Definition: nurbs_curve_geometry.h:202
SizeType NumberOfNonzeroControlPoints() const
Definition: nurbs_curve_geometry.h:212
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: nurbs_curve_geometry.h:343
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: nurbs_curve_geometry.h:383
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: nurbs_curve_geometry.h:706
NurbsCurveGeometry & operator=(NurbsCurveGeometry< TWorkingSpaceDimension, TOtherContainerPointType > const &rOther)
Assignment operator for geometries with different point type.
Definition: nurbs_curve_geometry.h:135
BaseType::SizeType SizeType
Definition: nurbs_curve_geometry.h:44
BaseType::Pointer Create(PointsArrayType const &ThisPoints) const override
Definition: nurbs_curve_geometry.h:149
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rCoordinates) const override
Computes the Jacobian with coordinates.
Definition: nurbs_curve_geometry.h:423
NurbsCurveGeometry(NurbsCurveGeometry< TWorkingSpaceDimension, TContainerPointType > const &rOther)
Copy constructor.
Definition: nurbs_curve_geometry.h:98
NurbsInterval DomainInterval() const
Definition: nurbs_curve_geometry.h:241
void CreateIntegrationPoints(IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo) const override
Definition: nurbs_curve_geometry.h:473
CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rLocalCoordinates) const override
Definition: nurbs_curve_geometry.h:574
KRATOS_CLASS_POINTER_DEFINITION(NurbsCurveGeometry)
Counted pointer of NurbsCurveGeometry.
NurbsCurveShapeFunction.
Definition: nurbs_curve_shape_functions.h:34
IndexType GetFirstNonzeroControlPoint() const
Definition: nurbs_curve_shape_functions.h:141
SizeType NumberOfNonzeroControlPoints() const
Definition: nurbs_curve_shape_functions.h:108
SizeType NumberOfShapeFunctionRows() const
Definition: nurbs_curve_shape_functions.h:117
void ComputeNurbsShapeFunctionValues(const Vector &rKnots, const Vector &rWeights, const double ParameterT)
Definition: nurbs_curve_shape_functions.h:284
void ComputeBSplineShapeFunctionValues(const Vector &rKnots, const double ParameterT)
Definition: nurbs_curve_shape_functions.h:172
Class for optimized use of intervals.
Definition: nurbs_interval.h:36
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
void resize(size_type dim)
Definition: pointer_vector.h:314
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
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
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
SizeType GetNumberOfKnots(const SizeType PolynomialDegree, const SizeType NumberOfControlPoints)
Definition: nurbs_utilities.h:89
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
u
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:30
string t0
Definition: kernel_approximation_error.py:61
def load(f)
Definition: ode_solve.py:307
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31