void makeBox(gmi_model* model)
{
  //making a box

  int vertPer = 0;
  double vertRan[1][2] = {{0.0,0.0}};
  int vertexMap[8] = {58,56,54,60,5,10,15,2};
  gmi_ent* g_vert[8];
  g_vert[0] = gmi_add_analytic(model, 0, 58, vert0, &vertPer, vertRan, 0);
  g_vert[1] = gmi_add_analytic(model, 0, 56, vert1, &vertPer, vertRan, 0);
  g_vert[2] = gmi_add_analytic(model, 0, 54, vert2, &vertPer, vertRan, 0);
  g_vert[3] = gmi_add_analytic(model, 0, 60, vert3, &vertPer, vertRan, 0);
  g_vert[4] = gmi_add_analytic(model, 0, 5, vert4, &vertPer, vertRan, 0);
  g_vert[5] = gmi_add_analytic(model, 0, 10, vert5, &vertPer, vertRan, 0);
  g_vert[6] = gmi_add_analytic(model, 0, 15, vert6, &vertPer, vertRan, 0);
  g_vert[7] = gmi_add_analytic(model, 0, 2, vert7, &vertPer, vertRan, 0);


  int edgePer = 0;
  double edgeRan[1][2] = {{0.0,1.0}};
  gmi_ent* g_edge[12];

  g_edge[0] = gmi_add_analytic(model, 1, 50, edge0, &edgePer, edgeRan, 0);
  g_edge[1] = gmi_add_analytic(model, 1, 48, edge1, &edgePer, edgeRan, 0);
  g_edge[2] = gmi_add_analytic(model, 1, 46, edge2, &edgePer, edgeRan, 0);
  g_edge[3] = gmi_add_analytic(model, 1, 52, edge3, &edgePer, edgeRan, 0);
  g_edge[4] = gmi_add_analytic(model, 1, 11, edge4, &edgePer, edgeRan, 0);
  g_edge[5] = gmi_add_analytic(model, 1, 16, edge5, &edgePer, edgeRan, 0);
  g_edge[6] = gmi_add_analytic(model, 1, 20, edge6, &edgePer, edgeRan, 0);
  g_edge[7] = gmi_add_analytic(model, 1, 6, edge7, &edgePer, edgeRan, 0);
  g_edge[8] = gmi_add_analytic(model, 1, 73, edge8, &edgePer, edgeRan, 0);
  g_edge[9] = gmi_add_analytic(model, 1, 72, edge9, &edgePer, edgeRan, 0);
  g_edge[10] = gmi_add_analytic(model, 1, 71, edge10, &edgePer, edgeRan, 0);
  g_edge[11] = gmi_add_analytic(model, 1, 74, edge11, &edgePer, edgeRan, 0);

  //reparameterize vertices on edges
  agm_bdry b;
  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[0]));
  agm_use edgeUse0 = add_adj(model, b, vertexMap[0]);
  agm_use edgeUse0_1 = add_adj(model,b,vertexMap[1]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[1]));
  edgeUse0 = add_adj(model, b, vertexMap[1]);
  edgeUse0_1 = add_adj(model,b,vertexMap[2]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[2]));
  edgeUse0 = add_adj(model, b, vertexMap[2]);
  edgeUse0_1 = add_adj(model,b,vertexMap[3]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_one, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_zero, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[3]));
  edgeUse0 = add_adj(model, b, vertexMap[3]);
  edgeUse0_1 = add_adj(model,b,vertexMap[0]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_one, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_zero, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[4]));
  edgeUse0 = add_adj(model, b, vertexMap[4]);
  edgeUse0_1 = add_adj(model,b,vertexMap[5]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[5]));
  edgeUse0 = add_adj(model, b, vertexMap[5]);
  edgeUse0_1 = add_adj(model,b,vertexMap[6]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[6]));
  edgeUse0 = add_adj(model, b, vertexMap[6]);
  edgeUse0_1 = add_adj(model,b,vertexMap[7]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_one, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_zero, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[7]));
  edgeUse0 = add_adj(model, b, vertexMap[7]);
  edgeUse0_1 = add_adj(model,b,vertexMap[4]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_one, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_zero, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[8]));
  edgeUse0 = add_adj(model, b, vertexMap[0]);
  edgeUse0_1 = add_adj(model,b,vertexMap[4]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[9]));
  edgeUse0 = add_adj(model, b, vertexMap[1]);
  edgeUse0_1 = add_adj(model,b,vertexMap[5]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[10]));
  edgeUse0 = add_adj(model, b, vertexMap[2]);
  edgeUse0_1 = add_adj(model,b,vertexMap[6]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_edge[11]));
  edgeUse0 = add_adj(model, b, vertexMap[3]);
  edgeUse0_1 = add_adj(model,b,vertexMap[7]);
  gmi_add_analytic_reparam(model, edgeUse0, reparamVert_zero, 0);
  gmi_add_analytic_reparam(model, edgeUse0_1, reparamVert_one, 0);

  //make faces

  int facePeriodic[2] = {0, 0};
  double faceRanges[2][2] = {{0,1.0},{0,1.0}};
  gmi_ent* g_face[6];
  g_face[0] = gmi_add_analytic(model, 2, 80, face0, facePeriodic, faceRanges, 0);
  g_face[1] = gmi_add_analytic(model, 2, 78, face1, facePeriodic, faceRanges, 0);
  g_face[2] = gmi_add_analytic(model, 2, 76, face2, facePeriodic, faceRanges, 0);
  g_face[3] = gmi_add_analytic(model, 2, 82, face3, facePeriodic, faceRanges, 0);
  g_face[4] = gmi_add_analytic(model, 2, 42, face4, facePeriodic, faceRanges, 0);
  g_face[5] = gmi_add_analytic(model, 2, 24, face5, facePeriodic, faceRanges, 0);

  //reparam edges onto face

  //int edgeMap[12] = {50,48,46,52,11,16,20,6,73,72,71,74};
  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}}; 
  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}}; 
  //int faceLoop[6] = {80,78,76,82,42,24};

  //int faceMap[6] = {0,1,2,3,4,5};
  //int faceLoop[6][4] = {{0,9,4,8},{9,1,10,5},{2,11,6,10},{3,8,7,11},{0,3,2,1},{4,5,6,7}}; 
  
