← Back to team overview

dolfin team mailing list archive

Mesh has no edges until needed by assembly?

 

Hello all!

A mesh does not have its edges and facets defined when it is constructed? A call to mesh.init() is required unless Dirichlet BCs are applied? Can this perhaps be stated a bit clearer in the Programmers Ref? The following illustrates the confusion that could otherwise occur:

int main(void)
{
  UnitSquare mesh(32,32);
  //mesh.init();

  cout << "Statistics:"    << endl;
  cout << "\t Vertices:\t" << mesh.numVertices() << endl;
  cout << "\t Edges:   \t" << mesh.numEdges()    << endl;
  cout << "\t Faces:   \t" << mesh.numFaces()    << endl;
  cout << "\t Facets:  \t" << mesh.numFacets()   << endl;
  cout << "\t Cells:   \t" << mesh.numCells()    << endl;

  return 0;
}

Output (without explicit initialization):
Statistics:
         Vertices:      1089
         Edges:         0
         Faces:         2048
         Facets:        0
         Cells:         2048

From the point of view of the user, this is unexpected.

  Dag


Follow ups