getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] Adding new elements without library recompilation


From: Yves Renard
Subject: Re: [Getfem-users] Adding new elements without library recompilation
Date: Tue, 13 Jul 2010 15:53:21 +0200
User-agent: KMail/1.13.2 (Linux/2.6.32-22-server; KDE/4.4.2; x86_64; ; )


Dear Roman,

I suppose you want to be able to perform a
add_suffix("FEM_NAME", function);
to the  fem_naming_system out of the file getfem_fem.cc

This implies effectively to at least export the definition
 
typedef dal::naming_system<virtual_fem>::param_list fem_param_list;

The function  read_poly can be exported, although this is just a call to 
bgeot::base_poly.

However, I don't know if the export of "struct fem_naming_system" is a good 
idea. May be it is sufficient to export a function like the following

void add_fem_name(std::string name, dal::naming_system::pfunction f) {
    dal::singleton<fem_naming_system>::instance().add_suffix(name, f);
}

What do you think?

Yves.


On mardi 13 juillet 2010, Roman Putanowicz wrote:
> Dear All,
> 
> I would like to indicate some minor additions to GetFEM API
> that would enable adding new elements without library recompilation.
> 
> At the moment adding new element definition to the library requires
> modification of the structure fem_naming_system in the file getfem_fem.cc
> which results in the need of library recompilation.
> 
> However this structure is used in GetFEM code via singleton object
> (i.e.  dal::singleton<getfem::fem_naming_system>::instance()).
> 
> If we add the following declarations to getfem_fem.h :
> 
>  struct fem_naming_system : public dal::naming_system<virtual_fem> {
>     fem_naming_system();
>  };
> 
>  typedef dal::naming_system<virtual_fem>::param_list fem_param_list;
> 
>  void read_poly(bgeot::base_poly &p, int d, const char *s);
> 
> and in getfem_fem.cc leave only definition of fem_naming_system constructor
> then we can add new elements on run time, using the mentioned singleton.
> 
> What is more (thought I have not tested that) it should be possible this
> way to easily introduce custom aliases for standard GetFEM names of
> finite elements.
> 
> Exposing internals is not always good idea but in my view in this case
> it is worth it. What do you think?
> 
> To Yves:  I have included the recent versions of getfem_fem.cc and
> getfem_fem.h with the required changes (couple of lines indeed). If you
> prefer I can send patches instead.
> 
> Regards
> 
> Roman


-- 

  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

---------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]