Mercurial > fem-fenics-eugenio
diff src/fem_init_mesh.cc @ 44:fca8c3d75036
register_type is called before every type is used.
* A new static variable for every class has been defined.
It is named class_type_loaded, and it specify if the corresponding type have
yet been loaded or not. If not, it proceed with the registration.
This should be only a temporary solution.
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Mon, 22 Jul 2013 11:33:50 +0200 |
parents | 448e01d4411f |
children | 3e49ef16d74a |
line wrap: on
line diff
--- a/src/fem_init_mesh.cc Sat Jul 20 23:53:31 2013 +0200 +++ b/src/fem_init_mesh.cc Mon Jul 22 11:33:50 2013 +0200 @@ -45,23 +45,37 @@ { std::string filename = args(0).string_value (); //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 - { - octave_scalar_map a = args(0).scalar_map_value (); - Array<double> p = a.contents ("p").matrix_value (); - Array<octave_idx_type> t = a.contents ("t").matrix_value (); - Array<octave_idx_type> e = a.contents ("e").matrix_value (); + else + { + octave_scalar_map a = args(0).scalar_map_value (); + Array<double> p = a.contents ("p").matrix_value (); + Array<octave_idx_type> t = a.contents ("t").matrix_value (); + Array<octave_idx_type> e = a.contents ("e").matrix_value (); - if (! error_state) - { - retval = new mesh (p, e, t); - } - else - error ("fem_init_mesh: the argument you provide is invalid"); - } + if (! error_state) + { + if (! mesh_type_loaded) + { + mesh::register_type (); + mesh_type_loaded = true; + mlock (); + } + + retval = new mesh (p, e, t); + } + else + error ("fem_init_mesh: the argument you provide is invalid"); + } } } return retval;