20#include <gsUnstructuredSplines/src/gsApproxC1GluingData.h>
24 template<
short_t d,
class T>
25 void gsApproxC1Edge<d,T>::compute(std::vector<patchSide> & sidesContainer) {
28 gsApproxC1GluingData<d, T> approxGluingData(m_auxPatches, m_optionList, sidesContainer);
32 if (sidesContainer.size() == 2) {
33 if (m_auxPatches[0].getBasisRotated().piece(0).component(1).numElements() >
34 m_auxPatches[1].getBasisRotated().piece(0).component(0).numElements()) {
52 basisEdgeResult.clear();
53 for (
size_t patchID = 0; patchID < sidesContainer.size(); patchID++)
57 index_t dir = patchID == 0 ? 1 : 0;
61 gsMultiBasis<T> initSpace(m_auxPatches[patchID].getBasisRotated().piece(0));
62 createPlusSpace(m_auxPatches[patch].getPatchRotated(), basis, dir_pm, basis_plus);
63 createMinusSpace(m_auxPatches[patch].getPatchRotated(), basis, dir_pm, basis_minus);
69 if (sidesContainer.size() == 2)
72 beta = approxGluingData.betaS(dir);
73 alpha = approxGluingData.alphaS(dir);
77 typename gsSparseSolver<T>::SimplicialLDLT solver;
82 m_auxPatches[patchID].getBasisRotated().piece(sidesContainer[patchID]));
84 A.setIntegrationElements(edgeSpace);
88 auto u = A.getSpace(edgeSpace);
92 if (!m_optionList.getSwitch(
"interpolation"))
95 for (index_t i = 2; i < edgeSpace[0].component(1 - dir).size();
98 act = edgeSpace[0].boundaryOffset(dir == 0 ? 3 : 1, i);
99 map.markBoundary(0, act);
106 fixedDofs.setZero(u.mapper().boundarySize(), 1);
109 A.assemble(u * u.tr());
110 solver.compute(A.matrix());
118 for (index_t bfID = bfID_init; bfID < n_plus - bfID_init; bfID++)
120 gsTraceBasis<T> traceBasis(geo, beta, basis_plus, initSpace.basis(0), bdy, bfID, dir);
122 if (m_optionList.getSwitch(
"interpolation"))
126 gsMatrix<T> anchors = edgeSpace.basis(0).anchors();
128 result.
addPatch(edgeSpace.basis(0).interpolateAtAnchors(
give(values)));
134 auto aa = A.getCoeff(traceBasis);
140 auto u_sol = A.getSolution(u, solVector);
144 result.
addPatch(edgeSpace.basis(0).makeGeometry(
give(sol)));
149 for (index_t bfID = bfID_init; bfID < n_minus - bfID_init; bfID++)
151 gsNormalDerivBasis<T> normalDerivBasis(geo, alpha, basis_minus, initSpace.basis(0), bdy, bfID,
153 if (m_optionList.getSwitch(
"interpolation"))
157 gsMatrix<T> anchors = edgeSpace.basis(0).anchors();
158 gsMatrix<T> values = normalDerivBasis.eval(anchors);
159 result.
addPatch(edgeSpace.basis(0).interpolateAtAnchors(
give(values)));
165 auto aa = A.getCoeff(normalDerivBasis);
171 auto u_sol = A.getSolution(u, solVector);
175 result.
addPatch(edgeSpace.basis(0).makeGeometry(
give(sol)));
180 m_auxPatches[patchID].parametrizeBasisBack(result);
182 basisEdgeResult.push_back(result);
187 template<
short_t d,
class T>
188 void gsApproxC1Edge<d,T>::computeAuxTopology()
190 for(
size_t i = 0; i < m_auxPatches.size(); i++)
192 if(m_auxPatches[i].getPatchRotated().orientation() == -1)
193 m_auxPatches[i].swapAxis();
198 template<
short_t d,
class T>
199 void gsApproxC1Edge<d,T>::reparametrizeInterfacePatches(std::vector<patchSide> & sidesContainer)
201 computeAuxTopology();
210 switch (sidesContainer[0].side().index())
214 case 4: m_auxPatches[0].rotateParamClock();
216 case 3: m_auxPatches[0].rotateParamAntiClock();
218 case 2: m_auxPatches[0].rotateParamAntiClockTwice();
225 switch (sidesContainer[1].side().index())
229 case 4: m_auxPatches[1].rotateParamAntiClockTwice();
231 case 2: m_auxPatches[1].rotateParamAntiClock();
233 case 1: m_auxPatches[1].rotateParamClock();
241 template<
short_t d,
class T>
242 void gsApproxC1Edge<d,T>::reparametrizeSinglePatch(index_t side)
244 computeAuxTopology();
246 if(m_auxPatches[0].getOrient())
253 m_auxPatches[0].rotateParamClock();
256 m_auxPatches[0].rotateParamAntiClockTwice();
259 m_auxPatches[0].rotateParamAntiClock();
270 m_auxPatches[0].rotateParamClock();
273 m_auxPatches[0].rotateParamAntiClockTwice();
276 m_auxPatches[0].rotateParamAntiClock();
Definition gsExpressions.h:973
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A B-spline function of one argument, with arbitrary target dimension.
Definition gsBSpline.h:51
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
Definition gsExprAssembler.h:33
Generic evaluator of isogeometric expressions.
Definition gsExprEvaluator.h:39
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition gsMultiPatch.hpp:211
index_t size() const
Returns the number of elements in the basis.
Definition gsBSplineBasis.h:165
A tensor product B-spline basis.
Definition gsTensorBSplineBasis.h:37
Creates the (approx) C1 Edge space.
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266