← Back to team overview

dolfin team mailing list archive

str(), disp()

 

We currently have two ways to print object data to the screen in
DOLFIN:

  cout << foo << endl;

  foo.disp()

The first of these prints a nicely-formatted one-liner:

  [Mesh of topological dimension 2 with 121 vertices and 200 cells]

The second prints more detailed information:

Mesh data
---------
  
  Mesh topology
  -------------
    
    Topological dimension: 2
    
    Number of entities:
    
      dim = 0: 121
      dim = 1: 0
      dim = 2: 200

    ...
    
    Connectivity:
    
        0 1 2
      0 - - -
      1 - - -
      2 x - -
      
    Connectivity 2 -- 0:
    
      0: 0 1 12
      1: 0 11 12
      2: 1 2 13
      3: 1 12 13

I'm thinking we could add a method named str() to all classes and then
call str() both from LogStream<< and from __str__ in Python.

Should the disp() method remain as it is today or should it be renamed
to something else? Maybe print()?

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups