13 #if !defined(KRATOS_NURBS_VOLUME_SHAPE_FUNCTIONS_H_INCLUDED )
14 #define KRATOS_NURBS_VOLUME_SHAPE_FUNCTIONS_H_INCLUDED
74 IndexType number_of_shape_function_rows = 0.0;
76 number_of_shape_function_rows += (1 +
i) * (2 +
i) / 2;
79 return number_of_shape_function_rows;
97 const SizeType current_level = DerivativeOrderU + DerivativeOrderV + DerivativeOrderW;
99 SizeType first_index_of_current_level = 0;
100 if( current_level > 0){
102 const SizeType offset = current_level - DerivativeOrderU;
103 SizeType index_in_current_level = 0;
105 index_in_current_level +=
i + 1;
107 index_in_current_level += DerivativeOrderW;
109 return first_index_of_current_level + index_in_current_level;
133 return ShapeFunctionValue(ControlPointIndexU, ControlPointIndexV, ControlPointIndexW, DerivativeRow);
155 mShapeFunctionValues.
resize(number_of_nonzero_control_points * number_of_shape_function_rows);
178 return mDerivativeOrder;
224 indices[poleIndex][0] = poleU;
225 indices[poleIndex][1] = poleV;
226 indices[poleIndex][2] = poleW;
256 NumberOfControlPointsU, NumberOfControlPointsV, NumberOfControlPointsW, cp_index_u, cp_index_v, cp_index_w);
279 KRATOS_DEBUG_ERROR_IF(index >= mShapeFunctionValues.size()) <<
"Index exceeds size of shape function values. Index: "
280 << index <<
", mShapeFunctionValues.size(): " << mShapeFunctionValues.size()
281 <<
", ControlPointIndexU: " << ControlPointIndexU <<
", ControlPointIndexV: " << ControlPointIndexV
282 <<
", ControlPointIndexW: " << ControlPointIndexW <<
", DerivativeRow: " << DerivativeRow << std::endl;
284 return mShapeFunctionValues[index];
298 KRATOS_DEBUG_ERROR_IF(index >= mShapeFunctionValues.size()) <<
"Index exceeds size of shape function values. Index: "
299 << index <<
", mShapeFunctionValues.size(): " << mShapeFunctionValues.size()
300 <<
", ControlPointIndex: " << ControlPointIndex <<
", DerivativeOrder: " <<
DerivativeOrder << std::endl;
302 return mShapeFunctionValues[index];
307 return mFirstNonzeroControlPointU;
317 return mFirstNonzeroControlPointV;
327 return mFirstNonzeroControlPointW;
345 const double ParameterU,
346 const double ParameterV,
347 const double ParameterW)
349 mShapeFunctionValues =
ZeroVector(mShapeFunctionValues.size());
361 for (
int OrderU = currrent_order; OrderU >= 0; OrderU = OrderU - 1) {
362 const IndexType difference = currrent_order - OrderU;
363 for (
IndexType OrderW = 0; OrderW <= difference; ++OrderW) {
364 const IndexType OrderV = difference - OrderW;
369 ShapeFunctionValue(
a,
b,
c, index) = mShapeFunctionsU(
a, OrderU) * mShapeFunctionsV(
b, OrderV) * mShapeFunctionsW(
c, OrderW);
387 const double ParameterU,
388 const double ParameterV,
389 const double ParameterW)
415 const double ParameterU,
416 const double ParameterV,
417 const double ParameterW)
420 KRATOS_WARNING(
"NURBSVolumeShapeFunctions: ComputeNurbsShapeFunctionValuesAtSpan")
421 <<
"The NURBS weights are not yet imlemented. "
422 <<
"Therefore the 'ComputeBSplineShapeFunctionValuesAtSpan' is invoked." << std::endl;
426 rKnotsU, rKnotsV, rKnotsW, SpanU, SpanV, SpanW, ParameterU, ParameterV, ParameterW);
434 const double ParameterU,
435 const double ParameterV,
436 const double ParameterW)
443 rKnotsU, rKnotsV, rKnotsW, SpanU, SpanV, SpanW, Weights, ParameterU, ParameterV, ParameterW);
463 inline int GetControlPointIndex(
476 ControlPointIndexU, ControlPointIndexV, ControlPointIndexW);
479 inline int GetNonzeroControlPointIndex(
487 ControlPointIndexU, ControlPointIndexV, ControlPointIndexW);
497 const IndexType control_point_index = GetNonzeroControlPointIndex(
498 ControlPointIndexU, ControlPointIndexV, ControlPointIndexW);
502 DerivativeRow, control_point_index);
513 DerivativeRow, ControlPointIndex);
515 return mShapeFunctionValues[index];
524 const IndexType index = this->GetIndex(ControlPointIndexU, ControlPointIndexV, ControlPointIndexW, DerivativeRow);
526 return mShapeFunctionValues[index];
533 int mDerivativeOrder;
534 NurbsCurveShapeFunction mShapeFunctionsU;
535 NurbsCurveShapeFunction mShapeFunctionsV;
536 NurbsCurveShapeFunction mShapeFunctionsW;
537 Vector mShapeFunctionValues;
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void ResizeDataContainers(const SizeType PolynomialDegree, const SizeType DerivativeOrder)
Definition: nurbs_curve_shape_functions.h:79
void ComputeBSplineShapeFunctionValuesAtSpan(const Vector &rKnots, const IndexType Span, const double ParameterT)
Definition: nurbs_curve_shape_functions.h:188
SizeType NumberOfNonzeroControlPoints() const
Definition: nurbs_curve_shape_functions.h:108
SizeType PolynomialDegree() const
Definition: nurbs_curve_shape_functions.h:98
Definition: nurbs_volume_shape_functions.h:32
SizeType PolynomialDegreeU() const
Definition: nurbs_volume_shape_functions.h:161
double ShapeFunctionValue(const IndexType ControlPointIndex, const SizeType DerivativeOrder) const
Get shape function value for given CP-index and derivative row.
Definition: nurbs_volume_shape_functions.h:290
IndexType GetLastNonzeroControlPointW() const
Definition: nurbs_volume_shape_functions.h:330
NurbsVolumeShapeFunction()
Default constructor.
Definition: nurbs_volume_shape_functions.h:45
void ComputeNurbsShapeFunctionValuesAtSpan(const Vector &rKnotsU, const Vector &rKnotsV, const Vector &rKnotsW, const IndexType SpanU, const IndexType SpanV, const IndexType SpanW, const Vector &Weights, const double ParameterU, const double ParameterV, const double ParameterW)
Definition: nurbs_volume_shape_functions.h:407
static IndexType IndexOfShapeFunctionRow(const SizeType DerivativeOrderU, const SizeType DerivativeOrderV, const SizeType DerivativeOrderW)
Returns the index of the shape function row for the given derivative indices.
Definition: nurbs_volume_shape_functions.h:91
double operator()(const IndexType ControlPointIndexU, const IndexType ControlPointIndexV, const IndexType ControlPointIndexW, const IndexType DerivativeRow) const
Definition: nurbs_volume_shape_functions.h:127
void ComputeBSplineShapeFunctionValues(const Vector &rKnotsU, const Vector &rKnotsV, const Vector &rKnotsW, const double ParameterU, const double ParameterV, const double ParameterW)
Computes the shape function values at the given parameter.
Definition: nurbs_volume_shape_functions.h:383
IndexType GetFirstNonzeroControlPointU() const
Definition: nurbs_volume_shape_functions.h:305
std::size_t SizeType
Definition: nurbs_volume_shape_functions.h:38
IndexType GetFirstNonzeroControlPointW() const
Definition: nurbs_volume_shape_functions.h:325
IndexType GetLastNonzeroControlPointV() const
Definition: nurbs_volume_shape_functions.h:320
SizeType NumberOfShapeFunctionRows() const
Definition: nurbs_volume_shape_functions.h:181
SizeType PolynomialDegreeW() const
Definition: nurbs_volume_shape_functions.h:171
SizeType DerivativeOrder() const
Definition: nurbs_volume_shape_functions.h:176
std::vector< array_1d< int, 3 > > NonzeroControlPointIndices() const
Computes indices of the nonzero control points.
Definition: nurbs_volume_shape_functions.h:210
SizeType NumberOfNonzeroControlPointsU() const
Definition: nurbs_volume_shape_functions.h:186
void ComputeNurbsShapeFunctionValues(const Vector &rKnotsU, const Vector &rKnotsV, const Vector &rKnotsW, const Vector &Weights, const double ParameterU, const double ParameterV, const double ParameterW)
Definition: nurbs_volume_shape_functions.h:429
std::size_t IndexType
Definition: nurbs_volume_shape_functions.h:37
void ResizeDataContainers(const SizeType PolynomialDegreeU, const SizeType PolynomialDegreeV, const SizeType PolynomialDegreeW, const SizeType DerivativeOrder)
Prepares the required shape function data containers.
Definition: nurbs_volume_shape_functions.h:143
void ComputeBSplineShapeFunctionValuesAtSpan(const Vector &rKnotsU, const Vector &rKnotsV, const Vector &rKnotsW, const int SpanU, const int SpanV, const int SpanW, const double ParameterU, const double ParameterV, const double ParameterW)
Computes the shape function values at the given parameter and span.
Definition: nurbs_volume_shape_functions.h:338
std::vector< int > ControlPointIndices(SizeType NumberOfControlPointsU, SizeType NumberOfControlPointsV, SizeType NumberOfControlPointsW) const
Definition: nurbs_volume_shape_functions.h:240
double operator()(const IndexType ControlPointIndex, const IndexType DerivativeRow) const
Definition: nurbs_volume_shape_functions.h:120
NurbsVolumeShapeFunction(const SizeType PolynomialDegreeU, const SizeType PolynomialDegreeV, const SizeType PolynomialDegreeW, const SizeType DerivativeOrder)
Definition: nurbs_volume_shape_functions.h:51
SizeType NumberOfNonzeroControlPointsV() const
Definition: nurbs_volume_shape_functions.h:191
static SizeType NumberOfShapeFunctionRows(const SizeType DerivativeOrder)
Returns the number of shape function rows for a given order.
Definition: nurbs_volume_shape_functions.h:72
double ShapeFunctionValue(const IndexType ControlPointIndexU, const IndexType ControlPointIndexV, const IndexType ControlPointIndexW, const SizeType DerivativeRow) const
Get shape function value for given CP-indices and derivative row.
Definition: nurbs_volume_shape_functions.h:267
SizeType NumberOfNonzeroControlPoints() const
Definition: nurbs_volume_shape_functions.h:201
SizeType PolynomialDegreeV() const
Definition: nurbs_volume_shape_functions.h:166
IndexType GetFirstNonzeroControlPointV() const
Definition: nurbs_volume_shape_functions.h:315
IndexType GetLastNonzeroControlPointU() const
Definition: nurbs_volume_shape_functions.h:310
SizeType NumberOfNonzeroControlPointsW() const
Definition: nurbs_volume_shape_functions.h:196
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
#define KRATOS_WARNING(label)
Definition: logger.h:265
IndexType GetLowerSpan(const SizeType PolynomialDegree, const Vector &rKnots, const double ParameterT)
Definition: nurbs_utilities.h:64
SizeType GetNumberOfControlPoints(const SizeType PolynomialDegree, const SizeType NumberOfKnots)
Definition: nurbs_utilities.h:99
static constexpr IndexType GetVectorIndexFromMatrixIndices(const SizeType NumberPerRow, const SizeType NumberPerColumn, const IndexType RowIndex, const IndexType ColumnIndex) noexcept
Definition: nurbs_utilities.h:133
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
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
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17