Skip to content

Commit ff1bef9

Browse files
committed
add requiredVertex to mmg interface
1 parent 45f9d5f commit ff1bef9

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

plugin/seq/mmg.cpp

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ template<class ffmesh>
234234
class mmg_Op : public E_F0mps {
235235
public:
236236
Expression eTh;
237-
static const int n_name_param = std::is_same<ffmesh,Mesh3>::value ? 27 : 20;
237+
static const int n_name_param = std::is_same<ffmesh,Mesh3>::value ? 28 : 21;
238238
static basicAC_F0::name_and_type name_param[];
239239
Expression nargs[n_name_param];
240240

@@ -301,6 +301,7 @@ basicAC_F0::name_and_type mmg_Op<Mesh3>::name_param[] = {
301301
{"ls" , &typeid(double)},/*!< [val], Value of level-set */
302302
//{"rmc" , &typeid(double)},/*!< [-1/val], Remove small connex componants in level-set mode */
303303
{"requiredTriangle" , &typeid(KN<long>*)},/*!< [val], References of surfaces with required triangles */
304+
{"requiredVertex" , &typeid(KN<long>*)},/*!< [val], Indices of required vertices */
304305
{"localParameter" , &typeid(KNM<double>*)}/*!< [val], Local parameters on given surfaces */
305306
};
306307

@@ -326,7 +327,8 @@ basicAC_F0::name_and_type mmg_Op<MeshS>::name_param[] = {
326327
{"hausd" , &typeid(double)},/*!< [val], Control global Hausdorff distance (on all the boundary surfaces of the mesh) */
327328
{"hgrad" , &typeid(double)},/*!< [val], Control gradation */
328329
{"ls" , &typeid(double)},/*!< [val], Value of level-set */
329-
{"requiredEdge" , &typeid(KN<long>*)}/*!< [val], References of boundaries with required edges */
330+
{"requiredEdge" , &typeid(KN<long>*)},/*!< [val], References of boundaries with required edges */
331+
{"requiredVertex" , &typeid(KN<long>*)}/*!< [val], Indices of required vertices */
330332
};
331333

332334
template<class ffmesh>
@@ -352,6 +354,7 @@ AnyType mmg_Op<Mesh3>::operator( )(Stack stack) const {
352354

353355
KN< double > *pmetric = 0;
354356
KN< long > *prequiredTriangle = 0;
357+
KN< long > *prequiredVertex = 0;
355358
KNM< double > *plocalParameter = 0;
356359

357360
if (nargs[0]) {
@@ -361,7 +364,10 @@ AnyType mmg_Op<Mesh3>::operator( )(Stack stack) const {
361364
prequiredTriangle = GetAny< KN< long > * >((*nargs[25])(stack));
362365
}
363366
if (nargs[26]) {
364-
plocalParameter = GetAny< KNM< double > * >((*nargs[26])(stack));
367+
prequiredVertex = GetAny< KN< long > * >((*nargs[26])(stack));
368+
}
369+
if (nargs[27]) {
370+
plocalParameter = GetAny< KNM< double > * >((*nargs[27])(stack));
365371
}
366372

367373
MMG5_pMesh mesh;
@@ -425,6 +431,14 @@ AnyType mmg_Op<Mesh3>::operator( )(Stack stack) const {
425431
}
426432
}
427433
}
434+
if (prequiredVertex && prequiredVertex->N( ) > 0) {
435+
const KN< long > &requiredVertex = *prequiredVertex;
436+
for (int k=0; k<requiredVertex.N( ); k++) {
437+
if ( MMG3D_Set_requiredVertex(mesh,requiredVertex[k]+1) != 1 ) {
438+
exit(EXIT_FAILURE);
439+
}
440+
}
441+
}
428442
if (plocalParameter && plocalParameter->M( ) > 0) {
429443
const KNM< double > &localParameter = *plocalParameter;
430444
ffassert(localParameter.N() == 4);
@@ -502,13 +516,17 @@ AnyType mmg_Op<MeshS>::operator( )(Stack stack) const {
502516

503517
KN< double > *pmetric = 0;
504518
KN< long > *prequiredEdge = 0;
519+
KN< long > *prequiredVertex = 0;
505520

506521
if (nargs[0]) {
507522
pmetric = GetAny< KN< double > * >((*nargs[0])(stack));
508523
}
509524
if (nargs[19]) {
510525
prequiredEdge = GetAny< KN< long > * >((*nargs[19])(stack));
511526
}
527+
if (nargs[20]) {
528+
prequiredVertex = GetAny< KN< long > * >((*nargs[20])(stack));
529+
}
512530

513531
MMG5_pMesh mesh;
514532
MMG5_pSol sol;
@@ -569,6 +587,14 @@ AnyType mmg_Op<MeshS>::operator( )(Stack stack) const {
569587
}
570588
}
571589
}
590+
if (prequiredVertex && prequiredVertex->N( ) > 0) {
591+
const KN< long > &requiredVertex = *prequiredVertex;
592+
for (int k=0; k<requiredVertex.N( ); k++) {
593+
if ( MMGS_Set_requiredVertex(mesh,requiredVertex[k]+1) != 1 ) {
594+
exit(EXIT_FAILURE);
595+
}
596+
}
597+
}
572598

573599
long iso=0L;
574600

0 commit comments

Comments
 (0)