/*
  typedef void (*ParametricFunctionArray) (double const p[2], double x[3], void*);
  ParametricFunctionArray faceFunction[] = 
    {
      face0,
      face1,
      face2,
      face3,
      face4,
      face5,
    };
  for(int i=0; i<6;i++)
  {
    b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_face[i]));
    for(int j=0; j<4;j++)
    {
      agm_use faceUse = add_adj(model, b, edgeLoop[i][j]);
      gmi_add_analytic_reparam(model, faceUse, faceFunction[i], 0);
    }
  }
  

*/

  typedef void (*ParametricFunctionArray) (double const from[2], double to[2], void*);
  ParametricFunctionArray edgeFaceFunction[] = 
    {
      reparamEdge_0,
      reparamEdge_1,
      reparamEdge_2,
      reparamEdge_3,
    };

  for(int i=0; i<6;i++)
  {
    b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_face[i]));
    for(int j=0; j<4;j++)
    {
      agm_use faceUse = add_adj(model, b, edgeLoop[i][j]);
      gmi_add_analytic_reparam(model, faceUse, edgeFaceFunction[edgeReparamLoop[i][j]], 0);
    }
  }


  //make region
/*
  int regionPeriodic[3] = {0, 0, 0};
  double regionRanges[3][2] = {{0,0},{0,0},{0.0}};
  gmi_ent* g_region;
  g_region = gmi_add_analytic(model, 3, 92, regionFunction, regionPeriodic, regionRanges, 0);
  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(g_region));
*/
  gmi_add_analytic_cell(model,3,92);

  b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(gmi_find(model,3,92)));
  for(int i=0; i<6;i++)
  {
    agm_use regionUse = add_adj(model, b, faceLoop[i]);
    gmi_add_analytic_reparam(model, regionUse, regionFunction, 0);
  }

/*
  //add edge adjacencies to region?
  it doesn't seem like i need to do this
  for(int i=0;i<12;i++)
  {
    agm_use regionUse = add_adj(model,b,1,edgeMap[i]);
    gmi_add_analytic_reparam(model, regionUse, regionFunction, 0);
  }
*/

  //get the sphere reparameterizations onto box
  //b = agm_add_bdry(gmi_analytic_topo(model), agm_from_gmi(gmi_find(model,3,92)));
  agm_use regionUse = add_adj(model, b, 123);
  gmi_add_analytic_reparam(model, regionUse, regionFunction, 0);


  return;
}
Beispiel #2
0
void gmi_add_analytic_region(struct gmi_model* m, int tag)
{
  gmi_add_analytic_cell(m, 3, tag);
}