Ejemplo n.º 1
0
  void exportXML(XMLImporter& importer)
  {
    StaticElement projectElement("project");
    projectElement.insertAttribute("version", BUILDMENU_VERSION);
    importer.pushElement(projectElement);
    importer << "\n";

    for(Tools::iterator i = m_tools.begin(); i != m_tools.end(); ++i)
    {
      StaticElement toolElement("var");
      toolElement.insertAttribute("name", (*i).first.c_str());
      importer.pushElement(toolElement);
      (*i).second.exportXML(importer);
      importer.popElement(toolElement.name());
      importer << "\n";
    }
    for(Project::iterator i = m_project.begin(); i != m_project.end(); ++i)
    {
      StaticElement buildElement("build");
      buildElement.insertAttribute("name", (*i).first.c_str());
      importer.pushElement(buildElement);
      BuildXMLExporter buildExporter((*i).second);
      buildExporter.exportXML(importer);
      importer.popElement(buildElement.name());
      importer << "\n";
    }
    importer.popElement(projectElement.name());
  }
Ejemplo n.º 2
0
/* ------------------------------------------------------------------------------
 * buildSurface - Create the tempSurf (SDL_Surface) by blitting corners, edges
 * and background onto it (effectively an empty box).
 *
 * Override to implement additional behavior.
 */
void Box::buildSurface() {

   // Create an SDL_Surface.
   this->tempSurf = std::shared_ptr<SDL_Surface>(SDL_CreateRGBSurface(
           SDL_HWSURFACE
         , this->width
         , this->height
         , 32
         , 0,0,0,0
      )
      , SDLSurfaceDeleter()
   );

   // Get the Theme object.
   auto theme = GuiFactory::GetInstance()->getTheme();

   // Tile
   auto bg = theme->buildElement("bg");

   // Edges
   auto bh = theme->buildElement("bh");
   auto bw = theme->buildElement("bw");

   // Corners
   auto tl = theme->buildElement("tl");
   auto tr = theme->buildElement("tr");
   auto bl = theme->buildElement("bl");
   auto br = theme->buildElement("br");

   // Tile the Background onto the Surface.
   this->twoDimTile(bg.get(), tl->w/2, tl->h/2, this->tempSurf->w - br->w, this->tempSurf->h - br->h);

   // Tiles the Edges onto the Surface.
   this->horzLinearTile(bw.get(), tl->w, 0, this->tempSurf->w - tl->w);
   this->vertLinearTile(bh.get(), 0, tl->h, this->tempSurf->h - bl->h);
   this->horzLinearTile(bw.get(), br->w, this->getHeight() - br->h, this->tempSurf->w - tl->w);
   this->vertLinearTile(bh.get(), this->getWidth() - tr->w, tl->h, this->tempSurf->h - br->h);

   // Draw the Corners onto the surface.
   this->singBlit(tl.get(), 0, 0);
   this->singBlit(tr.get(), this->getWidth() - tr->w, 0);
   this->singBlit(bl.get(), 0, this->getHeight() - bl->h);
   this->singBlit(br.get(), this->getWidth() - br->w, this->getHeight() - br->h);

}
Ejemplo n.º 3
0
  //APF Mesh construction helper functions modified and placed here to support arbitrary entity types
  void constructElements(const gno_t* conn, lno_t nelem, const lno_t* offsets, 
                         const EntityTopologyType* tops, apf::GlobalToVert& globalToVert)
  {
    apf::ModelEntity* interior = m->findModelEntity(m->getDimension(), 0);
    for (lno_t i = 0; i < nelem; ++i) {
      apf::Mesh::Type etype = topologyZ2toAPF(tops[i]);
      apf::Downward verts;
      for (int j = offsets[i]; j < offsets[i+1]; ++j)
	verts[j-offsets[i]] = globalToVert[conn[j]];
      buildElement(m, interior, etype, verts);
    }
  }
