On 13 Mar 2014, at 13:48, Anders Logg <[email protected]> wrote: > On Thu, Mar 13, 2014 at 01:27:36PM +0000, Garth N. Wells wrote: >> >> On 13 Mar 2014, at 13:03, Benjamin Kehlet <[email protected]> wrote: >> >>> Other possible solutions include >>> * Requiring the user to call a init_dolfin() function before doing >>> anything (From python this could be done implicitly when doing "import >>> dolfin”) >> >> I think this is the ‘best’ approach, but others probably won’t like >> a using having to initialise MPI manually in C++. > > I think init functions are extremely ugly. > > We used to have a dolfin_init function, but it was removed ca 10 years > ago. Here's dolfin.h from that time (not as an argument but just for > the fun of it): > > #ifndef __DOLFIN_H > #define __DOLFIN_H > > // Data types > typedef double real; > enum bc_type { dirichlet , neumann}; > > // Boundary conditions > class dolfin_bc{ > public: > dolfin_bc(){ type=neumann; val=0.0; } > bc_type type; > real val; > }; > > // Main function calls > void dolfin_init (int argc, char **argv); > void dolfin_end (); > void dolfin_solve(); > > // Specification of problem > void dolfin_set_problem(const char *problem); > > // Specification of boundary conditions > void dolfin_set_boundary_conditions(dolfin_bc (*bc)(real x, real y, real z, > int node, int component)); > > // Parameters > void dolfin_set_parameter (const char *identifier, ...); > void dolfin_get_parameter (const char *identifier, ...); > void dolfin_save_parameters(); > void dolfin_save_parameters(const char *filename); > void dolfin_load_parameters(); > void dolfin_load_parameters(const char *filename); > > // Functions > void dolfin_set_function(const char *identifier, > real (*f)(real x, real y, real z, real t)); > > // For testing internal functions > void dolfin_test(); > void dolfin_test_memory(); > > #endif > >>> * Adding calls to init_mpi() in the functions in MPI.h where this is >>> missing. >>> >> >> This is too low-level. init_mpi() should be called from the highest possible >> level. > > Adding it to Variable would work. It would cost nothing and be easy to > implement. >
It would not work at all. MPI initialisation must be collective. Garth > -- > Anders _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
