13 #if !defined(KRATOS_NURBS_VOLUME_REFINEMENT_UTILITIES_H_INCLUDED )
14 #define KRATOS_NURBS_VOLUME_REFINEMENT_UTILITIES_H_INCLUDED
58 std::sort(rKnotsUToInsert.begin(),rKnotsUToInsert.end());
77 SizeType new_num_of_knots_u = old_num_of_knots_u + r;
78 rKnotsURefined.
resize(new_num_of_knots_u);
80 SizeType new_num_of_cp_u = old_num_of_cp_u + r;
81 rPointsRefined.
resize(new_num_of_cp_u*old_num_of_cp_v*old_num_of_cp_w);
86 rKnotsURefined[
i] = old_knots_u[
i];
87 for(
IndexType i =
b+polynomial_degree_u;
i < old_num_of_knots_u; ++
i)
88 rKnotsURefined[
i+r+1] = old_knots_u[
i];
92 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth){
97 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
i,
column, depth);
99 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
i,
column, depth);
100 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
105 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
i+r+1,
column, depth);
107 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
i,
column, depth);
108 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
117 for(
int j = r;
j >= 0;
j--){
118 while( rKnotsUToInsert[
j] <= old_knots_u[
i] &&
i >
static_cast<int>(
a) ){
120 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
125 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
k-
p-1+1,
column, depth);
127 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
i-
p-1+1,
column, depth);
128 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
131 rKnotsURefined[
k] = old_knots_u[
i];
136 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
139 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
k-
p-1+1,
column, depth);
141 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
k-
p+1,
column, depth);
142 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
147 double alpha = rKnotsURefined[
k+
l] - rKnotsUToInsert[
j];
148 if( std::abs(
alpha) < 1
e-10){
150 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
153 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w, index-1+1,
column, depth);
155 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w, index+1,
column, depth);
156 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
163 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
166 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w, index-1+1,
column, depth);
168 new_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w, index+1,
column, depth);
170 double x =
alpha * rPointsRefined[cp_index_minus][0] + (1.0-
alpha) * rPointsRefined[cp_index][0];
171 double y =
alpha * rPointsRefined[cp_index_minus][1] + (1.0-
alpha) * rPointsRefined[cp_index][1];
172 double z =
alpha * rPointsRefined[cp_index_minus][2] + (1.0-
alpha) * rPointsRefined[cp_index][2];
174 rPointsRefined(cp_index_minus) = Kratos::make_intrusive<NodeType>(0,
x,
y,
z);
179 rKnotsURefined[
k] = rKnotsUToInsert[
j];
198 std::sort(rKnotsVToInsert.begin(),rKnotsVToInsert.end());
214 SizeType r = rKnotsVToInsert.size();
216 SizeType new_num_of_knots_v = old_num_of_knots_v + r;
217 rKnotsVRefined.
resize(new_num_of_knots_v);
219 SizeType new_num_of_cp_v = old_num_of_cp_v + r;
220 rPointsRefined.
resize(old_num_of_cp_u*new_num_of_cp_v*old_num_of_cp_w);
225 rKnotsVRefined[
i] = old_knots_v[
i];
226 for(
IndexType i =
b+polynomial_degree_v;
i < old_num_of_knots_v; ++
i)
227 rKnotsVRefined[
i+r+1] = old_knots_v[
i];
231 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth){
234 for(
IndexType i = 0;
i <=
a - polynomial_degree_v + 1; ++
i){
236 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row,
i, depth);
238 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
i, depth);
239 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
244 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row,
i+r+1, depth);
246 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
i, depth);
247 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
256 for(
int j = r;
j >= 0;
j--){
257 while( rKnotsVToInsert[
j] <= old_knots_v[
i] &&
i >
static_cast<int>(
a)){
259 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
264 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row,
k-
p-1+1, depth);
266 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
i-
p-1+1, depth);
267 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
270 rKnotsVRefined[
k] = old_knots_v[
i];
275 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
278 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row,
k-
p-1+1, depth);
280 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row,
k-
p+1, depth);
281 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
286 double alpha = rKnotsVRefined[
k+
l] - rKnotsVToInsert[
j];
287 if( std::abs(
alpha) < 1
e-10){
289 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
292 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row, index-1+1, depth);
294 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row, index+1, depth);
295 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
302 for(
IndexType depth=0; depth < old_num_of_cp_w; ++depth) {
305 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row, index-1+1, depth);
307 old_num_of_cp_u, new_num_of_cp_v, old_num_of_cp_w,
row, index+1, depth);
309 double x =
alpha * rPointsRefined[cp_index_minus][0] + (1.0-
alpha) * rPointsRefined[cp_index][0];
310 double y =
alpha * rPointsRefined[cp_index_minus][1] + (1.0-
alpha) * rPointsRefined[cp_index][1];
311 double z =
alpha * rPointsRefined[cp_index_minus][2] + (1.0-
alpha) * rPointsRefined[cp_index][2];
313 rPointsRefined(cp_index_minus) = Kratos::make_intrusive<NodeType>(0,
x,
y,
z);
319 rKnotsVRefined[
k] = rKnotsVToInsert[
j];
338 std::sort(rKnotsWToInsert.begin(),rKnotsWToInsert.end());
354 SizeType r = rKnotsWToInsert.size();
356 SizeType new_num_of_knots_w = old_num_of_knots_w + r;
357 rKnotsWRefined.
resize(new_num_of_knots_w);
359 SizeType new_num_of_cp_w = old_num_of_cp_w + r;
360 rPointsRefined.
resize(old_num_of_cp_u*old_num_of_cp_v*new_num_of_cp_w);
365 rKnotsWRefined[
i] = old_knots_w[
i];
366 for(
IndexType i =
b+polynomial_degree_w;
i < old_num_of_knots_w; ++
i)
367 rKnotsWRefined[
i+r+1] = old_knots_w[
i];
374 for(
IndexType i = 0;
i <=
a - polynomial_degree_w + 1; ++
i){
376 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column,
i);
378 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
column,
i);
379 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
384 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column,
i+r+1);
386 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
column,
i);
387 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
396 for(
int j = r;
j >= 0;
j--){
397 while( rKnotsWToInsert[
j] <= old_knots_w[
i] &&
i >
static_cast<int>(
a)){
404 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column,
k-
p-1+1);
406 old_num_of_cp_u, old_num_of_cp_v, old_num_of_cp_w,
row,
column,
i-
p-1+1);
407 rPointsRefined(cp_index_left) = Kratos::make_intrusive<NodeType>(0, rGeometry[cp_index_right]);
410 rKnotsWRefined[
k] = old_knots_w[
i];
418 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column,
k-
p-1+1);
420 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column,
k-
p+1);
421 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
426 double alpha = rKnotsWRefined[
k+
l] - rKnotsWToInsert[
j];
427 if( std::abs(
alpha) < 1
e-10){
432 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column, index-1+1);
434 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column, index+1);
435 rPointsRefined(cp_index_left) = rPointsRefined(cp_index_right);
445 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column, index-1+1);
447 old_num_of_cp_u, old_num_of_cp_v, new_num_of_cp_w,
row,
column, index+1);
449 double x =
alpha * rPointsRefined[cp_index_minus][0] + (1.0-
alpha) * rPointsRefined[cp_index][0];
450 double y =
alpha * rPointsRefined[cp_index_minus][1] + (1.0-
alpha) * rPointsRefined[cp_index][1];
451 double z =
alpha * rPointsRefined[cp_index_minus][2] + (1.0-
alpha) * rPointsRefined[cp_index][2];
453 rPointsRefined(cp_index_minus) = Kratos::make_intrusive<NodeType>(0,
x,
y,
z);
459 rKnotsWRefined[
k] = rKnotsWToInsert[
j];
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class defines the node.
Definition: node.h:65
A volume geometry based on a full 3-dimensional BSpline tensor product.
Definition: nurbs_volume_geometry.h:46
const Vector & KnotsV() const
Get Knot vector in v-direction.
Definition: nurbs_volume_geometry.h:305
SizeType PolynomialDegreeV() const
Definition: nurbs_volume_geometry.h:277
SizeType NumberOfControlPointsW() const
Definition: nurbs_volume_geometry.h:381
SizeType NumberOfControlPointsV() const
Definition: nurbs_volume_geometry.h:373
const Vector & KnotsU() const
Get Knot vector in u-direction.
Definition: nurbs_volume_geometry.h:295
SizeType NumberOfControlPointsU() const
Attention weights are not yet implemented.
Definition: nurbs_volume_geometry.h:365
SizeType PolynomialDegreeW() const
Definition: nurbs_volume_geometry.h:285
SizeType NumberOfKnotsV() const
Definition: nurbs_volume_geometry.h:331
SizeType PolynomialDegreeU() const
Definition: nurbs_volume_geometry.h:269
SizeType NumberOfKnotsU() const
Definition: nurbs_volume_geometry.h:323
const Vector & KnotsW() const
Get Knot vector in w-direction.
Definition: nurbs_volume_geometry.h:315
SizeType NumberOfKnotsW() const
Definition: nurbs_volume_geometry.h:339
Definition: nurbs_volume_refinement_utilities.h:28
static void KnotRefinementW(NurbsVolumeGeometryType &rGeometry, std::vector< double > &rKnotsWToInsert, PointerVector< NodeType > &rPointsRefined, Vector &rKnotsWRefined)
Refines the w-knotvector of a NurbsVolumeGeometry.
Definition: nurbs_volume_refinement_utilities.h:334
std::size_t IndexType
Definition: nurbs_volume_refinement_utilities.h:33
NurbsVolumeGeometryType::Pointer NurbsVolumeGeometryPointerType
Definition: nurbs_volume_refinement_utilities.h:38
static void KnotRefinementV(NurbsVolumeGeometryType &rGeometry, std::vector< double > &rKnotsVToInsert, PointerVector< NodeType > &rPointsRefined, Vector &rKnotsVRefined)
Refines the v-knotvector of a NurbsVolumeGeometry.
Definition: nurbs_volume_refinement_utilities.h:194
static void KnotRefinementU(NurbsVolumeGeometryType &rGeometry, std::vector< double > &rKnotsUToInsert, PointerVector< NodeType > &rPointsRefined, Vector &rKnotsURefined)
Refines the u-knotvector of a NurbsVolumeGeometry.
Definition: nurbs_volume_refinement_utilities.h:54
std::size_t SizeType
Definition: nurbs_volume_refinement_utilities.h:34
Node NodeType
Definition: nurbs_volume_refinement_utilities.h:35
NurbsVolumeGeometry< PointerVector< NodeType > > NurbsVolumeGeometryType
Definition: nurbs_volume_refinement_utilities.h:37
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void resize(size_type dim)
Definition: pointer_vector.h:314
z
Definition: GenerateWind.py:163
IndexType GetLowerSpan(const SizeType PolynomialDegree, const Vector &rKnots, const double ParameterT)
Definition: nurbs_utilities.h:64
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
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::MatrixColumn< const TExpressionType > column(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t ColumnIndex)
Definition: amatrix_interface.h:637
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
p
Definition: sensitivityMatrix.py:52
x
Definition: sensitivityMatrix.py:49
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31