Пример #1
0
void EllipseSelection::next() {
  // Move to the next slot
  advance();
  // Check if it's a valid point
  while (!interior() && !done_)
    advance();
}
Пример #2
0
  LinearProblem prob(const Mesh& mesh) const
    {
      CellFilter left = domain().left();
      CellFilter right = domain().right();


      Expr u = new UnknownFunction(new Lagrange(3), "u");
      Expr v = new UnknownFunction(new Lagrange(1), "v");
      Expr du = new TestFunction(new Lagrange(3), "du");
      Expr dv = new TestFunction(new Lagrange(1), "dv");

      Expr dx = gradient(1);
      Expr x = coord(0);


      QuadratureFamily quad = new GaussianQuadrature(10);

      Expr eqn = Integral(interior(), 
        (dx*du)*(dx*u) + du*v + (dx*dv)*(dx*v) + x*dv, 
        quad);

      Expr bc = EssentialBC(left, du*u + dv*v, quad)
        + EssentialBC(right, du*u + dv*v, quad);


      return LinearProblem(mesh, eqn, bc, 
        List(dv,du), List(v,u), vecType());
      
    }  
Пример #3
0
  /** 
   * Return a LP for the specified mesh. This function implements the
   * prob() pure virtual function of class LPTestBase.
   */
  LinearProblem prob(const Mesh& mesh) const
    {
      const double pi = 4.0*atan(1.0);
      CellFilter left = domain().left();

      Expr u = new UnknownFunction(new Lagrange(2), "u");
      Expr v = new TestFunction(new Lagrange(2), "v");
      Expr dx = gradient(1);
      Expr x = coord(0);

      QuadratureFamily quad = new GaussianQuadrature(4);

      Expr eqn = Integral(interior(), (dx*v)*(dx*u), quad)
        + Integral(interior(), -0.25*pi*pi*sin(pi*x/2.0)*v, quad);

      Expr bc = EssentialBC(left, v*u, quad);
      
      return LinearProblem(mesh, eqn, bc, v, u, vecType());
    }