Ejemplo n.º 4
0
static void constructElements(
    Mesh2* m, const Gid* conn, int nelem, int etype,
    GlobalToVert& globalToVert)
{
  ModelEntity* interior = m->findModelEntity(m->getDimension(), 0);
  int nev = apf::Mesh::adjacentCount[etype][0];
  for (int i = 0; i < nelem; ++i) {
    Downward verts;
    int offset = i * nev;
    for (int j = 0; j < nev; ++j)
      verts[j] = globalToVert[conn[j + offset]];
    buildElement(m, interior, etype, verts);
  }
}
Ejemplo n.º 5
0
int
eliminateStep(minprior_t *minprior, int istage, int scoretype)
{ gelim_t     *Gelim;
  bucket_t    *bucket;
  stageinfo_t *stageinfo;
  int         *stage, *reachset, *auxtmp;
  int         *xadj, *adjncy, *vwght, *len, *degree, *score;
  int         *pflag, *pnreach, nelim, minscr, vwghtu, u, v, i, istart, istop;
  FLOAT       tri, rec;

  Gelim = minprior->Gelim;
  bucket = minprior->bucket;
  stage = minprior->ms->stage;
  stageinfo = minprior->stageinfo + istage;
  reachset = minprior->reachset;
  pnreach = &(minprior->nreach);
  auxtmp = minprior->auxtmp;
  pflag = &(minprior->flag);

  xadj = Gelim->G->xadj;
  adjncy = Gelim->G->adjncy;
  vwght = Gelim->G->vwght;
  len = Gelim->len;
  degree = Gelim->degree;
  score = Gelim->score;

#ifdef DEBUG
  printf("\nStarting new elimination step (nedges %d, maxedges %d)\n",
         Gelim->G->nedges, Gelim->maxedges);
  /* waitkey(); */
#endif

  /* ----------------------
     check for empty bucket
     ---------------------- */
  if ((u = minBucket(bucket)) == -1)
    return(0);
  minscr = score[u];

  /* ----------------------------------------
     loop while nodes of minimum score remain
     ---------------------------------------- */
  nelim = 0;
  *pnreach = 0;
  while (TRUE)
   { vwghtu = vwght[u];

     /* --------------------------------------------------
        increment welim and nelim and remove u from bucket
        -------------------------------------------------- */
     removeBucket(bucket, u);
     stageinfo->welim += vwghtu;
     nelim++;

     /* -----------------------------------------------------------------
        call buildElement to create element u and merge u's boundary with 
        the nodes in reachset; remove any vertex from bucket that belongs
        to u's boundary and to the actual stage
        ----------------------------------------------------------------- */
     buildElement(Gelim, u);
     istart = xadj[u];
     istop = istart + len[u];
     for (i = istart; i < istop; i++)
      { v = adjncy[i];                 /* v belongs to u's boundary */
        if (auxtmp[v] < *pflag)        /* v not yet in reachset */
         { auxtmp[v] = *pflag;
           if (stage[v] <= istage)     /* v belongs to actual stage */
             removeBucket(bucket, v);
           reachset[(*pnreach)++] = v;
         }
      }

#ifdef DEBUG
     printf("Node %d (weight %d, score %d) eliminated: (boundary weight %d)\n",
            u, vwghtu, minscr, degree[u]);
     for (i = istart; i < istop; i++)
       printf("%4d (degree %2d)", adjncy[i], degree[adjncy[i]]);
     printf("\n");
#endif

      /* ---------------------------------------------------------------
         increment the storage and operation counts for this elim. stage
         --------------------------------------------------------------- */
     tri = vwghtu;
     rec = degree[u];
     stageinfo->nzf += (int)((tri * (tri+1)) / 2);
     stageinfo->nzf += (int)(tri * rec);
     stageinfo->ops += (tri*tri*tri) / 3.0 + (tri*tri) / 2.0 - (5*tri) / 6.0;
     stageinfo->ops += (tri*tri*rec) + (rec*(rec+1)*tri);

     /* ---------------------------------------------------------------
        end this elim. step, if one of the following conditions is true
         (1) no multiple elimination
         (2) bucket empty
         (3) no further variable with minimum score
        ---------------------------------------------------------------- */
     if (scoretype / 10 == 0)
       break;
     if ((u = minBucket(bucket)) == -1)
       break;
     if (score[u] > minscr)
       break;
   }

  /* -----------------------
     clear auxtmp and return
     ----------------------- */
  (*pflag)++;
  return(nelim);
}