dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #13381
Re: str(), disp()
On Fri, May 08, 2009 at 11:19:35AM +0200, Anders Logg wrote:
> 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()?
Or maybe info() is more logical, since calling foo.info() will result
in a string being sent to the info() function.
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References