Пример #4
0
void BevelFrame::pick(Canvas* c, const Allocation& a, int depth, Hit& h) {
    Glyph* g = body();
    if (g != nil) {
	if (hmargin_ || vmargin_) {
	    Allocation interior(a);
	    allocate_body(g, thickness(c), interior);
	    g->pick(c, interior, depth, h);
	} else {
	    g->pick(c, a, depth, h);
	}
    }
}
Пример #5
0
//--------------------------------------------------------------
// paint content of control
void mgFormPane::paint(
  mgContext* gc)
{
  mgDimension size;
  getSize(size);

  mgRectangle interior(0, 0, size.m_width, size.m_height);
  if (m_frame != NULL)
  {
    m_frame->paintBackground(gc, 0, 0, size.m_width, size.m_height);
    m_frame->getInsideRect(interior);
  }

  m_drawGC = gc;

//#define SHOWBACK
#ifdef SHOWBACK
  // =-= debug
  gc->setBrush(getSurface()->createBrush(mgColor(1.0-m_defaultTextColor.m_r, 1.0-m_defaultTextColor.m_g, 1.0-m_defaultTextColor.m_b)));
  gc->fillRect(1, 1, size.m_width-2, size.m_height-2);
#endif
//#define SHOWEDGE
#ifdef SHOWEDGE
  // =-= debug
  gc->setPen(getSurface()->createPen(mgColor("green"), 1));
  gc->drawRect(1, 1, size.m_width-2, size.m_height-2);
#endif

  gc->setAlphaMode(MG_ALPHA_MERGE);
#ifdef TRACE_TABLES
mgDebug("FormPane interior = (%d, %d) (%d by %d)", interior.m_x, interior.m_y, interior.m_width, interior.m_height);
#endif

  mgTextDraw draw(m_text, this, interior, interior.m_x, interior.m_y, interior.m_width);
  unsigned int posn = 0;
  draw.scan(posn);

//#define SHOWPAGE
#ifdef SHOWPAGE
  gc->setPen(getSurface()->createPen(mgColor("red"), 1));
  gc->drawLine(5, draw.m_boxHeight-3, size.m_width-3, draw.m_boxHeight-3);
  gc->drawLine(draw.m_boxWidth-3, 5, draw.m_boxWidth-3, size.m_height-3);
#endif

  m_drawGC = NULL;

  if (m_frame != NULL)
  {
    m_frame->paintForeground(gc, 0, 0, size.m_width, size.m_height);
  }

}
Пример #6
0
void BevelFrame::allocate(Canvas* c, const Allocation& a, Extension& ext) {
    Glyph* g = body();
    if (g != nil) {
	if (hmargin_ || vmargin_) {
	    Allocation interior(a);
	    allocate_body(g, thickness(c), interior);
	    g->allocate(c, interior, ext);
	} else {
	    g->allocate(c, a, ext);
	}
    }
    ext.merge(c, a);
}
Пример #7
0
void BevelFrame::print(Printer* p, const Allocation& a) const {
    Coord t = thickness(p);
    draw_frame(p, a, t);
    Glyph* g = body();
    if (g != nil) {
	if (hmargin_ || vmargin_) {
	    Allocation interior(a);
	    allocate_body(g, t, interior);
	    g->print(p, interior);
	} else {
	    g->print(p, a);
	}
    }
}
Пример #8
0
void BevelFrame::draw(Canvas* c, const Allocation& a) const {
    Coord t = thickness(c);
    draw_frame(c, a, t);
    Glyph* g = body();
    if (g != nil) {
	if (hmargin_ || vmargin_) {
	    Allocation interior(a);
	    allocate_body(g, t, interior);
	    g->draw(c, interior);
	} else {
	    g->draw(c, a);
	}
    }
}
Пример #9
0
  LinearProblem prob(const Mesh& mesh) const
    {
      Expr u = new UnknownFunction(basis_, "u");
      Expr v = new TestFunction(basis_, "v");
      Expr x = coord(0);

      int p = basis_.order();
      QuadratureFamily quad = new GaussianQuadrature(2*p);

      Expr ex = exactSoln();
      Expr eqn = Integral(interior(), v*(u-ex), quad);
      Expr bc;
      
      return LinearProblem(mesh, eqn, bc, v, u, vecType());
    }
