33 if ( m_result!=
nullptr )
44 GISMO_ASSERT(points.cols()==param_values.cols(),
"Pointset dimensions problem "<< points.cols() <<
" != " <<param_values.cols() );
45 GISMO_ASSERT(basis.domainDim()==param_values.rows(),
"Parameter values are inconsistent: "<< basis.domainDim() <<
" != " <<param_values.rows() );
47 m_param_values = param_values;
51 m_points.transposeInPlace();
55 m_offset[1] = m_points.rows();
64 gsMappedBasis<2,T> & mbasis)
66 m_param_values = param_values;
70 m_points.transposeInPlace();
71 m_offset =
give(offset);
80 m_last_lambda = lambda;
83 if ( m_result!=
nullptr )
86 const int num_basis = m_basis->size();
87 const short_t dimension = m_points.cols();
91 gsSparseMatrix<T> A_mat(num_basis + m_constraintsLHS.rows(), num_basis + m_constraintsLHS.rows());
95 int nonZerosPerCol = 1;
96 for (
int i = 0; i < m_basis->domainDim(); ++i)
98 nonZerosPerCol *= ( 2 * m_basis->basis(0).degree(i) + 1 ) * 4;
100 A_mat.reservePerColumn( nonZerosPerCol );
103 gsMatrix<T> m_B(num_basis + m_constraintsRHS.rows(), dimension);
109 assembleSystem(A_mat, m_B);
115 applySmoothing(lambda, A_mat);
117 if(m_constraintsLHS.rows() > 0)
118 extendSystem(A_mat, m_B);
121 A_mat.makeCompressed();
123 typename gsSparseSolver<T>::BiCGSTABILUT solver( A_mat );
125 if ( solver.preconditioner().info() != gsEigen::Success )
127 gsWarn<<
"The preconditioner failed. Aborting.\n";
134 x = solver.solve(m_B);
137 x.conservativeResize(num_basis, gsEigen::NoChange);
145 m_result = bb->makeGeometry(
give(x) ).release();
147 m_mresult = gsMappedSpline<2,T> ( *
static_cast<gsMappedBasis<2,T>*
>(m_basis),
give(x));
160 m_result = bb->makeGeometry(
give( coefficients ) ).release();
162 m_mresult = gsMappedSpline<2,T> ( *
static_cast<gsMappedBasis<2,T>*
>(m_basis),
give(coefficients));
166 this->m_result->coefs() = coefficients;
168 this->m_param_values = parameters;
169 this->computeErrors();
181 m_result = bb->makeGeometry(
give( coefficients ) ).release();
183 m_mresult = gsMappedSpline<2,T> ( *
static_cast<gsMappedBasis<2,T>*
>(m_basis),
give(coefficients));
187 this->m_result->coefs() = coefficients;
189 this->m_param_values = parameters;
199 auto G = ev.
getMap(*m_result);
205 N_int.resize(num_int * 3, num_int);
208 for(
index_t j=0; j < num_int; j++)
210 normals.col(j) = ev.
eval(sn(G).normalized(), m_param_values.col(j));
211 N_int(j, j) = normals(0, j);
212 N_int(num_int+j, j) = normals(1, j);
213 N_int(2*num_int+j, j) = normals(2, j);
215 N_int.makeCompressed();
225 for (
index_t d = 0; d<num_int; d++)
227 matrix(d,0) = m_pointErrors[d];
228 if (max_err_int < m_pointErrors[d])
229 max_err_int = m_pointErrors[d];
239 index_t numData = params.cols();
240 m_pointCurvature.resize(numData, 2);
242 auto G = ev.
getMap(*m_result);
248 for (
index_t d = 0; d<numData; d++)
251 out = ev.
eval( shapeop(G), pm );
253 pcs = out.template selfadjointView<gsEigen::Lower>().eigenvalues();
255 m_pointCurvature.row(d) = pcs.transpose();
259 return m_pointCurvature;
271 if (m_pointCurvature.size() == 0)
272 pcs = principal_curvatures(params_int);
274 pcs = m_pointCurvature;
276 pcs = pcs.cwiseAbs();
279 for (
index_t d = 0; d<num_int; d++)
282 if ( pcs(d,1) > pcs(d,0) )
298 NNT.resize(3 * num_int, 3 * num_int);
299 if (method == hybrid_pdm_tdm_boundary_pdm)
304 NNT = mu * Im + sigma * N_int * N_int.transpose();
309 if (m_pointErrors.size() == 0)
311 gsWarn <<
"No point-wise errors found. Computing them now.\n";
315 T max_err_int = m_pointErrors[0];
317 gsMatrix<T> points_int_errors, rho_c, dist_plus_rho;
319 points_int_errors = fill_pointWiseErrors(num_int, max_err_int);
321 if (method == hybrid_error_pdm_tdm_boundary_pdm)
324 MK = (0.5/max_err_int) * points_int_errors;
326 else if (method == hybrid_curvature_pdm_tdm_boundary_pdm)
329 rho_c = inverse_principal_curvatures(num_int, params_int);
330 dist_plus_rho = (points_int_errors + rho_c);
331 MK = (points_int_errors.cwiseProduct( dist_plus_rho.cwiseInverse() ));
334 gsWarn <<
"Unknown method." << std::endl;
336 NNT = MK.replicate(3,1).asDiagonal();
341 NNT.makeCompressed();
358 assembleBlockB(points_int, params_int, num_basis, B_int);
359 assembleBlockX(points_int, X_int);
362 assembleBlockB(points_bdy, params_bdy, num_basis, B_bdy);
363 assembleBlockX(points_bdy, X_bdy);
366 A_tilde = B_int.transpose() * NNT * B_int + B_bdy.transpose() * B_bdy;
367 rhs = B_int.transpose() * NNT * X_int + B_bdy.transpose() * X_bdy;
369 A_tilde.makeCompressed();
378 const index_t num_basis = m_basis->size();
379 const index_t dim_pts = m_points.cols();
380 const index_t dim_par = m_param_values.rows();
381 const index_t num_pts = m_points.rows();
382 const index_t num_int = interpIdx[0];
383 const index_t num_bdy = num_pts - num_int;
385 gsMatrix<T> points_int = m_points.block(0, 0, num_int, dim_pts);
386 gsMatrix<T> points_bdy = m_points.block(num_int, 0, num_bdy, dim_pts);
387 gsMatrix<T> params_int = m_param_values.block(0, 0, dim_par, num_int);
388 gsMatrix<T> params_bdy = m_param_values.block(0, num_int, dim_par, num_bdy);
390 m_last_lambda = lambda;
393 gsWarn <<
"No existing geometry. Computing it now as Penalized Least Squares model, with lambda = "<< m_last_lambda <<
".\n";
394 compute(m_last_lambda);
402 m_result = bb->makeGeometry(
give(refCoefs) ).release();
404 m_mresult = gsMappedSpline<2,T> ( *
static_cast<gsMappedBasis<2,T>*
>(m_basis),
give(refCoefs));
408 if( interpIdx.size() == 0)
410 GISMO_ERROR(
"Input point cloud needs to be ordered:\n"
411 "interior points, south boundary curve, east boundary curve, north boundary curve, west boundary curve.\n");
424 compute_normals(num_int, params_int, N_int);
427 blending_weights(N_int, num_int, mu, sigma, params_int, method, NNT);
431 assembleSystem(points_int, params_int, points_bdy, params_bdy, num_basis, NNT, A_tilde, rhs);
437 m_G.resize(num_basis, num_basis);
440 applySmoothing(lambda, m_G);
442 A_tilde += lambda * G_mat;
445 A_tilde.makeCompressed();
448 typename gsSparseSolver<T>::BiCGSTABILUT solver( A_tilde );
449 if ( solver.preconditioner().info() != gsEigen::Success )
451 gsWarn<<
"The preconditioner failed. Aborting.\n";
459 sol_tilde.conservativeResize(num_basis * 3, gsEigen::NoChange);
462 for(
index_t j=0; j<m_basis->size(); j++)
464 coefs_tilde(j,0) = sol_tilde(j);
465 coefs_tilde(j,1) = sol_tilde(m_basis->size()+j);
466 coefs_tilde(j,2) = sol_tilde(2*m_basis->size()+j);
474 m_result = bb->makeGeometry(
give(coefs_tilde) ).release();
476 m_mresult = gsMappedSpline<2,T> ( *
static_cast<gsMappedBasis<2,T>*
>(m_basis),
give(coefs_tilde));
487 bool corner_check =
false;
488 if( (math::abs(param(0) - p_domain(0,0)) < 1e-15) && (math::abs(param(1) - p_domain(1,0)) < 1e-15) ){
491 else if( (math::abs(param(0) - p_domain(0,1)) < 1e-15) && (math::abs(param(1) - p_domain(1,0)) < 1e-15) ){
494 else if( (math::abs(param(0) - p_domain(0,1)) < 1e-15) && (math::abs(param(1) - p_domain(1,1)) < 1e-15) ){
497 else if( (math::abs(param(0) - p_domain(0,0)) < 1e-15) && (math::abs(param(1) - p_domain(1,1)) < 1e-15) ){
501 corner_check =
false;
515 return element(0, 0) < x && x < element(0, 1) &&
516 element(1, 0) < y && y < element(1, 1);
521bool is_point_within_cell(
const T x,
523 const gsMatrix<T>& element)
525 bool condition = (element(0, 0) < x && x < element(0, 1) && element(1, 0) < y && y < element(1, 1));
531bool is_point_inside_support(
const gsMatrix<T>&
parameter,
532 const gsMatrix<T>& support)
537 return support(0, 0) <= x && x < support(0, 1) &&
538 support(1, 0) <= y && y < support(1, 1);
543bool is_point_inside_support(
const T x,
545 const gsMatrix<T>& support)
547 return support(0, 0) <= x && x < support(0, 1) &&
548 support(1, 0) <= y && y < support(1, 1);
558 compute(m_last_lambda);
562 for (
index_t i = 0; i < interpIdx[0]; ++i)
565 const auto & curr = m_points.row(i).transpose();
566 newParam = m_param_values.col(i);
567 m_result->closestPointTo(curr, newParam, accuracy,
true);
570 if ((m_result->eval(newParam) - curr).norm()
571 < (m_result->eval(m_param_values.col(i)) - curr).norm())
573 m_param_values.col(i) = newParam;
578 for (
index_t i = interpIdx[0]+1; i < interpIdx[1]; ++i)
582 newParam(0,0) = m_param_values(0,i);
583 oldParam(0,0) = m_param_values(0,i);
584 const auto & curr = m_points.row(i).transpose();
588 if ((b->
eval(newParam) - curr).norm()
589 < (b->
eval(oldParam) - curr).norm())
591 m_param_values(0,i) = newParam(0,0);
597 for (
index_t i = interpIdx[1]+1; i < interpIdx[2]; ++i)
601 newParam(0,0) = m_param_values(1,i);
602 oldParam(0,0) = m_param_values(1,i);
603 const auto & curr = m_points.row(i).transpose();
607 if ((b->
eval(newParam) - curr).norm()
608 < (b->
eval(oldParam) - curr).norm())
609 m_param_values(1,i) = newParam(0,0);
612 for (
index_t i = interpIdx[2]+1; i < interpIdx[3]; ++i)
616 newParam(0,0) = m_param_values(0,i);
617 oldParam(0,0) = m_param_values(0,i);
618 const auto & curr = m_points.row(i).transpose();
622 if ((b->
eval(newParam) - curr).norm()
623 < (b->
eval(oldParam) - curr).norm())
624 m_param_values(0,i) = newParam(0,0);
627 for (
index_t i = interpIdx[3]+1; i < m_points.rows(); ++i)
631 newParam(0,0) = m_param_values(1,i);
632 oldParam(0,0) = m_param_values(1,i);
633 const auto & curr = m_points.row(i).transpose();
637 if ((b->
eval(newParam) - curr).norm()
638 < (b->
eval(oldParam) - curr).norm())
639 m_param_values(1,i) = newParam(0,0);
649 const std::vector<index_t>& interpIdx,
654 compute(m_last_lambda);
659 for (
index_t it = 0; it<maxIter; ++it)
662 parameterProjectionSepBoundary(accuracy, interpIdx);
663 compute_tdm(m_last_lambda, mu, sigma, interpIdx, method);
672 const std::vector<index_t>& interpIdx)
676 compute(m_last_lambda);
681 for (
index_t it = 0; it<maxIter; ++it)
684 parameterProjectionSepBoundary(accuracy, interpIdx);
685 compute(m_last_lambda);
698 compute(m_last_lambda);
703 for (
index_t it = 0; it<maxIter; ++it)
706 for (
index_t i = 0; i<m_points.rows(); ++i)
709 const auto & curr = m_points.row(i).transpose();
711 m_result->closestPointTo(curr, newParam, accuracy,
true);
714 if ((m_result->eval(newParam) - curr).norm()
715 < (m_result->eval(m_param_values.col(i))
717 m_param_values.col(i) = newParam;
724 compute(m_last_lambda);
734 const int num_patches ( m_basis->nPieces() );
740 for (
index_t h = 0; h < num_patches; h++ )
742 auto & basis = m_basis->basis(h);
745 for (
index_t k = m_offset[h]; k < m_offset[h+1]; ++k)
747 curr_point = m_param_values.col(k);
750 basis.eval_into(curr_point, value);
753 basis.active_into(curr_point, actives);
755 const index_t numActive = actives.rows();
757 for (
index_t i = 0; i != numActive; ++i)
761 m_B.row(ii) += value.
at(i) * m_points.row(k);
762 for (
index_t j = 0; j != numActive; ++j)
764 A_mat(ii, actives.
at(j)) += value.
at(i) * value.
at(j);
776 index_t basisSize = m_basis->size();
783 m_B.bottomRows(m_constraintsRHS.rows()) = m_constraintsRHS;
785 for (
index_t k=0; k<m_constraintsLHS.outerSize(); ++k)
789 A_mat(basisSize + it.row(), it.col()) = it.value();
790 A_mat(it.col(), basisSize + it.row()) = it.value();
800 m_last_lambda = lambda;
802 const int num_basis=m_basis->size();
804 gsSparseMatrix<T> A_mat(num_basis + m_constraintsLHS.rows(), num_basis + m_constraintsLHS.rows());
805 int nonZerosPerCol = 1;
806 for (
int i = 0; i < m_basis->domainDim(); ++i)
807 nonZerosPerCol *= ( 2 * m_basis->basis(0).degree(i) + 1 );
808 A_mat.reservePerColumn( nonZerosPerCol );
809 const_cast<gsFitting*
>(
this)->applySmoothing(lambda, A_mat);
818 m_last_lambda = lambda;
819 const int num_patches(m_basis->nPieces());
820 const short_t dim(m_basis->domainDim());
821 const short_t stride = dim * (dim + 1) / 2;
829 const int tid = omp_get_thread_num();
830 const int nt = omp_get_num_threads();
833 for (
index_t h = 0; h < num_patches; h++)
835 auto & basis = m_basis->basis(h);
840 for (
short_t i = 0; i != dim; ++i)
842 numNodes[i] = basis.degree(i);
847 typename gsBasis<T>::domainIter domIt = basis.makeDomainIterator();
851 for ( domIt->next(tid); domIt->good(); domIt->next(nt) )
853 for (; domIt->good(); domIt->next() )
857 QuRule.
mapTo(domIt->lowerCorner(), domIt->upperCorner(), quNodes, quWeights);
858 basis.deriv2_into(quNodes, der2);
859 basis.active_into(domIt->center, actives);
860 const index_t numActive = actives.rows();
861 localA.setZero(numActive, numActive);
864 for (
index_t k = 0; k < quWeights.rows(); ++k)
866 const T weight = quWeights[k] * lambda;
868 for (
index_t i = 0; i != numActive; ++i)
869 for (
index_t j = 0; j != numActive; ++j)
873 for (
short_t s = 0; s < stride; s++)
879 localAij += der2(i * stride + s, k) *
880 der2(j * stride + s, k);
885 localAij += T(2) * der2(i * stride + s, k) *
886 der2(j * stride + s, k);
889 localA(i, j) += weight * localAij;
893 for (
index_t i = 0; i != numActive; ++i)
895 const int ii = actives(i, 0);
896 for (
index_t j = 0; j != numActive; ++j)
897 A_mat(ii, actives(j, 0)) += localA(i, j);
909 m_pointErrors.clear();
912 m_result->eval_into(m_param_values, val_i);
913 m_pointErrors.push_back( (m_points.row(0) - val_i.col(0).transpose()).norm() );
914 m_max_error = m_min_error = m_pointErrors.back();
916 for (
index_t i = 1; i < m_points.rows(); i++)
918 const T err = (m_points.row(i) - val_i.col(i).transpose()).norm() ;
919 m_pointErrors.push_back(err);
921 if ( err > m_max_error ) m_max_error = err;
922 if ( err < m_min_error ) m_min_error = err;
932 m_result->eval_into(parameters, eval);
935 for (
index_t col = 0; col != eval.cols(); col++)
937 ptwErrors(0, col) = (eval.col(col) - points.col(col)).norm();
947 std::vector<T> min_max_mse;
949 m_result->eval_into(parameters, eval);
953 for (
index_t col = 0; col != eval.cols(); col++)
955 pointWiseErrors(0, col) = (eval.col(col) - points.col(col)).norm();
962 for (
index_t i = 1; i < pointWiseErrors.cols(); i++)
964 const real_t err = pointWiseErrors(0,i) ;
965 mse_error += err * err ;
966 if ( err > max_error ) max_error = err;
967 if ( err < min_error ) min_error = err;
970 min_max_mse.push_back(min_error);
971 min_max_mse.push_back(max_error);
972 min_max_mse.push_back(mse_error/pointWiseErrors.cols());
981 m_pointErrors.clear();
983 const int num_patches(m_basis->nPieces());
985 for (
index_t h = 0; h < num_patches; h++)
987 for (
index_t k = m_offset[h]; k < m_offset[h + 1]; ++k)
989 auto curr_point = m_param_values.col(k);
992 m_result->eval_into(curr_point, values);
995 m_mresult.eval_into(h, curr_point, values);
999 const T err = (m_points.row(k) - values.transpose()).
template lpNorm<gsEigen::Infinity>();
1001 m_pointErrors.push_back(err);
1003 if ( k == 0 || m_max_error < err ) m_max_error = err;
1004 if ( k == 0 || err < m_min_error ) m_min_error = err;
1016 const int num_patches(m_basis->nPieces());
1020 for (
index_t h = 0; h < num_patches; h++)
1023 for (
index_t k = m_offset[h]; k < m_offset[h + 1]; ++k)
1025 auto curr_point = m_param_values.col(k);
1028 m_result->eval_into(curr_point, results);
1031 m_mresult.eval_into(h, curr_point, results);
1034 const T err = (m_points.row(k) - results.transpose()).squaredNorm();
1041 error += math::sqrt(err);
1044 gsWarn <<
"Unknown type in computeApproxError(error, type)...\n";
1056 errors.reserve(m_points.rows());
1062 const int num_patches(m_basis->nPieces());
1064 for (
index_t h = 0; h < num_patches; h++)
1066 for (
index_t k = m_offset[h]; k < m_offset[h + 1]; ++k)
1068 curr_point = m_param_values.col(k);
1071 m_result->eval_into(curr_point, results);
1074 m_mresult.eval_into(h, curr_point, results);
1077 results.transposeInPlace();
1079 err = (m_points.row(k) - results).
template lpNorm<gsEigen::Infinity>();
1084 errors.push_back(err);
1087 gsWarn <<
"Unknown type in get_Error(errors, type)...\n";
1098 if(coefs.size() == 0)
1102 "Prescribed indices and coefs must have the same length.");
1108 for(
size_t r=0; r<indices.size(); r++)
1111 lhs(r-duplicates, fix) = 1;
1112 rhs.row(r-duplicates) = coefs[r];
1115 setConstraints(lhs, rhs);
1121 if(fixedSides.size() == 0)
1124 std::vector<index_t> indices;
1125 std::vector<gsMatrix<T> > coefs;
1127 for(std::vector<boxSide>::const_iterator it=fixedSides.begin(); it!=fixedSides.end(); ++it)
1130 for(
index_t r=0; r<ind.rows(); r++)
1134 if(std::find(indices.begin(), indices.end(), fix) == indices.end())
1136 indices.push_back(fix);
1137 coefs.push_back(this->m_result->coef(fix));
1141 setConstraints(indices, coefs);
1148 std::vector<gsBSpline<T> > tmp = fixedCurves;
1149 std::vector<gsGeometry<T> *> fixedCurves_input(tmp.size());
1150 for (
size_t k=0; k!=fixedCurves.size(); k++)
1151 fixedCurves_input[k] =
dynamic_cast<gsGeometry<T> *
>(&(tmp[k]));
1152 setConstraints(fixedSides, fixedCurves_input);
1159 if(fixedSides.size() == 0)
1163 "fixedCurves and fixedSides are of different sizes.");
1165 std::vector<index_t> indices;
1166 std::vector<gsMatrix<T> > coefs;
1167 for(
size_t s=0; s<fixedSides.size(); s++)
1169 gsMatrix<T> coefsThisSide = fixedCurves[s]->coefs();
1170 gsMatrix<index_t> indicesThisSide = m_basis->basis(0).boundaryOffset(fixedSides[s],0);
1171 GISMO_ASSERT(coefsThisSide.rows() == indicesThisSide.rows(),
1172 "Coef number mismatch between prescribed curve and basis side.");
1174 for(
index_t r=0; r<indicesThisSide.rows(); r++)
1176 index_t fix = indicesThisSide(r,0);
1178 if(std::find(indices.begin(), indices.end(), fix) == indices.end())
1180 indices.push_back(fix);
1181 coefs.push_back(coefsThisSide.row(r));
1186 setConstraints(indices, coefs);
A B-spline function of one argument, with arbitrary target dimension.
Definition gsBSpline.h:51
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
Generic evaluator of isogeometric expressions.
Definition gsExprEvaluator.h:39
void eval(const expr::_expr< E > &expr, gsGridIterator< T, mode, d > &git, const index_t patchInd=0)
geometryMap getMap(const gsMultiPatch< T > &mp)
Registers mp as an isogeometric geometry map and return a handle to it.
Definition gsExprEvaluator.h:116
Class for performing a fit of a parametrized point cloud with a gsGeometry.
Definition gsFitting.h:32
gsFitting()
default constructor
Definition gsFitting.h:35
tdm_method
choose the method for computing the coefficients: TDM, PDM, HDM with different blending weights
Definition gsFitting.h:81
gsMatrix< T > fill_pointWiseErrors(const index_t &num_int, T &max_err_int)
vector of length num_int containing all the point-wise errors; store also the max err value in max_er...
Definition gsFitting.hpp:222
void extendSystem(gsSparseMatrix< T > &A_mat, gsMatrix< T > &m_B)
Extends the system of equations by taking constraints into account.
Definition gsFitting.hpp:773
void computeApproxError(T &error, int type=0) const
Definition gsFitting.hpp:1011
void assembleSystem(gsSparseMatrix< T > &A_mat, gsMatrix< T > &B)
Assembles system for the least square fit.
Definition gsFitting.hpp:731
const std::vector< T > & pointWiseErrors() const
Return the errors for each point.
Definition gsFitting.h:183
void parameterCorrectionSepBoundary_tdm(T accuracy, index_t maxIter, T mu, T sigma, const std::vector< index_t > &sepIndex, tdm_method method=hybrid_curvature_pdm_tdm_boundary_pdm)
parameterCorrectionSepBoundary_tdm: apply maxIter steps of parameter correction for HDM method,...
Definition gsFitting.hpp:646
void applySmoothing(T lambda, gsSparseMatrix< T > &A_mat)
Adds to the matrix A_mat terms for minimization of second derivative, weighted with parameter lambda.
Definition gsFitting.hpp:816
void initializeGeometry(const gsMatrix< T > &coefficients, const gsMatrix< T > ¶meters)
initializeGeometry: Initializes the fitted geometry with given coefficients and parameters
Definition gsFitting.hpp:175
gsMatrix< T > inverse_principal_curvatures(const index_t &num_int, const gsMatrix< T > ¶ms_int)
vector of length num_int containing rho = 1/max(c1, c2), where c1, c2 are the principal curvature val...
Definition gsFitting.hpp:266
void compute_normals(const index_t &num_int, const gsMatrix< T > ¶ms_int, gsSparseMatrix< T > &N_int)
compute_normals: Computes the normals of the fitted geometry at the input parameter values params_int
Definition gsFitting.hpp:195
void compute_tdm(T lambda, T mu, T sigma, const std::vector< index_t > &interpIdx, tdm_method method=hybrid_curvature_pdm_tdm_boundary_pdm)
compute_hdm: computes the coefficients of the spline geometry via Hybrid Distance Minimization (HDM)
Definition gsFitting.hpp:375
void setConstraints(const gsSparseMatrix< T > &lhs, const gsMatrix< T > &rhs)
Definition gsFitting.h:272
void parameterProjectionSepBoundary(T accuracy, const std::vector< index_t > &interpIdx)
parameterProjectionSepBoundary: project the points onto the fitted geometry, separating interior and ...
Definition gsFitting.hpp:554
void get_Error(std::vector< T > &errors, int type=0) const
Definition gsFitting.hpp:1053
void compute(T lambda=0)
compute: Computes the coefficients of the spline geometry via penalized least squares
Definition gsFitting.hpp:77
void computeMaxNormErrors()
Definition gsFitting.hpp:979
virtual ~gsFitting()
Destructor.
Definition gsFitting.hpp:31
void parameterCorrectionSepBoundary_pdm(T accuracy, index_t maxIter, const std::vector< index_t > &sepIndex)
parameterCorrectionSepBoundary_pdm: apply maxIter steps of parameter correction for PDM method,...
Definition gsFitting.hpp:670
void parameterCorrection(T accuracy=1e-8, index_t maxIter=10, T tolOrth=1e-6)
parameterCorrection: globally apply maxIter steps of parameter correction to the least squares fitted...
Definition gsFitting.hpp:692
void blending_weights(const gsSparseMatrix< T > &N_int, const index_t &num_int, const T &mu, const T &sigma, const gsMatrix< T > ¶ms_int, tdm_method method, gsSparseMatrix< T > &NNT)
blending_weights: computes the blending weights mu and sigma for the balance mu * PDM + sigma * TDM i...
Definition gsFitting.hpp:294
void updateGeometry(gsMatrix< T > coefficients, gsMatrix< T > parameters)
updateGeometry: Updates the fitted geometry with new coefficients and parameters
Definition gsFitting.hpp:154
gsMatrix< T > principal_curvatures(const gsMatrix< T > ¶ms)
compute the principal curvatures (c1, c2) at the given parameters params
Definition gsFitting.hpp:237
bool is_corner(gsMatrix< T > ¶metric_domain, gsVector< T > ¶meter)
check if the given parameter parameter is a corner of the domain parametric_domain
Definition gsFitting.hpp:484
void computeErrors()
Definition gsFitting.hpp:907
gsMatrix< T > eval(const gsMatrix< T > &u) const
Evaluate the function,.
Definition gsFunctionSet.hpp:120
Class that represents the (tensor) Gauss-Legendre quadrature rule.
Definition gsGaussRule.h:28
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
memory::unique_ptr< gsGeometry > uPtr
Unique pointer for gsGeometry.
Definition gsGeometry.h:100
T closestPointTo(const gsVector< T > &pt, gsVector< T > &result, const T accuracy=1e-6, const bool useInitialPoint=false) const
Definition gsGeometry.hpp:339
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
virtual void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps quadrature rule (i.e., points and weights) from the reference domain to an element.
Definition gsQuadRule.h:177
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Represents a B-spline curve/function with one parameter.
Provides declaration of Basis abstract interface.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define gsWarn
Definition gsDebug.h:50
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Generic expressions evaluator.
Generic expressions helper.
Defines different expressions.
Provides declaration of Geometry abstract interface.
This is the main header file that collects wrappers of Eigen for linear algebra.
Utility functions required by gsModeling classes.
Iterator over the elements of a tensor-structured grid.
The G+Smo namespace, containing all definitions for the library.
void threeOnDiag(const gsSparseMatrix< T > &block, gsSparseMatrix< T > &result)
Definition gsModelingUtils.hpp:664
S give(S &x)
Definition gsMemory.h:266
GISMO_DEPRECATED bool parameter(int s)
Returns the parameter value (false=0=start, true=1=end) that corresponds to side s.
Definition gsBoundary.h:1069