Esempio n. 1
0
void write_complex2d(GRID const& G,   ::std::ostream& out, int offset, 
                     VCORR & G2Out_v, CCORR & G2Out_c)
{
  typedef grid_types<GRID>                  gt;
  typedef typename gt::Vertex               Vertex;
  typedef typename gt::Cell                 Cell;
  typedef typename gt::VertexIterator       VertexIterator;
  typedef typename gt::CellIterator         CellIterator;
  typedef typename gt::VertexOnCellIterator VertexOnCellIterator;

  out << G.NumOfVertices() << " " << G.NumOfCells() << "\n\n";

  // if GRID is a subrange type, we cannot initialized grid-functions
  // directly with G, but must get hold of the underlying grid.
  // This solution is not optimal. There could be a c-t branch
  // with an additional grid-type parameter for grid-functions.
  typedef element_traits<Vertex> et;
  typedef typename et::grid_type base_grid_type; // possibly != GRID
  Vertex dummy(*(G.FirstVertex()));
  base_grid_type const& baseG(dummy.TheGrid());

  grid_function<Vertex,int> VNum(baseG);
  int vnum = offset;
  for(VertexIterator v= G.FirstVertex(); ! v.IsDone(); ++v){
    //    out << Geo.coord(*v) << "\n"; 
    VNum[*v] = vnum;
    G2Out_v[v.handle()] = vnum;
    vnum++;
  }
  out << "\n";

  int cnum = offset;
  for(CellIterator c = GrAL::begin_x(G); !c.IsDone(); ++c){
    out	<< (*c).NumOfVertices() << "   ";
    G2Out_c[c.handle()] = cnum; ++cnum;
    for(VertexOnCellIterator vc = GrAL::begin_x(*c); ! vc.IsDone(); ++vc)
      out << VNum[*vc] << " ";
    out << "\n";
  }
}
Esempio n. 2
0
void write_complex2d(GRID const& G, GEOM const& Geo,  ::std::ostream& out, int offset)
{
  typedef grid_types<GRID>                  gt;
  typedef typename gt::Vertex               Vertex;
  typedef typename gt::Cell                 Cell;
  typedef typename gt::VertexIterator       VertexIterator;
  typedef typename gt::CellIterator         CellIterator;
  typedef typename gt::VertexOnCellIterator VertexOnCellIterator;

  out << G.NumOfVertices() << " " << G.NumOfCells() << "\n\n";

  // if GRID is a subrange type, we cannot initialized grid-functions
  // directly with G, but must get hold of the underlying grid.
  // This solution is not optimal. There could be a c-t branch
  // with an additional grid-type parameter for grid-functions.
  typedef element_traits<Vertex> et;
  typedef typename et::grid_type base_grid_type; // possibly != GRID
  Vertex dummy(*(G.FirstVertex()));
  ref_ptr<base_grid_type const> baseG(dummy.TheGrid());

  grid_function<Vertex,int> VNum(* baseG);
  int vnum = offset;
  for(VertexIterator v= G.FirstVertex(); ! v.IsDone(); ++v){
    out << std::setprecision(std::numeric_limits<double>::digits10) << Geo.coord(*v) << "\n"; 
    VNum[*v] = vnum;
    vnum++;
  }
  out << "\n";


  for(CellIterator c = G.FirstCell(); !c.IsDone(); ++c){
    out	<< GrAL::size<Vertex>(*c) << "  ";
    for(VertexOnCellIterator vc = GrAL::begin<Vertex>(*c); ! vc.IsDone(); ++vc)
      out << VNum[*vc] << " ";
    out << "\n";
  }
}