Пример #10
0
void Viewport::DoAdjust(float px, float py, float zx, float zy) {
    register Perspective* p = perspective;
    register Shape* s = interior()->GetShape();
    cwidth = s->width;
    cheight = s->height;

    if (px < 0.0) px = 0.0;
    if (px > 1.0) px = 1.0;
    if (py < 0.0) py = 0.0;
    if (py > 1.0) py = 1.0;

    int w = Math::round(cwidth * zx);
    int h = Math::round(cheight * zy);
    int x = Math::round(w * px);
    int y = Math::round(h * py);

    AlignHelper(align, x, y, -p->curwidth, -p->curheight);
    Place(interior(), -x, -y, -x + (w - 1), -y + (h - 1));
    p->width = w;
    p->height = h;
    p->curx = p->x0 + x;
    p->cury = p->y0 + y;
    p->Update();
}
Пример #11
0
void ArrowVarView::Init () {
    ArrowInteractor* b = (ArrowInteractor*) interior();

    _prevVal = ((BrushVar*) _subject)->GetBrush();
    b->SetBrush(_prevVal);

    _prevHead = _arrowSubj->Head();
    _prevTail = _arrowSubj->Tail();
    b->SetArrows(_prevHead, _prevTail);

    if (_colorSubj != nil) {
        _prevFg = _colorSubj->GetFgColor();
        _prevBg = _colorSubj->GetBgColor();
        b->SetColors(_prevFg, _prevBg);
    }
}
Пример #12
0
int edge_normal
(const MVertex *const vertex, const int zoneIndex, const GEdge *const gEdge,
 const CCon::FaceVector<MZoneBoundary<2>::GlobalVertexData<MEdge>::FaceDataB>
 &faces, SVector3 &boNormal, const int onlyFace = -1)
{

  double par=0.0;
  // Note: const_cast used to match MVertex.cpp interface
  if(!reparamMeshVertexOnEdge(const_cast<MVertex*>(vertex), gEdge, par)) return 1;

  const SVector3 tangent(gEdge->firstDer(par));
                                        // Tangent to the boundary face
  SPoint3 interior(0., 0., 0.);         // An interior point
  SVector3 meshPlaneNormal(0.);         // This normal is perpendicular to the
                                        // plane of the mesh

  // The interior point and mesh plane normal are computed from all elements in
  // the zone.
  int cFace = 0;
  int iFace = 0;
  int nFace = faces.size();
  if ( onlyFace >= 0 ) {
    iFace = onlyFace;
    nFace = onlyFace + 1;
  }
  for(; iFace != nFace; ++iFace) {
    if(faces[iFace].zoneIndex == zoneIndex) {
      ++cFace;
      interior += faces[iFace].parentElement->barycenter();
      // Make sure all the planes go in the same direction
      //**Required?
      SVector3 mpnt = faces[iFace].parentElement->getFace(0).normal();
      if(dot(mpnt, meshPlaneNormal) < 0.) mpnt.negate();
      meshPlaneNormal += mpnt;
    }
  }
  interior /= cFace;
  // Normal to the boundary edge (but unknown direction)
  boNormal = crossprod(tangent, meshPlaneNormal);
  boNormal.normalize();
  // Direction vector from vertex to interior (inwards).  The normal should
  // point in the same direction.
  if(dot(boNormal, SVector3(vertex->point(), interior)) < 0.)
    boNormal.negate();
  return 0;

}
Пример #13
0
void Viewport::Reconfig() {
    Shape* s = interior()->GetShape();
    cwidth = s->width;
    cheight = s->height;
    shape->width = cwidth;
    shape->height = cheight;
    perspective->Init(0, 0, cwidth, cheight);
    perspective->curx = 0;
    perspective->cury = 0;
    perspective->curwidth = cwidth;
    perspective->curheight = cheight;
    perspective->sx = s->hunits;
    perspective->sy = s->vunits;
    background = new Painter(output);
    background->Reference();
    background->SetPattern(new Pattern(Pattern::lightgray));
}
Пример #14
0
  LinearProblem prob(const Mesh& mesh) const
    {
      CellFilter left = domain().left();
      CellFilter right = domain().right();

      Expr u = new UnknownFunction(new Lagrange(2), "u");
      Expr v = new TestFunction(new Lagrange(2), "v");
      Expr dx = gradient(1);
      Expr x = coord(0);

      QuadratureFamily quad = new GaussianQuadrature(4);

      Expr eqn = Integral(interior(), (dx*v)*(dx*u) - v*u, quad);
      Expr bc = EssentialBC(left, v*(u-cos(x)), quad);
      
      return LinearProblem(mesh, eqn, bc, v, u, vecType());
    }
