Mercurial > fem-fenics-eugenio
changeset 115:41614aa82191
Improved error messagging.
author | gedeone-octave <marcovass89@hotmail.it> |
---|---|
date | Tue, 27 Aug 2013 21:45:15 +0200 |
parents | af287918111e |
children | 77eefe47f7ab |
files | src/Mesh.cc src/mesh.h |
diffstat | 2 files changed, 22 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Mesh.cc Tue Aug 27 19:53:32 2013 +0200 +++ b/src/Mesh.cc Tue Aug 27 21:45:15 2013 +0200 @@ -22,12 +22,14 @@ Mesh (@var{mesh_in}) \n\ The @var{mesh_in} should be either\n\ @itemize @bullet \n\ -@item a string containing the name of the file where the mesh is stored\ -(compatible formats are the ones which are compatible with Fenics\n\ +@item a string containing the name of the file where the mesh is stored in .xml file\ +If the file is not a .xml file you can try to use the command dolfin-convert\n\ +directly from the bash. \n\ @item a a PDE-tool like structure with matrix fields (p,e,t)\n\ @end itemize\n\ The output @var{mesh_out} is a representation of the\n\ -@var{mesh_in} which is compatible with fem-fenics\n\ +@var{mesh_in} which is compatible with fem-fenics.\n\ +The easiest way for dealing with mesh is using the msh pkg. \n\ @seealso{fem_get_mesh}\n\ @end deftypefn") { @@ -40,21 +42,23 @@ { if (!error_state) { + + if (! mesh_type_loaded) + { + mesh::register_type (); + mesh_type_loaded = true; + mlock (); + } + if (args(0).is_string () == true) { std::string filename = args(0).string_value (); + std::cout << "Assembling the Mesh from (p, e, t) format..." << std::endl; //if the filename is not valid, dolfin takes care of it - - if (! mesh_type_loaded) - { - mesh::register_type (); - mesh_type_loaded = true; - mlock (); - } retval = new mesh (filename); } - else + else if (args(0).is_map () == true) { octave_scalar_map a = args(0).scalar_map_value (); Array<double> p = a.contents ("p").matrix_value (); @@ -63,18 +67,14 @@ if (! error_state) { - if (! mesh_type_loaded) - { - mesh::register_type (); - mesh_type_loaded = true; - mlock (); - } - + std::cout << "Assembling the Mesh from (p, e, t) format..." << std::endl; retval = new mesh (p, e, t); } - else - error ("fem_init_mesh: the argument you provide is invalid"); } + + else + error ("Mesh: the argument you provide is invalid"); + } } return retval; @@ -86,7 +86,7 @@ std::size_t D = p.rows (); if (D < 2 || D > 3) - error ("mesh constructor: only 2D or 3D meshes are supported"); + error ("Mesh constructor: only 2D or 3D meshes are supported"); else { dolfin::MeshEditor editor;