8 agm_bdry
add_bdry(gmi_model* m, gmi_ent* e)
10 return agm_add_bdry(gmi_analytic_topo(m), agm_from_gmi(e));
13 agm_use
add_adj(gmi_model* m, agm_bdry b,
int tag)
15 agm* topo = gmi_analytic_topo(m);
16 int dim = agm_dim_from_type(agm_bounds(topo, b).type);
17 gmi_ent* de = gmi_find(m, dim - 1, tag);
18 return agm_add_use(topo, b, agm_from_gmi(de));
24 int edgeMap[12] = {50,48,46,52,11,16,20,6,73,72,71,74};
28 void vert0(
double const p[2],
double x[3],
void*)
36 void vert1(
double const p[2],
double x[3],
void*)
44 void vert2(
double const p[2],
double x[3],
void*)
52 void vert3(
double const p[2],
double x[3],
void*)
60 void vert4(
double const p[2],
double x[3],
void*)
68 void vert5(
double const p[2],
double x[3],
void*)
76 void vert6(
double const p[2],
double x[3],
void*)
84 void vert7(
double const p[2],
double x[3],
void*)
92 void edge0(
double const p[2],
double x[3],
void*)
99 void edge1(
double const p[2],
double x[3],
void*)
106 void edge2(
double const p[2],
double x[3],
void*)
113 void edge3(
double const p[2],
double x[3],
void*)
120 void edge4(
double const p[2],
double x[3],
void*)
127 void edge5(
double const p[2],
double x[3],
void*)
134 void edge6(
double const p[2],
double x[3],
void*)
141 void edge7(
double const p[2],
double x[3],
void*)
148 void edge8(
double const p[2],
double x[3],
void*)
155 void edge9(
double const p[2],
double x[3],
void*)
162 void edge10(
double const p[2],
double x[3],
void*)
169 void edge11(
double const p[2],
double x[3],
void*)
176 void face0(
double const p[2],
double x[3],
void*)
183 void face1(
double const p[2],
double x[3],
void*)
190 void face2(
double const p[2],
double x[3],
void*)
197 void face3(
double const p[2],
double x[3],
void*)
203 void face4(
double const p[2],
double x[3],
void*)
209 void face5(
double const p[2],
double x[3],
void*)
269 double vertRan[1][2] = {{0.0,0.0}};
270 int vertexMap[8] = {58,56,54,60,5,10,15,2};
272 g_vert[0] = gmi_add_analytic(model, 0, 58,
vert0, &vertPer, vertRan, 0);
273 g_vert[1] = gmi_add_analytic(model, 0, 56,
vert1, &vertPer, vertRan, 0);
274 g_vert[2] = gmi_add_analytic(model, 0, 54,
vert2, &vertPer, vertRan, 0);
275 g_vert[3] = gmi_add_analytic(model, 0, 60,
vert3, &vertPer, vertRan, 0);
276 g_vert[4] = gmi_add_analytic(model, 0, 5,
vert4, &vertPer, vertRan, 0);
277 g_vert[5] = gmi_add_analytic(model, 0, 10,
vert5, &vertPer, vertRan, 0);
278 g_vert[6] = gmi_add_analytic(model, 0, 15,
vert6, &vertPer, vertRan, 0);
279 g_vert[7] = gmi_add_analytic(model, 0, 2,
vert7, &vertPer, vertRan, 0);
283 double edgeRan[1][2] = {{0.0,1.0}};
286 g_edge[0] = gmi_add_analytic(model, 1, 50,
edge0, &edgePer, edgeRan, 0);
287 g_edge[1] = gmi_add_analytic(model, 1, 48,
edge1, &edgePer, edgeRan, 0);
288 g_edge[2] = gmi_add_analytic(model, 1, 46,
edge2, &edgePer, edgeRan, 0);
289 g_edge[3] = gmi_add_analytic(model, 1, 52,
edge3, &edgePer, edgeRan, 0);
290 g_edge[4] = gmi_add_analytic(model, 1, 11,
edge4, &edgePer, edgeRan, 0);
291 g_edge[5] = gmi_add_analytic(model, 1, 16,
edge5, &edgePer, edgeRan, 0);
292 g_edge[6] = gmi_add_analytic(model, 1, 20,
edge6, &edgePer, edgeRan, 0);
293 g_edge[7] = gmi_add_analytic(model, 1, 6,
edge7, &edgePer, edgeRan, 0);
294 g_edge[8] = gmi_add_analytic(model, 1, 73,
edge8, &edgePer, edgeRan, 0);
295 g_edge[9] = gmi_add_analytic(model, 1, 72,
edge9, &edgePer, edgeRan, 0);
296 g_edge[10] = gmi_add_analytic(model, 1, 71,
edge10, &edgePer, edgeRan, 0);
297 g_edge[11] = gmi_add_analytic(model, 1, 74,
edge11, &edgePer, edgeRan, 0);
301 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[0]));
302 agm_use edgeUse0 =
add_adj(model, b, vertexMap[0]);
303 agm_use edgeUse0_1 =
add_adj(model,b,vertexMap[1]);
307 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[1]));
308 edgeUse0 =
add_adj(model, b, vertexMap[1]);
309 edgeUse0_1 =
add_adj(model,b,vertexMap[2]);
313 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[2]));
314 edgeUse0 =
add_adj(model, b, vertexMap[2]);
315 edgeUse0_1 =
add_adj(model,b,vertexMap[3]);
319 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[3]));
320 edgeUse0 =
add_adj(model, b, vertexMap[3]);
321 edgeUse0_1 =
add_adj(model,b,vertexMap[0]);
325 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[4]));
326 edgeUse0 =
add_adj(model, b, vertexMap[4]);
327 edgeUse0_1 =
add_adj(model,b,vertexMap[5]);
331 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[5]));
332 edgeUse0 =
add_adj(model, b, vertexMap[5]);
333 edgeUse0_1 =
add_adj(model,b,vertexMap[6]);
337 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[6]));
338 edgeUse0 =
add_adj(model, b, vertexMap[6]);
339 edgeUse0_1 =
add_adj(model,b,vertexMap[7]);
343 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[7]));
344 edgeUse0 =
add_adj(model, b, vertexMap[7]);
345 edgeUse0_1 =
add_adj(model,b,vertexMap[4]);
349 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[8]));
350 edgeUse0 =
add_adj(model, b, vertexMap[0]);
351 edgeUse0_1 =
add_adj(model,b,vertexMap[4]);
355 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[9]));
356 edgeUse0 =
add_adj(model, b, vertexMap[1]);
357 edgeUse0_1 =
add_adj(model,b,vertexMap[5]);
361 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[10]));
362 edgeUse0 =
add_adj(model, b, vertexMap[2]);
363 edgeUse0_1 =
add_adj(model,b,vertexMap[6]);
367 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[11]));
368 edgeUse0 =
add_adj(model, b, vertexMap[3]);
369 edgeUse0_1 =
add_adj(model,b,vertexMap[7]);
375 int facePeriodic[2] = {0, 0};
376 double faceRanges[2][2] = {{0,1.0},{0,1.0}};
378 g_face[0] = gmi_add_analytic(model, 2, 80,
face0, facePeriodic, faceRanges, 0);
379 g_face[1] = gmi_add_analytic(model, 2, 78,
face1, facePeriodic, faceRanges, 0);
380 g_face[2] = gmi_add_analytic(model, 2, 76,
face2, facePeriodic, faceRanges, 0);
381 g_face[3] = gmi_add_analytic(model, 2, 82,
face3, facePeriodic, faceRanges, 0);
382 g_face[4] = gmi_add_analytic(model, 2, 42,
face4, facePeriodic, faceRanges, 0);
383 g_face[5] = gmi_add_analytic(model, 2, 24,
face5, facePeriodic, faceRanges, 0);
388 int edgeLoop[6][4] = {{50,72,11,73},{72,48,71,16},{46,74,20,71},{52,73,6,74},{50,52,46,48},{11,16,20,6}};
389 int edgeReparamLoop[6][4] = {{0,3,2,1},{1,0,3,2},{0,1,2,3},{0,1,2,3},{0,1,2,3},{0,3,2,1}};
419 typedef void (*ParametricFunctionArray) (
double const from[2],
double to[2],
void*);
420 ParametricFunctionArray edgeFaceFunction[] =
428 for(
int i=0; i<6;i++)
430 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_face[i]));
431 for(
int j=0; j<4;j++)
433 agm_use faceUse =
add_adj(model, b, edgeLoop[i][j]);
434 gmi_add_analytic_reparam(model, faceUse, edgeFaceFunction[edgeReparamLoop[i][j]], 0);
447 gmi_add_analytic_cell(model,3,92);
449 b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(gmi_find(model,3,92)));
450 for(
int i=0; i<6;i++)
468 agm_use regionUse =
add_adj(model, b, 123);
491 int faPer[2] = {1, 0};
492 double faRan[2][2] = {{0,6.28318530718},{0.0,
apf::pi}};
501 apf::MeshEntity* ent;
502 for(
int i =0;i<4;i++)
504 apf::MeshIterator* it = m->begin(i);
505 while( (ent = m->iterate(it)))
507 apf::ModelEntity* g_ent = m->toModel(ent);
508 int modelTag = m->getModelTag(g_ent);
509 int modelType = m->getModelType(g_ent);
510 if(modelTag > 139 && modelTag< 148)
512 m->setModelEntity(ent,(apf::ModelEntity*)gmi_find(model,modelType,
sphereFaceID));
515 m->setModelEntity(ent,(apf::ModelEntity*)gmi_find(model,modelType,modelTag));
524 std::map<int,int> edgeParam;
525 int edgeScales[12] = {0,1,0,1,0,1,0,1,2,2,2,2};
527 for(
int i=0;i<12;i++)
529 edgeParam[
edgeMap[i]] = edgeScales[i];
532 std::map<int,int(*)[2]> faceParam;
533 int faceScales[6][2] = {{0,2},{1,2},{0,2},{1,2},{0,1},{0,1}};
534 for(
int i = 0; i<6;i++)
536 faceParam[
faceLoop[i]] = &(faceScales[i]);
539 apf::MeshIterator* it = m->begin(0);
540 while( (ent = m->iterate(it)) )
542 apf::ModelEntity* g_ent = m->toModel(ent);
544 apf::MeshEntity* ev[2];
545 m->getDownward(ent,0,ev);
546 int modelTag = m->getModelTag(g_ent);
547 int modelType = m->getModelType(g_ent);
548 if(modelType<3 && modelType!=0)
551 apf::Vector3 oldParam;
552 apf::Vector3 newParam;
553 m->getPoint(ent,0,pt);
554 m->getParam(ent,oldParam);
557 int relevantIndex = edgeParam[modelTag];
558 newParam[0]=pt[relevantIndex]/edgeLengths[relevantIndex];
559 m->setParam(ent,newParam);
563 int* relevantIndex = faceParam[modelTag][0];
564 newParam[0] = pt[relevantIndex[0]]/edgeLengths[relevantIndex[0]];
565 newParam[1] = pt[relevantIndex[1]]/edgeLengths[relevantIndex[1]];
566 m->setParam(ent,newParam);
572 if(argx == 0 && argy ==0)
575 newParam[0] = atan2(argy,argx);
582 newParam[1] = acos(arg2);
584 newParam[0] = newParam[0]+2*
apf::pi;
586 newParam[0] = newParam[0]-2*
apf::pi;
590 newParam[1] = -1*newParam[1];
592 newParam[1] = -1*(newParam[1]-2.0*
apf::pi);
594 m->setParam(ent,newParam);
612 lion_set_verbosity(1);
615 gmi_model* model = gmi_make_analytic();
629 size_iso = apf::createLagrangeField(m,
"proteus_size",apf::SCALAR,1);
630 apf::MeshIterator* it = m->begin(0);
631 apf::MeshEntity* ent;
632 while( (ent = m->iterate(it)) )
635 m->getPoint(ent,0,pt);
637 apf::setScalar(size_iso,ent,0,
hmin);
639 apf::setScalar(size_iso,ent,0,
hmax);
646 ma::Input* in = ma::makeAdvanced(ma::configure(m,size_iso));
647 in->maximumIterations = 10;
648 in->shouldSnap =
true;
649 in->shouldTransferParametric =
true;
650 in->shouldFixShape =
true;
651 in->debugFolder=
"./debug_fine";
652 ma::adaptVerbose(in,
false);
658 size_iso = apf::createLagrangeField(m,
"proteus_size",apf::SCALAR,1);
660 while( (ent = m->iterate(it)) )
663 m->getPoint(ent,0,pt);
665 apf::setScalar(size_iso,ent,0,
hmin);
667 apf::setScalar(size_iso,ent,0,
hmax);
673 in = ma::makeAdvanced(ma::configure(m,size_iso));
674 in->maximumIterations = 10;
675 in->shouldSnap =
true;
676 in->shouldTransferParametric =
true;
677 in->shouldFixShape =
true;
678 in->debugFolder=
"./debug_fine";
679 ma::adaptVerbose(in,
false);