Пример #15
0
static void ExtractMat(Face & face,const Face & src) 
{
	if (dot(face.xyz(), src.xyz())<0.95f) {
		return;
	}
	if (FaceSplitTest(face, src.plane(), PAPERWIDTH) != COPLANAR) {
		return;
	}
	float3 interior(0,0,0);
	for(auto &v : face.vertex) 
		interior += v * (1.0f/face.vertex.size());

	if (!PolyHitCheck(src.vertex, interior + face.xyz(), interior - face.xyz())){
		return;
	}
	// src and face coincident
	face.matid = src.matid;
	face.gu    = src.gu;
	face.gv    = src.gv;
	face.ot    = src.ot;
}
Пример #16
0
void Cylinder::setSize(vec x, vec y, float xcenter, float ycenter, float radius, float M) {
    X = zeros<mat>(x.n_rows, x.n_rows);
    Y = zeros<mat>(y.n_rows, y.n_rows);
    for(unsigned int i = 0; i < X.n_rows; i++) {
        X.row(i) = trans(x);
    }
    for(unsigned int i = 0; i < Y.n_cols; i++) {
        Y.col(i) = y;
    }
    r = zeros<mat>(x.n_rows, y.n_rows);
    for(unsigned int i = 0; i < x.n_rows; i++) {
        for(unsigned int j = 0; j < y.n_rows; j++) {
            r(i, j) = sqrt(pow(Y(i, j) - xcenter, 2) + pow(X(i, j) - ycenter, 2));
        }
    }
    Oint_C = zeros<mat>(r.n_rows, r.n_cols);
    Gamma_C = zeros<mat>(r.n_rows, r.n_cols);
    for(unsigned int i = 0; i < Oint_C.n_rows; i++) {
        for(unsigned int j = 0; j < Oint_C.n_cols; j++) {
            if(r(i, j) <= (radius - 0.55)) {
                Oint_C(i, j) = 1;
            }
            if(r(i, j) <= (radius + 0.55)) {
                Gamma_C(i, j) = 1 - Oint_C(i, j);
            }
        }
    }
    Oint_N = sum(sum(Oint_C));
    Gamma_N = sum(sum(Gamma_C));
    interior = zeros<mat>(Oint_N, 2);
    Gamma_I = zeros<mat>(Gamma_N, 2);
    int n = 0;
    for(unsigned int i = 0; i < Gamma_C.n_rows; i++) {
        for(unsigned int j = 0; j < Gamma_C.n_cols; j++) {
            if(Gamma_C(i, j) != 0) {
                Gamma_I(n, 0) = i;
                Gamma_I(n, 1) = j;
                n++;
            }
        }
    }
    int m = 0;
    for(unsigned int i = 0; i < Oint_C.n_rows; i++) {
        for(unsigned int j = 0; j < Oint_C.n_cols; j++) {
            if(Oint_C(i, j) != 0) {
                interior(m, 1) = i;
                interior(m, 0) = j;
                m++;
            }
        }
    }
    n_grid_temp = zeros<mat>(Gamma_N, 2);
    n_grid = zeros<mat>(Gamma_N, 2);
    n_grid_temp.col(0) = Gamma_I.col(0) - xcenter;
    n_grid_temp.col(1) = Gamma_I.col(1) - ycenter;
    for(unsigned int i = 0; i < n_grid_temp.n_rows; i++) {
        n_grid(i, 0) = n_grid_temp(i, 0) / sqrt(pow(n_grid_temp(i, 0), 2)+pow(n_grid_temp(i, 1), 2));
        n_grid(i, 1) = n_grid_temp(i, 1) / sqrt(pow(n_grid_temp(i, 0), 2)+pow(n_grid_temp(i, 1), 2));
    }

    theta = linspace<vec>(0, 2*M_PI*(1-1/M), M);
    loc = zeros<mat>(M, 2);
    loc.col(0) = radius*cos(theta);
    loc.col(1) = radius*sin(theta);

    ex_ds = ones<mat>(M)*2*M_PI*radius/M;

    ex_n = zeros<mat>(loc.n_rows, loc.n_cols);
    ex_n.col(0) = loc.col(0)/radius;
    ex_n.col(1) = loc.col(1)/radius;

    ex_loc = zeros<mat>(loc.n_rows, loc.n_cols);
    ex_loc.col(0) = loc.col(0) + xcenter;
    ex_loc.col(1) = loc.col(1) + ycenter;
}
Пример #17
0
void updateBoVec<3, MFace>(
  const int normalSource, const MVertex *const vertex, const int zoneIndex,
  const int vertIndex,
  const CCon::FaceVector<MZoneBoundary<3>::GlobalVertexData<MFace>::FaceDataB>
    &faces,
  ZoneBoVec &zoneBoVec, BCPatchIndex &patch, bool &warnNormFromElem)
{
  GEntity *ent;
  if(normalSource == NormalSourceElement) goto getNormalFromElements;
  ent = vertex->onWhat();
  if(ent == 0) {
    goto getNormalFromElements;
    // No entity: try to find a normal from the faces
  }
  else {
    switch(ent->dim()) {
    case 0:
    case 1:

      /*--------------------------------------------------------------------*
       * In this case, there are possibly multiple GFaces from this zone
       * connected to the vertex.  One patch for each GFace will be written.
       *--------------------------------------------------------------------*/

      {
        //--Get a list of face entities connected to 'ent'

        std::list<GFace *> gFaceList;
        switch(ent->dim()) {
        case 0: {
          std::vector<GEdge *> gEdgeList = ent->edges();
          std::list<GFace *> gFaceList;
          for(std::vector<GEdge *>::const_iterator gEIt = gEdgeList.begin();
              gEIt != gEdgeList.end(); ++gEIt) {
            std::vector<GFace *> alist = (*gEIt)->faces();
            gFaceList.insert(gFaceList.end(), alist.begin(), alist.end());
          }
          // Remove duplicates
          gFaceList.sort();
          gFaceList.unique();
        } break;
        case 1: {
          std::vector<GFace *> fac = ent->faces();
          gFaceList.insert(gFaceList.end(), fac.begin(), fac.end());
        } break;
        }

        //--Get a list of face entities connected to the 'vertex' that are also
        // in the
        //--zone

        std::list<const GFace *> useGFace;
        std::vector<GEdge *> gEdgeList;
        const int nFace = faces.size();
        for(int iFace = 0; iFace != nFace; ++iFace) {
          if(zoneIndex == faces[iFace].zoneIndex) {
            bool matchedFace = false;
            MFace mFace =
              faces[iFace].parentElement->getFace(faces[iFace].parentFace);
            const int nVOnF = mFace.getNumVertices();
            int vertexOnF = 0; // The index of 'vertex' in the face
            for(int iVOnF = 0; iVOnF != nVOnF; ++iVOnF) {
              const MVertex *const vertex2 = mFace.getVertex(iVOnF);
              if(vertex == vertex2)
                vertexOnF = iVOnF;
              else {
                const GEntity *const ent2 = vertex2->onWhat();
                if(ent2->dim() == 2) {
                  matchedFace = true;
                  useGFace.push_back(static_cast<const GFace *>(ent2));
                  break;
                }
              }
            }
            // Triangle MElements are a total P.I.T.A.:
            // - If the original 'ent' is a vertex, one MVertex can be on the
            //   GVertex, and the other two on GEdges, and then the MElement is
            //   still on the GFace.
            // - If the original 'ent' is an edge, one MVertex can be on the
            //   original GEdge, another on a GVertex, and the final on another
            //   GEdge, and then the MElement is still on the GFace.  There is
            //   also the unlikely case where the two other MVertex are both on
            //   edges ... and the MElement is still on the GFace.
            if(!matchedFace && (3 == nVOnF)) {
              const MVertex *vertex2 = 0;
              const MVertex *vertex3 = 0;
              switch(vertexOnF) {
              case 0:
                vertex2 = mFace.getVertex(1);
                vertex3 = mFace.getVertex(2);
                break;
              case 1:
                vertex2 = mFace.getVertex(0);
                vertex3 = mFace.getVertex(2);
                break;
              case 2:
                vertex2 = mFace.getVertex(0);
                vertex3 = mFace.getVertex(1);
                break;
              }
              if(vertex2 && vertex3) {
                const GEntity *const ent2 = vertex2->onWhat();
                const GEntity *const ent3 = vertex3->onWhat();
                if(ent2 && ent3) {
                  if(ent2->dim() == 1 && ent3->dim() == 1) {
                    // Which GFace is bounded by edges ent2 and ent3?
                    for(std::list<GFace *>::const_iterator gFIt =
                          gFaceList.begin();
                        gFIt != gFaceList.end(); ++gFIt) {
                      gEdgeList = (*gFIt)->edges();
                      if((std::find(gEdgeList.begin(), gEdgeList.end(), ent2) !=
                          gEdgeList.end()) &&
                         (std::find(gEdgeList.begin(), gEdgeList.end(), ent3) !=
                          gEdgeList.end())) {
                        // Edges ent2 and ent3 bound this face
                        useGFace.push_back(*gFIt);
                        break;
                      }
                    }
                  }
                  else if(ent->dim() == 1 && (ent2->dim() + ent3->dim() == 1)) {
                    const GEntity *entCmp;
                    if(ent2->dim() == 1)
                      entCmp = ent2;
                    else
                      entCmp = ent3;
                    // Which GFace is bounded by entCmp
                    for(std::list<GFace *>::const_iterator gFIt =
                          gFaceList.begin();
                        gFIt != gFaceList.end(); ++gFIt) {
                      gEdgeList = (*gFIt)->edges();
                      if(std::find(gEdgeList.begin(), gEdgeList.end(),
                                   entCmp) != gEdgeList.end()) {
                        // Edge entCmp and the original edge bound this face
                        useGFace.push_back(*gFIt);
                        break;
                      }
                    }
                  }
                }
              }
            } // Stupid triangles
          } // End if face in zone
        } // End loop over faces
        // Duplicates are a possibility, remove
        useGFace.sort();
        useGFace.unique();

        //--'useGFace' now contains the face entities that connect to vertex.  A
        // BC
        //--patch will be written for each of them.

        for(std::list<const GFace *>::const_iterator gFIt = useGFace.begin();
            gFIt != useGFace.end(); ++gFIt) {
          SPoint2 par;
          if(!reparamMeshVertexOnFace(const_cast<MVertex *>(vertex), *gFIt,
                                      par))
            goto getNormalFromElements; // :P  After all that!

          SVector3 boNormal = (*gFIt)->normal(par);
          SPoint3 interior(0., 0., 0.);
          int cFace = 0;
          const int nFace = faces.size();
          for(int iFace = 0; iFace != nFace; ++iFace) {
            if(faces[iFace].zoneIndex == zoneIndex) {
              ++cFace;
              interior += faces[iFace].parentElement->barycenter();
            }
          }
          interior /= cFace;
          if(dot(boNormal, SVector3(vertex->point(), interior)) < 0.)
            boNormal.negate();

          zoneBoVec.push_back(
            VertexBoundary(zoneIndex, (*gFIt)->tag(), boNormal,
                           const_cast<MVertex *>(vertex), vertIndex));
          patch.add((*gFIt)->tag());
        }
      }
      break;
    case 2:

      /*--------------------------------------------------------------------*
       * The vertex exists on a face and belongs to only 1 BC patch.
       *--------------------------------------------------------------------*/

      {
        const GFace *const gFace = static_cast<const GFace *>(ent);
        SPoint2 par;
        if(!reparamMeshVertexOnFace(const_cast<MVertex *>(vertex), gFace, par))
          goto getNormalFromElements;

        SVector3 boNormal = static_cast<const GFace *>(ent)->normal(par);
        SPoint3 interior(0., 0., 0.);
        int cFace = 0;
        const int nFace = faces.size();
        for(int iFace = 0; iFace != nFace; ++iFace) {
          if(faces[iFace].zoneIndex == zoneIndex) {
            ++cFace;
            interior += faces[iFace].parentElement->barycenter();
          }
        }
        interior /= cFace;
        if(dot(boNormal, SVector3(vertex->point(), interior)) < 0.)
          boNormal.negate();

        zoneBoVec.push_back(VertexBoundary(zoneIndex, gFace->tag(), boNormal,
                                           const_cast<MVertex *>(vertex),
                                           vertIndex));
        patch.add(gFace->tag());
      }
      break;
    default: goto getNormalFromElements;
    }
  }
  return;

getNormalFromElements:;

  /*--------------------------------------------------------------------*
   * Geometry information cannot be used - generate normals from the
   * elements
   *--------------------------------------------------------------------*/

  {
    if(warnNormFromElem && normalSource == 1) {
      Msg::Warning("Some or all boundary normals were determined from mesh "
                   "elements instead of from the geometry");
      warnNormFromElem = false;
    }
    // Sum the normals from each element connected to the vertex and in the
    // zone.  Each normal has to be converted independently into an inwards-
    // pointing normal.
    //**Weight each normal by the area of the boundary element?
    SVector3 boNormal(0.);
    const int nFace = faces.size();
    for(int iFace = 0; iFace != nFace; ++iFace) {
      if(faces[iFace].zoneIndex == zoneIndex) {
        // Normal to the boundary (unknown direction)
        SVector3 bnt =
          faces[iFace].parentElement->getFace(faces[iFace].parentFace).normal();
        // Inwards normal
        const SVector3 inwards(vertex->point(),
                               faces[iFace].parentElement->barycenter());
        if(dot(bnt, inwards) < 0.) bnt.negate();
        boNormal += bnt;
      }
    }
    boNormal.normalize();
    zoneBoVec.push_back(VertexBoundary(
      zoneIndex, 0, boNormal, const_cast<MVertex *>(vertex), vertIndex));
    patch.add(0);
  }
}
Пример #18
0
int MtxLP::Interior(bool presolve){
    glp_iptcp parm;
    init_iptcp(&parm);
    parm.msg_lev = msg_lev;
    return interior(&parm);
}
Пример #19
0
void CircleSelection::start() {
  currentpt = ll;
  if (!interior()) next();
}
Пример #20
0
void MenuShadow::Resize() {
    if (interior() != nil) {
	Place(interior(), 0, depth_, xmax - depth_, ymax);
    }
}
Пример #21
0
void EllipseSelection::start() {
  currentpt = ll;
  if (!interior()) next();
}
Пример #22
0
int main(int argc, const char * argv[]) {
    ifstream fstream("input.txt");
    ofstream edges("edges.txt");
    ofstream coords("coords.txt");
    ofstream obs("obs.txt");
    ofstream json("fca.json");
    vector<string> input;
    string line;
    if (fstream.is_open()) {
        while (getline(fstream, line)) {
            input.push_back(line);
        }
        fstream.close();
        int num_obs = (int)input.size();
        unordered_set<bitset<MAX> > concepts;
        vector<BitObj*> extents;
        findConc(input, concepts, extents);
        vector<bitset<MAX> > relation(concepts.size());
        nodeJSON(extents, json);
        findEdges(extents, relation, edges);
        linkJSON(json);
        findCoords(extents, coords);
        nodeObs(extents, obs, num_obs);
        
        //Set operations
        ifstream com("com.txt");
        cout << "Computing operations...\n";
        string line;
        while (getline(com, line)) {
            cout << '\n';
            bitset<MAX> A = convInput(line.substr(2), num_obs);
            cout << "Input A: ";
            printObj(A, cout, num_obs);
            switch (line[0]) {
                case 'c':
                    cout << "Closure of A: ";
                    printObj(closure(extents, A).second, cout, num_obs);
                    break;
                case 'b':
                    cout << "Boundary of A: ";
                    printObj(boundary(extents, A, num_obs).second, cout, num_obs);
                    break;
                case 'i':
                    cout << "Interior of A: ";
                    printObj(interior(extents, A, num_obs), cout, num_obs);
                    break;
                case 'd':
                    cout << "Derived set of A: ";
                    printObj(derived(extents, A, num_obs), cout, num_obs);
                    break;
                case 's':
                    cout << "Isolated point of A: ";
                    printObj(isolated(extents, A, num_obs), cout, num_obs);
                    break;
            }
        }
        for (BitObj *b : extents)
            delete b;
    }
    else
        cerr << "Unable to open file" << endl;
    return 0;
}