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,
76 numActive = actives.rows();
79 std::vector<gsMatrix<T>> c_0, c_1;
80 std::vector<gsMatrix < >> c_0_plus, c_1_plus, c_2_plus;
81 std::vector<gsMatrix < >> c_0_plus_deriv, c_1_plus_deriv, c_2_plus_deriv;
82 std::vector<gsMatrix < >> c_0_minus, c_1_minus;
87 gsMatrix<T> b_0_plus_deriv, b_1_plus_deriv, b_2_plus_deriv;
94 basis_geo.
component(i).evalSingle_into(0, md.points.row(i),b_0);
95 basis_geo.
component(i).evalSingle_into(1, md.points.row(i),b_1);
97 basis_plus[i].evalSingle_into(0, md.points.row(i),b_0_plus);
98 basis_plus[i].evalSingle_into(1, md.points.row(i),b_1_plus);
99 basis_plus[i].evalSingle_into(2, md.points.row(i),b_2_plus);
101 basis_plus[i].derivSingle_into(0, md.points.row(i),b_0_plus_deriv);
102 basis_plus[i].derivSingle_into(1, md.points.row(i),b_1_plus_deriv);
103 basis_plus[i].derivSingle_into(2, md.points.row(i),b_2_plus_deriv);
105 basis_minus[i].evalSingle_into(0, md.points.row(i),b_0_minus);
106 basis_minus[i].evalSingle_into(1, md.points.row(i),b_1_minus);
113 basis_geo.
component(i).derivSingle_into(1, zero.row(i),b_1_0);
114 basis_minus[i].derivSingle_into(1, zero.row(i),b_1_minus_0);
120 T factor_b_1 = 1.0/b_1_0(0,0);
121 c_0.push_back(b_0 + b_1);
122 c_1.push_back(factor_b_1 * b_1);
124 T factor_b_1_minus = 1.0/b_1_minus_0(0,0);
125 c_0_minus.push_back(b_0_minus + b_1_minus);
126 c_1_minus.push_back(factor_b_1_minus * b_1_minus);
128 gsMatrix<T> der_b_1_plus_0, der2_b_1_plus_0, der2_b_2_plus_0;
129 basis_plus[i].derivSingle_into(1, zero.row(i), der_b_1_plus_0);
130 basis_plus[i].deriv2Single_into(1, zero.row(i), der2_b_1_plus_0);
131 basis_plus[i].deriv2Single_into(2, zero.row(i), der2_b_2_plus_0);
133 T factor_c_1_plus = 1/der_b_1_plus_0(0,0);
134 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));
135 T factor_c_2_plus = 1/der2_b_2_plus_0(0,0);
137 c_0_plus.push_back(b_0_plus + b_1_plus + b_2_plus);
138 c_1_plus.push_back(factor_c_1_plus * b_1_plus + factor2_c_1_plus * b_2_plus);
139 c_2_plus.push_back(factor_c_2_plus * b_2_plus );
141 c_0_plus_deriv.push_back(b_0_plus_deriv + b_1_plus_deriv + b_2_plus_deriv);
142 c_1_plus_deriv.push_back(factor_c_1_plus * b_1_plus_deriv + factor2_c_1_plus * b_2_plus_deriv);
143 c_2_plus_deriv.push_back(factor_c_2_plus * b_2_plus_deriv);
180 std::vector<gsMatrix<T>> alpha, beta, alpha_0, beta_0, alpha_deriv, beta_deriv;
188 geo_jac = geo.jacobian(zero);
189 geo_der2 = geo.
deriv2(zero);
201 alpha.push_back( gluingData(0, 0) * ( ones - md.points.row(0) ) + gluingData(1, 0) * md.points.row(0) );
202 alpha.push_back( gluingData(0, 1) * ( ones - md.points.row(1) ) + gluingData(1, 1) * md.points.row(1) );
205 alpha_0.push_back( gluingData(0, 0) * ( one.row(0) - zero.row(0) ) + gluingData(1, 0) * zero.row(0) );
206 alpha_0.push_back( gluingData(0, 1) * ( one.row(0) - zero.row(0) ) + gluingData(1, 1) * zero.row(0) );
207 alpha_deriv.push_back( ( gluingData(1, 0) - gluingData(0, 0) ) * ones.col(0) );
208 alpha_deriv.push_back( ( gluingData(1, 1) - gluingData(0, 1) ) * ones.col(0) );
210 beta.push_back( gluingData(2, 0) * ( ones - md.points.row(0) ) + gluingData(3, 0) * md.points.row(0) );
211 beta.push_back( gluingData(2, 1) * ( ones - md.points.row(1) ) + gluingData(3, 1) * md.points.row(1) );
212 beta_0.push_back( gluingData(2, 0) * ( one.row(0) - zero.row(0) ) + gluingData(3, 0) * zero.row(0) );
213 beta_0.push_back( gluingData(2, 1) * ( one.row(0) - zero.row(0) ) + gluingData(3, 1) * zero.row(0) );
214 beta_deriv.push_back( ( gluingData(3, 0) - gluingData(2, 0) ) * ones.col(0) );
215 beta_deriv.push_back( ( gluingData(3, 1) - gluingData(2, 1) ) * ones.col(0) );
221 dd_ik_minus = ( -1 / alpha_0[0](0,0) ) * ( geo_jac.col(1) +
222 beta_0[0](0,0) * geo_jac.col(0) );
224 dd_ik_plus = ( 1 / alpha_0[1](0,0) ) * ( geo_jac.col(0) +
225 beta_0[1](0,0) * geo_jac.col(1) );
229 geo_deriv2_12.row(0) = geo_der2.row(2);
230 geo_deriv2_12.row(1) = geo_der2.row(5);
232 geo_deriv2_11.row(0) = geo_der2.row(0);
233 geo_deriv2_11.row(1) = geo_der2.row(3);
235 geo_deriv2_22.row(0) = geo_der2.row(1);
236 geo_deriv2_22.row(1) = geo_der2.row(4);
240 geo_deriv2_12.row(2) = geo_der2.row(8);
242 geo_deriv2_11.row(2) = geo_der2.row(6);
244 geo_deriv2_22.row(2) = geo_der2.row(7);
247 gsMatrix<T> alpha_squared_u = alpha_0[0]*alpha_0[0];
248 gsMatrix<T> alpha_squared_v = alpha_0[1]*alpha_0[1];
250 dd_ik_minus_deriv = -1/(alpha_squared_u(0,0)) *
251 ( ( 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) -
252 ( geo_jac.col(1) + beta_0[0](0,0) * geo_jac.col(0) ) * alpha_deriv[0](0,0) );
255 dd_ik_plus_deriv = 1/(alpha_squared_v(0,0)) *
256 ( ( 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) -
257 ( geo_jac.col(0) + beta_0[1](0,0) * geo_jac.col(1) ) * alpha_deriv[1](0,0) );
265 std::vector<gsMatrix<T>> d_ik;
266 d_ik.push_back(Phi.row(0).transpose());
268 d_ik.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(0) );
277 d_ik.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(1) );
282 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) +
283 (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) +
284 (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) +
285 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(2) +
286 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(5) +
287 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(8) );
292 d_ik.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4)) * geo_jac(0,1) +
293 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5)) * geo_jac(1,1) +
294 Phi.block(0,1, 6,1) * geo_der2.row(2) +
295 Phi.block(0,2, 6,1) * geo_der2.row(5));
300 std::vector<gsMatrix<T>> d_ilik_minus, d_ilik_plus;
303 d_ilik_minus.push_back(Phi.row(0).transpose());
305 d_ilik_minus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(0));
309 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) +
310 (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) +
311 (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) +
312 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(0) +
313 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(3) +
314 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(6) );
318 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4))*geo_jac(0,0) +
319 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5))*geo_jac(1,0) +
320 Phi.block(0,1,6,1) * geo_der2.row(0) +
321 Phi.block(0,2,6,1) * geo_der2.row(3));
324 d_ilik_minus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * dd_ik_minus);
328 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) +
329 (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) +
330 (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) +
331 Phi.block(1, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(0) +
332 Phi.block(2, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(1) +
333 Phi.block(3, 0, 1, 6).transpose() * dd_ik_minus_deriv.row(2) );
337 d_ilik_minus.push_back( (geo_jac(0,0) * Phi.col(3) + geo_jac(1,0) * Phi.col(4)) * dd_ik_minus(0,0) +
338 (geo_jac(0,0) * Phi.col(4) + geo_jac(1,0) * Phi.col(5)) * dd_ik_minus(1,0) +
339 Phi.block(0,1,6,1) * dd_ik_minus_deriv.row(0) +
340 Phi.block(0,2,6,1) * dd_ik_minus_deriv.row(1));
345 d_ilik_plus.push_back(Phi.row(0).transpose());
347 d_ilik_plus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * geo_jac.col(1));
351 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) +
352 (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) +
353 (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) +
354 Phi.block(1, 0, 1, 6).transpose() * geo_der2.row(1) +
355 Phi.block(2, 0, 1, 6).transpose() * geo_der2.row(4) +
356 Phi.block(3, 0, 1, 6).transpose() * geo_der2.row(7) );
360 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.col(3) + geo_jac(1,1) * Phi.col(4)) * geo_jac(0,1) +
361 (geo_jac(0,1) * Phi.col(4) + geo_jac(1,1) * Phi.col(5)) * geo_jac(1,1) +
362 Phi.block(0,1,6,1) * geo_der2.row(1) +
363 Phi.block(0,2,6,1) * geo_der2.row(4) );
366 d_ilik_plus.push_back(Phi.block(1, 0, geo.
targetDim(), 6).transpose() * dd_ik_plus);
370 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) +
371 (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) +
372 (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) +
373 Phi.block(1, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(0) +
374 Phi.block(2, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(1) +
375 Phi.block(3, 0, 1, 6).transpose() * dd_ik_plus_deriv.row(2) );
379 d_ilik_plus.push_back( (geo_jac(0,1) * Phi.col(3) + geo_jac(1,1) * Phi.col(4)) * dd_ik_plus(0,0) +
380 (geo_jac(0,1) * Phi.col(4) + geo_jac(1,1) * Phi.col(5)) * dd_ik_plus(1,0) +
381 Phi.block(0,1,6,1) * dd_ik_plus_deriv.row(0) +
382 Phi.block(0,2,6,1) * dd_ik_plus_deriv.row(1) );
386 for (
index_t i = 0; i < 6; i++)
388 rhsVals.
at(i) = d_ilik_minus.at(0)(i,0) * (c_0_plus.at(0).cwiseProduct(c_0.at(1)) -
389 beta[0].cwiseProduct(c_0_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) +
390 d_ilik_minus.at(1)(i,0) * (c_1_plus.at(0).cwiseProduct(c_0.at(1)) -
391 beta[0].cwiseProduct(c_1_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) +
392 d_ilik_minus.at(2)(i,0) * (c_2_plus.at(0).cwiseProduct(c_0.at(1)) -
393 beta[0].cwiseProduct(c_2_plus_deriv.at(0).cwiseProduct(c_1.at(1)))) -
394 d_ilik_minus.at(3)(i,0) * alpha[0].cwiseProduct(c_0_minus.at(0).cwiseProduct(c_1.at(1))) -
395 d_ilik_minus.at(4)(i,0) * alpha[0].cwiseProduct(c_1_minus.at(0).cwiseProduct(c_1.at(1)));
397 rhsVals.at(i) += d_ilik_plus.at(0)(i,0) * (c_0_plus.at(1).cwiseProduct(c_0.at(0)) -
398 beta[1].cwiseProduct(c_0_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
399 d_ilik_plus.at(1)(i,0) * (c_1_plus.at(1).cwiseProduct(c_0.at(0)) -
400 beta[1].cwiseProduct(c_1_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
401 d_ilik_plus.at(2)(i,0) * (c_2_plus.at(1).cwiseProduct(c_0.at(0)) -
402 beta[1].cwiseProduct(c_2_plus_deriv.at(1).cwiseProduct(c_1.at(0)))) +
403 d_ilik_plus.at(3)(i,0) * alpha[1].cwiseProduct(c_0_minus.at(1).cwiseProduct(c_1.at(0))) +
404 d_ilik_plus.at(4)(i,0) * alpha[1].cwiseProduct(c_1_minus.at(1).cwiseProduct(c_1.at(0)));
406 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)) +
407 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));
409 localMat.at(i).setZero(numActive, numActive);
410 localRhs.at(i).setZero(numActive, rhsVals.at(i).rows());
412 localMat.at(i).setZero(numActive, numActive);
413 localRhs.at(i).setZero(numActive, rhsVals.at(i).rows());
424 for (
index_t i = 0; i < 6; i++)
427 localMat.
at(i).noalias() = basisData * quWeights.asDiagonal() * md.measures.asDiagonal() * basisData.transpose();
429 for (
index_t k = 0; k < quWeights.rows(); ++k)
431 T weight = quWeights[k];
434 if( Jk.dim().second + 1 == Jk.dim().first)
437 T detG = G.determinant();
438 weight *= sqrt(detG);
442 weight *= md.measure(k);
446 localRhs.at(i).noalias() += weight * (basisVals.col(k) * rhsVals.
at(i).col(k).transpose());
451 inline void localToGlobal(
const index_t patchIndex,
456 for (
size_t i = 0; i < system.size(); i++)
459 system.
at(i).mapColIndices(actives, patchIndex, actives_temp);
461 system.at(i).push(localMat.at(i), localRhs.at(i), actives_temp, eliminatedDofs[0], 0, 0);
472 std::vector< gsMatrix<T> > rhsVals;
476 std::vector< gsMatrix<T> > localMat;
477 std::vector< gsMatrix<T> > localRhs;
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
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
Class representing a reference quadrature rule.
Definition: gsQuadRule.h:28
virtual void computeMap(gsMapData< T > &InOut) const
Computes map function data.
Definition: gsFunction.hpp:822
virtual short_t degree(short_t i) const
Degree with respect to the i-th variable. If the basis is a tensor product of (piecewise) polynomial ...
Definition: gsBasis.hpp:650
the gsMapData is a cache of pre-computed function (map) values.
Definition: gsFuncData.h:324
#define index_t
Definition: gsConfig.h:32
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:514
A univariate B-spline basis.
Definition: gsBSplineBasis.h:694
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
Class which enables iteration over all elements of a parameter domain.
Definition: gsDomainIterator.h:67
short_t parDim() const
Dimension d of the parameter domain (same as domainDim()).
Definition: gsGeometry.hpp:190
The density of the measure pull back.
Definition: gsForwardDeclarations.h:76
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates nonzero basis functions at point u into result.
Definition: gsBasis.hpp:443
short_t targetDim() const
Dimension of the ambient physical space (overriding gsFunction::targetDim())
Definition: gsGeometry.h:286
Class that represents the (tensor) Gauss-Legendre quadrature rule.
Definition: gsGaussRule.h:27
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
virtual void active_into(const gsMatrix< T > &u, gsMatrix< index_t > &result) const
Returns the indices of active basis functions at points u, as a list of indices, in result...
Definition: gsBasis.hpp:293