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,
"Solution",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();
638 basis.eval_into(params,basisValues);
639 basis.active_into(params,activeBasis);
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();
683 return basis.makeGeometry(
give(coefs));
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)
883 for (
index_t i = 0; i < xiNum; ++i)
885 for (
index_t j = 0; j < etaNum; ++j)
887 coefs(j*xiNum+i,0) = xiCircle->
coef(i,0)*etaCircle->
coef(j,1);
888 coefs(j*xiNum+i,1) = xiCircle->
coef(i,1)*etaCircle->
coef(j,1);
889 coefs(j*xiNum+i,2) = etaCircle->
coef(j,0);
893 return basis.makeGeometry(
give(coefs));
917 T height, T pitch, T x0, T y0)
922 GISMO_ASSERT(pDim == 1 || pDim ==2,
"Wrong geometry type\n");
932 for (
index_t i = 0; i < numPoints; ++i)
934 params(0,i) = 1.*i/(numPoints-1);
935 points(0,i) = cos(params(0,i)*2*EIGEN_PI*pitch/360);
936 points(1,i) = sin(params(0,i)*2*EIGEN_PI*pitch/360);
937 points(2,i) = height*params(0,i);
948 for (
index_t i = 0; i < num; ++i)
950 T x = helix->
coef(i,0);
951 T y = helix->
coef(i,1);
952 T radius = sqrt(x*x+y*y);
953 T angle = atan2(y,x);
955 temp.
patch(0).rotate(angle-oldAngle);
956 temp.
patch(0).scale(radius/oldRadius);
959 for (
index_t j = 0; j < numBase; j++)
961 coefs(i*numBase + j,0) = temp.
patch(0).coef(j,0);
962 coefs(i*numBase + j,1) = temp.
patch(0).coef(j,1);
963 coefs(i*numBase + j,2) = helix->
coef(i,2);
973 return basis.makeGeometry(
give(coefs));
980 return basis.makeGeometry(
give(coefs));
997 std::vector<T> knots;
998 for (
index_t i = 0; i < 3; ++i)
1000 for (
index_t i = 0; i < N-1; ++i)
1001 for (
index_t j = 0; j < 2; ++j)
1002 knots.push_back(1./N*(i+1));
1003 for (
index_t i = 0; i < 3; ++i)
1004 knots.push_back(1.);
1012 for (
index_t i = 0; i < 2*N+1; ++i)
1013 weights.middleRows(i*numP,numP) = crossWeights*(i%2==0 ? 1 : 1./sqrt(2));
1017 crossCoefs.setZero();
1018 crossCoefs.col(0) = crossSection.
coefs().col(0);
1019 crossCoefs.col(2) = crossSection.
coefs().col(1);
1020 for (
index_t i = 0; i < numP; ++i)
1021 crossCoefs(i,0) += R;
1025 for (
index_t i = 0; i < 2*N+1; ++i)
1027 gsMatrix<T> rotation = gsEigen::AngleAxis<T>(-1.0*EIGEN_PI/4*i,gsEigen::Vector3f(0.,0.,1.)).toRotationMatrix().transpose();
1028 gsMatrix<T> scaling = gsEigen::DiagonalMatrix<T,3>((i%2 == 0 ? 1. : sqrt(2)),1.,1.);
1029 coefs.middleRows(i*numP,numP) = crossCoefs * scaling * rotation;
1030 for (
index_t j = 0; j < numP; ++j)
1031 coefs(i*numP + j,2) += i*springPitch/8;
1055 std::vector<T> knotsEtaShort;
1056 for (
index_t i = 0; i < 4; ++i)
1057 knotsEtaShort.push_back(0.);
1058 for (
index_t i = 0; i < 4; ++i)
1059 knotsEtaShort.push_back(1.);
1062 std::vector<T> knotsEtaLong;
1063 for (
index_t i = 0; i < 4; ++i)
1064 knotsEtaLong.push_back(0.);
1065 knotsEtaLong.push_back(0.5);
1066 for (
index_t i = 0; i < 4; ++i)
1067 knotsEtaLong.push_back(1.);
1070 std::vector<T> knotsInner;
1071 for (
index_t i = 0; i < innerDim+1; ++i)
1072 knotsInner.push_back(0.);
1073 for (
index_t i = 0; i < innerDim+1; ++i)
1074 knotsInner.push_back(1.);
1078 knotVectorEtaShort,knotVectorInner);
1080 knotVectorEtaLong,knotVectorInner);
1082 knotVectorEtaShort,knotVectorInner);
1084 knotVectorEtaLong,knotVectorInner);
1086 knotVectorEtaShort,knotVectorEtaLong);
1093 for (
index_t i = 0; i < 7; ++i)
1103 cornerB =
combine(cornerB,cornerC,(T)0.5);
1104 cornerD =
combine(cornerD,cornerC,(T)0.5);
1112 for (
index_t j = 0; j < 4; ++j)
1113 bdryABcoefs.row(j) = temp.
patch(0).coefs().row(j*7+i);
1119 for (
index_t j = 0; j < 4; ++j)
1120 for (
index_t k = 0; k < innerDim+1; ++k)
1121 coefs1.row(k*4*7+j*7+(6-i)) = coonsPatch1.
result().coefs().row(k*4+j);
1128 for (
index_t j = 0; j < 5; ++j)
1129 bdryBCcoefs.row(j) = temp.
patch(0).coefs().row((j+3)*7+i);
1135 for (
index_t j = 0; j < 5; ++j)
1136 for (
index_t k = 0; k < innerDim+1; ++k)
1137 coefs2.row(k*5*7+j*7+(6-i)) = coonsPatch2.
result().coefs().row(k*5+j);
1144 for (
index_t j = 0; j < 4; ++j)
1145 bdryCDcoefs.row(j) = temp.
patch(0).coefs().row((j+7)*7+i);
1151 for (
index_t j = 0; j < 4; ++j)
1152 for (
index_t k = 0; k < innerDim+1; ++k)
1153 coefs3.row(k*4*7+j*7+(6-i)) = coonsPatch3.
result().coefs().row(k*4+j);
1160 for (
index_t j = 0; j < 5; ++j)
1161 bdryDAcoefs.row(j) = temp.
patch(0).coefs().row((j+10)*7+i);
1167 for (
index_t j = 0; j < 5; ++j)
1168 for (
index_t k = 0; k < innerDim+1; ++k)
1169 coefs4.row(k*5*7+j*7+(6-i)) = coonsPatch4.
result().coefs().row(k*5+j);
1181 for (
index_t j = 0; j < 4; ++j)
1182 for (
index_t k = 0; k < 5; ++k)
1183 coefs5.row(k*4*7+j*7+(6-i)) = coonsPatch5.
result().coefs().row(k*4+j);
1206 GISMO_ENSURE(A.rows() == B.rows(),
"Points have different dimensions\n");
1209 combination.col(0) = (1-x)*A.col(iA) + x*B.col(iB);
1214 GISMO_ENSURE(A.cols() == B.cols(),
"Points have different dimensions\n");
1217 combination.row(0) = (1-x)*A.row(iA) + x*B.row(iB);
1229 GISMO_ENSURE(A.rows() == B.rows(),
"Wrong matrix size\n");
1230 for (
index_t d = 0; d < A.rows(); ++d)
1231 dist = sqrt(pow(dist,2)+pow(A(d,i)-B(d,j),2));
1235 GISMO_ENSURE(A.cols() == B.cols(),
"Wrong matrix size\n");
1236 for (
index_t d = 0; d < A.cols(); ++d)
1237 dist = sqrt(pow(dist,2)+pow(A(i,d)-B(j,d),2));
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A B-spline function of one argument, with arbitrary target dimension.
Definition gsBSpline.h:51
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
memory::unique_ptr< gsBSpline > uPtr
Unique pointer for gsBSpline.
Definition gsBSpline.h:63
void insertKnot(T knot, index_t i=1)
Definition gsBSpline.hpp:249
KnotVectorType & knots(const int i=0)
Returns a reference to the knot vector.
Definition gsBSpline.h:170
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
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.
short_t dim() const
Dimension of the boxes.
Definition gsBoxTopology.h:98
Computes a Coons' patch parametrization given a set of boundary geometries. Parametrization is not gu...
Definition gsCoonsPatch.h:33
const gsGeometry< T > & compute()
Main routine that performs the computation (to be implemented in derived classes)
Definition gsCoonsPatch.hpp:25
Compute jacobian determinant of the geometry mapping. Can be pushed into gsPiecewiseFunction to const...
Definition gsElasticityFunctions.h:134
A scalar of vector field defined on a m_parametric geometry.
Definition gsField.h:55
static std::string getFilename(std::string const &fn)
Returns the filename without the path of fn.
Definition gsFileManager.cpp:597
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
virtual void computeMap(gsMapData< T > &InOut) const
Computes map function data.
Definition gsFunction.hpp:817
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
gsMatrix< T > & coefs()
Definition gsGeometry.h:340
std::vector< gsGeometry * > boundary() const
Get boundary of this geometry as a vector of new gsGeometry instances.
Definition gsGeometry.hpp:437
void scale(T s, int coord=-1)
Apply Scaling by factor s.
Definition gsGeometry.h:413
gsMatrix< T >::RowXpr coef(index_t i)
Returns the i-th coefficient of the geometry as a row expression.
Definition gsGeometry.h:346
void translate(gsVector< T > const &v)
Apply translation by vector v.
Definition gsGeometry.h:429
short_t degree(const short_t &i) const
Returns the degree wrt direction i.
Definition gsGeometry.hpp:333
memory::unique_ptr< gsGeometry > uPtr
Unique pointer for gsGeometry.
Definition gsGeometry.h:100
short_t targetDim() const
Dimension of the ambient physical space (overriding gsFunction::targetDim())
Definition gsGeometry.h:286
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition gsGeometry.hpp:166
virtual short_t domainDim() const
Dimension d of the parameter domain (overriding gsFunction::domainDim()).
Definition gsGeometry.hpp:184
virtual const gsBasis< T > & basis() const =0
Returns a const reference to the basis of the geometry.
short_t parDim() const
Dimension d of the parameter domain (same as domainDim()).
Definition gsGeometry.hpp:190
index_t coefsSize() const
Return the number of coefficients (control points)
Definition gsGeometry.h:371
void embed3d()
Embeds coefficients in 3D.
Definition gsGeometry.h:467
Class for representing a knot vector.
Definition gsKnotVector.h:80
T at(const size_t &i) const
Returns the value of the i - th knot (counted with repetitions).
Definition gsKnotVector.h:865
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
gsMatrix< T > points
input (parametric) points
Definition gsFuncData.h:372
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 triangle mesh with 3D vertices.
Definition gsMesh.h:32
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
bool computeTopology(T tol=1e-4, bool cornersOnly=false, bool tjunctions=false)
Attempt to compute interfaces and boundaries automatically.
Definition gsMultiPatch.hpp:377
gsGeometry< T > & patch(size_t i) const
Return the i-th patch.
Definition gsMultiPatch.h:292
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition gsMultiPatch.hpp:211
short_t parDim() const
Dimension of the parameter domain (must match for all patches).
Definition gsMultiPatch.h:249
gsBasis< T > & basis(const size_t i) const
Return the basis of the i-th patch.
Definition gsMultiPatch.hpp:172
size_t nPatches() const
Number of patches.
Definition gsMultiPatch.h:274
This class is used to create a Paraview .pvd (collection) file.
Definition gsParaviewCollection.h:77
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
void save()
Definition gsParaviewCollection.h:203
const gsGeometry< T > & result() const
Returns the resulting patch. Assumes that compute() has been called before.
Definition gsPatchGenerator.h:72
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition gsPiecewiseFunction.h:29
Simple progress bar class.
Definition gsBaseUtils.h:172
void display(double progress)
display the progress from 0 to 1
Definition gsBaseUtils.h:178
Class representing a reference quadrature rule.
Definition gsQuadRule.h:29
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
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A tensor product B-spline basis.
Definition gsTensorBSplineBasis.h:37
A tensor product of d B-spline functions, with arbitrary target dimension.
Definition gsTensorBSpline.h:45
KnotVectorType & knots(const int i)
Returns a reference to the knot vector in direction i.
Definition gsTensorBSpline.h:185
A tensor product Non-Uniform Rational B-spline (NURBS) basis.
Definition gsTensorNurbsBasis.h:38
A tensor product Non-Uniform Rational B-spline function (NURBS) of parametric dimension d,...
Definition gsTensorNurbs.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
T at(index_t i) const
Returns the i-th element of the vector.
Definition gsVector.h:177
std::string to_string(const C &value)
Converts value to string, assuming "operator<<" defined on C.
Definition gsUtils.h:56
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
Represents a B-spline curve/function with one parameter.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
Provides Coons's patch construction from boundary data.
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
#define gsInfo
Definition gsDebug.h:43
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
Provides useful classes derived from gsFunction which can be used for visualization or coupling.
Provides declaration of the Field class.
This object is a cache for computed values from an evaluator.
Provides declaration of FunctionExpr class.
Provides isogeometric meshing and modelling routines.
Provides declaration of the Mesh class.
Provides a base class for a quadrature rule.
Creates a variety of quadrature rules.
Provides declaration of TensorBSplineBasis abstract interface.
Represents a tensor-product NURBS patch.
Allows to write several fields defined on the same geometry in one file, making it easier to operate ...
Provides declaration of functions writing Paraview files.
The G+Smo namespace, containing all definitions for the library.
T geometryJacRatio(gsMultiPatch< T > const &domain)
Returns min(Jacobian determinant) divided by max(Jacobian determinant); samples the Jacobian elementw...
Definition gsGeoUtils.hpp:336
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
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
T normL2(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &solution)
@ Compute norm of the isogeometric solution
Definition gsGeoUtils.hpp:295
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
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
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
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
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
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 curveLength(const gsGeometry< T > &geo)
compute curve length
Definition gsGeoUtils.hpp:510
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
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:897
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:985
T combine(T a, T b, T x)
compute a convex combintation (1-x)a+xb
Definition gsGeoUtils.h:206
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
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
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
@ NEED_DERIV
Gradient of the object.
Definition gsForwardDeclarations.h:73
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
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
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:915
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...
void plotDeformation(const gsMultiPatch< T > &initDomain, const std::vector< gsMultiPatch< T > > &displacements, std::string fileName, index_t numSamplingPoints=10000)
Definition gsGeoUtils.hpp:95
S give(S &x)
Definition gsMemory.h:266
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 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
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:1038
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
Struct that defines the boundary sides and corners and types of a geometric object.
Definition gsBoundary.h:56
@ GaussLegendre
Gauss-Legendre quadrature.
Definition gsQuadrature.h:37