17#include <gsUnstructuredSplines/src/gsC1SurfGluingData.h>
25 class gsG1ASVisitorBasisVertex
29 gsG1ASVisitorBasisVertex()
37 for (index_t i = 0; i < basis.dim(); ++i)
38 numQuadNodes[i] = basis.degree(i) + 1;
60 std::vector<bool> & isBoundary,
69 basis.active_into(md.points.col(0), actives);
72 basis.eval_into(md.points, basisData);
78 numActive = actives.rows();
81 std::vector<gsMatrix<T>> c_0, c_1;
82 std::vector<gsMatrix < >> c_0_plus, c_1_plus, c_2_plus;
83 std::vector<gsMatrix < >> c_0_plus_deriv, c_1_plus_deriv, c_2_plus_deriv;
84 std::vector<gsMatrix < >> c_0_minus, c_1_minus;
85 for (index_t i = 0; i < 2; i++)
89 gsMatrix<T> b_0_plus_deriv, b_1_plus_deriv, b_2_plus_deriv;
96 basis_geo.
component(i).evalSingle_into(0, md.points.row(i),b_0);
97 basis_geo.
component(i).evalSingle_into(1, md.points.row(i),b_1);
99 basis_plus[i].evalSingle_into(0, md.points.row(i),b_0_plus);
100 basis_plus[i].evalSingle_into(1, md.points.row(i),b_1_plus);
101 basis_plus[i].evalSingle_into(2, md.points.row(i),b_2_plus);
103 basis_plus[i].derivSingle_into(0, md.points.row(i),b_0_plus_deriv);
104 basis_plus[i].derivSingle_into(1, md.points.row(i),b_1_plus_deriv);
105 basis_plus[i].derivSingle_into(2, md.points.row(i),b_2_plus_deriv);
107 basis_minus[i].evalSingle_into(0, md.points.row(i),b_0_minus);
108 basis_minus[i].evalSingle_into(1, md.points.row(i),b_1_minus);
115 basis_geo.
component(i).derivSingle_into(1, zero.row(i),b_1_0);
116 basis_minus[i].derivSingle_into(1, zero.row(i),b_1_minus_0);
122 T factor_b_1 = 1.0/b_1_0(0,0);
123 c_0.push_back(b_0 + b_1);
124 c_1.push_back(factor_b_1 * b_1);
126 T factor_b_1_minus = 1.0/b_1_minus_0(0,0);
127 c_0_minus.push_back(b_0_minus + b_1_minus);
128 c_1_minus.push_back(factor_b_1_minus * b_1_minus);
130 gsMatrix<T> der_b_1_plus_0, der2_b_1_plus_0, der2_b_2_plus_0;
131 basis_plus[i].derivSingle_into(1, zero.row(i), der_b_1_plus_0);
132 basis_plus[i].deriv2Single_into(1, zero.row(i), der2_b_1_plus_0);
133 basis_plus[i].deriv2Single_into(2, zero.row(i), der2_b_2_plus_0);
135 T factor_c_1_plus = 1/der_b_1_plus_0(0,0);
136 T factor2_c_1_plus = -der2_b_1_plus_0(0,0)/(der_b_1_plus_0(0,0)*der2_b_2_plus_0(0,0));
137 T factor_c_2_plus = 1/der2_b_2_plus_0(0,0);
139 c_0_plus.push_back(b_0_plus + b_1_plus + b_2_plus);
140 c_1_plus.push_back(factor_c_1_plus * b_1_plus + factor2_c_1_plus * b_2_plus);
141 c_2_plus.push_back(factor_c_2_plus * b_2_plus );
143 c_0_plus_deriv.push_back(b_0_plus_deriv + b_1_plus_deriv + b_2_plus_deriv);
144 c_1_plus_deriv.push_back(factor_c_1_plus * b_1_plus_deriv + factor2_c_1_plus * b_2_plus_deriv);
145 c_2_plus_deriv.push_back(factor_c_2_plus * b_2_plus_deriv);
182 std::vector<gsMatrix<T>> alpha, beta, alpha_0, beta_0, alpha_deriv, beta_deriv;
190 geo_jac = geo.jacobian(zero);
191 geo_der2 = geo.
deriv2(zero);
203 alpha.push_back( gluingData(0, 0) * ( ones - md.points.row(0) ) + gluingData(1, 0) * md.points.row(0) );
204 alpha.push_back( gluingData(0, 1) * ( ones - md.points.row(1) ) + gluingData(1, 1) * md.points.row(1) );
207 alpha_0.push_back( gluingData(0, 0) * ( one.row(0) - zero.row(0) ) + gluingData(1, 0) * zero.row(0) );
208 alpha_0.push_back( gluingData(0, 1) * ( one.row(0) - zero.row(0) ) + gluingData(1, 1) * zero.row(0) );
209 alpha_deriv.push_back( ( gluingData(1, 0) - gluingData(0, 0) ) * ones.col(0) );
210 alpha_deriv.push_back( ( gluingData(1, 1) - gluingData(0, 1) ) * ones.col(0) );
212 beta.push_back( gluingData(2, 0) * ( ones - md.points.row(0) ) + gluingData(3, 0) * md.points.row(0) );
213 beta.push_back( gluingData(2, 1) * ( ones - md.points.row(1) ) + gluingData(3, 1) * md.points.row(1) );
214 beta_0.push_back( gluingData(2, 0) * ( one.row(0) - zero.row(0) ) + gluingData(3, 0) * zero.row(0) );
215 beta_0.push_back( gluingData(2, 1) * ( one.row(0) - zero.row(0) ) + gluingData(3, 1) * zero.row(0) );
216 beta_deriv.push_back( ( gluingData(3, 0) - gluingData(2, 0) ) * ones.col(0) );
217 beta_deriv.push_back( ( gluingData(3, 1) - gluingData(2, 1) ) * ones.col(0) );
223 dd_ik_minus = ( -1 / alpha_0[0](0,0) ) * ( geo_jac.col(1) +
224 beta_0[0](0,0) * geo_jac.col(0) );
226 dd_ik_plus = ( 1 / alpha_0[1](0,0) ) * ( geo_jac.col(0) +
227 beta_0[1](0,0) * geo_jac.col(1) );
231 geo_deriv2_12.row(0) = geo_der2.row(2);
232 geo_deriv2_12.row(1) = geo_der2.row(5);
234 geo_deriv2_11.row(0) = geo_der2.row(0);
235 geo_deriv2_11.row(1) = geo_der2.row(3);
237 geo_deriv2_22.row(0) = geo_der2.row(1);
238 geo_deriv2_22.row(1) = geo_der2.row(4);
242 geo_deriv2_12.row(2) = geo_der2.row(8);
244 geo_deriv2_11.row(2) = geo_der2.row(6);
246 geo_deriv2_22.row(2) = geo_der2.row(7);
249 gsMatrix<T> alpha_squared_u = alpha_0[0]*alpha_0[0];
250 gsMatrix<T> alpha_squared_v = alpha_0[1]*alpha_0[1];
252 dd_ik_minus_deriv = -1/(alpha_squared_u(0,0)) *
253 ( ( geo_deriv2_12 + (beta_deriv[0](0,0) * geo_jac.col(0) + beta_0[0](0,0) * geo_deriv2_11) ) * alpha_0[0](0,0) -
254 ( geo_jac.col(1) + beta_0[0](0,0) * geo_jac.col(0) ) * alpha_deriv[0](0,0) );
257 dd_ik_plus_deriv = 1/(alpha_squared_v(0,0)) *
258 ( ( geo_deriv2_12 + (beta_deriv[1](0,0) * geo_jac.col(1) + beta_0[1](0,0) * geo_deriv2_22) ) * alpha_0[1](0,0) -
259 ( geo_jac.col(0) + beta_0[1](0,0) * geo_jac.col(1) ) * alpha_deriv[1](0,0) );
267 std::vector<gsMatrix<T>> d_ik;
268 d_ik.push_back(Phi.row(0).transpose());
270 d_ik.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(0) );
279 d_ik.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(1) );
284 d_ik.push_back( (geo_jac(0,0) * Phi.row(4).transpose() + geo_jac(1,0) * Phi.row(7).transpose() + geo_jac(2,0) * Phi.row(10).transpose()) * geo_jac(0,1) +
285 (geo_jac(0,0) * Phi.row(5).transpose() + geo_jac(1,0) * Phi.row(8).transpose() + geo_jac(2,0) * Phi.row(11).transpose()) * geo_jac(1,1) +
286 (geo_jac(0,0) * Phi.row(6).transpose() + geo_jac(1,0) * Phi.row(9).transpose() + geo_jac(2,0) * Phi.row(12).transpose()) * geo_jac(2,1) +
287 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(2) +
288 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(5) +
289 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(8) );
294 d_ik.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4)) * geo_jac(0,1) +
295 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5)) * geo_jac(1,1) +
296 Phi.block(0,1, 6,1) * geo_der2.row(2) +
297 Phi.block(0,2, 6,1) * geo_der2.row(5));
302 std::vector<gsMatrix<T>> d_ilik_minus, d_ilik_plus;
305 d_ilik_minus.push_back(Phi.row(0).transpose());
307 d_ilik_minus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(0));
311 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.row(4).transpose() + geo_jac(1,0) * Phi.row(7).transpose() + geo_jac(2,0) * Phi.row(10).transpose()) * geo_jac(0,0) +
312 (geo_jac(0,0) * Phi.row(5).transpose() + geo_jac(1,0) * Phi.row(8).transpose() + geo_jac(2,0) * Phi.row(11).transpose()) * geo_jac(1,0) +
313 (geo_jac(0,0) * Phi.row(6).transpose() + geo_jac(1,0) * Phi.row(9).transpose() + geo_jac(2,0) * Phi.row(12).transpose()) * geo_jac(2,0) +
314 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(0) +
315 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(3) +
316 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(6) );
320 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4))*geo_jac(0,0) +
321 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5))*geo_jac(1,0) +
322 Phi.block(0,1,6,1) * geo_der2.row(0) +
323 Phi.block(0,2,6,1) * geo_der2.row(3));
326 d_ilik_minus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * dd_ik_minus);
330 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.row(4).transpose() + geo_jac(1,0) * Phi.row(7).transpose() + geo_jac(2,0) * Phi.row(10).transpose()) * dd_ik_minus(0,0) +
331 (geo_jac(0,0) * Phi.row(5).transpose() + geo_jac(1,0) * Phi.row(8).transpose() + geo_jac(2,0) * Phi.row(11).transpose()) * dd_ik_minus(1,0) +
332 (geo_jac(0,0) * Phi.row(6).transpose() + geo_jac(1,0) * Phi.row(9).transpose() + geo_jac(2,0) * Phi.row(12).transpose()) * dd_ik_minus(2,0) +
333 Phi.block(1, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(0) +
334 Phi.block(2, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(1) +
335 Phi.block(3, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(2) );
339 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4)) * dd_ik_minus(0,0) +
340 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5)) * dd_ik_minus(1,0) +
341 Phi.block(0,1,6,1) * dd_ik_minus_deriv.row(0) +
342 Phi.block(0,2,6,1) * dd_ik_minus_deriv.row(1));
347 d_ilik_plus.push_back(Phi.row(0).transpose());
349 d_ilik_plus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(1));
353 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.row(4).transpose() + geo_jac(1,1) * Phi.row(7).transpose() + geo_jac(2,1) * Phi.row(10).transpose()) * geo_jac(0,1) +
354 (geo_jac(0,1) * Phi.row(5).transpose() + geo_jac(1,1) * Phi.row(8).transpose() + geo_jac(2,1) * Phi.row(11).transpose()) * geo_jac(1,1) +
355 (geo_jac(0,1) * Phi.row(6).transpose() + geo_jac(1,1) * Phi.row(9).transpose() + geo_jac(2,1) * Phi.row(12).transpose()) * geo_jac(2,1) +
356 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(1) +
357 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(4) +
358 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(7) );
362 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.col(3) + geo_jac(1,1) * Phi.col(4)) * geo_jac(0,1) +
363 (geo_jac(0,1) * Phi.col(4) + geo_jac(1,1) * Phi.col(5)) * geo_jac(1,1) +
364 Phi.block(0,1,6,1) * geo_der2.row(1) +
365 Phi.block(0,2,6,1) * geo_der2.row(4) );
368 d_ilik_plus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * dd_ik_plus);
372 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.row(4).transpose() + geo_jac(1,1) * Phi.row(7).transpose() + geo_jac(2,1) * Phi.row(10).transpose()) * dd_ik_plus(0,0) +
373 (geo_jac(0,1) * Phi.row(5).transpose() + geo_jac(1,1) * Phi.row(8).transpose() + geo_jac(2,1) * Phi.row(11).transpose()) * dd_ik_plus(1,0) +
374 (geo_jac(0,1) * Phi.row(6).transpose() + geo_jac(1,1) * Phi.row(9).transpose() + geo_jac(2,1) * Phi.row(12).transpose()) * dd_ik_plus(2,0) +
375 Phi.block(1, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(0) +
376 Phi.block(2, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(1) +
377 Phi.block(3, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(2) );
381 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.col(3) + geo_jac(1,1) * Phi.col(4)) * dd_ik_plus(0,0) +
382 (geo_jac(0,1) * Phi.col(4) + geo_jac(1,1) * Phi.col(5)) * dd_ik_plus(1,0) +
383 Phi.block(0,1,6,1) * dd_ik_plus_deriv.row(0) +
384 Phi.block(0,2,6,1) * dd_ik_plus_deriv.row(1) );
388 for (index_t i = 0; i < 6; i++)
390 rhsVals.
at(i) = d_ilik_minus.at(0)(i,0) * (c_0_plus.at(0).cwiseProduct(c_0.at(1)) -
391 beta[0].cwiseProduct(c_0_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) +
392 d_ilik_minus.at(1)(i,0) * (c_1_plus.at(0).cwiseProduct(c_0.at(1)) -
393 beta[0].cwiseProduct(c_1_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) +
394 d_ilik_minus.at(2)(i,0) * (c_2_plus.at(0).cwiseProduct(c_0.at(1)) -
395 beta[0].cwiseProduct(c_2_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) -
396 d_ilik_minus.at(3)(i,0) * alpha[0].cwiseProduct(c_0_minus.at(0).cwiseProduct(c_1.at(1))) -
397 d_ilik_minus.at(4)(i,0) * alpha[0].cwiseProduct(c_1_minus.at(0).cwiseProduct(c_1.at(1)));
399 rhsVals.at(i) += d_ilik_plus.at(0)(i,0) * (c_0_plus.at(1).cwiseProduct(c_0.at(0)) -
400 beta[1].cwiseProduct(c_0_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
401 d_ilik_plus.at(1)(i,0) * (c_1_plus.at(1).cwiseProduct(c_0.at(0)) -
402 beta[1].cwiseProduct(c_1_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
403 d_ilik_plus.at(2)(i,0) * (c_2_plus.at(1).cwiseProduct(c_0.at(0)) -
404 beta[1].cwiseProduct(c_2_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
405 d_ilik_plus.at(3)(i,0) * alpha[1].cwiseProduct(c_0_minus.at(1).cwiseProduct(c_1.at(0))) +
406 d_ilik_plus.at(4)(i,0) * alpha[1].cwiseProduct(c_1_minus.at(1).cwiseProduct(c_1.at(0)));
408 rhsVals.at(i) -= d_ik.at(0)(i,0) * c_0.at(0).cwiseProduct(c_0.at(1)) + d_ik.at(2)(i,0) * c_0.at(0).cwiseProduct(c_1.at(1)) +
409 d_ik.at(1)(i,0) * c_1.at(0).cwiseProduct(c_0.at(1)) + d_ik.at(3)(i,0) * c_1.at(0).cwiseProduct(c_1.at(1));
411 localMat.at(i).setZero(numActive, numActive);
412 localRhs.at(i).setZero(numActive, rhsVals.at(i).rows());
414 localMat.at(i).setZero(numActive, numActive);
415 localRhs.at(i).setZero(numActive, rhsVals.at(i).rows());
428 for (index_t i = 0; i < 6; i++)
431 localMat.
at(i).noalias() = basisData * quWeights.asDiagonal() * md.measures.asDiagonal() * basisData.transpose();
433 for (index_t k = 0; k < quWeights.rows(); ++k)
435 T weight = quWeights[k];
438 if( Jk.dim().second + 1 == Jk.dim().first)
441 T detG = G.determinant();
442 weight *= sqrt(detG);
446 weight *= md.measure(k);
450 localRhs.at(i).noalias() += weight * (basisVals.col(k) * rhsVals.
at(i).col(k).transpose());
455 inline void localToGlobal(
const index_t patchIndex,
460 for (
size_t i = 0; i < system.size(); i++)
463 system.
at(i).mapColIndices(actives, patchIndex, actives_temp);
465 system.at(i).push(localMat.at(i), localRhs.at(i), actives_temp, eliminatedDofs[0], 0, 0);
476 std::vector< gsMatrix<T> > rhsVals;
480 std::vector< gsMatrix<T> > localMat;
481 std::vector< gsMatrix<T> > localRhs;
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
virtual const gsBasis< T > & component(short_t i) const
For a tensor product basis, return the (const) 1-d basis for the i-th parameter component.
Definition gsBasis.hpp:563
Class which enables iteration over all elements of a parameter domain.
Definition gsDomainIterator.h:68
gsMatrix< T > deriv2(const gsMatrix< T > &u) const
Evaluates the second derivatives of active (i.e., non-zero) functions at points u.
Definition gsFunctionSet.hpp:138
virtual void computeMap(gsMapData< T > &InOut) const
Computes map function data.
Definition gsFunction.hpp:817
Class that represents the (tensor) Gauss-Legendre quadrature rule.
Definition gsGaussRule.h:28
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
short_t targetDim() const
Dimension of the ambient physical space (overriding gsFunction::targetDim())
Definition gsGeometry.h:286
short_t parDim() const
Dimension d of the parameter domain (same as domainDim()).
Definition gsGeometry.hpp:190
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
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
Class representing a reference quadrature rule.
Definition gsQuadRule.h:29
A sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
The G+Smo namespace, containing all definitions for the library.
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76