21 template<
short_t d,
class T>
22 class gsApproxC1GluingData
25 typedef typename std::vector<gsPatchReparameterized<d,T>> C1AuxPatchContainer;
28 typedef memory::shared_ptr<gsApproxC1GluingData> Ptr;
31 typedef memory::unique_ptr<gsApproxC1GluingData> uPtr;
34 gsApproxC1GluingData()
38 gsApproxC1GluingData(C1AuxPatchContainer
const & auxPatchContainer,
39 gsOptionList
const & optionList,
40 std::vector<patchSide> sidesContainer,
41 std::vector<bool> isInterface = std::vector<bool>{},
42 gsTensorBSplineBasis<d, T> basis = gsTensorBSplineBasis<d, T>())
43 : m_auxPatches(auxPatchContainer), m_optionList(optionList)
45 alphaSContainer.resize(2);
46 betaSContainer.resize(2);
47 if (m_auxPatches.size() == 2)
49 setGlobalGluingData(1,0);
50 setGlobalGluingData(0,1);
52 else if (m_auxPatches.size() == 1 && sidesContainer.size() == 2)
54 for (
size_t dir = 0; dir < sidesContainer.size(); dir++)
57 index_t localSide = auxPatchContainer[0].getMapIndex(sidesContainer[dir].index());
59 index_t localDir = localSide < 3 ? 1 : 0;
61 createGluingDataSpace(m_auxPatches[0].getPatchRotated(), basis,
62 localDir, bsp_gD, m_optionList.getInt(
"gluingDataDegree"), m_optionList.getInt(
"gluingDataSmoothness"));
66 setGlobalGluingData(0, localDir);
83 gsBSpline<T> & alphaS(
index_t patchID) {
return alphaSContainer[patchID]; }
84 gsBSpline<T> & betaS(
index_t patchID) {
return betaSContainer[patchID]; }
89 C1AuxPatchContainer m_auxPatches;
91 gsBSplineBasis<T> bsp_gD;
93 const gsOptionList m_optionList;
96 std::vector<gsBSpline<T>> alphaSContainer, betaSContainer;
101 template<
short_t d,
class T>
102 void gsApproxC1GluingData<d, T>::setGlobalGluingData(
index_t patchID,
index_t dir)
105 bool interpolate_boundary =
false;
108 gsTensorBSplineBasis<d, T> basis =
dynamic_cast<const gsTensorBSplineBasis<d, T> &
>(m_auxPatches[patchID].getBasisRotated().piece(0));;
109 if (m_auxPatches.size() == 2)
111 gsTensorBSplineBasis<d, T> basis2 =
dynamic_cast<const gsTensorBSplineBasis<d, T> &
>(m_auxPatches[1-patchID].getBasisRotated().piece(0));
112 if (basis.component(dir).numElements() > basis2.component(1-dir).numElements())
113 basis.component(dir) = basis2.component(1-dir);
116 createGluingDataSpace(m_auxPatches[patchID].getPatchRotated(), basis,
117 dir, bsp_gD, m_optionList.getInt(
"gluingDataDegree"), m_optionList.getInt(
"gluingDataSmoothness"));
123 typename gsSparseSolver<T>::SimplicialLDLT solver;
124 gsExprAssembler<T> A(1,1);
127 gsMultiBasis<T> BsplineSpace(bsp_gD);
128 A.setIntegrationElements(BsplineSpace);
129 gsExprEvaluator<T> ev(A);
131 gsAlpha<T> alpha(m_auxPatches[patchID].getPatchRotated(), dir);
132 auto aa = A.getCoeff(alpha);
135 auto u = A.getSpace(BsplineSpace);
138 gsDofMapper map(BsplineSpace);
139 gsMatrix<index_t> act(2,1);
141 act(1,0) = BsplineSpace[0].size()-1;
142 if (interpolate_boundary)
143 map.markBoundary(0, act);
148 gsMatrix<T> & fixedDofs =
const_cast<expr::gsFeSpace<T>&
>(u).fixedPart();
149 fixedDofs.setZero( u.mapper().boundarySize(), 1 );
152 gsMatrix<T> points_bdy(1,2);
153 points_bdy << 0.0, 1.0;
154 if (interpolate_boundary)
155 fixedDofs = alpha.eval(points_bdy).transpose();
158 A.assemble(u * u.tr(), u * aa);
160 solver.compute( A.matrix() );
161 gsMatrix<T> solVector = solver.solve(A.rhs());
163 auto u_sol = A.getSolution(u, solVector);
167 typename gsGeometry<T>::uPtr tilde_temp;
168 tilde_temp = bsp_gD.makeGeometry(sol);
169 alphaSContainer[dir] =
dynamic_cast<gsBSpline<T> &
> (*tilde_temp);
171 gsBeta<T> beta(m_auxPatches[patchID].getPatchRotated(), dir);
172 auto bb = A.getCoeff(beta);
175 if (interpolate_boundary)
176 fixedDofs = beta.eval(points_bdy).transpose();
179 A.assemble(u * u.tr(), u * bb);
181 solver.compute( A.matrix() );
182 solVector = solver.solve(A.rhs());
184 auto u_sol2 = A.getSolution(u, solVector);
187 tilde_temp = bsp_gD.makeGeometry(sol);
188 betaSContainer[dir] =
dynamic_cast<gsBSpline<T> &
> (*tilde_temp);
Provides declaration of Basis abstract interface.
#define index_t
Definition: gsConfig.h:32