55 for (
size_t p = 0; p < domain.
nPatches(); ++p)
58 std::map<std::string,const gsField<> *> fields;
59 fields[
"Jacobian"] = &detField;
62 for (
size_t p = 0; p < domain.
nPatches(); ++p)
64 collectionMesh.
addPart(fileNameOnly +
"_mesh.vtp",0,
"Mesh",p);
66 collectionJac.
addPart(fileNameOnly +
".vts",0,
"Jac",p);
69 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
71 res = system((
"rm " + fileName +
".pvd").c_str());
72 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
75 collectionMesh.
save();
84 for (
size_t p = 0; p < domain.
nPatches(); ++p)
87 domain.
patch(p).evaluateMesh(mesh);
89 gsWriteParaview(mesh,patchFileName,
false);
96 std::string fileName,
index_t numSamplingPoints)
98 gsInfo <<
"Plotting deformed configurations...\n";
106 for (
size_t p = 0; p < initDomain.
nPatches(); ++p)
110 for (
size_t p = 0; p < configuration.
nPatches(); ++p)
114 if (numSamplingPoints == 0)
118 bar.
display(0, displacements.size());
121 std::map<std::string,const gsField<T> *> fields;
122 fields[
"Jacobian"] = &detField;
125 for (
size_t p = 0; p < configuration.
nPatches(); ++p)
133 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
136 res = system((
"rm " + fileName +
util::to_string(0) +
".pvd").c_str());
137 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
139 for (
size_t s = 0; s < displacements.size(); ++s)
142 bar.
display(s+1, displacements.size());
144 for (
size_t p = 0; p < configuration.
nPatches(); ++p)
146 configuration.
patch(p).coefs() += displacements[s].patch(p).coefs();
148 configuration.
patch(p).coefs() -= displacements[s-1].patch(p).coefs();
152 for (
size_t p = 0; p < configuration.
nPatches(); ++p)
160 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
163 res = system((
"rm " + fileName +
util::to_string(s+1) +
".pvd").c_str());
164 GISMO_ENSURE(res == 0,
"Problems with deleting files\n");
167 collectionMesh.
save();
169 collectionJac.
save();
183 for (
size_t p = 0; p < initDomain.
nPatches(); ++p)
186 configuration.
patch(p).coefs() += displacement.
patch(p).coefs();
189 for (
size_t p = 0; p < configuration.
nPatches(); ++p)
192 configuration.
patch(p).evaluateMesh(mesh);
194 gsWriteParaview(mesh,patchFileName,
false);
203 bool continueIt =
true;
204 for (
size_t p = 0; p < domain.
nPatches() && continueIt; ++p)
214 numNodes.
at(i) = domain.
basis(p).degree(i)+1;
217 typename gsBasis<T>::domainIter domIt = domain.
basis(p).makeDomainIterator(boundary::none);
219 const int tid = omp_get_thread_num();
220 const int nt = omp_get_num_threads();
221 for ( domIt->next(tid); domIt->good() && continueIt; domIt->next(nt) )
223 for (; domIt->good() && continueIt; domIt->next() )
228 domain.
patch(p).computeMap(md);
229 for (
index_t q = 0; q < points.cols() && continueIt; ++q)
231 if (md.jacobian(q).determinant() <= 0)
233 gsInfo <<
"Bad patch: " << p <<
"\nBad point:\n" << points.col(q) <<
"\nDet: " << md.jacobian(q).determinant() << std::endl;
240 return corruptedPatch;
248 bool continueIt =
true;
249 for (
size_t p = 0; p < domain.
nPatches() && continueIt; ++p)
260 numNodes.
at(i) = displacement.
basis(p).degree(i)+1;
263 typename gsBasis<T>::domainIter domIt = displacement.
basis(p).makeDomainIterator(boundary::none);
265 const int tid = omp_get_thread_num();
266 const int nt = omp_get_num_threads();
267 for ( domIt->next(tid); domIt->good() && continueIt; domIt->next(nt) )
269 for (; domIt->good() && continueIt; domIt->next() )
275 domain.
patch(p).computeMap(mdG);
276 displacement.
patch(p).computeMap(mdU);
277 for (
index_t q = 0; q < points.cols() && continueIt; ++q)
279 gsMatrix<T> physDispJac = mdU.jacobian(q)*(mdG.jacobian(q).cramerInverse());
281 if (F.determinant() <= 0)
283 gsInfo <<
"Bad patch: " << p <<
"\nBad point:\n" << points.col(q) <<
"\nDet: " << F.determinant() << std::endl;
291 return corruptedPatch;
298 for (
size_t p = 0; p < domain.
nPatches(); ++p)
308 numNodes.
at(i) = solution.
basis(p).degree(i)+1;
311 typename gsBasis<T>::domainIter domIt = solution.
basis(p).makeDomainIterator(boundary::none);
313 const int tid = omp_get_thread_num();
314 const int nt = omp_get_num_threads();
315 for ( domIt->next(tid); domIt->good(); domIt->next(nt) )
317 for (; domIt->good(); domIt->next() )
320 quRule.
mapTo( domIt->lowerCorner(), domIt->upperCorner(), quNodes, quWeights );
322 domain.
patch(p).computeMap(mdGeo);
323 solution.
patch(p).eval_into(quNodes,values);
325 for (
index_t q = 0; q < quNodes.cols(); ++q)
326 tempNorm += mdGeo.measure(q)*quWeights.
at(q)*(values.col(q).transpose()*values.col(q))(0,0);
338 std::vector<T> maxs, mins;
343 for (
size_t p = 0; p < domain.
nPatches(); ++p)
347 numNodes.
at(i) = domain.
basis(p).degree(i)+1;
350 typename gsBasis<T>::domainIter domIt = domain.
basis(p).makeDomainIterator(boundary::none);
351 for (; domIt->good(); domIt->next())
355 domain.
patch(p).computeMap(md);
357 T min = md.jacobian(0).determinant();
359 for (
index_t q = 1; q < points.cols(); ++q)
361 T
jac = md.jacobian(q).determinant();
373 return *(std::min_element(mins.begin(),mins.end())) / *(std::max_element(maxs.begin(),maxs.end()));
379 std::vector<T> maxs, mins;
384 size_t dim = domain.
parDim();
386 for (
size_t p = 0; p < displacement.
nPatches(); ++p)
390 numNodes.
at(i) = displacement.
basis(p).degree(i)+1;
393 typename gsBasis<T>::domainIter domIt = domain.
basis(p).makeDomainIterator(boundary::none);
394 for (; domIt->good(); domIt->next())
399 domain.
patch(p).computeMap(mdG);
400 displacement.
patch(p).computeMap(mdU);
402 T minJ = (
gsMatrix<T>::Identity(dim,dim) + mdU.jacobian(0)*(mdG.jacobian(0).cramerInverse())).determinant();
404 for (
int q = 1; q < points.cols(); ++q)
406 T J = (
gsMatrix<T>::Identity(dim,dim) + mdU.jacobian(q)*(mdG.jacobian(q).cramerInverse())).determinant();
413 maxs.push_back(maxJ);
414 mins.push_back(minJ);
418 return *(std::min_element(mins.begin(),mins.end())) / *(std::max_element(maxs.begin(),maxs.end()));
427 quRule.
mapTo(lower,upper,quadPoints,tempVector);
430 for (
index_t d = 0; d < quadPoints.rows(); ++d)
434 points.resize(quadPoints.rows(),quadPoints.cols()+corners.cols());
435 points << quadPoints,corners;
445 case 1:
return curveLength<T>(geo);
454 return (curveLength<T>(*sideS) + curveLength<T>(*sideN))/2;
460 return (curveLength<T>(*sideW) + curveLength<T>(*sideE))/2;
477 return (curveLength<T>(*edgeBS) + curveLength<T>(*edgeBN) +
478 curveLength<T>(*edgeFS) + curveLength<T>(*edgeFN))/4;
488 return (curveLength<T>(*edgeBW) + curveLength<T>(*edgeBE) +
489 curveLength<T>(*edgeFW) + curveLength<T>(*edgeFE))/4;
499 return (curveLength<T>(*edgeNW) + curveLength<T>(*edgeNE) +
500 curveLength<T>(*edgeSW) + curveLength<T>(*edgeSE))/4;
516 numNodes << geo.
basis().degree(0)+1;
523 typename gsBasis<>::domainIter domIt = geo.
basis().makeDomainIterator(boundary::none);
524 for (; domIt->good(); domIt->next())
526 quRule.
mapTo(domIt->lowerCorner(),domIt->upperCorner(),qPoints,qWeights);
529 for (
index_t q = 0; q < qWeights.rows(); ++q)
530 length += qWeights.
at(q)*md.jacobian(q).norm();
544 for (
short_t d = 0; d < dim; ++d)
546 parLengths.
at(d) = patchLength<T>(geo,d);
547 volume *= parLengths.
at(d);
550 T unit = pow(1.0*numPoints/volume,1./geo.
parDim());
552 numPointsPerDir.
at(d) = math::ceil(unit*parLengths.
at(d)) > 1 ? math::ceil(unit*parLengths.
at(d)) : 2;
553 return numPointsPerDir;
568 index_t num = deg + 1 + additionalPoints;
575 for (
index_t p = 0; p < numSamples; ++p)
576 params.
at(p) = 1.*p/(numSamples-1);
583 for (
index_t p = 1; p < numSamples; ++p)
584 lens.
at(p) = lens.
at(p-1) +
distance(curveValues,p,curveValues,p-1,
true);
587 for (
index_t p = 0; p < numSamples; ++p)
588 lenParams.
at(p) = lens.
at(p)/lens.
at(numSamples-1);
592 simpleCurve->
eval_into(params,curveValues);
593 for (
index_t p = 1; p < numSamples; ++p)
594 lens.
at(p) = lens.
at(p-1) +
distance(curveValues,p,curveValues,p-1,
true);
596 for (
index_t p = 0; p < numSamples; ++p)
597 lenParams.
at(p) = lens.
at(p)/lens.
at(numSamples-1);
608 for (
index_t p = 0; p < numSamples; ++p)
609 params.
at(p) = 1.*p/(numSamples-1);
616 for (
int p = 0; p < numSamples; ++p)
617 dist += pow(
distance(pointsA,p,pointsB,p,
true),2);
619 return sqrt(dist/numSamples);
627 index_t numSamples = params.cols();
641 for (
index_t p = 1; p < numSamples; ++p)
643 index_t numActive = activeBasis.rows();
644 for (
index_t i = 0; i < numActive; ++i)
646 if (activeBasis(i,p) == 0)
648 for (
index_t j = 0; j < numActive; ++j)
650 if (activeBasis(j,p) != 0 && activeBasis(j,p) != num-1 )
651 b.row(activeBasis(j,p)-1) -= basisValues(i,p) * basisValues(j,p) *
652 points.col(0).transpose() * (params.
at(p)-params.
at(p-1));
655 else if (activeBasis(i,p) == num-1)
657 for (
index_t j = 0; j < numActive; ++j)
659 if (activeBasis(j,p) != 0 && activeBasis(j,p) != num-1 )
660 b.row(activeBasis(j,p)-1) -= basisValues(i,p) * basisValues(j,p) *
661 points.col(numSamples-1).transpose() * (params.
at(p)-params.
at(p-1));
666 b.row(activeBasis(i,p)-1) += basisValues(i,p) * points.col(p).transpose() * (params.
at(p)-params.
at(p-1));
667 for (
index_t j = 0; j < numActive; ++j)
668 if (activeBasis(j,p) != 0 && activeBasis(j,p) != num-1 )
669 A(activeBasis(i,p)-1, activeBasis(j,p)-1) += basisValues(i,p) * basisValues(j,p) * (params.
at(p)-params.
at(p-1));
675 typename gsSparseSolver<T>::CGDiagonal solver(A);
679 coefs.row(0) = points.col(0).transpose();
680 coefs.block(1,0,num-2,dim) = x.block(0,0,num-2,dim);
681 coefs.row(num-1) = points.col(numSamples-1).transpose();
693 GISMO_ASSERT(pDim == 1 || pDim ==2,
"Can only interpolate between curves or surfaces. Given geometries have parametric dimension " +
695 for (
index_t d = 0; d < pDim; ++d)
716 T part = 1./(num-deg);
718 for (
index_t i = 0; i < num; ++i)
722 else if (deg <= i && i < num-deg )
725 pos += part/deg*(num-i);
727 for (
index_t j = 0; j < baseNum; ++j)
740 return basis.makeGeometry(
give(coefs));
746 return basis.makeGeometry(
give(coefs));
756 T part = 1./(num-deg);
758 for (
index_t i = 0; i < num; ++i)
762 else if (deg <= i && i < num-deg )
765 pos += part/deg*(num-i);
767 for (
index_t j = 0; j < baseNum; ++j)
771 return basis.makeGeometry(
give(coefs));
782 scaledBoundary->
scale(scaling);
793 GISMO_ENSURE(A.cols() == B.cols(),
"Points have different dimensions\n");
798 coefs.row(0) = A.row(iA);
799 coefs.row(1) = B.row(iB);
803 for (
index_t i = 0; i < deg - 1; ++i)
806 for (
index_t i = 0; i < num - deg - 1; ++i)
814 T radius, T x0, T y0,
815 T angle0, T arcAngle)
820 return genCircle(basis,radius,x0,y0,angle0,arcAngle);
827 T angle0, T arcAngle)
832 for (
index_t i = 0; i < numPoints; ++i)
834 params(0,i) = 1.*i/(numPoints-1);
835 points(0,i) = x0 + radius*cos(angle0 + i*arcAngle/(numPoints-1));
836 points(1,i) = y0 + radius*sin(angle0 + i*arcAngle/(numPoints-1));
856 T xi0, T xi1, T eta0, T eta1)
859 GISMO_ENSURE(etaNum - etaDeg - 1 >= 0,
"Too few DoFs\n");
863 return genSphere(xiKnots,etaKnots,xi0,xi1,eta0,eta1);
869 T xi0, T xi1, T eta0, T eta1)
881 for (
index_t i = 0; i < xiNum; ++i)
883 for (
index_t j = 0; j < etaNum; ++j)
885 coefs(j*xiNum+i,0) = xiCircle->
coef(i,0)*etaCircle->
coef(j,1);
886 coefs(j*xiNum+i,1) = xiCircle->
coef(i,1)*etaCircle->
coef(j,1);
887 coefs(j*xiNum+i,2) = etaCircle->
coef(j,0);
915 T height, T pitch, T x0, T y0)
920 GISMO_ASSERT(pDim == 1 || pDim ==2,
"Wrong geometry type\n");
930 for (
index_t i = 0; i < numPoints; ++i)
932 params(0,i) = 1.*i/(numPoints-1);
933 points(0,i) = cos(params(0,i)*2*EIGEN_PI*pitch/360);
934 points(1,i) = sin(params(0,i)*2*EIGEN_PI*pitch/360);
935 points(2,i) = height*params(0,i);
946 for (
index_t i = 0; i < num; ++i)
948 T x = helix->
coef(i,0);
949 T y = helix->
coef(i,1);
950 T radius = sqrt(x*x+y*y);
951 T angle = atan2(y,x);
953 temp.
patch(0).rotate(angle-oldAngle);
954 temp.
patch(0).scale(radius/oldRadius);
957 for (
index_t j = 0; j < numBase; j++)
959 coefs(i*numBase + j,0) = temp.
patch(0).coef(j,0);
960 coefs(i*numBase + j,1) = temp.
patch(0).coef(j,1);
961 coefs(i*numBase + j,2) = helix->
coef(i,2);
971 return basis.makeGeometry(
give(coefs));
978 return basis.makeGeometry(
give(coefs));
992 gsKnotVector<T> yKnots = nurbs ?
static_cast<const gsTensorNurbsBasis<2,T> &
>(crossSection.
basis()).knots(1)
995 std::vector<T> knots;
996 for (
index_t i = 0; i < 3; ++i)
998 for (
index_t i = 0; i < N-1; ++i)
999 for (
index_t j = 0; j < 2; ++j)
1000 knots.push_back(1./N*(i+1));
1001 for (
index_t i = 0; i < 3; ++i)
1002 knots.push_back(1.);
1007 gsMatrix<T> crossWeights = nurbs ?
static_cast<const gsTensorNurbsBasis<2,T> &
>(crossSection.
basis()).weights()
1010 for (
index_t i = 0; i < 2*N+1; ++i)
1011 weights.middleRows(i*numP,numP) = crossWeights*(i%2==0 ? 1 : 1./sqrt(2));
1015 crossCoefs.setZero();
1016 crossCoefs.col(0) = crossSection.
coefs().col(0);
1017 crossCoefs.col(2) = crossSection.
coefs().col(1);
1018 for (
index_t i = 0; i < numP; ++i)
1019 crossCoefs(i,0) += R;
1023 for (
index_t i = 0; i < 2*N+1; ++i)
1025 gsMatrix<T> rotation = gsEigen::AngleAxis<T>(-1.0*EIGEN_PI/4*i,gsEigen::Vector3f(0.,0.,1.)).toRotationMatrix().transpose();
1026 gsMatrix<T> scaling = gsEigen::DiagonalMatrix<T,3>((i%2 == 0 ? 1. : sqrt(2)),1.,1.);
1027 coefs.middleRows(i*numP,numP) = crossCoefs * scaling * rotation;
1028 for (
index_t j = 0; j < numP; ++j)
1029 coefs(i*numP + j,2) += i*springPitch/8;
1047 static_cast<gsTensorBSpline<2,T> &
>(temp.
patch(0)).insertKnot(0.5,1);
1048 static_cast<gsTensorBSpline<2,T> &
>(temp.
patch(0)).insertKnot(
1050 static_cast<gsTensorBSpline<2,T> &
>(temp.
patch(0)).insertKnot(
1053 std::vector<T> knotsEtaShort;
1054 for (
index_t i = 0; i < 4; ++i)
1055 knotsEtaShort.push_back(0.);
1056 for (
index_t i = 0; i < 4; ++i)
1057 knotsEtaShort.push_back(1.);
1060 std::vector<T> knotsEtaLong;
1061 for (
index_t i = 0; i < 4; ++i)
1062 knotsEtaLong.push_back(0.);
1063 knotsEtaLong.push_back(0.5);
1064 for (
index_t i = 0; i < 4; ++i)
1065 knotsEtaLong.push_back(1.);
1068 std::vector<T> knotsInner;
1069 for (
index_t i = 0; i < innerDim+1; ++i)
1070 knotsInner.push_back(0.);
1071 for (
index_t i = 0; i < innerDim+1; ++i)
1072 knotsInner.push_back(1.);
1076 knotVectorEtaShort,knotVectorInner);
1078 knotVectorEtaLong,knotVectorInner);
1080 knotVectorEtaShort,knotVectorInner);
1082 knotVectorEtaLong,knotVectorInner);
1084 knotVectorEtaShort,knotVectorEtaLong);
1091 for (
index_t i = 0; i < 7; ++i)
1101 cornerB =
combine(cornerB,cornerC,(T)0.5);
1102 cornerD =
combine(cornerD,cornerC,(T)0.5);
1110 for (
index_t j = 0; j < 4; ++j)
1111 bdryABcoefs.row(j) = temp.
patch(0).coefs().row(j*7+i);
1117 for (
index_t j = 0; j < 4; ++j)
1118 for (
index_t k = 0; k < innerDim+1; ++k)
1119 coefs1.row(k*4*7+j*7+(6-i)) = coonsPatch1.
result().coefs().row(k*4+j);
1126 for (
index_t j = 0; j < 5; ++j)
1127 bdryBCcoefs.row(j) = temp.
patch(0).coefs().row((j+3)*7+i);
1133 for (
index_t j = 0; j < 5; ++j)
1134 for (
index_t k = 0; k < innerDim+1; ++k)
1135 coefs2.row(k*5*7+j*7+(6-i)) = coonsPatch2.
result().coefs().row(k*5+j);
1142 for (
index_t j = 0; j < 4; ++j)
1143 bdryCDcoefs.row(j) = temp.
patch(0).coefs().row((j+7)*7+i);
1149 for (
index_t j = 0; j < 4; ++j)
1150 for (
index_t k = 0; k < innerDim+1; ++k)
1151 coefs3.row(k*4*7+j*7+(6-i)) = coonsPatch3.
result().coefs().row(k*4+j);
1158 for (
index_t j = 0; j < 5; ++j)
1159 bdryDAcoefs.row(j) = temp.
patch(0).coefs().row((j+10)*7+i);
1165 for (
index_t j = 0; j < 5; ++j)
1166 for (
index_t k = 0; k < innerDim+1; ++k)
1167 coefs4.row(k*5*7+j*7+(6-i)) = coonsPatch4.
result().coefs().row(k*5+j);
1179 for (
index_t j = 0; j < 4; ++j)
1180 for (
index_t k = 0; k < 5; ++k)
1181 coefs5.row(k*4*7+j*7+(6-i)) = coonsPatch5.
result().coefs().row(k*4+j);
1185 result.
addPatch(basis1.makeGeometry(coefs1));
1186 result.
addPatch(basis2.makeGeometry(coefs2));
1187 result.
addPatch(basis3.makeGeometry(coefs3));
1188 result.
addPatch(basis4.makeGeometry(coefs4));
1189 result.
addPatch(basis5.makeGeometry(coefs5));
1204 GISMO_ENSURE(A.rows() == B.rows(),
"Points have different dimensions\n");
1207 combination.col(0) = (1-x)*A.col(iA) + x*B.col(iB);
1212 GISMO_ENSURE(A.cols() == B.cols(),
"Points have different dimensions\n");
1215 combination.row(0) = (1-x)*A.row(iA) + x*B.row(iB);
1227 GISMO_ENSURE(A.rows() == B.rows(),
"Wrong matrix size\n");
1228 for (
index_t d = 0; d < A.rows(); ++d)
1229 dist = sqrt(pow(dist,2)+pow(A(d,i)-B(d,j),2));
1233 GISMO_ENSURE(A.cols() == B.cols(),
"Wrong matrix size\n");
1234 for (
index_t d = 0; d < A.cols(); ++d)
1235 dist = sqrt(pow(dist,2)+pow(A(i,d)-B(j,d),2));
gsGeometry< T >::uPtr genQuad(index_t xiDeg, index_t xiNum, index_t etaDeg, index_t etaNum, gsMatrix< T > const &A, gsMatrix< T > const &B, gsMatrix< T > const &C, gsMatrix< T > const &D, index_t iA=0, index_t iB=0, index_t iC=0, index_t iD=0)
generates a quad patch given by its four C—D corners with the following orientation; | | the points a...
Definition: gsGeoUtils.hpp:843
gsGeometry< T >::uPtr genPatchInterpolation(gsGeometry< T > const &A, gsGeometry< T > const &B, index_t deg, index_t num, bool xiDir=false)
Definition: gsGeoUtils.hpp:687
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition: gsMultiPatch.hpp:210
Provides a base class for a quadrature rule.
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
T geometryJacRatio(gsMultiPatch< T > const &domain)
Returns min(Jacobian determinant) divided by max(Jacobian determinant); samples the Jacobian elementw...
Definition: gsGeoUtils.hpp:336
Class representing a reference quadrature rule.
Definition: gsQuadRule.h:28
gsMatrix< T >::RowXpr coef(index_t i)
Returns the i-th coefficient of the geometry as a row expression.
Definition: gsGeometry.h:346
Provides declaration of FunctionExpr class.
Provides Coons's patch construction from boundary data.
Gradient of the object.
Definition: gsForwardDeclarations.h:73
virtual void computeMap(gsMapData< T > &InOut) const
Computes map function data.
Definition: gsFunction.hpp:822
short_t dim() const
Dimension of the boxes.
Definition: gsBoxTopology.h:98
T distance(gsMatrix< T > const &A, gsMatrix< T > const &B, index_t i=0, index_t j=0, bool cols=false)
compute a distance between the point number in the set and the point number <j> in the set ; by def...
T curveLength(const gsGeometry< T > &geo)
compute curve length
Definition: gsGeoUtils.hpp:510
void genSamplingPoints(const gsVector< T > &lower, const gsVector< T > &upper, const gsQuadRule< T > &quRule, gsMatrix< T > &points)
Generates a matrix of sampling points for a given parametric element; includes quadrature points for ...
Definition: gsGeoUtils.hpp:422
A scalar of vector field defined on a m_parametric geometry.
Definition: gsField.h:54
#define short_t
Definition: gsConfig.h:35
void embed3d()
Embeds coefficients in 3D.
Definition: gsGeometry.h:467
A tensor product of d B-spline functions, with arbitrary target dimension.
Definition: gsTensorBSpline.h:44
gsBasis< T > & basis(const size_t i) const
Return the basis of the i-th patch.
Definition: gsMultiPatch.hpp:171
std::string to_string(const C &value)
Converts value to string, assuming "operator<<" defined on C.
Definition: gsUtils.h:56
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
short_t degree(const short_t &i) const
Returns the degree wrt direction i.
Definition: gsGeometry.hpp:333
A tensor product Non-Uniform Rational B-spline function (NURBS) of parametric dimension d...
Definition: gsTensorNurbs.h:40
short_t parDim() const
Dimension of the parameter domain (must match for all patches).
Definition: gsMultiPatch.h:183
the gsMapData is a cache of pre-computed function (map) values.
Definition: gsFuncData.h:324
const gsGeometry< T > & result() const
Returns the resulting patch. Assumes that compute() has been called before.
Definition: gsPatchGenerator.h:72
virtual index_t size() const
size
Definition: gsFunctionSet.h:578
S give(S &x)
Definition: gsMemory.h:266
gsGeometry< T >::uPtr genSphere(index_t xiDeg, index_t xiNum, index_t etaDeg, index_t etaNum, T xi0=0., T xi1=2 *EIGEN_PI, T eta0=-EIGEN_PI/2, T eta1=EIGEN_PI/2)
generates a tensor product B-spline spherical patch with radius 1 and center at 0 given the degrees a...
Definition: gsGeoUtils.hpp:855
memory::unique_ptr< gsBSpline > uPtr
Unique pointer for gsBSpline.
Definition: gsBSpline.h:63
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
static std::string getFilename(std::string const &fn)
Returns the filename without the path of fn.
Definition: gsFileManager.cpp:597
Provides declaration of functions writing Paraview files.
T combine(T a, T b, T x)
compute a convex combintation (1-x)a+xb
Definition: gsGeoUtils.h:206
gsGeometry< T >::uPtr genCircle(index_t deg, index_t num, T radius=1., T x0=0., T y0=0., T angle0=0., T arcAngle=2 *EIGEN_PI)
Definition: gsGeoUtils.hpp:813
Represents a tensor-product NURBS patch.
A tensor product B-spline basis.
Definition: gsTensorBSplineBasis.h:36
index_t coefsSize() const
Return the number of coefficients (control points)
Definition: gsGeometry.h:371
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Provides useful classes derived from gsFunction which can be used for visualization or coupling...
A B-spline function of one argument, with arbitrary target dimension.
Definition: gsBSpline.h:50
A univariate B-spline basis.
Definition: gsBSplineBasis.h:694
void insertKnot(T knot, index_t i=1)
Definition: gsBSpline.hpp:249
gsGeometry< T >::uPtr genLine(index_t deg, index_t num, gsMatrix< T > const &A, gsMatrix< T > const &B, index_t iA=0, index_t iB=0)
Definition: gsGeoUtils.hpp:788
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
void plotGeometry(gsMultiPatch< T > const &domain, std::string fileName, index_t numSamples)
Plots the mesh and the jacobian (if <numSamples> > 0) to Paraview.
Definition: gsGeoUtils.hpp:43
void scale(T s, int coord=-1)
Apply Scaling by factor s.
Definition: gsGeometry.h:413
Provides isogeometric meshing and modelling routines.
gsGeometry< T >::uPtr genPatchScaling(gsGeometry< T > const &boundary, index_t deg, index_t num, T scaling, gsVector< T > const ¢er)
generates a tensor product B-spline bdry south | front patch by scaling a given geometry object \ / |...
Definition: gsGeoUtils.hpp:776
T displacementJacRatio(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &displacement)
Returns min(Jacobian determinant) divided by max(Jacobian determinant) for geo+disp samples the Jacob...
Definition: gsGeoUtils.hpp:377
gsGeometry< T > & patch(size_t i) const
Return the i-th patch.
Definition: gsMultiPatch.h:226
virtual short_t domainDim() const
Dimension d of the parameter domain (overriding gsFunction::domainDim()).
Definition: gsGeometry.hpp:184
size_t nPatches() const
Number of patches.
Definition: gsMultiPatch.h:208
Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
Gauss-Legendre quadrature.
Definition: gsQuadrature.h:34
gsMatrix< T > gsPointGrid(gsVector< T > const &a, gsVector< T > const &b, gsVector< unsigned > const &np)
Construct a Cartesian grid of uniform points in a hypercube, using np[i] points in direction i...
Definition: gsPointGrid.hpp:82
#define gsInfo
Definition: gsDebug.h:43
std::vector< gsGeometry * > boundary() const
Get boundary of this geometry as a vector of new gsGeometry instances.
Definition: gsGeometry.hpp:423
void save()
Definition: gsParaviewCollection.h:203
virtual memory::unique_ptr< gsGeometry< T > > makeGeometry(gsMatrix< T > coefs) const =0
Create a gsGeometry of proper type for this basis with the given coefficient matrix.
T at(index_t i) const
Returns the i-th element of the vector.
Definition: gsVector.h:177
gsGeometry< T >::uPtr genScrew(gsGeometry< T > const &base, index_t deg, index_t num, T height, T pitch, T x0=0., T y0=0.)
generates a 3D tensor product B-spline screw-like patch
Definition: gsGeoUtils.hpp:913
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
void display(double progress)
display the progress from 0 to 1
Definition: gsBaseUtils.h:178
T patchLength(const gsGeometry< T > &geo, short_t dir=0)
compute length of a patch in a given parametric direction as a mean of all boundary edges correspondi...
Definition: gsGeoUtils.hpp:439
Creates a variety of quadrature rules.
A tensor product Non-Uniform Rational B-spline (NURBS) basis.
Definition: gsTensorNurbsBasis.h:38
gsVector< unsigned > distributePoints(const gsGeometry< T > &geo, unsigned numPoints)
distributes sampling points according to the length of the patch in each parametric direction ...
Definition: gsGeoUtils.hpp:536
This class is used to create a Paraview .pvd (collection) file.
Definition: gsParaviewCollection.h:76
void addPart(String const &fn, real_t tStep=-1, std::string name="", index_t part=-1)
Appends a file to the Paraview collection (.pvd file).
Definition: gsParaviewCollection.h:114
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
gsGeometry< T >::uPtr genCylinder(gsGeometry< T > const &base, index_t deg, index_t num, T height)
generates a 3D tensor product B-spline cylindrical patch
Definition: gsGeoUtils.hpp:895
Provides declaration of the Mesh class.
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
const gsGeometry< T > & compute()
Main routine that performs the computation (to be implemented in derived classes) ...
Definition: gsCoonsPatch.hpp:25
memory::unique_ptr< gsGeometry > uPtr
Unique pointer for gsGeometry.
Definition: gsGeometry.h:100
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
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
Represents a B-spline curve/function with one parameter.
Computes a Coons' patch parametrization given a set of boundary geometries. Parametrization is not gu...
Definition: gsCoonsPatch.h:32
void genMuscleMP(gsGeometry< T > const &muscleSurface, gsMultiPatch< T > &result)
This is more of a script than a function. I use it to generate a multi-parametrization for the biceps...
Definition: gsGeoUtils.hpp:1036
void degreeElevate(short_t const i=1, short_t const dir=-1)
Elevate the degree by the given amount i for the direction dir. If dir is -1 then degree elevation is...
Definition: gsBSpline.hpp:347
T at(const size_t &i) const
Returns the value of the i - th knot (counted with repetitions).
Definition: gsKnotVector.h:865
index_t checkDisplacement(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &displacement)
Checks whether the deformed configuration is bijective, i.e. det(Jac(geo+disp)) > 0; returns -1 if ye...
Definition: gsGeoUtils.hpp:245
Simple progress bar class.
Definition: gsBaseUtils.h:171
Compute jacobian determinant of the geometry mapping. Can be pushed into gsPiecewiseFunction to const...
Definition: gsElasticityFunctions.h:133
gsGeometry< T >::uPtr simplifyCurve(gsGeometry< T > const &curve, index_t additionalPoints=0, index_t degree=0, index_t numSamples=1000)
generates a simplified curve by fitting with the coarsest basis of the same degree; then reparametriz...
Definition: gsGeoUtils.hpp:562
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition: gsGeometry.hpp:166
gsGeometry< T >::uPtr genSpring(gsGeometry< T > const &crossSection, T springRadius=6.0, T springPitch=2.60258, index_t numQuarterSegments=12, bool nurbs=false)
generates a 3D NURBS spring using provided geometry as a cross-section
Definition: gsGeoUtils.hpp:983
Class for representing a knot vector.
Definition: gsKnotVector.h:79
Allows to write several fields defined on the same geometry in one file, making it easier to operate ...
gsMatrix< T > points
input (parametric) points
Definition: gsFuncData.h:348
void gsWriteParaviewMultiPhysics(std::map< std::string, const gsField< T > * > fields, std::string const &fn, unsigned npts=NS, bool mesh=false, bool ctrlNet=false)
Write a file containing several fields defined on the same geometry to ONE paraview file...
Definition: gsWriteParaviewMultiPhysics.hpp:76
T curveDistance(gsGeometry< T > const &curveA, gsGeometry< T > const &curveB, index_t numSamples=1000)
returns a distance in L2 sense between two curves parametrized from 0 to 1
Definition: gsGeoUtils.hpp:603
short_t targetDim() const
Dimension of the ambient physical space (overriding gsFunction::targetDim())
Definition: gsGeometry.h:286
gsGeometry< T >::uPtr fittingDirichlet(gsMatrix< T > const ¶ms, gsMatrix< T > const &points, gsBasis< T > const &basis)
fits a given parametrized point cloud with a curve using a given basis; the resulting curve interpola...
Definition: gsGeoUtils.hpp:623
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition: gsPiecewiseFunction.h:28
T normL2(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &solution)
@ Compute norm of the isogeometric solution
Definition: gsGeoUtils.hpp:295
void plotDeformation(const gsMultiPatch< T > &initDomain, const std::vector< gsMultiPatch< T > > &displacements, std::string fileName, index_t numSamplingPoints=10000)
Definition: gsGeoUtils.hpp:95
index_t checkGeometry(gsMultiPatch< T > const &domain)
Checks whether configuration is bijective, i.e. det(Jac(geo)) > 0; returns -1 if yes or the number of...
Definition: gsGeoUtils.hpp:200
virtual const gsBasis< T > & basis() const =0
Returns a const reference to the basis of the geometry.
This object is a cache for computed values from an evaluator.
void translate(gsVector< T > const &v)
Apply translation by vector v.
Definition: gsGeometry.h:429
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
bool computeTopology(T tol=1e-4, bool cornersOnly=false, bool tjunctions=false)
Attempt to compute interfaces and boundaries automatically.
Definition: gsMultiPatch.hpp:366
Provides declaration of the Field class.
gsMatrix< T > & coefs()
Definition: gsGeometry.h:340
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
EIGEN_STRONG_INLINE jac_expr< E > jac(const symbol_expr< E > &u)
The Jacobian matrix of a FE variable.
Definition: gsExpressions.h:4528
Provides declaration of TensorBSplineBasis abstract interface.