20 double yTarget,
double zTarget,
21 const std::vector<MElement *> <,
27 ver->
x() = (1. - xi) * ver->
x() + xi * xTarget;
28 ver->
y() = (1. - xi) * ver->
y() + xi * yTarget;
29 ver->
z() = (1. - xi) * ver->
z() + xi * zTarget;
31 for(std::size_t i = 0; i < lt.size(); i++) {
35 lt[i]->getVertex(0)->x(), lt[i]->getVertex(0)->y(),
36 lt[i]->getVertex(0)->
z(), lt[i]->getVertex(1)->x(),
37 lt[i]->getVertex(1)->y(), lt[i]->getVertex(1)->
z(),
38 lt[i]->getVertex(2)->x(), lt[i]->getVertex(2)->y(),
39 lt[i]->getVertex(2)->
z(), lt[i]->getVertex(3)->x(),
40 lt[i]->getVertex(3)->y(), lt[i]->getVertex(3)->
z(), &V);
42 minQual = std::min(Q, minQual);
45 minQual = std::min(std::abs(lt[i]->minSICNShapeMeasure()) * .2, minQual);
56 const std::vector<MElement *> <)
61 SPoint2 p = p1 * (1. - xi) + p2 * xi;
67 for(std::size_t i = 0; i < lt.size(); i++) {
69 minQual = std::min((lt[i]->etaShapeMeasure()), minQual);
71 minQual = std::min(std::abs(lt[i]->gammaShapeMeasure()), minQual);
81 const std::vector<MElement *> <)
83 double const x = ver->
x();
84 double const y = ver->
y();
85 double const z = ver->
z();
86 SPoint3 p = p1 * (1. - xi) + p2 * xi;
88 double initialGuess[2] = {0, 0};
95 for(std::size_t i = 0; i < lt.size(); i++) {
97 minQual = std::min(lt[i]->etaShapeMeasure(), minQual);
99 minQual = std::min(std::abs(lt[i]->gammaShapeMeasure()), minQual);
107 static bool Stopping_Rule(
double const x0,
double const x1,
double const tol)
109 return std::abs(x1 - x0) < tol;
113 double yTarget,
double zTarget,
114 const std::vector<MElement *> <,
115 double const tol,
double &q)
117 const double lambda = 0.5 * (std::sqrt(5.0) - 1.0);
118 const double mu = 0.5 * (3.0 - std::sqrt(5.0));
122 double x1 = b - lambda * (b - a);
123 double x2 = a + lambda * (b - a);
127 if(tol < 0.0)
return fx1 > fx2 ? x1 : x2;
136 x2 = b - mu * (b - a);
144 x1 = a + mu * (b - a);
149 q = std::min(fx1, fx2);
155 const std::vector<MElement *> <,
156 double tol,
double &worst)
158 const double lambda = 0.5 * (std::sqrt(5.0) - 1.0);
159 const double mu = 0.5 * (3.0 - std::sqrt(5.0));
165 if(worst > 0.5)
return 0.0;
167 double x1 = b - lambda * (b - a);
168 double x2 = a + lambda * (b - a);
172 if(tol < 0.0)
return fx1 > fx2 ? x1 : x2;
181 x2 = b - mu * (b - a);
189 x1 = a + mu * (b - a);
194 if(
final < worst)
return 0.0;
202 const std::vector<MElement *> <,
203 double tol,
double &worst)
205 const double lambda = 0.5 * (std::sqrt(5.0) - 1.0);
206 const double mu = 0.5 * (3.0 - std::sqrt(5.0));
212 if(worst > 0.5)
return 0.0;
214 double x1 = b - lambda * (b - a);
215 double x2 = a + lambda * (b - a);
219 if(tol < 0.0)
return fx1 > fx2 ? x1 : x2;
228 x2 = b - mu * (b - a);
236 x1 = a + mu * (b - a);
241 if(
final < worst)
return 0.0;
248 const std::vector<MElement *> <,
252 double x = 0.0, y = 0.0,
z = 0.0;
256 for(std::size_t i = 0; i < lt.size(); i++) {
257 double XCG = 0.0, YCG = 0.0, ZCG = 0.0;
261 for(std::size_t j = 0; j < lt[i]->getNumVertices(); j++) {
262 XCG += lt[i]->getVertex(j)->x();
263 YCG += lt[i]->getVertex(j)->y();
264 ZCG += lt[i]->getVertex(j)->z();
269 N += lt[i]->getNumVertices();
283 if(
dot(n, d) < 0) n = n * (-1.0);
284 double H = .5 * sqrt(fabs(A));
285 double XOPT =
c.x() + relax * H * n.
x();
286 double YOPT =
c.y() + relax * H * n.
y();
287 double ZOPT =
c.z() + relax * H * n.
z();
288 double FULL_MOVE_OBJ =
291 if(FULL_MOVE_OBJ > 0.1) {
301 const std::vector<MElement *> <,
302 double relax,
double tol)
305 double x = 0.0, y = 0.0,
z = 0.0;
307 for(std::size_t i = 0; i < lt.size(); i++) {
308 double XCG = 0.0, YCG = 0.0, ZCG = 0.0;
309 for(std::size_t j = 0; j < lt[i]->getNumVertices(); j++) {
310 XCG += lt[i]->getVertex(j)->x();
311 YCG += lt[i]->getVertex(j)->y();
312 ZCG += lt[i]->getVertex(j)->z();
317 N += lt[i]->getNumVertices();
321 if(NO_MOVE_OBJ > 0.1)
return;
323 if(FULL_MOVE_OBJ > NO_MOVE_OBJ) {
333 ver->
x() = (1. - xi) * ver->
x() + xi * x / N;
334 ver->
y() = (1. - xi) * ver->
y() + xi * y / N;
335 ver->
z() = (1. - xi) * ver->
z() + xi *
z / N;
340 const std::vector<MElement *> <,
double tol)
343 std::size_t counter = 0;
344 for(std::size_t i = 0; i < lt.size(); i++) {
345 for(std::size_t j = 0; j < lt[i]->getNumVertices(); j++) {
346 MVertex *v = lt[i]->getVertex(j);
351 p1 *= 1.0 / (double)counter;
356 SPoint3 p = p1 * (1 - xi) + p2 * xi;
357 double initialGuess[2] = {0, 0};
367 const std::vector<MElement *> <,
double tol)
369 if(ver->
onWhat()->
dim() != 2)
return 2.0;
378 std::size_t counter = 0;
379 for(std::size_t i = 0; i < lt.size(); i++) {
380 for(std::size_t j = 0; j < lt[i]->getNumVertices(); j++) {
381 MVertex *v = lt[i]->getVertex(j);
388 if(ge->
isSeam(gf))
return 2.0;
393 p1 *= 1. / (double)counter;
397 SPoint2 p = p1 * (1 - xi) + p2 * xi;
399 if(!pp.succeeded())
return 2.0;
415 std::set<MVertex *> vs;
421 for(
int i = 0; i < niter; i++) {
422 auto it = adj.begin();
423 while(it != adj.end()) {
424 if(vs.find(it->first) == vs.end()) {
441 for(
int i = 0; i < niter + 2; i++) {
442 auto it = adj.begin();
443 double relax = std::min((
double)(i + 1) / niter, 1.0);
444 while(it != adj.end()) {
456 std::vector<MVertex *> _v_pyr;
457 for(
size_t i = 0; i < region->
pyramids.size(); i++) {
458 _v_pyr.push_back(region->
pyramids[i]->getVertex(4));
460 std::sort(_v_pyr.begin(), _v_pyr.end());
462 std::vector<MTetrahedron *> _tets;
463 std::set<MVertex *> _vts;
464 for(
size_t i = 0; i < region->
tetrahedra.size(); i++) {
466 for(
size_t j = 0; j < 4; j++) {
468 if(std::binary_search(_v_pyr.begin(), _v_pyr.end(), v)) {
480 for(
size_t i = 0; i < region->
tetrahedra.size(); i++) {
482 for(
size_t j = 0; j < 4; j++) {
484 if(_vts.find(v) != _vts.end()) {
498 for(
int i = 0; i < 10; i++) {
499 double X = (double)(i + 1) / 10.;
500 auto it = adj.begin();
501 while(it != adj.end()) {
507 for(
int i = 0; i < niter + 2; i++) {
508 auto it = adj.begin();
509 double relax = std::min((
double)(i + 1) / niter, 1.0);
510 while(it != adj.end()) {
520 for(std::size_t k = 0; k <
regions.size(); k++) {
527 for(std::size_t k = 0; k <
regions.size(); k++) {